Skip to content

Build your personal knowledge base with Trilium Notes

feat(layout/note_actions): integrate add child for relation map

Elian Dorand7722a1e0555
diff --git a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
index f1b178dafd..497e1ae148 100644
--- a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
+++ b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
@@ -54,6 +54,7 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) {
return (innerProps &&
<div className="note-actions-custom">
+ <AddChildButton {...innerProps} />
<RunActiveNoteButton {...innerProps } />
<OpenTriliumApiDocsButton {...innerProps} />
<SwitchSplitOrientationButton {...innerProps} />
@@ -221,4 +222,13 @@ function OpenTriliumApiDocsButton({ noteMime }: NoteActionsCustomInnerProps) {
onClick={() => openInAppHelpFromUrl(noteMime.endsWith("frontend") ? "Q2z6av6JZVWm" : "MEtfsqa5VwNi")}
/>;
}
+
+function AddChildButton({ parentComponent, noteType, ntxId }: NoteActionsCustomInnerProps) {
+ const isEnabled = noteType === "relationMap";
+ return isEnabled && <ActionButton
+ icon="bx bx-folder-plus"
+ text={t("relation_map_buttons.create_child_note_title")}
+ onClick={() => parentComponent.triggerEvent("relationMapCreateChildNote", { ntxId })}
+ />;
+}
//#endregion