[FIX] web_editor: toolbar position in scrolled iframe
Before this commit, an error in the toolbar position happened when the editor was inside an iframe and the iframe's window had scroll bars. Steps to reproduce: - go to the Market Automation app (enterprise edition) - create new campaign - add new activity - create a new mail template by typing a name and selecting "create and edit" - select the "plain text" theme - add a lot of content in order to have the scroll bars - scroll down - select something to display the toolbar The `scrollX` and `scrollY` variables in `_positionToolbar` are ment to correct the floating toolbar position in case the document in which the toolbar is mounted has some scrolloffset. As the floating toolbar is always mounted on the body of the top document, this is the document to watch for scroll offsets, and not the inner document when the editor is mounted inside an iframe. task-3263463 X-original-commit: fb080218def7c47e7b96cf284d613fc03b8325f6 Part-of: odoo/odoo#126445
This commit is contained in:
@@ -3070,8 +3070,8 @@ export class OdooEditor extends EventTarget {
|
||||
const editorRect = this.editable.getBoundingClientRect();
|
||||
const parentContextRect = this.options.getContextFromParentRect();
|
||||
const editorTopPos = Math.max(0, editorRect.top);
|
||||
const scrollX = this.document.defaultView.scrollX;
|
||||
const scrollY = this.document.defaultView.scrollY;
|
||||
const scrollX = document.defaultView.scrollX;
|
||||
const scrollY = document.defaultView.scrollY;
|
||||
|
||||
// Get left position.
|
||||
let left = correctedSelectionRect.left + OFFSET;
|
||||
|
||||
Reference in New Issue
Block a user