From 4a2f39e8f4872bc276f67c236dda708b032695b2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 16 Apr 2019 18:58:59 +1000 Subject: [PATCH] Revert "Remove
from empty fields." This reverts commit 4ca22201170bddcab6c24ce0f93d52ac7efff2ab. The above commit caused a regression with RTL text: https://anki.tenderapp.com/discussions/ankidesktop/33592-bugs-in-add-box --- web/editor.css | 4 +--- web/editor.js | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/web/editor.css b/web/editor.css index e4fd79078..b1f7bea27 100644 --- a/web/editor.css +++ b/web/editor.css @@ -8,9 +8,7 @@ padding: 5px; overflow-wrap: break-word; } -.field:empty:before { - content: "\00a0"; /* nbsp */ -} + .clearfix:after { content: ""; display: table; diff --git a/web/editor.js b/web/editor.js index d858545e4..fcdcfbd43 100644 --- a/web/editor.js +++ b/web/editor.js @@ -91,6 +91,11 @@ function inPreEnvironment() { } function onInput() { + // empty field? + if (currentField.innerHTML === "") { + currentField.innerHTML = "
"; + } + // make sure IME changes get saved triggerKeyTimer(); } @@ -293,6 +298,9 @@ function setFields(fields) { for (var i = 0; i < fields.length; i++) { var n = fields[i][0]; var f = fields[i][1]; + if (!f) { + f = "
"; + } txt += "{0}".format(n); txt += "