feat: add modify internal context menu interface #300
This commit is contained in:
@@ -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()
|
||||
```
|
||||
|
||||
@@ -56,6 +56,7 @@ interface IEditorOption {
|
||||
printPixelRatio?: number // Print the pixel ratio (larger values are clearer, but larger sizes). default: 3
|
||||
maskMargin?: IMargin // Masking margins above the editor(for example: menu bar, bottom toolbar)。default: [0, 0, 0, 0]
|
||||
letterClass? string[] // Alphabet class supported by typesetting. default: a-zA-Z. Built-in alternative alphabet class: LETTER_CLASS
|
||||
contextMenuDisableKeys?: string[] // Disable context menu keys. default: []
|
||||
wordBreak?: WordBreak // Word and punctuation breaks: No punctuation in the first line of the BREAK_WORD &The word is not split, and the line is folded after BREAK_ALL full according to the width of the character. default: BREAK_WORD
|
||||
watermark?: IWatermark // Watermark{data:string; color?:string; opacity?:number; size?:number; font?:string;}
|
||||
control?: IControlOption // Control {placeholderColor?:string; bracketColor?:string; prefix?:string; postfix?:string;}
|
||||
|
||||
Reference in New Issue
Block a user