[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) <qsm@odoo.com>
This commit is contained in:
Benjamin Vray
2020-10-01 19:33:36 +00:00
committed by qsm-odoo
parent 463fd81486
commit bb7f91cb14
@@ -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;