diff --git a/apps/client/src/components/app_context.ts b/apps/client/src/components/app_context.ts index 319988aa4..34b3df21a 100644 --- a/apps/client/src/components/app_context.ts +++ b/apps/client/src/components/app_context.ts @@ -322,6 +322,7 @@ export type CommandMappings = { printActiveNote: CommandData; exportAsPdf: CommandData; openNoteExternally: CommandData; + openNoteCustom: CommandData; renderActiveNote: CommandData; unhoist: CommandData; reloadFrontendApp: CommandData; diff --git a/apps/client/src/widgets/buttons/note_actions.ts b/apps/client/src/widgets/buttons/note_actions.ts index 0c5e2e34f..05b60230a 100644 --- a/apps/client/src/widgets/buttons/note_actions.ts +++ b/apps/client/src/widgets/buttons/note_actions.ts @@ -36,41 +36,6 @@ const TPL = /*html*/` } - - `; export default class NoteActionsWidget extends NoteContextAwareWidget { @@ -114,15 +79,6 @@ export default class NoteActionsWidget extends NoteContextAwareWidget { this.$openNoteExternallyButton = this.$widget.find(".open-note-externally-button"); this.$openNoteCustomButton = this.$widget.find(".open-note-custom-button"); - - this.$deleteNoteButton = this.$widget.find(".delete-note-button"); - this.$deleteNoteButton.on("click", () => { - if (!this.note || this.note.noteId === "root") { - return; - } - - branchService.deleteNotes([this.note.getParentBranches()[0].branchId], true); - }); } async refreshVisibility(note: FNote) { diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx index 5393e1618..f5587dbbf 100644 --- a/apps/client/src/widgets/ribbon/NoteActions.tsx +++ b/apps/client/src/widgets/ribbon/NoteActions.tsx @@ -13,6 +13,7 @@ import { isElectron as getIsElectron } from "../../services/utils"; import { ParentComponent } from "../react/react_utils"; import { useContext } from "preact/hooks"; import NoteContext from "../../components/note_context"; +import branches from "../../services/branches"; interface NoteActionsProps { note?: FNote; @@ -74,13 +75,27 @@ function NoteContextMenu(props: NoteActionsProps) { defaultType: "single" })} /> + + + + + + + + branches.deleteNotes([note.getParentBranches()[0].branchId])} + /> + + + ); } -function CommandItem({ icon, text, command, disabled }: { icon: string, text: string, command: CommandNames | (() => void), disabled?: boolean }) { +function CommandItem({ icon, text, title, command, disabled }: { icon: string, text: string, title?: string, command: CommandNames | (() => void), disabled?: boolean, destructive?: boolean }) { return