From c21aeb9a5cae33049f716ffb80d85f62da663e1f Mon Sep 17 00:00:00 2001 From: "lihao.ylh" Date: Wed, 23 Feb 2022 15:22:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B0=B1=E6=9C=89=E4=B8=A4=E6=9D=A1=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/src/document/document-model.ts | 2 +- packages/designer/src/document/history.ts | 27 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/packages/designer/src/document/document-model.ts b/packages/designer/src/document/document-model.ts index 3a181d17e..d52ea21ab 100644 --- a/packages/designer/src/document/document-model.ts +++ b/packages/designer/src/document/document-model.ts @@ -86,7 +86,7 @@ export class DocumentModel { } get fileName(): string { - return this.rootNode?.getExtraProp('fileName')?.getAsString() || this.id; + return this.rootNode?.getExtraProp('fileName', false)?.getAsString() || this.id; } set fileName(fileName: string) { diff --git a/packages/designer/src/document/history.ts b/packages/designer/src/document/history.ts index a27e180b9..68cd2feda 100644 --- a/packages/designer/src/document/history.ts +++ b/packages/designer/src/document/history.ts @@ -43,21 +43,20 @@ export class History { if (this.asleep) return; untracked(() => { const log = currentSerialization.serialize(data); - if (this.session.isActive()) { - this.session.log(log); - } else { - this.session.end(); - const lastState = this.getState(); - const cursor = this.session.cursor + 1; - const session = new Session(cursor, log, this.timeGap); - this.session = session; - this.records.splice(cursor, this.records.length - cursor, session); - const currentState = this.getState(); - if (currentState !== lastState) { - this.emitter.emit('statechange', currentState); - } + if (this.session.isActive()) { + this.session.log(log); + } else { + this.session.end(); + const lastState = this.getState(); + const cursor = this.session.cursor + 1; + const session = new Session(cursor, log, this.timeGap); + this.session = session; + this.records.splice(cursor, this.records.length - cursor, session); + const currentState = this.getState(); + if (currentState !== lastState) { + this.emitter.emit('statechange', currentState); } - // } + } }); }, { fireImmediately: true }); }