From 7220c526366fc3abaea5fa692dc0aed690cc3f89 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Thu, 8 Aug 2024 12:58:41 +1000 Subject: [PATCH] Ensure deleted cell in nb diff view is readonly --- .../contrib/notebook/browser/diff/diffComponents.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts b/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts index 506524d445b..3ac0898469f 100644 --- a/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts +++ b/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts @@ -773,7 +773,7 @@ abstract class SingleSideDiffElement extends AbstractElementRenderer { override readonly cell: SingleSideDiffElementViewModel; override readonly templateData: CellDiffSingleSideRenderTemplate; abstract get nestedCellViewModel(): DiffNestedCellViewModel; - abstract get isEditable(): boolean; + abstract get readonly(): boolean; constructor( notebookEditor: INotebookTextDiffEditor, cell: SingleSideDiffElementViewModel, @@ -915,9 +915,7 @@ abstract class SingleSideDiffElement extends AbstractElementRenderer { height: editorHeight } ); - if (this.isEditable) { - this._editor.updateOptions({ readOnly: false }); - } + this._editor.updateOptions({ readOnly: this.readonly }); this.cell.editorHeight = editorHeight; this._register(this._editor.onDidContentSizeChange((e) => { @@ -1092,7 +1090,7 @@ export class DeletedElement extends SingleSideDiffElement { get nestedCellViewModel() { return this.cell.original!; } - get isEditable() { + get readonly() { return true; } @@ -1222,8 +1220,8 @@ export class InsertElement extends SingleSideDiffElement { get nestedCellViewModel() { return this.cell.modified!; } - get isEditable() { - return true; + get readonly() { + return false; } styleContainer(container: HTMLElement): void {