From bb7f91cb14371d25080ef60e11f00cd576f74288 Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Fri, 28 Aug 2020 13:36:08 +0000 Subject: [PATCH] [FIX] web_editor: fix select with images in left panel Before this commit, we were looking for text content inside SVG element to set the selected value of a select in the editor panel. After this commit, we avoid looking inside SVG tags. task-2312878 closes odoo/odoo#58941 X-original-commit: 338f8d843832c339c52c00c7f4c41b5ab2d696ed Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.options.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index c7b30f86dfd..28a344a323c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -861,7 +861,8 @@ const SelectUserValueWidget = BaseSelectionUserValueWidget.extend({ let textContent = ''; const activeWidget = this._userValueWidgets.find(widget => !widget.isPreviewed() && widget.isActive()); if (activeWidget) { - const value = (activeWidget.el.dataset.selectLabel || activeWidget.el.textContent.trim()); + const svgTag = activeWidget.el.querySelector('svg'); // useful to avoid searching text content in svg element + const value = (activeWidget.el.dataset.selectLabel || (!svgTag && activeWidget.el.textContent.trim())); const imgSrc = activeWidget.el.dataset.img; if (value) { textContent = value;