From 08d37a85a3fa415a67783ce339c548159d460ef0 Mon Sep 17 00:00:00 2001 From: rebornix Date: Sat, 24 Apr 2021 12:40:22 -0700 Subject: [PATCH] turn markdown cell into preview mode after hiding find. --- .../contrib/notebook/browser/contrib/find/findController.ts | 6 ++++++ .../workbench/contrib/notebook/browser/notebookBrowser.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/find/findController.ts b/src/vs/workbench/contrib/notebook/browser/contrib/find/findController.ts index aa472c03371..bf46cd65ad3 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/find/findController.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/find/findController.ts @@ -362,6 +362,12 @@ export class NotebookFindWidget extends SimpleFindReplaceWidget implements INote this._previousFocusElement.focus(); this._previousFocusElement = undefined; } + + this._notebookEditor.viewModel?.viewCells.forEach(cell => { + if (cell.getEditState() === CellEditState.Editing && cell.editStateSource === 'find') { + cell.updateEditState(CellEditState.Preview, 'find'); + } + }); } override _updateMatchesCount(): void { diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index e1649746a78..01ea269fc93 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -247,6 +247,7 @@ export interface ICellViewModel extends IGenericCellViewModel { readonly layoutInfo: { totalHeight: number; }; readonly onDidChangeLayout: Event<{ totalHeight?: boolean | number; outerWidth?: number; }>; readonly onDidChangeCellStatusBarItems: Event; + readonly editStateSource: string; dragging: boolean; handle: number; uri: URI;