Link plugin
yarn add @aomao/plugin-link
Vue3
use
yarn add @aomao/plugin-link-vue
Vue2
use
yarn add am-editor-link-vue2
Add to engine
import Engine, {EngineInterface} from'@aomao/engine';import Link from'@aomao/plugin-link';new Engine(...,{ plugins:[Link] })
The default shortcut key is mod+k
, and the default parameter is ["_blank"]
//Shortcut keys, key combination keys, args, execution parameters, [target?:string,href?:string,text?:string] Open mode: optional, default link: optional, default text: optionalhotkey?:string | {key:string,args:Array<string>};//Use configurationnew Engine(...,{config:{"link":{//Modify shortcut keyshotkey:{key:"mod+k",args:["_balnk_","https://www.aomao.com","ITELLYOU"]}}}})
The url or text to be modified can be modified
Confirm execution after editing text and url
onConfirm?: (text: string,link: string,) => Promise<{ text: string; link: string }>;
Whether to enable the toolbar for link editing
enableToolbar?: boolean;
Fired when a link is clicked in edit mode
onLinkClick?: (e: MouseEvent, link: string) => void;
Three parameters can be passed in [target?:string,href?:string,text?:string] Open mode: optional, default link: optional, default text: optional
//target:'_blank','_parent','_top','_self', href: link, text: textengine.command.execute('link', '_blank', 'https://www.aomao.com', 'ITELLYOU');//Use command to execute query current status, return boolean | undefinedengine.command.queryState('link');