mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 10:49:51 +08:00 
			
		
		
		
	fix(editor): 使用画布上的删除按钮删除组件时依赖没有清空
This commit is contained in:
		
							parent
							
								
									2f28252c64
								
							
						
					
					
						commit
						0d3cd11ade
					
				@ -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', () => {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user