Skip to content

Commit 1d1919a

Browse files
authored
Derive enableDropIntoEditor from editorConfiguration.readOnly (microsoft#151777)
Fixes microsoft#151704
1 parent 82902cd commit 1d1919a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
596596
}
597597

598598
protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: Readonly<IEditorConstructionOptions>, editorWidgetOptions: ICodeEditorWidgetOptions): CodeEditorWidget {
599-
return instantiationService.createInstance(CodeEditorWidget, container, { enableDropIntoEditor: true, ...options }, editorWidgetOptions);
599+
return instantiationService.createInstance(CodeEditorWidget, container, options, editorWidgetOptions);
600600
}
601601

602602
public override dispose(): void {
@@ -1113,6 +1113,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
11131113
result.ariaLabel = options.originalAriaLabel;
11141114
}
11151115
result.readOnly = !this._options.originalEditable;
1116+
result.enableDropIntoEditor = !result.readOnly;
11161117
result.extraEditorClassName = 'original-in-monaco-diff-editor';
11171118
return {
11181119
...result,

src/vs/workbench/browser/parts/editor/textEditor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ export abstract class BaseTextEditor<T extends IEditorViewState> extends Abstrac
107107
const editorConfiguration: ICodeEditorOptions = isObject(configuration.editor) ? deepClone(configuration.editor) : Object.create(null);
108108
Object.assign(editorConfiguration, this.getConfigurationOverrides());
109109

110+
editorConfiguration.enableDropIntoEditor = !editorConfiguration.readOnly;
111+
110112
// ARIA label
111113
editorConfiguration.ariaLabel = this.computeAriaLabel();
112114

@@ -179,7 +181,7 @@ export abstract class BaseTextEditor<T extends IEditorViewState> extends Abstrac
179181
protected createEditorControl(parent: HTMLElement, configuration: ICodeEditorOptions): IEditor {
180182

181183
// Use a getter for the instantiation service since some subclasses might use scoped instantiation services
182-
return this.instantiationService.createInstance(CodeEditorWidget, parent, { enableDropIntoEditor: true, ...configuration }, {});
184+
return this.instantiationService.createInstance(CodeEditorWidget, parent, configuration, {});
183185
}
184186

185187
override async setInput(input: EditorInput, options: ITextEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {

0 commit comments

Comments
 (0)