Add test for last edit mode (#18734)

* add test for persisting last edit mode

* remove empty line

* address comments

* update comment
This commit is contained in:
Maddy
2022-03-18 16:13:58 -07:00
committed by GitHub
parent 6263cc2f87
commit 23a69f9b69
2 changed files with 65 additions and 0 deletions

View File

@@ -241,6 +241,11 @@ export class CellModel extends Disposable implements ICellModel {
const newEditMode = this._lastEditMode ?? this._defaultTextEditMode;
this.showPreview = newEditMode !== TextCellEditModes.Markdown;
this.showMarkdown = newEditMode !== TextCellEditModes.RichText;
} else {
// when not in edit mode, default the values since they are only valid when editing.
// And to return the correct currentMode value.
this._showMarkdown = false;
this._showPreview = true;
}
this._onCellModeChanged.fire(this._isEditMode);
// Note: this does not require a notebook update as it does not change overall state