Skip to content
Snippets Groups Projects
Commit 5fd86124 authored by Rodolpho Lima's avatar Rodolpho Lima
Browse files

[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

Part-of: odoo/odoo#123568
parent 8ff33c75
No related branches found
No related tags found
No related merge requests found
......@@ -2217,8 +2217,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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment