feat(editor): runtime add api中parent参数加回去

This commit is contained in:
roymondchen 2022-08-16 16:28:24 +08:00 committed by jia000
parent b1bd7a870e
commit 2cde4bb5a0
2 changed files with 8 additions and 2 deletions

View File

@ -302,7 +302,12 @@ class Editor extends BaseService {
const layout = await this.getLayout(toRaw(parent), node as MNode);
node.style = getInitPositionStyle(node.style, layout);
await stage?.add({ config: cloneDeep(node), parentId: parent.id, root: cloneDeep(root) });
await stage?.add({
config: cloneDeep(node),
parent: cloneDeep(parent),
parentId: parent.id,
root: cloneDeep(root),
});
node.style = fixNodePosition(node, parent, stage);

View File

@ -19,7 +19,7 @@
import { MoveableOptions } from 'moveable';
import Core from '@tmagic/core';
import type { Id, MApp, MNode } from '@tmagic/schema';
import type { Id, MApp, MContainer, MNode } from '@tmagic/schema';
import { GuidesType } from './const';
import StageCore from './StageCore';
@ -118,6 +118,7 @@ export interface SortEventData {
export interface UpdateData {
config: MNode;
parent?: MContainer;
parentId: Id;
root: MApp;
}