From 953b6126584f87f1986c63fd94bbd240880559e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Thu, 18 Nov 2021 14:43:57 +0000 Subject: [PATCH] [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) --- addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js index c9e71e6c385..c4d2f675bd5 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js @@ -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)); } } }