diff --git a/src/components/piEditor/ext/extImage.ts b/src/components/piEditor/ext/extImage.ts new file mode 100644 index 0000000..7e2cfc9 --- /dev/null +++ b/src/components/piEditor/ext/extImage.ts @@ -0,0 +1,36 @@ +import { Boot, IButtonMenu, IDomEditor } from '@wangeditor/editor' + +export default class ExtImage implements IButtonMenu{ + key = 'extImage' + title = '插入图片' + tag: 'button' = 'button' + iconSvg = "" + + // 执行逻辑 + exec(editor: IDomEditor, value?: any) { + console.log(editor.getConfig()?.MENU_CONF?.headerSelect) + const fn = editor.getConfig()?.MENU_CONF?.extImage?.callback + if (fn) fn() + } + + // 是否高亮 + isActive(editor: IDomEditor): boolean { + return false + } + + getValue(editor: IDomEditor): string | boolean { + return undefined; + } + + isDisabled(editor: IDomEditor): boolean { + return false; + } +} + +// 注册菜单 +Boot.registerMenu({ + key: 'extImage', + factory(): IButtonMenu { + return new ExtImage() + } +}) diff --git a/src/components/piEditor/ext/extVideo.ts b/src/components/piEditor/ext/extVideo.ts new file mode 100644 index 0000000..895177a --- /dev/null +++ b/src/components/piEditor/ext/extVideo.ts @@ -0,0 +1,35 @@ +import { Boot, IButtonMenu, IDomEditor } from '@wangeditor/editor' + +export default class ExtVideo implements IButtonMenu{ + key = 'extVideo' + title = '插入视频' + tag: 'button' = 'button' + iconSvg = "" + + // 执行逻辑 + exec(editor: IDomEditor, value?: any) { + const fn = editor.getConfig()?.MENU_CONF?.extVideo?.callback + if (fn) fn() + } + + // 是否高亮 + isActive(editor: IDomEditor): boolean { + return false + } + + getValue(editor: IDomEditor): string | boolean { + return undefined; + } + + isDisabled(editor: IDomEditor): boolean { + return false; + } +} + +// 注册菜单 +Boot.registerMenu({ + key: 'extVideo', + factory(): IButtonMenu { + return new ExtVideo() + } +}) diff --git a/src/components/piEditor/index.vue b/src/components/piEditor/index.vue index 1a02b71..3cc2018 100644 --- a/src/components/piEditor/index.vue +++ b/src/components/piEditor/index.vue @@ -1,9 +1,11 @@