Skip to content

Commit 0625bc3

Browse files
committed
fix microsoft#104196. detached overflow widget.
1 parent 65804ae commit 0625bc3

5 files changed

Lines changed: 19 additions & 2 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
@@ -193,6 +193,7 @@ export interface INotebookEditor extends IEditor {
193193

194194
getId(): string;
195195
getDomNode(): HTMLElement;
196+
getOverflowContainerDomNode(): HTMLElement;
196197
getInnerWebview(): Webview | undefined;
197198

198199
/**

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
7676
private static readonly EDITOR_MEMENTOS = new Map<string, EditorMemento<unknown>>();
7777
private _overlayContainer!: HTMLElement;
7878
private _body!: HTMLElement;
79+
private _overflowContainer!: HTMLElement;
7980
private _webview: BackLayerWebView | null = null;
8081
private _webviewResolved: boolean = false;
8182
private _webviewResolvePromise: Promise<BackLayerWebView | null> | null = null;
@@ -356,6 +357,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
356357
DOM.addClass(this._body, 'cell-list-container');
357358
this._createCellList();
358359
DOM.append(parent, this._body);
360+
361+
this._overflowContainer = document.createElement('div');
362+
DOM.addClass(this._overflowContainer, 'notebook-overflow-widget-container');
363+
DOM.addClass(this._overflowContainer, 'monaco-editor');
364+
DOM.append(parent, this._overflowContainer);
359365
}
360366

361367
private _createCellList(): void {
@@ -484,6 +490,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
484490
return this._overlayContainer;
485491
}
486492

493+
getOverflowContainerDomNode() {
494+
return this._overflowContainer;
495+
}
496+
487497
onWillHide() {
488498
this._isVisible = false;
489499
this._editorFocus?.set(false);

src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,8 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
992992
dimension: {
993993
width: 0,
994994
height: 0
995-
}
995+
},
996+
overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode()
996997
}, {});
997998

998999
disposables.add(this.editorOptions.onDidChange(newValue => editor.updateOptions(newValue)));

src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ export class StatefulMarkdownCell extends Disposable {
189189
dimension: {
190190
width: width,
191191
height: editorHeight
192-
}
192+
},
193+
overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode()
193194
}, {});
194195
this.templateData.currentEditor = this.editor;
195196

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ export class TestNotebookEditor implements INotebookEditor {
103103
throw new Error('Method not implemented.');
104104
}
105105

106+
getOverflowContainerDomNode(): HTMLElement {
107+
throw new Error('Method not implemented.');
108+
}
109+
106110
private _onDidChangeModel = new Emitter<NotebookTextModel | undefined>();
107111
onDidChangeModel: Event<NotebookTextModel | undefined> = this._onDidChangeModel.event;
108112
getContribution<T extends INotebookEditorContribution>(id: string): T {

0 commit comments

Comments
 (0)