summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2017-05-22 10:04:19 +0200
committerNicolas Lempereur <nle@odoo.com>2017-05-22 11:06:50 +0200
commit57f7c681062f07002312e91d79d02b2b1b59d9fe (patch)
tree61c6d22986e24cc4df572190aff35e458ae71e79 /addons/web_editor/static/src/js
parentea4d29351e8d9f0049eaab5e291d0a13d612183a (diff)
[FIX] web_editor: inline space in source code
The prettifying of html when editing sources (user need to be in debug mode to see the button) was removing too much spaces in some instances. For example if someone got in a case such as: <span>hello<b> cruel </b>world!</span> The spaces between text and tag would be removed (this would work fine with the space outside of the tag). This code add a special case so this doesn't happen anymore. opw-743565 closes #17142
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/rte.summernote.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js
index 60c096603d8..4ab1e7bed06 100644
--- a/addons/web_editor/static/src/js/rte.summernote.js
+++ b/addons/web_editor/static/src/js/rte.summernote.js
@@ -511,7 +511,12 @@ function prettify_html(html) {
level--;
}
- result += token.trim().replace(/\s+/, ' ');
+ // don't trim inline content (which could change appearance)
+ if (!inline) {
+ token = token.trim();
+ }
+
+ result += token.replace(/\s+/, ' ');
if (inline_level > level) {
result += '\n';