[FIX] web_editor: limit custom table selection to editable area bounds
The custom table selection was not limited to the editable area bounds, which means we could end up styling a table as selected, which did not belong to the editor's scope. This sometimes happened when Firefox triggered a selectionchange event during the instantiation of the editor and the selection happened to be in a table outside the editor. opw-3150654 task-3166078 closes odoo/odoo#111779 X-original-commit: d51aab54775ed541d7955cee032aceed143d3a08 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -2204,7 +2204,7 @@ export class OdooEditor extends EventTarget {
|
||||
_handleSelectionInTable(ev=undefined) {
|
||||
const selection = this.document.getSelection();
|
||||
const anchorNode = selection.anchorNode;
|
||||
if (anchorNode && closestElement(anchorNode, '[data-oe-protected="true"]')) {
|
||||
if (anchorNode && (closestElement(anchorNode, '[data-oe-protected="true"]') || !ancestors(anchorNode).includes(this.editable))) {
|
||||
return false;
|
||||
}
|
||||
this.deselectTable();
|
||||
|
||||
Reference in New Issue
Block a user