diff --git a/lib/table-element.js b/lib/table-element.js index 81b9bee..d21503a 100644 --- a/lib/table-element.js +++ b/lib/table-element.js @@ -1306,8 +1306,10 @@ class TableElement extends HTMLElement { const cursorValue = cursor.getValue() this.editor.setText(String(cursorValue || this.getUndefinedDisplay())) - this.editor.getBuffer().history.clearUndoStack() - this.editor.getBuffer().history.clearRedoStack() + if (this.editor.getBuffer().history != undefined) { + this.editor.getBuffer().history.clearUndoStack() + this.editor.getBuffer().history.clearRedoStack() + } if (initialData) { this.editor.setText(initialData) } } @@ -1353,8 +1355,10 @@ class TableElement extends HTMLElement { this.editorElement.focus() this.editor.setText(this.columnUnderEdit.name != null ? this.columnUnderEdit.name : columnName(columnIndex)) - this.editor.getBuffer().history.clearUndoStack() - this.editor.getBuffer().history.clearRedoStack() + if (this.editor.getBuffer().history != undefined) { + this.editor.getBuffer().history.clearUndoStack() + this.editor.getBuffer().history.clearRedoStack() + } } }