From fd63a53fcd15bb01def9cb9f2be21ae8f9d3e6da Mon Sep 17 00:00:00 2001 From: Rodolpho Lima Date: Fri, 2 Jun 2023 15:58:24 +0000 Subject: [PATCH] [FIX] web_editor: toolbar glitch when selecting media The code snippet removed by this commit had no useful effect, as `selection.addRange(range)` a few line above triggers `OdooEditor._onSelectionChange`, which repositions the toolbar elsewhere. The result was a "glitch": the toolbar would briefly be displayed over the top left corner of the media before finally being displayed above (or below) it. This commit removes such undesirable effect. task-3347942 closes odoo/odoo#126445 X-original-commit: f0272411f6cab059cc8bc2ceed37d9ce59ffe80c Signed-off-by: David Monjoie (dmo) Signed-off-by: Nicolas Bayet (nby) Signed-off-by: Rodolpho Cammarosano de Lima (rcdl) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 31d0e54cedc..84d1164e7c4 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1969,15 +1969,6 @@ const Wysiwyg = Widget.extend({ selection.addRange(range); // Always hide the unlink button on media. this.toolbar.$el.find('#unlink').toggleClass('d-none', true); - // Show the floatingtoolbar on the topleft of the media. - if (this.odooEditor.autohideToolbar && !this.odooEditor.isMobile) { - const imagePosition = this.lastMediaClicked.getBoundingClientRect(); - this.toolbar.$el.css({ - visibility: 'visible', - top: imagePosition.top + 10 + 'px', - left: imagePosition.left + 10 + 'px', - }); - } // Toggle the 'active' class on the active image tool buttons. for (const button of this.toolbar.$el.find('#image-shape div, #fa-spin')) { button.classList.toggle('active', $(e.target).hasClass(button.id));