mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Remove <br> from empty fields.
This commit is contained in:
parent
2a539cda1b
commit
4ca2220117
3 changed files with 3 additions and 14 deletions
|
@ -254,7 +254,6 @@ class Editor:
|
|||
return
|
||||
txt = urllib.parse.unquote(txt)
|
||||
txt = unicodedata.normalize("NFC", txt)
|
||||
txt = self.mungeHTML(txt)
|
||||
# misbehaving apps may include a null byte in the text
|
||||
txt = txt.replace("\x00", "")
|
||||
# reverse the url quoting we added to get images to display
|
||||
|
@ -286,10 +285,6 @@ class Editor:
|
|||
else:
|
||||
print("uncaught cmd", cmd)
|
||||
|
||||
def mungeHTML(self, txt):
|
||||
txt = re.sub(r"<br>$", "", txt)
|
||||
return txt
|
||||
|
||||
# Setting/unsetting the current note
|
||||
######################################################################
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
padding: 5px;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.field:empty:before {
|
||||
content: "\00a0"; /* nbsp */
|
||||
}
|
||||
.clearfix:after {
|
||||
content: "";
|
||||
display: table;
|
||||
|
|
|
@ -87,11 +87,6 @@ function inPreEnvironment() {
|
|||
}
|
||||
|
||||
function onInput() {
|
||||
// empty field?
|
||||
if (currentField.innerHTML === "") {
|
||||
currentField.innerHTML = "<br>";
|
||||
}
|
||||
|
||||
// make sure IME changes get saved
|
||||
triggerKeyTimer();
|
||||
}
|
||||
|
@ -292,9 +287,6 @@ function setFields(fields) {
|
|||
for (var i = 0; i < fields.length; i++) {
|
||||
var n = fields[i][0];
|
||||
var f = fields[i][1];
|
||||
if (!f) {
|
||||
f = "<br>";
|
||||
}
|
||||
txt += "<tr><td class=fname>{0}</td></tr><tr><td width=100%>".format(n);
|
||||
txt += "<div id=f{0} onkeydown='onKey();' oninput='onInput()' onmouseup='onKey();'".format(i);
|
||||
txt += " onfocus='onFocus(this);' onblur='onBlur();' class='field clearfix' ";
|
||||
|
|
Loading…
Reference in a new issue