work around --text-fg ending up in fields

https://forums.ankiweb.net/t/strange-behaviour-in-the-html-editor/5796/4
This commit is contained in:
Damien Elmes 2020-12-21 17:56:20 +10:00
parent 64173b5c02
commit 256db85577
2 changed files with 6 additions and 1 deletions

View File

@ -4,7 +4,6 @@
.field {
border: 1px solid var(--border);
background: var(--frame-bg);
color: var(--text-fg);
padding: 5px;
overflow-wrap: break-word;
overflow: auto;

View File

@ -343,6 +343,11 @@ function onCutOrCopy() {
function setFields(fields) {
let txt = "";
// webengine will include the variable after enter+backspace
// if we don't convert it to a literal colour
const color = window
.getComputedStyle(document.documentElement)
.getPropertyValue("--text-fg");
for (let i = 0; i < fields.length; i++) {
const n = fields[i][0];
let f = fields[i][1];
@ -369,6 +374,7 @@ function setFields(fields) {
oncut='onCutOrCopy(this);'
contentEditable=true
class=field
style='color: ${color}'
>${f}</div>
</td>
</tr>`;