From 319b13b559f637301934c60cae9d72dbec3bf48d Mon Sep 17 00:00:00 2001 From: liujuping Date: Fri, 28 Oct 2022 17:18:15 +0800 Subject: [PATCH] fix: fix historySymbol is undefined causing errores when calling the history method --- packages/shell/src/document-model.ts | 2 +- packages/shell/src/history.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/shell/src/document-model.ts b/packages/shell/src/document-model.ts index 3f4fc4398..3f8f4e70e 100644 --- a/packages/shell/src/document-model.ts +++ b/packages/shell/src/document-model.ts @@ -56,7 +56,7 @@ export default class DocumentModel { this[editorSymbol] = document.designer.editor as Editor; this.selection = new Selection(document); this.detecting = new Detecting(document); - this.history = new History(document.getHistory()); + this.history = new History(document); this.canvas = new Canvas(document.designer); this._focusNode = Node.create(this[documentSymbol].focusNode); diff --git a/packages/shell/src/history.ts b/packages/shell/src/history.ts index debc0ccef..267c7fd99 100644 --- a/packages/shell/src/history.ts +++ b/packages/shell/src/history.ts @@ -1,11 +1,15 @@ import { History as InnerHistory, DocumentModel as InnerDocumentModel } from '@alilc/lowcode-designer'; -import { historySymbol } from './symbols'; +import { historySymbol, documentSymbol } from './symbols'; export default class History { - private readonly [historySymbol]: InnerHistory; + private readonly [documentSymbol]: InnerDocumentModel; - constructor(history: InnerHistory) { - this[historySymbol] = history; + private get [historySymbol]() { + return this[documentSymbol].getHistory(); + } + + constructor(document: InnerDocumentModel) { + this[documentSymbol] = document; } /**