From a4fc95775eab88ecb5850f824ae5bf7889e951e4 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Mon, 25 Mar 2024 14:52:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20element-plus=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=88=B02.6=E5=90=8E=E8=A1=A8=E5=8D=95=E9=A1=B9=E6=B8=85?= =?UTF-8?q?=E9=99=A4=E5=90=8E=E6=98=AFundefined=EF=BC=8C=E9=99=A4=E4=BA=86?= =?UTF-8?q?string=E5=A4=96=E5=85=B6=E4=BB=96=E7=BB=9F=E4=B8=80=E6=94=B9?= =?UTF-8?q?=E6=88=90null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/services/editor.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/services/editor.ts b/packages/editor/src/services/editor.ts index a8d21e60..17e8207a 100644 --- a/packages/editor/src/services/editor.ts +++ b/packages/editor/src/services/editor.ts @@ -533,7 +533,15 @@ class Editor extends BaseService { let newConfig = await this.toggleFixedPosition(toRaw(config), node, root); - newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => { + newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue, key) => { + if (typeof srcValue === 'undefined' && Object.hasOwn(newConfig, key)) { + if (typeof objValue === 'string') { + return ''; + } + + return null; + } + if (isObject(srcValue) && Array.isArray(objValue)) { // 原来的配置是数组,新的配置是对象,则直接使用新的值 return srcValue;