Skip to content

Commit 3b81dd8

Browse files
authored
CSS Highlight fallback. (microsoft#166156)
1 parent d5a5128 commit 3b81dd8

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export class NotebookFindFilters extends Disposable {
2626
set markupInput(value: boolean) {
2727
if (this._markupInput !== value) {
2828
this._markupInput = value;
29-
this._onDidChange.fire({ markupInput: value });
29+
this._markupPreview = !value;
30+
this._onDidChange.fire({ markupInput: value, markupPreview: this._markupPreview });
3031
}
3132
}
3233

@@ -39,7 +40,8 @@ export class NotebookFindFilters extends Disposable {
3940
set markupPreview(value: boolean) {
4041
if (this._markupPreview !== value) {
4142
this._markupPreview = value;
42-
this._onDidChange.fire({ markupPreview: value });
43+
this._markupInput = !value;
44+
this._onDidChange.fire({ markupPreview: value, markupInput: this._markupInput });
4345
}
4446
}
4547
private _codeInput: boolean = true;

src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class NotebookFindFilterActionViewItem extends DropdownMenuActionViewItem {
8181
const markdownInput: IAction = {
8282
checked: this.filters.markupInput,
8383
class: undefined,
84-
enabled: !this.filters.markupPreview,
84+
enabled: true,
8585
id: 'findInMarkdownInput',
8686
label: NOTEBOOK_FIND_IN_MARKUP_INPUT,
8787
run: async () => {

src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { coalesce } from 'vs/base/common/arrays';
88
import { DeferredPromise } from 'vs/base/common/async';
99
import { decodeBase64 } from 'vs/base/common/buffer';
1010
import { Emitter, Event } from 'vs/base/common/event';
11-
import { Disposable } from 'vs/base/common/lifecycle';
1211
import { getExtensionForMimeType } from 'vs/base/common/mime';
1312
import { FileAccess, Schemas } from 'vs/base/common/network';
1413
import { equals } from 'vs/base/common/objects';
@@ -29,6 +28,8 @@ import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
2928
import { IFileService } from 'vs/platform/files/common/files';
3029
import { IOpenerService, matchesScheme, matchesSomeScheme } from 'vs/platform/opener/common/opener';
3130
import { IStorageService } from 'vs/platform/storage/common/storage';
31+
import { editorFindMatch, editorFindMatchHighlight } from 'vs/platform/theme/common/colorRegistry';
32+
import { IThemeService, Themable } from 'vs/platform/theme/common/themeService';
3233
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
3334
import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust';
3435
import { asWebviewUri, webviewGenericCspSource } from 'vs/workbench/common/webview';
@@ -98,7 +99,7 @@ interface BacklayerWebviewOptions {
9899
readonly outputLineHeight: number;
99100
}
100101

101-
export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
102+
export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
102103

103104
private static _originStore?: WebviewOriginStore;
104105

@@ -149,8 +150,9 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
149150
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
150151
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
151152
@IStorageService private readonly storageService: IStorageService,
153+
@IThemeService themeService: IThemeService,
152154
) {
153-
super();
155+
super(themeService);
154156

155157
this.element = document.createElement('div');
156158

@@ -247,6 +249,8 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
247249
this.nonce);
248250

249251
const enableCsp = this.configurationService.getValue('notebook.experimental.enableCsp');
252+
const findHighlight = this.getColor(editorFindMatch);
253+
const currentMatchHighlight = this.getColor(editorFindMatchHighlight);
250254
return /* html */`
251255
<html lang="en">
252256
<head>
@@ -264,11 +268,11 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
264268
">` : ''}
265269
<style nonce="${this.nonce}">
266270
::highlight(find-highlight) {
267-
background-color: var(--vscode-editor-findMatchHighlightBackground);
271+
background-color: var(--vscode-editor-findMatchBackground, ${findHighlight});
268272
}
269273
270274
::highlight(current-find-highlight) {
271-
background-color: var(--vscode-editor-findMatchBackground);
275+
background-color: var(--vscode-editor-findMatchHighlightBackground, ${currentMatchHighlight});
272276
}
273277
274278
#container .cell_container {

src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,6 @@
164164
}
165165
::-webkit-scrollbar-thumb:active {
166166
background-color: var(--vscode-scrollbarSlider-activeBackground);
167-
}
168-
::highlight(find-highlight) {
169-
background-color: var(--vscode-editor-findMatchHighlightBackground);
170-
}
171-
::highlight(current-find-highlight) {
172-
background-color: var(--vscode-editor-findMatchBackground);
173167
}`;
174168

175169
/**

0 commit comments

Comments
 (0)