From 8503ab29ab26dc9aa7f6906e062bd8252a3160ab Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 31 Jul 2017 13:22:35 +1000 Subject: [PATCH] fix literal '\n' being inserted into card --- web/editor.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/editor.js b/web/editor.js index 19541521d..bb393e8b8 100644 --- a/web/editor.js +++ b/web/editor.js @@ -42,7 +42,7 @@ function onKey() { function insertNewline() { if (!inPreEnvironment()) { - setFormat("insertText", "\\n"); + setFormat("insertText", "\n"); return; } @@ -59,9 +59,9 @@ function insertNewline() { } var oldHeight = currentField.clientHeight; - setFormat("inserthtml", "\\n"); + setFormat("inserthtml", "\n"); if (currentField.clientHeight === oldHeight) { - setFormat("inserthtml", "\\n"); + setFormat("inserthtml", "\n"); } } @@ -326,13 +326,13 @@ function isInlineElement(n) { function convertDivToNewline(node, isParagraph) { var html = node.innerHTML; if (isInlineElement(node.previousSibling) && html) { - html = "\\n" + html; + html = "\n" + html; } if (isInlineElement(node.nextSibling)) { - html += "\\n"; + html += "\n"; } if (isParagraph) { - html += "\\n"; + html += "\n"; } node.outerHTML = html; } @@ -342,7 +342,7 @@ var filterNode = function (node) { if (node.nodeType === 3) { if (prewrapMode) { // collapse standard whitespace - var val = node.nodeValue.replace(/^[ \\r\\n\\t]+$/g, " "); + var val = node.nodeValue.replace(/^[ \r\n\t]+$/g, " "); // non-breaking spaces can be represented as normal spaces val = val.replace(/ |\u00a0/g, " "); @@ -376,7 +376,7 @@ var filterNode = function (node) { node.outerHTML = node.innerHTML; } } else if (prewrapMode && node.tagName === "BR") { - node.outerHTML = "\\n"; + node.outerHTML = "\n"; } else if (prewrapMode && node.tagName === "DIV") { convertBlockToNewline(node, false); } else if (prewrapMode && node.tagName === "P") {