From 3b81dd8d48797b9d9caf20ff3a089df90008b0d2 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Fri, 11 Nov 2022 14:47:08 -0800 Subject: CSS Highlight fallback. (#166156) --- .../contrib/notebook/browser/contrib/find/findFilters.ts | 6 ++++-- .../browser/contrib/find/notebookFindReplaceWidget.ts | 2 +- .../notebook/browser/view/renderers/backLayerWebView.ts | 14 +++++++++----- .../contrib/webview/browser/pre/index-no-csp.html | 6 ------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.ts b/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.ts index f4ab978a823..f14ee0b70e2 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.ts @@ -26,7 +26,8 @@ export class NotebookFindFilters extends Disposable { set markupInput(value: boolean) { if (this._markupInput !== value) { this._markupInput = value; - this._onDidChange.fire({ markupInput: value }); + this._markupPreview = !value; + this._onDidChange.fire({ markupInput: value, markupPreview: this._markupPreview }); } } @@ -39,7 +40,8 @@ export class NotebookFindFilters extends Disposable { set markupPreview(value: boolean) { if (this._markupPreview !== value) { this._markupPreview = value; - this._onDidChange.fire({ markupPreview: value }); + this._markupInput = !value; + this._onDidChange.fire({ markupPreview: value, markupInput: this._markupInput }); } } private _codeInput: boolean = true; diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts b/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts index 408d739ee69..877498df2b0 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts @@ -81,7 +81,7 @@ class NotebookFindFilterActionViewItem extends DropdownMenuActionViewItem { const markdownInput: IAction = { checked: this.filters.markupInput, class: undefined, - enabled: !this.filters.markupPreview, + enabled: true, id: 'findInMarkdownInput', label: NOTEBOOK_FIND_IN_MARKUP_INPUT, run: async () => { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts index 9fc80f70589..64eaad44d7f 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -8,7 +8,6 @@ import { coalesce } from 'vs/base/common/arrays'; import { DeferredPromise } from 'vs/base/common/async'; import { decodeBase64 } from 'vs/base/common/buffer'; import { Emitter, Event } from 'vs/base/common/event'; -import { Disposable } from 'vs/base/common/lifecycle'; import { getExtensionForMimeType } from 'vs/base/common/mime'; import { FileAccess, Schemas } from 'vs/base/common/network'; import { equals } from 'vs/base/common/objects'; @@ -29,6 +28,8 @@ import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IFileService } from 'vs/platform/files/common/files'; import { IOpenerService, matchesScheme, matchesSomeScheme } from 'vs/platform/opener/common/opener'; import { IStorageService } from 'vs/platform/storage/common/storage'; +import { editorFindMatch, editorFindMatchHighlight } from 'vs/platform/theme/common/colorRegistry'; +import { IThemeService, Themable } from 'vs/platform/theme/common/themeService'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust'; import { asWebviewUri, webviewGenericCspSource } from 'vs/workbench/common/webview'; @@ -98,7 +99,7 @@ interface BacklayerWebviewOptions { readonly outputLineHeight: number; } -export class BackLayerWebView extends Disposable { +export class BackLayerWebView extends Themable { private static _originStore?: WebviewOriginStore; @@ -149,8 +150,9 @@ export class BackLayerWebView extends Disposable { @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, @IStorageService private readonly storageService: IStorageService, + @IThemeService themeService: IThemeService, ) { - super(); + super(themeService); this.element = document.createElement('div'); @@ -247,6 +249,8 @@ export class BackLayerWebView extends Disposable { this.nonce); const enableCsp = this.configurationService.getValue('notebook.experimental.enableCsp'); + const findHighlight = this.getColor(editorFindMatch); + const currentMatchHighlight = this.getColor(editorFindMatchHighlight); return /* html */` @@ -264,11 +268,11 @@ export class BackLayerWebView extends Disposable { ">` : ''}