From a60a5c277227415b3a39b484d60f65220cc207e2 Mon Sep 17 00:00:00 2001
From: Raymond Hill
Date: Thu, 2 Mar 2023 20:50:32 -0500
Subject: [PATCH] Fix wrong syntax color highlight in "Trusted sites" pane
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2521
---
src/1p-filters.html | 2 +-
src/asset-viewer.html | 2 +-
src/css/codemirror.css | 34 ++++++++++----------
src/js/whitelist.js | 4 +--
src/web_accessible_resources/epicker-ui.html | 2 +-
src/whitelist.html | 2 +-
6 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/src/1p-filters.html b/src/1p-filters.html
index 2fae16182..f3479e41f 100644
--- a/src/1p-filters.html
+++ b/src/1p-filters.html
@@ -33,7 +33,7 @@
-
+
diff --git a/src/asset-viewer.html b/src/asset-viewer.html
index 2f2d92f81..d2ff422fd 100644
--- a/src/asset-viewer.html
+++ b/src/asset-viewer.html
@@ -23,7 +23,7 @@
-
+
diff --git a/src/css/codemirror.css b/src/css/codemirror.css
index ead8a5d9b..ed6c51254 100644
--- a/src/css/codemirror.css
+++ b/src/css/codemirror.css
@@ -68,67 +68,67 @@
word-break: break-all;
}
-.codeMirrorFilters .cm-s-default .cm-comment {
+.cm-theme-override .cm-s-default .cm-comment {
color: var(--sf-comment-ink);
}
-.codeMirrorFilters .cm-s-default .cm-def {
+.cm-theme-override .cm-s-default .cm-def {
color: var(--sf-def-ink);
}
-.codeMirrorFilters .cm-s-default .cm-directive {
+.cm-theme-override .cm-s-default .cm-directive {
color: var(--sf-directive-ink);
font-weight: bold;
}
-.codeMirrorFilters .cm-s-default .cm-error {
+.cm-theme-override .cm-s-default .cm-error {
color: inherit;
}
-.codeMirrorFilters .cm-s-default .cm-error,
+.cm-theme-override .cm-s-default .cm-error,
.CodeMirror-linebackground.error {
background-color: var(--sf-error-surface);
text-decoration: underline var(--sf-error-ink);
text-underline-position: under;
}
-.codeMirrorFilters .cm-s-default .cm-link {
+.cm-theme-override .cm-s-default .cm-link {
text-decoration: none;
}
-.codeMirrorFilters .cm-s-default .cm-link:hover {
+.cm-theme-override .cm-s-default .cm-link:hover {
color: var(--link-ink);
}
-.codeMirrorFilters .cm-s-default .cm-keyword {
+.cm-theme-override .cm-s-default .cm-keyword {
color: var(--sf-keyword-ink);
}
-.codeMirrorFilters .cm-s-default .cm-negative {
+.cm-theme-override .cm-s-default .cm-negative {
color: var(--cm-negative);
}
-.codeMirrorFilters .cm-s-default .cm-positive {
+.cm-theme-override .cm-s-default .cm-positive {
color: var(--cm-positive);
}
-.codeMirrorFilters .cm-s-default .cm-notice {
+.cm-theme-override .cm-s-default .cm-notice {
text-underline-position: under;
text-decoration-color: var(--sf-notice-ink);
text-decoration-style: solid;
text-decoration-line: underline;
}
-.codeMirrorFilters .cm-s-default .cm-unicode {
+.cm-theme-override .cm-s-default .cm-unicode {
text-underline-position: under;
text-decoration-color: var(--sf-unicode-ink);
text-decoration-style: dashed;
text-decoration-line: underline;
}
-.codeMirrorFilters .cm-s-default .cm-tag {
+.cm-theme-override .cm-s-default .cm-tag {
color: var(--sf-tag-ink);
}
-.codeMirrorFilters .cm-s-default .cm-value {
+.cm-theme-override .cm-s-default .cm-value {
color: var(--sf-value-ink);
}
-.codeMirrorFilters .cm-s-default .cm-variable {
+.cm-theme-override .cm-s-default .cm-variable {
color: var(--sf-variable-ink);
}
-.codeMirrorFilters .cm-s-default .cm-warning {
+.cm-theme-override .cm-s-default .cm-warning {
background-color: var(--sf-warning-surface);
text-decoration: underline var(--sf-warning-ink);
text-underline-position: under;
}
-.codeMirrorFilters .cm-s-default .cm-readonly {
+.cm-theme-override .cm-s-default .cm-readonly {
color: var(--sf-readonly-ink);
}
diff --git a/src/js/whitelist.js b/src/js/whitelist.js
index a8a424b69..df2a15236 100644
--- a/src/js/whitelist.js
+++ b/src/js/whitelist.js
@@ -50,9 +50,7 @@ CodeMirror.defineMode("ubo-whitelist-directives", function() {
return null;
}
if ( reComment.test(line) ) {
- return whitelistDefaultSet.has(directiveFromLine(line))
- ? 'keyword comment'
- : 'comment';
+ return 'comment';
}
if ( line.indexOf('/') === -1 ) {
if ( reBadHostname.test(line) ) { return 'error'; }
diff --git a/src/web_accessible_resources/epicker-ui.html b/src/web_accessible_resources/epicker-ui.html
index 8f93a868f..09b22b5ff 100644
--- a/src/web_accessible_resources/epicker-ui.html
+++ b/src/web_accessible_resources/epicker-ui.html
@@ -18,7 +18,7 @@