[FIX] web_editor: ensure powerbox gets selection from owner document
When checking if the powerbox should open, we check the selection but that was done on the global document, which returns a wrong selection for the editable if it's in an iframe. As a result, the powerbox never opened in mass_mailing. task-2778414 closes odoo/odoo#85352 X-original-commit: d5b8c26c46b1daf795a6b286af80bb4dad8072ff Signed-off-by: David Monjoie (dmo) <dmo@odoo.com> Signed-off-by: Antoine Guenet <age@odoo.com>
This commit is contained in:
@@ -109,7 +109,7 @@ const Wysiwyg = Widget.extend({
|
||||
getYoutubeVideoElement: getYoutubeVideoElement,
|
||||
getContextFromParentRect: options.getContextFromParentRect,
|
||||
getPowerboxElement: () => {
|
||||
const selection = document.getSelection();
|
||||
const selection = (this.options.document || document).getSelection();
|
||||
if (selection.isCollapsed && selection.rangeCount) {
|
||||
const node = closestElement(selection.anchorNode, 'P, DIV');
|
||||
return !(node && node.hasAttribute && node.hasAttribute('data-oe-model')) && node;
|
||||
|
||||
Reference in New Issue
Block a user