From 117552f09764685b4efccf1bf910fc27f8741d9d Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 9 Jun 2020 08:28:20 +0000 Subject: [PATCH] [FIX] web_editor: properly cover modal snippets When a snippet contains a modal, the editor overlay should not cover the 0-height wrapping div but the modal element itself. Part of https://github.com/odoo/odoo/pull/52663 X-original-commit: bc055e7822b9b2e7f8f9608e335456a71d7896a1 --- addons/web_editor/static/src/js/editor/snippets.editor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 1376e6f76e7..eda2b4b3fc3 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -198,16 +198,18 @@ var SnippetEditor = Widget.extend({ if (!this.isShown() || !this.$target.length || !this.$target.is(':visible')) { return; } - var offset = this.$target.offset(); + const $modal = this.$target.find('.modal'); + const $target = $modal.length ? $modal : this.$target; + const offset = $target.offset(); var manipulatorOffset = this.$el.parent().offset(); offset.top -= manipulatorOffset.top; offset.left -= manipulatorOffset.left; this.$el.css({ - width: this.$target.outerWidth(), + width: $target.outerWidth(), left: offset.left, top: offset.top, }); - this.$('.o_handles').css('height', this.$target.outerHeight()); + this.$('.o_handles').css('height', $target.outerHeight()); this.$el.toggleClass('o_top_cover', offset.top < this.$editable.offset().top); }, /**