[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) <dmo@odoo.com> Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com> Signed-off-by: Rodolpho Cammarosano de Lima (rcdl) <rcdl@odoo.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user