[FIX] web_editor: fix wysiwyg focus

Ensure the wysiwyg.js focus() method will actually
restore the cursor in the latest selection inside the editor.

X-original-commit: 54877ecd8bf2454a7023e74aa739921e1468dad8
Part-of: odoo/odoo#102603
This commit is contained in:
Sébastien Geelen (sge)
2022-10-07 14:37:21 +02:00
parent e483ae5fb4
commit efd4a3f7c2
@@ -1238,8 +1238,10 @@ export class OdooEditor extends EventTarget {
focusNode,
computedSelection.focusOffset,
);
return true;
}
}
return false;
}
historySetSelection(step) {
this.deselectTable();
@@ -2400,7 +2402,7 @@ export class OdooEditor extends EventTarget {
focusNode: sel.focusNode,
focusOffset: sel.focusOffset,
};
if (!sel.isCollapsed && this.isSelectionInEditable(sel)) {
if (this.isSelectionInEditable(sel)) {
this._latestComputedSelectionInEditable = this._latestComputedSelection;
}
return this._latestComputedSelection;