[FIX] web_editor: reset the collaborative selection when reset content

When the content of the editor is reset, the collaborative selection
should be reset as well. Otherwise, the selection is not reset and
the user can still see the selection of the previous content.

task-3675074

closes odoo/odoo#148826

Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
This commit is contained in:
Nicolas Bayet
2024-01-10 21:04:32 +00:00
parent 0e22763a85
commit 5b04b4511c
@@ -869,6 +869,7 @@ export class OdooEditor extends EventTarget {
if (this.editable.textContent === '' && this.options.placeholder) {
this._makeHint(this.editable.firstChild, this.options.placeholder, true);
}
this.multiselectionRefresh();
}
sanitize(target) {
@@ -1821,6 +1822,7 @@ export class OdooEditor extends EventTarget {
}
_drawClientSelection({ selection, color, clientId, clientName = this.options._t('Anonymous') }) {
this._multiselectionRemoveClient(clientId);
let clientRects;
let anchorNode = this.idFind(selection.anchorNodeOid);
@@ -1906,7 +1908,6 @@ export class OdooEditor extends EventTarget {
caretElement.style.top = `${rect.y - containerRect.y}px`;
caretElement.style.left = `${rect.right - containerRect.x}px`;
}
this._multiselectionRemoveClient(clientId);
this._selectionsContainer.append(caretElement, ...indicators);
}