From 4c5b718da547b92a8afb902767968697e5b3de8a Mon Sep 17 00:00:00 2001 From: clinfc <1962109568@qq.com> Date: Mon, 14 Mar 2022 21:03:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=BC=BA?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/core.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/core.ts b/src/core/core.ts index 7f7b51c..ce653cc 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -45,6 +45,11 @@ export function setTimer(option: WeToolbarOption | WeEditableOption, fn?: () => * vue hook,在 WeEditable 组件中使用 */ export function injectEditor(option: WeEditableOption, reload: WeEditableReload, clearContent: () => void) { + // 必须是 useWangEditor 函数创建的编辑区配置项 + if (!EDITABLE_TOOLBAR.has(option)) { + throw new Error('You must use the Editable Opiton created by "useWangEditor" function!') + } + function reset() { const instance = reload() if (!instance) return @@ -76,6 +81,11 @@ export function injectEditor(option: WeEditableOption, reload: WeEditableReload, * vue hook,在 WeToolbar 组件中使用 */ export function injectToolbar(option: WeToolbarOption, reload: WeToolbarReload) { + // 必须是 useWangEditor 函数创建的菜单栏配置项 + if (!TOOLBAR_EDITABLE.has(option)) { + throw new Error('You must use the Toolbar Opiton created by "useWangEditor" function!') + } + function reset() { const editableOptions = TOOLBAR_EDITABLE.get(option) if (!editableOptions) return