mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 13:19:54 +01:00
feat(layout/note_actions): integrate in-app help button
This commit is contained in:
@@ -308,7 +308,7 @@ function ExportImageButtons({ note, triggerEvent, isDefaultViewMode }: FloatingB
|
||||
|
||||
function InAppHelpButton({ note }: FloatingButtonContext) {
|
||||
const helpUrl = getHelpUrlForNote(note);
|
||||
const isEnabled = !!helpUrl && (!isNewLayout || (note?.type !== "book"));
|
||||
const isEnabled = !!helpUrl && !isNewLayout;
|
||||
|
||||
return isEnabled && (
|
||||
<FloatingButton
|
||||
|
||||
@@ -5,6 +5,7 @@ import Component from "../../components/component";
|
||||
import NoteContext from "../../components/note_context";
|
||||
import FNote from "../../entities/fnote";
|
||||
import { t } from "../../services/i18n";
|
||||
import { getHelpUrlForNote } from "../../services/in_app_help";
|
||||
import { downloadFileNote, openNoteExternally } from "../../services/open";
|
||||
import { openInAppHelpFromUrl } from "../../services/utils";
|
||||
import { ViewTypeOptions } from "../collections/interface";
|
||||
@@ -62,6 +63,7 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) {
|
||||
<SaveToNoteButton {...innerProps} />
|
||||
<RefreshButton {...innerProps} />
|
||||
<CopyReferenceToClipboardButton {...innerProps} />
|
||||
<InAppHelpButton {...innerProps} />
|
||||
<NoteActionsCustomInner {...innerProps} />
|
||||
</div>
|
||||
);
|
||||
@@ -223,6 +225,19 @@ function OpenTriliumApiDocsButton({ noteMime }: NoteActionsCustomInnerProps) {
|
||||
/>;
|
||||
}
|
||||
|
||||
function InAppHelpButton({ note, noteType }: NoteActionsCustomInnerProps) {
|
||||
const helpUrl = getHelpUrlForNote(note);
|
||||
const isEnabled = !!helpUrl && (noteType !== "book");
|
||||
|
||||
return isEnabled && (
|
||||
<ActionButton
|
||||
icon="bx bx-help-circle"
|
||||
text={t("help-button.title")}
|
||||
onClick={() => helpUrl && openInAppHelpFromUrl(helpUrl)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function AddChildButton({ parentComponent, noteType, viewType, ntxId, isReadOnly }: NoteActionsCustomInnerProps) {
|
||||
if (noteType === "book" && viewType === "geoMap") {
|
||||
return <ActionButton
|
||||
|
||||
Reference in New Issue
Block a user