Merge branch 'fix/lihao-bugs-200824' into 'release/0.9.12'

Fix/lihao bugs 200824



See merge request !946640
This commit is contained in:
高凯 2020-08-24 21:19:22 +08:00
commit bff76191e1
4 changed files with 23 additions and 11 deletions

View File

@ -33,7 +33,7 @@ export class DocumentModel {
/**
* Page/Component/Block
*/
readonly rootNode: RootNode;
rootNode: RootNode | null;
/**
*
*/
@ -461,12 +461,16 @@ export class DocumentModel {
*
*/
remove() {
this.purge();
this.project.removeDocument(this);
// todo: ...
this.designer.postEvent('document.remove', { id: this.id });
}
purge() {
// todo:
this.rootNode?.purge();
this.nodes.clear();
this._nodesMap.clear();
this.rootNode = null;
}
checkNesting(dropTarget: ParentalNode, dragObject: DragNodeObject | DragNodeDataObject): boolean {

View File

@ -679,7 +679,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
/**
*
* @param node
* @param node
*/
removeChild(node: Node) {
this.children?.delete(node);
@ -699,11 +699,11 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
if (this.purged) {
return;
}
if (this._parent) {
// should remove thisNode before purge
this.remove(useMutator);
return;
}
// if (this._parent) {
// // should remove thisNode before purge
// this.remove(useMutator);
// return;
// }
this.purged = true;
if (this.isParental()) {
this.children.purge(useMutator);
@ -711,8 +711,8 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
this.autoruns?.forEach((dispose) => dispose());
this.props.purge();
this.document.internalRemoveAndPurgeNode(this);
this.document.destroyNode(this);
this.remove(useMutator);
}
/**
@ -862,7 +862,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
if (this.parent) {
return this.parent.getSuitablePlace(node, ref);
}
return null;
}
/**

View File

@ -65,6 +65,11 @@ export class Prop implements IPropParent {
export(stage: TransformStage = TransformStage.Save): CompositeValue | UNSET {
const type = this._type;
// 在设计器里,所有组件都需要展示
if (stage === TransformStage.Render && this.key === '___condition___') {
return true;
}
if (type === 'unset') {
// return UNSET; @康为 之后 review 下这块改造
return undefined;

View File

@ -54,6 +54,9 @@ export class TreeMaster {
time: (endTime - startTime).toFixed(2),
});
});
designer.editor.on('designer.document.remove', ({ id }) => {
this.treeMap.delete(id);
});
}
private toVision() {