fix: fix historySymbol is undefined causing errores when calling the history method

This commit is contained in:
liujuping 2022-10-28 17:18:15 +08:00 committed by LeoYuan 袁力皓
parent b4f3613bb4
commit 6cb0df3209
2 changed files with 9 additions and 5 deletions

View File

@ -56,7 +56,7 @@ export default class DocumentModel {
this[editorSymbol] = document.designer.editor as Editor; this[editorSymbol] = document.designer.editor as Editor;
this.selection = new Selection(document); this.selection = new Selection(document);
this.detecting = new Detecting(document); this.detecting = new Detecting(document);
this.history = new History(document.getHistory()); this.history = new History(document);
this.canvas = new Canvas(document.designer); this.canvas = new Canvas(document.designer);
this._focusNode = Node.create(this[documentSymbol].focusNode); this._focusNode = Node.create(this[documentSymbol].focusNode);

View File

@ -1,11 +1,15 @@
import { History as InnerHistory, DocumentModel as InnerDocumentModel } from '@alilc/lowcode-designer'; import { History as InnerHistory, DocumentModel as InnerDocumentModel } from '@alilc/lowcode-designer';
import { historySymbol } from './symbols'; import { historySymbol, documentSymbol } from './symbols';
export default class History { export default class History {
private readonly [historySymbol]: InnerHistory; private readonly [documentSymbol]: InnerDocumentModel;
constructor(history: InnerHistory) { private get [historySymbol]() {
this[historySymbol] = history; return this[documentSymbol].getHistory();
}
constructor(document: InnerDocumentModel) {
this[documentSymbol] = document;
} }
/** /**