From 0d3cd11ade5fbd697e24aa5c61fbc0be7c3ea9e6 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Wed, 2 Aug 2023 20:13:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E4=BD=BF=E7=94=A8=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E4=B8=8A=E7=9A=84=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E4=BB=B6=E6=97=B6=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/utils/stage.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/editor/src/utils/stage.ts b/packages/editor/src/utils/stage.ts index 7bfa394a..6e876f5d 100644 --- a/packages/editor/src/utils/stage.ts +++ b/packages/editor/src/utils/stage.ts @@ -1,5 +1,6 @@ import { computed } from 'vue'; +import type { MNode } from '@tmagic/schema'; import StageCore, { GuidesType, RemoveEventData, SortEventData, UpdateEventData } from '@tmagic/stage'; import editorService from '@editor/services/editor'; @@ -74,11 +75,8 @@ export const useStage = (stageOptions: StageOptions) => { }); stage.on('remove', (ev: RemoveEventData) => { - editorService.remove( - ev.data.map(({ el }) => ({ - id: el.id, - })), - ); + const nodes = ev.data.map(({ el }) => editorService.getNodeById(el.id)); + editorService.remove(nodes.filter((node) => Boolean(node)) as MNode[]); }); stage.on('select-parent', () => {