Skip to content

Commit e64364f

Browse files
committed
webview hijacks the focus for undo/redo
1 parent 5137025 commit e64364f

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export interface INotebookEditor extends IEditor {
198198
focus(): void;
199199

200200
hasFocus(): boolean;
201+
hasWebviewFocus(): boolean;
201202

202203
hasOutputTextSelection(): boolean;
203204

src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
273273
return this._editorFocus?.get() || false;
274274
}
275275

276+
hasWebviewFocus() {
277+
return this._webiewFocused;
278+
}
279+
276280
hasOutputTextSelection() {
277281
if (!this.hasFocus()) {
278282
return false;

src/vs/workbench/contrib/notebook/electron-browser/notebook.contribution.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ function getFocusedElectronBasedWebviewDelegate(accessor: ServicesAccessor): Ele
1818
return;
1919
}
2020

21+
if (!editor?.hasWebviewFocus()) {
22+
return;
23+
}
24+
2125
const webview = editor?.getInnerWebview();
2226
if (webview && webview instanceof ElectronWebviewBasedWebview) {
2327
return webview;

src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ export class TestNotebookEditor implements INotebookEditor {
8282
return true;
8383
}
8484

85+
hasWebviewFocus() {
86+
return false;
87+
}
88+
8589
hasOutputTextSelection() {
8690
return false;
8791
}

0 commit comments

Comments
 (0)