From 8a5c8a3cb940b8ed5829ce7b0a612b6b0a33e490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Tue, 22 Feb 2022 13:40:48 +0000 Subject: [PATCH] [FIX] web_editor: fix icon replacement is mass_mailing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Signed-off-by: Geelen Sébastien (sge) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 53e9d2d3b01..49bd6179b81 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -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();