提交 762f213a 编写于 作者: R Rob Lourens

Allow notebook cell editor taking focus when it's on body. The notebook can...

Allow notebook cell editor taking focus when it's on body. The notebook can lose focus, eg when scrolling a focused cell element out of view, then it goes to body.
Fix #129432
上级 e5bfa66d
......@@ -60,7 +60,11 @@ export class CodeCell extends Disposable {
templateData.editor.setModel(model);
viewCell.attachTextEditor(templateData.editor);
const focusEditorIfNeeded = () => {
if (notebookEditor.getActiveCell() === viewCell && viewCell.focusMode === CellFocusMode.Editor && this.notebookEditor.hasEditorFocus()) {
if (
notebookEditor.getActiveCell() === viewCell &&
viewCell.focusMode === CellFocusMode.Editor &&
(this.notebookEditor.hasEditorFocus() || document.activeElement === document.body)) // Don't steal focus from other workbench parts, but if body has focus, we can take it
{
templateData.editor?.focus();
}
};
......
......@@ -296,7 +296,9 @@ export class StatefulMarkdownCell extends Disposable {
}
private focusEditorIfNeeded() {
if (this.viewCell.focusMode === CellFocusMode.Editor && this.notebookEditor.hasEditorFocus()) {
if (
this.viewCell.focusMode === CellFocusMode.Editor &&
(this.notebookEditor.hasEditorFocus() || document.activeElement === document.body)) { // Don't steal focus from other workbench parts, but if body has focus, we can take it
this.editor?.focus();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册