Skip to content
Snippets Groups Projects
Commit 83956d4c authored by Nicolas Lempereur's avatar Nicolas Lempereur
Browse files

[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 `<pre />` tag or replace
spaces with `&nbsp;`.

closes #14593
opw-695535
parent 3ea207b5
No related branches found
No related tags found
No related merge requests found
......@@ -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, '<br/>');
// prevent html space collapsing
value = value.replace(/ /g, '&nbsp;').replace(/([^>])&nbsp;([^<])/g, '$1 $2');
var commands = this.options.commands_enabled ? this.mention_manager.get_listener_selection('/') : [];
return $.when({
content: this.mention_manager.generate_links(value),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment