From 329c6d365a844ff01ad1d3e482306e097373a195 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 17 May 2019 13:40:23 +1000 Subject: [PATCH] remove trailing
tag when pasting https://anki.tenderapp.com/discussions/ankidesktop/33843-anki-2112-adds-br https://anki.tenderapp.com/discussions/ankidesktop/33977-unwanted-automatic-line-break-insertion-after-pasting-into-a-field --- web/editor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/editor.js b/web/editor.js index fcdcfbd43..aaaf68628 100644 --- a/web/editor.js +++ b/web/editor.js @@ -342,7 +342,13 @@ function hideDupes() { var pasteHTML = function (html, internal, extendedMode) { html = filterHTML(html, internal, extendedMode); - setFormat("inserthtml", html); + if (html !== "") { + // remove trailing
in empty field + if (currentField && currentField.innerHTML === "
") { + currentField.innerHTML = ""; + } + setFormat("inserthtml", html); + } }; var filterHTML = function (html, internal, extendedMode) {