[FIX] web_editor: properly paste text in non-HTML fields

This resolves an issue with pasting in text only mode (no HTML): the
list of nodes to paste was being modified with the `_mergeAdjacentULs`
method which is irrelevant to text nodes. Because of that, a corrupted
list of nodes was inserted into the DOM.

opw-1962743

closes odoo/odoo#32454

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
This commit is contained in:
Antoine Guenet
2019-04-25 11:33:00 +00:00
committed by Pierre Paridans
parent c42ccf2ca7
commit fe2496350c
@@ -85,7 +85,7 @@ var TextPlugin = AbstractPlugin.extend({
return;
}
nodes = textOnly ? this.document.createTextNode($(nodes).text()) : nodes;
nodes = this._mergeAdjacentULs(nodes);
nodes = textOnly ? nodes : this._mergeAdjacentULs(nodes);
var point = this._getPastePoint();
// Prevent pasting HTML within a link: