CommandItem
CommandItem
is the definition of a custom menu, tool or shortcut, and is applied to the following interfaces:
pixso.setTopTools(tools: Tool[]): void
pixso.setBottomTools(tools: Tool[]): void
pixso.stickyToolbar.open(tools: Tool[]): void
pixso.setContextMenus(menus: ContextMenuItem[]): void
pixso.setShortcuts(shortcuts: ShortcutItem[]): void
interface CommandItem = {
label: string;
value: string;
disabled?: boolean;
description?: string;
icon?: string | Uint8Array; // svg string or image binary data. PS: When iconUrl also exists, icon data will be used first.
iconUrl?: string;
children: Array<CommandItem>
};
type CommandItemWithoutIcon = Omit<CommandItem, "icon" | "iconUrl">;
type SeparatorItem = {
separator: true;
};
ToolItem
type ToolItem =
| SeparatorItem
| (CommandItem & {
children?: Array<ToolItem>;
});
ContextMenuItem
type ContextMenuItem =
| SeparatorItem
| (CommandItemWithoutIcon & {
children?: Array<ContextMenuItem>;
});
ShortcutItem
type SubShortcutItem = CommandItemWithoutIcon & {
children?: Array<SubShortcutItem>;
};
type ShortcutItem = CommandItem & {
children?: Array<SubShortcutItem>;
};