From fc6f66f179798a731489a6a3e73af0d37af27f7d Mon Sep 17 00:00:00 2001
From: Rodolpho Lima <rcdl@odoo.com>
Date: Mon, 18 Sep 2023 13:34:05 +0200
Subject: [PATCH] [FIX] web_editor: toolbar in website forum

Steps:

In a website forum post without any previous scrolling, select some
text. A traceback appears due the fact that there's no .o_action_manager
element in website forum.

This commit uses the document body as a fallback for the scroll
container when the .o_action_manager element is not present.

task-3506312

closes odoo/odoo#135785

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
---
 addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js
index c0fac1b4d0b3..e3195584ef74 100644
--- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js
+++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js
@@ -209,7 +209,7 @@ const Wysiwyg = Widget.extend({
             getContextFromParentRect: options.getContextFromParentRect,
             getScrollContainerRect: () => {
                 if (!this.scrollContainer || !this.scrollContainer.getBoundingClientRect) {
-                    this.scrollContainer = document.querySelector('.o_action_manager');
+                    this.scrollContainer = document.querySelector('.o_action_manager') || document.body;
                 }
                 return this.scrollContainer.getBoundingClientRect();
             },
-- 
GitLab