Remove <br> from empty fields.

This commit is contained in:
David Lönnhager 2019-01-19 19:36:55 +01:00
parent 2a539cda1b
commit 4ca2220117
3 changed files with 3 additions and 14 deletions

View file

@ -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
######################################################################

View file

@ -5,7 +5,9 @@
padding: 5px;
overflow-wrap: break-word;
}
.field:empty:before {
content: "\00a0"; /* nbsp */
}
.clearfix:after {
content: "";
display: table;

View file

@ -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' ";