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 01f784f8e53..dee96211934 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1158,11 +1158,14 @@ var SnippetsMenu = Widget.extend({ */ async start() { var defs = [this._super.apply(this, arguments)]; - this.$el.data('snippetMenu', this); this.ownerDocument = this.$el[0].ownerDocument; this.$document = $(this.ownerDocument); this.window = this.ownerDocument.defaultView; this.$window = $(this.window); + // In an iframe, we need to make sure the element is using jquery on its + // own window and not on the top window lest jquery behave unexpectedly. + this.$el = this.window.$(this.$el); + this.$el.data('snippetMenu', this); this.customizePanel = document.createElement('div'); this.customizePanel.classList.add('o_we_customize_panel', 'd-none'); diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 174b88e6bcf..649dad9dfdc 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -901,7 +901,10 @@ const Wysiwyg = Widget.extend({ */ _updateEditorUI: function (e) { this.odooEditor.automaticStepSkipStack(); - const $target = e ? $(e.target) : $(); + // We need to use the editor's window so the tooltip displays in its + // document even if it's in an iframe. + const editorWindow = this.odooEditor.document.defaultView; + const $target = e ? editorWindow.$(e.target) : editorWindow.$(); // Restore paragraph dropdown button's default ID. this.toolbar.$el.find('#mediaParagraphDropdownButton').attr('id', 'paragraphDropdownButton'); // Remove the alt tools.