(core) Disable undo/redo in detached formula editor

Summary:
Undo and redo were causing errors to be thrown while the editor was detached. In the
interest of time, we'll disable undo/redo until we have a chance to look at whether
we can support it in the editor.

Test Plan: Manual.

Reviewers: JakubSerafin

Reviewed By: JakubSerafin

Differential Revision: https://phab.getgrist.com/D3959
This commit is contained in:
George Gevoian
2023-07-18 22:27:53 -04:00
parent c0ed4a8a60
commit 0040716006
3 changed files with 43 additions and 8 deletions

View File

@@ -153,7 +153,20 @@ export class FormulaEditor extends NewBaseEditor {
this._isEmpty.addListener(() => this._updateEditorPlaceholder());
// Update the placeholder text when expanding or collapsing the editor.
this.isDetached.addListener(() => this._updateEditorPlaceholder());
this.isDetached.addListener((isDetached) => {
// TODO: look into whether we can support undo/redo while the editor is detached.
if (isDetached) {
options.gristDoc.getUndoStack().disable();
} else {
options.gristDoc.getUndoStack().enable();
}
this._updateEditorPlaceholder();
});
this.onDispose(() => {
options.gristDoc.getUndoStack().enable();
});
this._dom = cssFormulaEditor(
// switch border shadow