diff options
| author | Benjamin Vray <bvr@odoo.com> | 2020-09-25 08:02:11 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-09-25 11:21:44 +0000 |
| commit | e6d32bc4bfa7f0c3c2f82c2eb99a562c1cb93d83 (patch) | |
| tree | a36d9b03befa3772e0ffe2ef607e7d6e449c91a8 /addons/web_editor/static/src | |
| parent | b497837522779def181c19957e25c7629a567793 (diff) | |
[FIX] web, web_editor: fix scroll to hidden dropped snippets
Fix the scroll when the snippet is the dynamic one because it did not
work as we tried to get the offset of an element with the d-none class.
Remove the scrollValue variable because we don't need it anymore.
It was used before the code was reviewed in a previous commit.
task-2312878
closes odoo/odoo#58486
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 5 |
1 files changed, 1 insertions, 4 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 dff27ed70e0..b4a5dca1d4b 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1825,7 +1825,6 @@ var SnippetsMenu = Widget.extend({ _makeSnippetDraggable: function ($snippets) { var self = this; var $toInsert, dropped, $snippet; - let scrollValue; let dragAndDropResolve; @@ -1880,7 +1879,6 @@ var SnippetsMenu = Widget.extend({ over: function () { if (!dropped) { dropped = true; - scrollValue = $(this).first().offset().top; $(this).first().after($toInsert).addClass('d-none'); $toInsert.removeClass('oe_snippet_body'); } @@ -1905,7 +1903,6 @@ var SnippetsMenu = Widget.extend({ if (!dropped && ui.position.top > 3 && ui.position.left + ui.helper.outerHeight() < self.el.getBoundingClientRect().left) { var $el = $.nearest({x: ui.position.left, y: ui.position.top}, '.oe_drop_zone', {container: document.body}).first(); if ($el.length) { - scrollValue = $el.offset().top; $el.after($toInsert); dropped = true; } @@ -1933,7 +1930,7 @@ var SnippetsMenu = Widget.extend({ } var $target = $toInsert; - await self._scrollToSnippet($target, scrollValue); + await self._scrollToSnippet($target); _.defer(async function () { self.trigger_up('snippet_dropped', {$target: $target}); |
