mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01: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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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> {
 | 
			
		||||
    private treeWidget: NoteTreeWidget;
 | 
			
		||||
 | 
			
		||||
@ -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<ContextMenuCommandData>;
 | 
			
		||||
 | 
			
		||||
async function getNoteTypeItems(command?: NoteTypeCommandNames) {
 | 
			
		||||
    const items: MenuItem<NoteTypeCommandNames>[] = [
 | 
			
		||||
async function getNoteTypeItems(command?: TreeCommandNames) {
 | 
			
		||||
    const items: MenuItem<TreeCommandNames>[] = [
 | 
			
		||||
        { 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" },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user