fix read mode search

This commit is contained in:
Le Tan 2022-08-27 21:40:15 +08:00
parent 6de3663269
commit 73ebcaeb90
4 changed files with 246 additions and 234 deletions

View File

@ -6,236 +6,240 @@ https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javasc
* @author Lea Verou * @author Lea Verou
*/ */
code[class*="language-"], code[class*="language-"],
pre[class*="language-"] { pre[class*="language-"] {
color: #525252; color: black;
background: none; background: none;
text-shadow: 0 1px white; font-size: 1em;
font-size: 0.9rem; text-align: left;
text-align: left; white-space: pre;
white-space: pre; word-spacing: normal;
word-spacing: normal; word-break: normal;
word-break: normal; word-wrap: normal;
word-wrap: normal; line-height: 1.5;
line-height: 1.5;
-moz-tab-size: 4;
-moz-tab-size: 4; -o-tab-size: 4;
-o-tab-size: 4; tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-webkit-hyphens: none; -moz-hyphens: none;
-moz-hyphens: none; -ms-hyphens: none;
-ms-hyphens: none; hyphens: none;
hyphens: none; }
}
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { text-shadow: none;
text-shadow: none; background-color: #1976d2;
background-color: #1976D2; color: #ffffff;
color: white; }
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
pre[class*="language-"]::selection, pre[class*="language-"] ::selection, code[class*="language-"]::selection, code[class*="language-"] ::selection {
code[class*="language-"]::selection, code[class*="language-"] ::selection { text-shadow: none;
text-shadow: none; background-color: #1976d2;
background-color: #1976D2; color: #ffffff;
color: white; }
}
@media print {
@media print { code[class*="language-"],
code[class*="language-"], pre[class*="language-"] {
pre[class*="language-"] { text-shadow: none;
text-shadow: none; }
} }
}
/* Code blocks */
/* Code blocks */ pre[class*="language-"] {
pre[class*="language-"] { padding: 1em;
padding: 1em; margin: .5em 0;
margin: 0; overflow: auto;
overflow: auto; }
border-radius: 4px;
} :not(pre) > code[class*="language-"],
pre[class*="language-"] {
:not(pre) > code[class*="language-"], background: #ede8e4;
pre[class*="language-"] { }
background:#F8F8F8 !important;
} /* Inline code */
:not(pre) > code[class*="language-"] {
/* Inline code */ padding: .1em;
:not(pre) > code[class*="language-"] { border-radius: .3em;
padding: .1em; white-space: normal;
border-radius: .3em; }
white-space: normal;
} .token.comment,
.token.prolog,
.token.comment, .token.doctype,
.token.prolog, .token.cdata {
.token.doctype, color: slategray;
.token.cdata { }
color: #a50;
} .token.punctuation {
color: #999;
.token.punctuation { }
color: #999;
} .token.namespace {
opacity: .7;
.token.namespace { }
opacity: .7;
} .token.property,
.token.tag,
.token.property, .token.boolean,
.token.tag, .token.number,
.token.boolean, .token.constant,
.token.number, .token.symbol,
.token.constant, .token.deleted {
.token.symbol, color: #905;
.token.deleted { }
color: #905;
} .token.selector,
.token.attr-name,
.token.selector, .token.string,
.token.attr-name, .token.char,
.token.string, .token.builtin,
.token.char, .token.inserted {
.token.builtin, color: #690;
.token.inserted { }
color: #690;
} .token.operator,
.token.entity,
.token.operator, .token.url,
.token.entity, .language-css .token.string,
.token.url, .style .token.string {
.language-css .token.string, color: #9a6e3a;
.style .token.string { }
color: #9a6e3a;
/* This background color was intended by the author of this theme. */ .token.atrule,
background: hsla(0, 0%, 100%, .5); .token.attr-value,
} .token.keyword {
color: #07a;
.token.atrule, }
.token.attr-value,
.token.keyword { .token.function,
color: #708; .token.class-name {
} color: #DD4A68;
}
.token.function,
.token.class-name { .token.regex,
color: #DD4A68; .token.important,
} .token.variable {
color: #e90;
.token.regex, }
.token.important,
.token.variable { .token.important,
color: #e90; .token.bold {
} font-weight: bold;
}
.token.important, .token.italic {
.token.bold { font-style: italic;
font-weight: bold; }
}
.token.italic { .token.entity {
font-style: italic; cursor: help;
} }
.token.entity { pre[class*="language-"].line-numbers {
cursor: help; position: relative;
} padding-left: 3.8em;
counter-reset: linenumber;
pre[class*="language-"].line-numbers { }
position: relative;
padding-left: 3.8em; pre[class*="language-"].line-numbers > code {
counter-reset: linenumber; position: relative;
} white-space: inherit;
}
pre[class*="language-"].line-numbers > code {
position: relative; .line-numbers .line-numbers-rows {
white-space: inherit; position: absolute;
letter-spacing: 1px; pointer-events: none;
} top: 0;
font-size: 100%;
.line-numbers .line-numbers-rows { left: -3.8em;
position: absolute; width: 3em; /* works for line-numbers below 1000 lines */
pointer-events: none; letter-spacing: -1px;
top: 0; border-right: 1px solid #999;
font-size: 100%;
left: -3.8em; -webkit-user-select: none;
width: 3em; /* works for line-numbers below 1000 lines */ -moz-user-select: none;
letter-spacing: -1px; -ms-user-select: none;
border-right: 1px solid #ddd; user-select: none;
color: #999;
-webkit-user-select: none; }
-moz-user-select: none;
-ms-user-select: none; .line-numbers-rows > span {
user-select: none; display: block;
counter-increment: linenumber;
} }
.line-numbers-rows > span { .line-numbers-rows > span:before {
display: block; content: counter(linenumber);
counter-increment: linenumber; color: #999;
} display: block;
padding-right: 0.8em;
.line-numbers-rows > span:before { text-align: right;
content: counter(linenumber); }
color: #999;
display: block; div.code-toolbar {
padding-right: 0.8em; position: relative;
text-align: right; }
}
div.code-toolbar > .toolbar {
div.code-toolbar { position: absolute;
position: relative; top: .3em;
} right: .2em;
transition: opacity 0.3s ease-in-out;
div.code-toolbar > .toolbar { opacity: 0;
position: absolute; }
top: 0;
right: 0; div.code-toolbar:hover > .toolbar {
transition: opacity 0.3s ease-in-out; opacity: 1;
opacity: 0; }
}
/* Separate line b/c rules are thrown out if selector is invalid.
div.code-toolbar:hover > .toolbar { IE11 and old Edge versions don't support :focus-within. */
opacity: 1; div.code-toolbar:focus-within > .toolbar {
} opacity: 1;
}
/* Separate line b/c rules are thrown out if selector is invalid.
IE11 and old Edge versions don't support :focus-within. */ div.code-toolbar > .toolbar .toolbar-item {
div.code-toolbar:focus-within > .toolbar { display: inline-block;
opacity: 1; }
}
div.code-toolbar > .toolbar a {
div.code-toolbar > .toolbar .toolbar-item { cursor: pointer;
display: inline-block; }
}
div.code-toolbar > .toolbar button {
div.code-toolbar > .toolbar a { background: none;
cursor: pointer; border: 0;
} color: inherit;
font: inherit;
div.code-toolbar > .toolbar button { line-height: normal;
background: none; overflow: visible;
border: 0; padding: 0;
color: inherit; -webkit-user-select: none; /* for button */
font: inherit; -moz-user-select: none;
line-height: normal; -ms-user-select: none;
overflow: visible; }
padding: 0;
-webkit-user-select: none; /* for button */ div.code-toolbar > .toolbar a,
-moz-user-select: none; div.code-toolbar > .toolbar button,
-ms-user-select: none; div.code-toolbar > .toolbar span {
} color: #bbb;
font-size: .8em;
div.code-toolbar > .toolbar a, padding: 0 .5em;
div.code-toolbar > .toolbar button, background: rgba(224, 224, 224, 0.2);
div.code-toolbar > .toolbar span { box-shadow: 0 2px 0 0 rgba(0,0,0,0.2);
color: #fff; border-radius: .5em;
font-size: .8em; }
font-weight: bold;
padding: .2em .5em; div.code-toolbar > .toolbar a:hover,
border-radius: 0 4px 0 4px; div.code-toolbar > .toolbar a:focus,
background-color: #5C9DFF; div.code-toolbar > .toolbar button:hover,
} div.code-toolbar > .toolbar button:focus,
div.code-toolbar > .toolbar span:hover,
div.code-toolbar > .toolbar span:focus {
color: inherit;
text-decoration: none;
}

View File

@ -642,6 +642,7 @@
} }
}, },
"hover" : { "hover" : {
"fg" : "@widgets#mainwindow#side_bar#fg",
"bg" : "@palette#layer3" "bg" : "@palette#layer3"
}, },
"widget" : { "widget" : {

View File

@ -81,7 +81,9 @@ class MarkJs {
'caseSensitive': p_options.caseSensitive, 'caseSensitive': p_options.caseSensitive,
'accuracy': p_options.wholeWordOnly ? 'exactly' : 'partially', 'accuracy': p_options.wholeWordOnly ? 'exactly' : 'partially',
// Ignore SVG, or SVG will be corrupted. // Ignore SVG, or SVG will be corrupted.
'exclude': ['svg *'] 'exclude': ['svg *'],
'separateWordSearch': false,
'acrossElements': true
} }
return opt; return opt;
} }

View File

@ -72,6 +72,11 @@ int main(int argc, char *argv[])
} }
#endif #endif
#if defined(Q_OS_LINUX)
// Disable sandbox on Linux.
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox");
#endif
Application app(argc, argv); Application app(argc, argv);
initWebEngineSettings(); initWebEngineSettings();