mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-16 11:21:37 +08:00
fix(build): type definitions for context menu
This commit is contained in:
parent
7874e88b4a
commit
23d01ec351
@ -18,7 +18,9 @@ interface ConvertToAttachmentResponse {
|
|||||||
attachment?: FAttachment;
|
attachment?: FAttachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData>;
|
// 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<ContextMenuCommandData> | "openBulkActionsDialog";
|
||||||
|
|
||||||
export default class TreeContextMenu implements SelectMenuItemEventListener<TreeCommandNames> {
|
export default class TreeContextMenu implements SelectMenuItemEventListener<TreeCommandNames> {
|
||||||
private treeWidget: NoteTreeWidget;
|
private treeWidget: NoteTreeWidget;
|
||||||
|
@ -2,12 +2,10 @@ import server from "./server.js";
|
|||||||
import froca from "./froca.js";
|
import froca from "./froca.js";
|
||||||
import { t } from "./i18n.js";
|
import { t } from "./i18n.js";
|
||||||
import type { MenuItem } from "../menus/context_menu.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<ContextMenuCommandData>;
|
async function getNoteTypeItems(command?: TreeCommandNames) {
|
||||||
|
const items: MenuItem<TreeCommandNames>[] = [
|
||||||
async function getNoteTypeItems(command?: NoteTypeCommandNames) {
|
|
||||||
const items: MenuItem<NoteTypeCommandNames>[] = [
|
|
||||||
{ title: t("note_types.text"), command, type: "text", uiIcon: "bx bx-note" },
|
{ 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.code"), command, type: "code", uiIcon: "bx bx-code" },
|
||||||
{ title: t("note_types.saved-search"), command, type: "search", uiIcon: "bx bx-file-find" },
|
{ title: t("note_types.saved-search"), command, type: "search", uiIcon: "bx bx-file-find" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user