[FIX] web_editor: fix icon replacement is mass_mailing

In mass mailing edition :
Replacing a font awesome icon with an image was not working properly.

task-2733908

closes odoo/odoo#85167

X-original-commit: d4d25c8b497e465753cef030292faa4824145cb1
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
This commit is contained in:
Sébastien Geelen (sge)
2022-02-22 21:05:40 +00:00
parent 4bfd756c2f
commit 8a5c8a3cb9
@@ -1008,6 +1008,8 @@ const Wysiwyg = Widget.extend({
const restoreSelection = preserveCursor(this.odooEditor.document);
const $node = $(params.node);
// We need to keep track of FA icon because media.js will _clear those classes
const wasFontAwesome = $node.hasClass('fa');
const $editable = $(this.odooEditor.editable);
const model = $editable.data('oe-model');
const field = $editable.data('oe-field');
@@ -1031,7 +1033,7 @@ const Wysiwyg = Widget.extend({
element.className += " " + params.htmlClass;
}
restoreSelection();
if (wysiwygUtils.isImg($node[0])) {
if (wysiwygUtils.isImg($node[0]) || wasFontAwesome) {
$node.replaceWith(element);
this.odooEditor.unbreakableStepUnactive();
this.odooEditor.historyStep();