Skip to content

Build your personal knowledge base with Trilium Notes

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

Elian Doranadae7fa03be6
diff --git a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx
index 114b02ed32..141f17863f 100644
--- a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx
+++ b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx
@@ -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
diff --git a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
index 81d36e3d7c..b60abf93b2 100644
--- a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
+++ b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
@@ -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