From d13e68e6cf5a42a3660ab6cacfb20012106227e8 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 24 Mar 2021 12:04:08 -0700 Subject: [PATCH] avoid markdown preview removal when it is disabled. --- .../notebook/browser/notebookEditorWidget.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index c85872e6cb1..aa160df8bfb 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -2075,6 +2075,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor } async unhideMarkdownPreview(cell: MarkdownCellViewModel) { + if (!this.useRenderer) { + // TODO: handle case where custom renderer is disabled? + return; + } + if (!this._webview) { return; } @@ -2087,6 +2092,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor } async hideMarkdownPreview(cell: MarkdownCellViewModel) { + if (!this.useRenderer) { + // TODO: handle case where custom renderer is disabled? + return; + } + if (!this._webview) { return; } @@ -2099,6 +2109,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor } async removeMarkdownPreview(cell: MarkdownCellViewModel) { + if (!this.useRenderer) { + // TODO: handle case where custom renderer is disabled? + return; + } + if (!this._webview) { return; } @@ -2111,6 +2126,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor } async updateMarkdownPreviewSelectionState(cell: ICellViewModel, isSelected: boolean): Promise { + if (!this.useRenderer) { + // TODO: handle case where custom renderer is disabled? + return; + } + if (!this._webview) { return; }