提交 0b18106a 编写于 作者: R Rob Lourens

Another fix for #99354

上级 e25e9d4b
......@@ -62,7 +62,7 @@ export class StatefullMarkdownCell extends Disposable {
// not first time, we don't need to create editor or bind listeners
viewCell.attachTextEditor(this.editor);
this.tryFocusEditor();
this.focusEditorIfNeeded();
this.bindEditorListeners(this.editor.getModel()!);
} else {
......@@ -95,7 +95,7 @@ export class StatefullMarkdownCell extends Disposable {
}
this.editor!.setModel(model);
this.tryFocusEditor();
this.focusEditorIfNeeded();
const realContentHeight = this.editor!.getContentHeight();
if (realContentHeight !== editorHeight) {
......@@ -111,7 +111,7 @@ export class StatefullMarkdownCell extends Disposable {
viewCell.attachTextEditor(this.editor!);
if (viewCell.editState === CellEditState.Editing) {
this.tryFocusEditor();
this.focusEditorIfNeeded();
}
this.bindEditorListeners(model, {
......@@ -131,7 +131,7 @@ export class StatefullMarkdownCell extends Disposable {
const totalHeight = editorHeight + 32 + clientHeight + CELL_STATUSBAR_HEIGHT;
this.viewCell.totalHeight = totalHeight;
notebookEditor.layoutNotebookCell(viewCell, totalHeight);
this.tryFocusEditor();
this.focusEditorIfNeeded();
renderedEditors.set(this.viewCell, this.editor!);
} else {
this.viewCell.detachTextEditor();
......@@ -201,7 +201,7 @@ export class StatefullMarkdownCell extends Disposable {
const updateForFocusMode = () => {
if (viewCell.focusMode === CellFocusMode.Editor) {
this.tryFocusEditor();
this.focusEditorIfNeeded();
}
toggleClass(templateData.container, 'cell-editor-focus', viewCell.focusMode === CellFocusMode.Editor);
......@@ -243,8 +243,8 @@ export class StatefullMarkdownCell extends Disposable {
viewUpdate();
}
private tryFocusEditor() {
if (this.notebookEditor.getActiveCell() === this.viewCell) {
private focusEditorIfNeeded() {
if (this.viewCell.focusMode === CellFocusMode.Editor) {
this.editor?.focus();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册