[FIX] web_editor: fix monetary fields Edition in FF

Changing value in monetary fields was not working properly in FF :

The ZeroWidthSpace inserted by the deleteRange function cannot be selected;
trying to do so loses the selection for some reason.

task-2679088

closes odoo/odoo#80071

X-original-commit: 1b36b4e8a6b319de10b6c1144c37533dab0e2f36
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Sébastien Geelen (sge)
2021-11-19 10:42:07 +00:00
parent 469a2ebc38
commit 953b612658
@@ -175,6 +175,7 @@ export class OdooEditor extends EventTarget {
this.document = options.document || document;
this.isMobile = matchMedia('(max-width: 767px)').matches;
this.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
// Keyboard type detection, happens only at the first keydown event.
this.keyboardType = KEYBOARD_TYPES.UNKNOWN;
@@ -1335,7 +1336,8 @@ export class OdooEditor extends EventTarget {
const el = closestElement(joinWith);
const { zws } = fillEmpty(el);
if (zws) {
setSelection(zws, 0, zws, nodeSize(zws));
// ZWS selection in OdooEditor is not working in current version of firefox (since v93.0)
setSelection(zws, 0, zws, this.isFirefox ? 0 : nodeSize(zws));
}
}
}