feat(layout/note_actions): integrate in-app help button

This commit is contained in:
Elian Doran
2025-12-15 10:24:24 +02:00
parent b725dbea7e
commit adae7fa03b
2 changed files with 16 additions and 1 deletions

View File

@@ -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

View File

@@ -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