From b1ab681571efe36f38a4ad7850bd0efb324c70e4 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 9 Dec 2019 12:52:18 +1000 Subject: [PATCH] preserve contextual formatting when wrapping text https://anki.tenderapp.com/discussions/ankidesktop/37385-cloze-is-stripping-formatting-enlarging-text any formatting inside the selection is removed, but formatting that starts and ends outside the selection will be preserved --- web/editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/editor.js b/web/editor.js index af5a24e7f..f5a68e2f2 100644 --- a/web/editor.js +++ b/web/editor.js @@ -276,8 +276,8 @@ function wrap(front, back) { var content = r.cloneContents(); var span = document.createElement("span"); span.appendChild(content); - var new_ = wrappedExceptForWhitespace(span.innerHTML, front, back); - setFormat("inserthtml", new_); + var new_ = wrappedExceptForWhitespace(span.innerText, front, back); + setFormat("inserttext", new_); if (!span.innerHTML) { // run with an empty selection; move cursor back past postfix r = s.getRangeAt(0);