From 828681e9608629414811d49da7ba3a3100e82ccd Mon Sep 17 00:00:00 2001 From: roymondchen Date: Mon, 5 Dec 2022 20:35:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E6=97=B6=E6=B7=BB=E5=8A=A0=E7=9A=84=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E7=88=B6=E7=BB=84=E4=BB=B6=E5=BA=94=E5=BD=93=E6=98=AF=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=88=B6=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #448 --- packages/editor/src/services/editor.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/services/editor.ts b/packages/editor/src/services/editor.ts index f61f5e4d..0987f997 100644 --- a/packages/editor/src/services/editor.ts +++ b/packages/editor/src/services/editor.ts @@ -352,6 +352,9 @@ class Editor extends BaseService { const newNodes = await Promise.all( addNodes.map((node) => { + if (isPage(node)) { + return this.doAdd(node, this.get('root')); + } const parentNode = parent && typeof parent !== 'function' ? parent : getAddParent(node); if (!parentNode) throw new Error('未找到父元素'); return this.doAdd(node, parentNode); @@ -579,7 +582,7 @@ class Editor extends BaseService { const pasteConfigs = await this.doPaste(config, position); - return this.add(pasteConfigs); + return this.add(pasteConfigs, this.get('parent')); } public async doPaste(config: MNode[], position: PastePosition = {}): Promise {