mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
Merge branch 'fix/multiple-tree' into 'release/1.0.0'
fix: 解决 set('schema') 后 componentsTree 越来越多的 bug
See merge request !962981
This commit is contained in:
commit
c52731879d
@ -1,5 +1,5 @@
|
||||
import { computed, obx } from '@ali/lowcode-editor-core';
|
||||
import { NodeData, isJSExpression, isDOMText, NodeSchema, isNodeSchema, RootSchema } from '@ali/lowcode-types';
|
||||
import { NodeData, isJSExpression, isDOMText, NodeSchema, isNodeSchema, RootSchema, PageSchema } from '@ali/lowcode-types';
|
||||
import { EventEmitter } from 'events';
|
||||
import { Project } from '../project';
|
||||
import { ISimulatorHost } from '../simulator';
|
||||
@ -659,3 +659,7 @@ export class DocumentModel {
|
||||
export function isDocumentModel(obj: any): obj is DocumentModel {
|
||||
return obj && obj.rootNode;
|
||||
}
|
||||
|
||||
export function isPageSchema(obj: any): obj is PageSchema {
|
||||
return obj?.componentName === 'Page';
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { obx, computed } from '@ali/lowcode-editor-core';
|
||||
import { Designer } from '../designer';
|
||||
import { DocumentModel, isDocumentModel } from '../document';
|
||||
import { DocumentModel, isDocumentModel, isPageSchema } from '../document';
|
||||
import { ProjectSchema, RootSchema } from '@ali/lowcode-types';
|
||||
|
||||
export class Project {
|
||||
@ -138,6 +138,11 @@ export class Project {
|
||||
|
||||
if (isDocumentModel(doc)) {
|
||||
return doc.open();
|
||||
} else if (isPageSchema(doc)) {
|
||||
const foundDoc = this.documents.find(curDoc => curDoc?.rootNode?.id && curDoc?.rootNode?.id === doc?.id);
|
||||
if (foundDoc) {
|
||||
foundDoc.remove();
|
||||
}
|
||||
}
|
||||
|
||||
doc = new DocumentModel(this, doc);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user