From 83956d4c49cd810e20149c00ad045b8c5c80317e Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 5 Dec 2016 13:20:17 +0100 Subject: [PATCH] [IMP] mail: keep multiple spaces in chatter and chat In chat window, a chatter and discuss, the text zone appear as a pure text zone but is transformed later on in HTML to add mentions links and possibly other features. Thus, when we wrote multiple spaces or a space at the next to html tag, with how html worked they were collpased into one (or zero). To keep them, we need to wrap the content with `
` tag or replace
spaces with ` `.

closes #14593
opw-695535
---
 addons/mail/static/src/js/composer.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/addons/mail/static/src/js/composer.js b/addons/mail/static/src/js/composer.js
index dd30dddf8f3..6560e76fb13 100644
--- a/addons/mail/static/src/js/composer.js
+++ b/addons/mail/static/src/js/composer.js
@@ -474,6 +474,8 @@ var BasicComposer = Widget.extend({
         // Return a deferred as this function is extended with asynchronous
         // behavior for the chatter composer
         var value = _.escape(this.$input.val()).replace(/\n|\r/g, '
'); + // prevent html space collapsing + value = value.replace(/ /g, ' ').replace(/([^>]) ([^<])/g, '$1 $2'); var commands = this.options.commands_enabled ? this.mention_manager.get_listener_selection('/') : []; return $.when({ content: this.mention_manager.generate_links(value),