preserve newlines and indents when pasting text
https://anki.tenderapp.com/discussions/ankidesktop/24123-paragraphsnew-lines-not-preserved-when-copypasting-into-anki
This commit is contained in:
parent
14597bd888
commit
7ecd889d8f
@ -310,8 +310,6 @@ var filterHTML = function(html) {
|
||||
var top = $.parseHTML("<ankitop>" + html + "</ankitop>")[0];
|
||||
filterNode(top);
|
||||
var outHtml = top.innerHTML;
|
||||
// get rid of nbsp
|
||||
outHtml = outHtml.replace(/ /ig, " ");
|
||||
//console.log(`input html: ${html}`);
|
||||
//console.log(`outpt html: ${outHtml}`);
|
||||
return outHtml;
|
||||
@ -1124,7 +1122,10 @@ class EditorWebView(AnkiWebView):
|
||||
return self.editor.urlToLink(txt)
|
||||
|
||||
# normal text; convert it to HTML
|
||||
return html.escape(txt)
|
||||
txt = html.escape(txt)
|
||||
txt = txt.replace("\n", "<br>")
|
||||
txt = txt.replace(" ", " ")
|
||||
return txt
|
||||
|
||||
def _processHtml(self, mime):
|
||||
if not mime.hasHtml():
|
||||
|
Loading…
Reference in New Issue
Block a user