From 55e6183e750b219b650af426b11252ac3c46f1ba Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 7 Jan 2022 15:16:27 +0800 Subject: [PATCH] Roo/htmleditor/TidyWriter.js --- Roo/htmleditor/TidyWriter.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Roo/htmleditor/TidyWriter.js b/Roo/htmleditor/TidyWriter.js index c2a0b04a49..3a46ac4571 100644 --- a/Roo/htmleditor/TidyWriter.js +++ b/Roo/htmleditor/TidyWriter.js @@ -209,6 +209,26 @@ Roo.htmleditor.TidyWriter.prototype = { return; } if (this.in_pre || this.in_inline) { + + if (this.in_inline) { + text = text.replace(/\s/g,' ') // all line breaks to ' ' + .replace(/\s+/,' ') // all white space to single white space + // if next tag is '
', then we can trim right.. + if (node.nextSibling && + node.nextSibling.nodeType == 1 && + node.nextSibling.nodeName == 'BR' ) + { + text = text.replace(/\s+$/g,''); + } + // if previous tag was a BR, we can also trim.. + if (node.previousSibling && + node.previousSibling.nodeType == 1 && + node.previousSibling.nodeName == 'BR' ) + { + text = text.replace(/^\s+/g,''); + } + + } this.html[this.html.length] = text; return; } -- 2.39.2