canvas-editor_fex765/docs/guide/contextmenu-custom.md

20 lines
543 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 自定义右键菜单
## 使用方式
```javascript
import Editor from "@hufe921/canvas-editor"
const instance = new Editor(container, <IElement[]>data, options)
instance.register.contextMenuList([
{
isDivider?: boolean;
icon?: string;
name?: string; // 使用%s代表选区文本。示例搜索%s
shortCut?: string;
when?: (payload: IContextMenuContext) => boolean;
callback?: (command: Command, context: IContextMenuContext) => any;
childMenus?: IRegisterContextMenu[];
}
])
```