Merge branch 'fix/checkId' into 'release/1.0.0'

fix: 支持 checkId 开关功能, 在 setSchema 时关闭, 避免 id 被不断重置



See merge request !988464
This commit is contained in:
康为 2020-09-23 17:28:45 +08:00
commit 4f89c98408
3 changed files with 4 additions and 4 deletions

View File

@ -193,7 +193,7 @@ export class DocumentModel {
/** /**
* schema * schema
*/ */
createNode<T extends Node = Node, C = undefined>(data: GetDataType<C, T>): T { createNode<T extends Node = Node, C = undefined>(data: GetDataType<C, T>, checkId: boolean = true): T {
let schema: any; let schema: any;
if (isDOMText(data) || isJSExpression(data)) { if (isDOMText(data) || isJSExpression(data)) {
schema = { schema = {
@ -205,7 +205,7 @@ export class DocumentModel {
} }
let node: Node | null = null; let node: Node | null = null;
if (this.inited) { if (this.inited && checkId) {
schema.id = null; schema.id = null;
} }
if (schema.id) { if (schema.id) {

View File

@ -51,7 +51,7 @@ export class NodeChildren {
node = child; node = child;
node.import(item); node.import(item);
} else { } else {
node = this.owner.document.createNode(item); node = this.owner.document.createNode(item, checkId);
} }
children[i] = node; children[i] = node;
} }

View File

@ -40,7 +40,7 @@ export class Project {
*/ */
setSchema(schema?: ProjectSchema) { setSchema(schema?: ProjectSchema) {
const doc = this.documents.find((doc) => doc.actived); const doc = this.documents.find((doc) => doc.actived);
doc && doc.import(schema?.componentsTree[0]); doc && doc.import(schema?.componentsTree[0], false);
} }
/** /**