[FIX] web_editor: cursor one step late in collaboration

Reproduction:
1. Install note
2. Open an existing note and open it again in another tab
3. When you click in one tab, the cursor position in the other one is
always one step behind

Fix: separate the logic between collaboration and appliedCustomSelection
and revert the calling of getCurrentCollaborativeSelection to the place
after _computeHistorySelection

Task-3221119

closes odoo/odoo#144929

X-original-commit: 854ef7df4db577d010bed9a3561c57b3700447d8
Signed-off-by: Nicolas Bayet (nby) <nby@odoo.com>
This commit is contained in:
Jinjiu Liu
2023-12-05 10:54:58 +00:00
parent ad0783edf1
commit 1f42c0f468
@@ -4100,9 +4100,6 @@ export class OdooEditor extends EventTarget {
// wasn't changed.
this._setLinkZws();
if (this.options.onCollaborativeSelectionChange) {
this.options.onCollaborativeSelectionChange(this.getCurrentCollaborativeSelection());
}
}
const isSelectionInEditable = this.isSelectionInEditable(selection);
if (!appliedCustomSelection) {
@@ -4135,6 +4132,13 @@ export class OdooEditor extends EventTarget {
if (this._currentMouseState === 'mouseup') {
this._fixFontAwesomeSelection();
}
if (
selection.rangeCount &&
selection.getRangeAt(0) &&
this.options.onCollaborativeSelectionChange
) {
this.options.onCollaborativeSelectionChange(this.getCurrentCollaborativeSelection());
}
}
/**