feat: add modify internal context menu interface #300

This commit is contained in:
Hufe921
2023-10-24 21:39:37 +08:00
parent 45e7eab119
commit 0891f053d2
15 changed files with 231 additions and 34 deletions
+12
View File
@@ -8,13 +8,25 @@ import Editor from "@hufe921/canvas-editor"
const instance = new Editor(container, <IElement[]>data, options)
instance.register.contextMenuList([
{
key?: string;
isDivider?: boolean;
icon?: string;
name?: string; // Use %s for selection text. Example: Search: %s
shortCut?: string;
disable?: boolean;
when?: (payload: IContextMenuContext) => boolean;
callback?: (command: Command, context: IContextMenuContext) => any;
childMenus?: IRegisterContextMenu[];
}
])
```
## getContextMenuList
Feature: Get context menu list
Usage:
```javascript
const contextMenuList = await instance.register.getContextMenuList()
```