mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
prevent field from collapsing
This commit is contained in:
parent
9c569ac35c
commit
eddef71f75
1 changed files with 9 additions and 10 deletions
|
@ -86,16 +86,15 @@ function onKey() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clearChangeTimer();
|
clearChangeTimer();
|
||||||
if (currentField.innerHTML == "<div><br></div>") {
|
changeTimer = setTimeout(function () {
|
||||||
// fix empty div bug. slight flicker, but must be done in a timer
|
|
||||||
changeTimer = setTimeout(function () {
|
|
||||||
currentField.innerHTML = "<br>";
|
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
saveField("key"); }, 1);
|
saveField("key");
|
||||||
} else {
|
}, 600);
|
||||||
changeTimer = setTimeout(function () {
|
};
|
||||||
updateButtonState();
|
|
||||||
saveField("key"); }, 600);
|
function checkForEmptyField() {
|
||||||
|
if (currentField.innerHTML == "") {
|
||||||
|
currentField.innerHTML = "<br>";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -240,7 +239,7 @@ function setFields(fields, focusTo) {
|
||||||
f = "<br>";
|
f = "<br>";
|
||||||
}
|
}
|
||||||
txt += "<tr><td class=fname>{0}</td></tr><tr><td width=100%%>".format(n);
|
txt += "<tr><td class=fname>{0}</td></tr><tr><td width=100%%>".format(n);
|
||||||
txt += "<div id=f{0} onkeydown='onKey();' onmouseup='onKey();'".format(i);
|
txt += "<div id=f{0} onkeydown='onKey();' oninput='checkForEmptyField()' onmouseup='onKey();'".format(i);
|
||||||
txt += " onfocus='onFocus(this);' onblur='onBlur();' class=field ";
|
txt += " onfocus='onFocus(this);' onblur='onBlur();' class=field ";
|
||||||
txt += "ondragover='onDragOver(this);' ";
|
txt += "ondragover='onDragOver(this);' ";
|
||||||
txt += "contentEditable=true class=field>{0}</div>".format(f);
|
txt += "contentEditable=true class=field>{0}</div>".format(f);
|
||||||
|
|
Loading…
Reference in a new issue