From 23d01ec351137bac93eb02eb7537021995ac58ab Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 24 Feb 2025 21:35:35 +0200 Subject: [PATCH] fix(build): type definitions for context menu --- src/public/app/menus/tree_context_menu.ts | 4 +++- src/public/app/services/note_types.ts | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/public/app/menus/tree_context_menu.ts b/src/public/app/menus/tree_context_menu.ts index 96872b484..5c2c74fe9 100644 --- a/src/public/app/menus/tree_context_menu.ts +++ b/src/public/app/menus/tree_context_menu.ts @@ -18,7 +18,9 @@ interface ConvertToAttachmentResponse { attachment?: FAttachment; } -type TreeCommandNames = FilteredCommandNames; +// This will include all commands that implement ContextMenuCommandData, but it will not work if it additional options are added via the `|` operator, +// so they need to be added manually. +export type TreeCommandNames = FilteredCommandNames | "openBulkActionsDialog"; export default class TreeContextMenu implements SelectMenuItemEventListener { private treeWidget: NoteTreeWidget; diff --git a/src/public/app/services/note_types.ts b/src/public/app/services/note_types.ts index fc6e7bed6..9c6af3b5c 100644 --- a/src/public/app/services/note_types.ts +++ b/src/public/app/services/note_types.ts @@ -2,12 +2,10 @@ import server from "./server.js"; import froca from "./froca.js"; import { t } from "./i18n.js"; import type { MenuItem } from "../menus/context_menu.js"; -import type { ContextMenuCommandData, FilteredCommandNames } from "../components/app_context.js"; +import type { TreeCommandNames } from "../menus/tree_context_menu.js"; -type NoteTypeCommandNames = FilteredCommandNames; - -async function getNoteTypeItems(command?: NoteTypeCommandNames) { - const items: MenuItem[] = [ +async function getNoteTypeItems(command?: TreeCommandNames) { + const items: MenuItem[] = [ { title: t("note_types.text"), command, type: "text", uiIcon: "bx bx-note" }, { title: t("note_types.code"), command, type: "code", uiIcon: "bx bx-code" }, { title: t("note_types.saved-search"), command, type: "search", uiIcon: "bx bx-file-find" },