summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2020-01-20 16:11:04 +0000
committerfja-odoo <fja@odoo.com>2020-02-03 11:07:15 +0000
commitc547d7c1c5d6319a079a6fdf9521ccb8f14a32cc (patch)
tree305254229ebd3e8b7e0822f48980f2077d8fbb4f /addons/web_editor/static/src
parent28796cddddbea9a9d7893020ec660f8d6ed95069 (diff)
[FIX] web_editor: fix input selection not supported
Some elements like the file input are not compatible with selection. Since there is no reliable way of figuring out if the element is compatible or not we will simply try catch it. closes odoo/odoo#44470 X-original-commit: 1f0a0b380c2738795b0b5a7976692d9e9cd88583 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/rte.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/editor/rte.js b/addons/web_editor/static/src/js/editor/rte.js
index e0a7d6a7829..ad079a5aab7 100644
--- a/addons/web_editor/static/src/js/editor/rte.js
+++ b/addons/web_editor/static/src/js/editor/rte.js
@@ -458,8 +458,14 @@ var RTEWidget = Widget.extend({
if (initialActiveElement && initialActiveElement !== document.activeElement) {
initialActiveElement.focus();
- initialActiveElement.selectionStart = initialSelectionStart;
- initialActiveElement.selectionEnd = initialSelectionEnd;
+ try {
+ initialActiveElement.selectionStart = initialSelectionStart;
+ initialActiveElement.selectionEnd = initialSelectionEnd;
+ } catch (e) {
+ // The active element might be of a type that
+ // does not support selection.
+ console.log('error', e);
+ }
}
},
/**