From 23a4b5de4f8309e20ab5806174d9c1a43ebd728a Mon Sep 17 00:00:00 2001 From: zhang zhuo Date: Sat, 22 Nov 2025 17:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/piEditor/ext/extImage.ts | 36 +++++++++++ src/components/piEditor/ext/extVideo.ts | 35 +++++++++++ src/components/piEditor/index.vue | 82 ++++++++++++++++++------- src/views/monitor/crontab/save.vue | 8 +-- 4 files changed, 135 insertions(+), 26 deletions(-) create mode 100644 src/components/piEditor/ext/extImage.ts create mode 100644 src/components/piEditor/ext/extVideo.ts 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 @@