[FIX] web_editor: restore overlay top options on top of the page

When the overlay covers a snippet, if that snippet is at the top of
the page, the options at the top of the overlay are hidden. A system
was made to make them change position in that case but this was broken
by [1], leaving the toggling of a class for that case but without its
related scss.

This commit restores that scss and also improves the detection of that
problematic case.

[1]: https://github.com/odoo/odoo/commit/4f27e52cabb77b8b1a9637a11185ddf882adc9af

closes odoo/odoo#60467

X-original-commit: 97f11571f9e3deacc9b9e1dc0d2cc8fc6b93f15c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2020-10-22 08:12:59 +00:00
parent f4bcfe6a32
commit b2afa61ec7
2 changed files with 10 additions and 2 deletions
@@ -273,7 +273,9 @@ var SnippetEditor = Widget.extend({
top: offset.top,
});
this.$('.o_handles').css('height', $target.outerHeight());
this.$el.toggleClass('o_top_cover', offset.top < this.$editable.offset().top);
const editableOffsetTop = this.$editable.offset().top - manipulatorOffset.top;
this.$el.toggleClass('o_top_cover', offset.top - editableOffsetTop < 25);
},
/**
* DOMElements have a default name which appears in the overlay when they
@@ -899,7 +901,7 @@ var SnippetEditor = Widget.extend({
/**
* Called when the 'mouse wheel' is used when hovering over the overlay.
* Disable the pointer events to prevent page scrolling from stopping.
*
*
* @private
* @param {Event} ev
*/
@@ -1788,6 +1788,12 @@ body.editor_enable.editor_has_snippets {
}
}
&.o_top_cover > .o_handles > .o_overlay_options_wrap {
top: auto;
bottom: -$o-we-handles-offset-to-hide;
transform: translate(-50%, 110%);
}
&.o_we_overlay_preview {
pointer-events: none;