mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
work around collapsing fields bug
This commit is contained in:
parent
0c23ee41bf
commit
04f32a7484
1 changed files with 12 additions and 3 deletions
|
@ -29,6 +29,7 @@ _html = """
|
||||||
.field {
|
.field {
|
||||||
border: 1px solid #aaa; background:#fff; color:#000; padding: 5px;
|
border: 1px solid #aaa; background:#fff; color:#000; padding: 5px;
|
||||||
}
|
}
|
||||||
|
/* prevent floated images from being displayed outside field */
|
||||||
.field:after {
|
.field:after {
|
||||||
content: ".";
|
content: ".";
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -64,9 +65,17 @@ function onKey() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clearChangeTimer();
|
clearChangeTimer();
|
||||||
changeTimer = setTimeout(function () {
|
if (currentField.innerHTML == "<div><br></div>") {
|
||||||
sendState();
|
// fix empty div bug. slight flicker, but must be done in a timer
|
||||||
saveField("key"); }, 600);
|
changeTimer = setTimeout(function () {
|
||||||
|
currentField.innerHTML = "<br>";
|
||||||
|
sendState();
|
||||||
|
saveField("key"); }, 1);
|
||||||
|
} else {
|
||||||
|
changeTimer = setTimeout(function () {
|
||||||
|
sendState();
|
||||||
|
saveField("key"); }, 600);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function sendState() {
|
function sendState() {
|
||||||
|
|
Loading…
Reference in a new issue