From 9c7e230fd67449a1028afdf224879b2e81836ba2 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 8 Jun 2020 12:54:06 -0500 Subject: [PATCH] Add editor drop target for notebooks Fix #99327 --- .../workbench/contrib/notebook/browser/notebookEditor.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts index 6612adf91ec73..ebe840ddb38e6 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts @@ -19,6 +19,7 @@ import { INotebookEditorViewState, NotebookViewModel } from 'vs/workbench/contri import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget'; import { NotebookRegistry } from 'vs/workbench/contrib/notebook/browser/notebookRegistry'; +import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart'; const NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'NotebookEditorViewState'; @@ -38,7 +39,7 @@ export class NotebookEditor extends BaseEditor { @IThemeService themeService: IThemeService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IStorageService storageService: IStorageService, - @IEditorGroupsService editorGroupService: IEditorGroupsService) { + @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) { super(NotebookEditor.ID, telemetryService, themeService, storageService); // this._widget = this.instantiationService.createInstance(NotebookEditorWidget); @@ -182,6 +183,12 @@ export class NotebookEditor extends BaseEditor { await this._widget.setModel(model.notebook, viewState, options); this._widgetDisposableStore.add(this._widget.onDidFocus(() => this._onDidFocusWidget.fire())); + + if (this.editorGroupService instanceof EditorPart) { + this._widgetDisposableStore.add(this.editorGroupService.createEditorDropTarget(this._widget.getDomNode(), { + groupContainsPredicate: (group) => this.group?.id === group.group.id + })); + } } clearInput(): void {