fix(editor): 拖拽改变父容器时错乱现象 (#296)

* fix(editor): 拖拽改变父容器时错乱现象

直接拖拽元素改变其父容器时, 会产生错乱的现象。

* Update packages/stage/src/types.ts

Co-authored-by: jia000 <398009049@qq.com>

Co-authored-by: jia000 <398009049@qq.com>
This commit is contained in:
i33 2022-08-22 13:18:23 +08:00 committed by GitHub
parent edcfe685d8
commit f3c9ba475f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -664,7 +664,8 @@ class Editor extends BaseService {
await stage.select(targetId); await stage.select(targetId);
await stage.update({ config: cloneDeep(target), parentId: parent.id, root }); const targetParent = this.getParentById(target.id);
await stage.update({ config: cloneDeep(target), parentId: targetParent?.id, root });
await this.select(newConfig); await this.select(newConfig);
stage.select(newConfig.id); stage.select(newConfig.id);

View File

@ -119,7 +119,7 @@ export interface SortEventData {
export interface UpdateData { export interface UpdateData {
config: MNode; config: MNode;
parent?: MContainer; parent?: MContainer;
parentId: Id; parentId?: Id;
root: MApp; root: MApp;
} }