Fix wrong syntax color highlight in "Trusted sites" pane

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2521
This commit is contained in:
Raymond Hill 2023-03-02 20:50:32 -05:00
parent cc979c900f
commit a60a5c2772
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
6 changed files with 22 additions and 24 deletions

View File

@ -33,7 +33,7 @@
<button id="exportUserFiltersToFile" class="iconified" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="1pExport">_</span><span class="hover"></span></button> <button id="exportUserFiltersToFile" class="iconified" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="1pExport">_</span><span class="hover"></span></button>
</p> </p>
</div> </div>
<div id="userFilters" class="codeMirrorContainer codeMirrorBreakAll codeMirrorFilters" spellcheck="false"></div> <div id="userFilters" class="codeMirrorContainer codeMirrorBreakAll cm-theme-override" spellcheck="false"></div>
<div class="hidden"> <div class="hidden">
<input id="importFilePicker" type="file" accept="text/plain"> <input id="importFilePicker" type="file" accept="text/plain">
</div> </div>

View File

@ -23,7 +23,7 @@
<button id="subscribeButton" type="button" data-i18n="subscribeButton">_<span class="hover"></span></button> <button id="subscribeButton" type="button" data-i18n="subscribeButton">_<span class="hover"></span></button>
</section> </section>
<div id="content" class="codeMirrorContainer codeMirrorBreakAll codeMirrorFilters"></div> <div id="content" class="codeMirrorContainer codeMirrorBreakAll cm-theme-override"></div>
<script src="lib/codemirror/lib/codemirror.js"></script> <script src="lib/codemirror/lib/codemirror.js"></script>
<script src="lib/codemirror/addon/display/panel.js"></script> <script src="lib/codemirror/addon/display/panel.js"></script>

View File

@ -68,67 +68,67 @@
word-break: break-all; word-break: break-all;
} }
.codeMirrorFilters .cm-s-default .cm-comment { .cm-theme-override .cm-s-default .cm-comment {
color: var(--sf-comment-ink); color: var(--sf-comment-ink);
} }
.codeMirrorFilters .cm-s-default .cm-def { .cm-theme-override .cm-s-default .cm-def {
color: var(--sf-def-ink); color: var(--sf-def-ink);
} }
.codeMirrorFilters .cm-s-default .cm-directive { .cm-theme-override .cm-s-default .cm-directive {
color: var(--sf-directive-ink); color: var(--sf-directive-ink);
font-weight: bold; font-weight: bold;
} }
.codeMirrorFilters .cm-s-default .cm-error { .cm-theme-override .cm-s-default .cm-error {
color: inherit; color: inherit;
} }
.codeMirrorFilters .cm-s-default .cm-error, .cm-theme-override .cm-s-default .cm-error,
.CodeMirror-linebackground.error { .CodeMirror-linebackground.error {
background-color: var(--sf-error-surface); background-color: var(--sf-error-surface);
text-decoration: underline var(--sf-error-ink); text-decoration: underline var(--sf-error-ink);
text-underline-position: under; text-underline-position: under;
} }
.codeMirrorFilters .cm-s-default .cm-link { .cm-theme-override .cm-s-default .cm-link {
text-decoration: none; text-decoration: none;
} }
.codeMirrorFilters .cm-s-default .cm-link:hover { .cm-theme-override .cm-s-default .cm-link:hover {
color: var(--link-ink); color: var(--link-ink);
} }
.codeMirrorFilters .cm-s-default .cm-keyword { .cm-theme-override .cm-s-default .cm-keyword {
color: var(--sf-keyword-ink); color: var(--sf-keyword-ink);
} }
.codeMirrorFilters .cm-s-default .cm-negative { .cm-theme-override .cm-s-default .cm-negative {
color: var(--cm-negative); color: var(--cm-negative);
} }
.codeMirrorFilters .cm-s-default .cm-positive { .cm-theme-override .cm-s-default .cm-positive {
color: var(--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-underline-position: under;
text-decoration-color: var(--sf-notice-ink); text-decoration-color: var(--sf-notice-ink);
text-decoration-style: solid; text-decoration-style: solid;
text-decoration-line: underline; text-decoration-line: underline;
} }
.codeMirrorFilters .cm-s-default .cm-unicode { .cm-theme-override .cm-s-default .cm-unicode {
text-underline-position: under; text-underline-position: under;
text-decoration-color: var(--sf-unicode-ink); text-decoration-color: var(--sf-unicode-ink);
text-decoration-style: dashed; text-decoration-style: dashed;
text-decoration-line: underline; text-decoration-line: underline;
} }
.codeMirrorFilters .cm-s-default .cm-tag { .cm-theme-override .cm-s-default .cm-tag {
color: var(--sf-tag-ink); color: var(--sf-tag-ink);
} }
.codeMirrorFilters .cm-s-default .cm-value { .cm-theme-override .cm-s-default .cm-value {
color: var(--sf-value-ink); color: var(--sf-value-ink);
} }
.codeMirrorFilters .cm-s-default .cm-variable { .cm-theme-override .cm-s-default .cm-variable {
color: var(--sf-variable-ink); 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); background-color: var(--sf-warning-surface);
text-decoration: underline var(--sf-warning-ink); text-decoration: underline var(--sf-warning-ink);
text-underline-position: under; text-underline-position: under;
} }
.codeMirrorFilters .cm-s-default .cm-readonly { .cm-theme-override .cm-s-default .cm-readonly {
color: var(--sf-readonly-ink); color: var(--sf-readonly-ink);
} }

View File

@ -50,9 +50,7 @@ CodeMirror.defineMode("ubo-whitelist-directives", function() {
return null; return null;
} }
if ( reComment.test(line) ) { if ( reComment.test(line) ) {
return whitelistDefaultSet.has(directiveFromLine(line)) return 'comment';
? 'keyword comment'
: 'comment';
} }
if ( line.indexOf('/') === -1 ) { if ( line.indexOf('/') === -1 ) {
if ( reBadHostname.test(line) ) { return 'error'; } if ( reBadHostname.test(line) ) { return 'error'; }

View File

@ -18,7 +18,7 @@
<aside> <aside>
<section> <section>
<div> <div>
<div class="codeMirrorContainer codeMirrorBreakAll codeMirrorFilters"></div> <div class="codeMirrorContainer codeMirrorBreakAll cm-theme-override"></div>
<div class="resultsetWidgets"> <div class="resultsetWidgets">
<span id="resultsetModifiers"> <span id="resultsetModifiers">
<span id="resultsetDepth" class="resultsetModifier"> <span id="resultsetDepth" class="resultsetModifier">

View File

@ -32,7 +32,7 @@
<button id="exportWhitelistToFile" class="iconified" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="whitelistExport">_</span><span class="hover"></span></button> <button id="exportWhitelistToFile" class="iconified" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="whitelistExport">_</span><span class="hover"></span></button>
</p> </p>
</div> </div>
<div id="whitelist" class="codeMirrorContainer"></div> <div id="whitelist" class="codeMirrorContainer cm-theme-override"></div>
<div class="hidden"> <div class="hidden">
<input id="importFilePicker" type="file" accept="text/plain"> <input id="importFilePicker" type="file" accept="text/plain">