diff --git a/addons/web_editor/models/ir_qweb_fields.py b/addons/web_editor/models/ir_qweb_fields.py index e5262d966ac..bf6a75c7909 100644 --- a/addons/web_editor/models/ir_qweb_fields.py +++ b/addons/web_editor/models/ir_qweb_fields.py @@ -518,7 +518,7 @@ class Monetary(models.AbstractModel): def from_html(self, model, field, element): lang = self.user_lang() - value = element.find('span').text.strip() + value = element.find('span').text_content().strip() return float(value.replace(lang.thousands_sep, '') .replace(lang.decimal_point, '.')) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 4f99eb43114..d6392b5eb37 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -13,6 +13,7 @@ const SmoothScrollOnDrag = require('web/static/src/js/core/smooth_scroll_on_drag const {getCSSVariableValue} = require('web_editor.utils'); const gridUtils = require('@web_editor/js/common/grid_layout_utils'); const QWeb = core.qweb; +const {closestElement} = require('@web_editor/js/editor/odoo-editor/src/utils/utils'); var _t = core._t; @@ -4189,8 +4190,8 @@ var SnippetsMenu = Widget.extend({ } if (!range || !$currentSelectionTarget.parents('#wrapwrap, .iframe-editor-wrapper .o_editable').length || - $(selection.anchorNode).parent('[data-oe-model]:not([data-oe-type="html"]):not([data-oe-field="arch"]):not([data-oe-translation-initial-sha])').length || - $(selection.focusNode).parent('[data-oe-model]:not([data-oe-type="html"]):not([data-oe-field="arch"]):not([data-oe-translation-initial-sha])').length || + closestElement(selection.anchorNode, '[data-oe-model]:not([data-oe-type="html"]):not([data-oe-field="arch"]):not([data-oe-translation-initial-sha])') || + closestElement(selection.focusNode, '[data-oe-model]:not([data-oe-type="html"]):not([data-oe-field="arch"]):not([data-oe-translation-initial-sha])') || (e && $(e.target).closest('.fa, img').length || this.options.wysiwyg.lastMediaClicked && $(this.options.wysiwyg.lastMediaClicked).is('.fa, img')) || (this.options.wysiwyg.lastElement && !this.options.wysiwyg.lastElement.isContentEditable)