mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-12 05:48:59 +08:00
fix(editor): 使用画布上的删除按钮删除组件时依赖没有清空
This commit is contained in:
parent
2f28252c64
commit
0d3cd11ade
@ -1,5 +1,6 @@
|
|||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
import type { MNode } from '@tmagic/schema';
|
||||||
import StageCore, { GuidesType, RemoveEventData, SortEventData, UpdateEventData } from '@tmagic/stage';
|
import StageCore, { GuidesType, RemoveEventData, SortEventData, UpdateEventData } from '@tmagic/stage';
|
||||||
|
|
||||||
import editorService from '@editor/services/editor';
|
import editorService from '@editor/services/editor';
|
||||||
@ -74,11 +75,8 @@ export const useStage = (stageOptions: StageOptions) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
stage.on('remove', (ev: RemoveEventData) => {
|
stage.on('remove', (ev: RemoveEventData) => {
|
||||||
editorService.remove(
|
const nodes = ev.data.map(({ el }) => editorService.getNodeById(el.id));
|
||||||
ev.data.map(({ el }) => ({
|
editorService.remove(nodes.filter((node) => Boolean(node)) as MNode[]);
|
||||||
id: el.id,
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
stage.on('select-parent', () => {
|
stage.on('select-parent', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user