[FIX] web_editor: solve traceback table RTL scroll

Commit that introduced the issue: fbc167bf84340b4bb6d0f8c59f2734814f56c6df

Issue:
======
Adding a table in a long chatter message with scroll raise a traceback

Steps to reproduce the issue:
=============================
- Switch to RTL lang
- Go to any form view and open the editor composer to create a log note
- Write a lot of lines so that the scrollbar appears
- Add a table
- Log the note
- Try to scroll -> traceback

Origin of the issue:
====================
The `_onScroll` method is called and it has `this._rowUiTarget` as the
row from the composer dialog which is not in the ui anymore so
`closestElement(row, 'table')`  will return `null`.

Solution:
=========
We just do nothing when the element is not connected.

task-3707808

closes odoo/odoo#151800

Signed-off-by: Antoine Guenet (age) <age@odoo.com>
This commit is contained in:
Mahdi Cheikh Rouhou (macr)
2024-02-01 14:30:03 +00:00
parent 02e0bcb10f
commit a9acebb086
@@ -2916,6 +2916,9 @@ export class OdooEditor extends EventTarget {
* @param {HTMLTableRowElement|HTMLTableCellElement} element
*/
_positionTableUi(element) {
if (!element.isConnected) {
return;
}
const tableUiContainerRect = this._tableUiContainer.getBoundingClientRect();
const isRtl = this.options.direction === 'rtl';
const isRow = element.nodeName === 'TR';