summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-01-23 14:10:48 +0100
committerqsm-odoo <qsm@odoo.com>2018-01-25 11:11:34 +0100
commit78a556601e6b1e72c6d1ac776e31588dd2ffa28f (patch)
tree65dbaedb2a56f19a75b18cd2dd6d0c838f69b327 /addons/web_editor/static/src
parentd29c2dbbddb2e7407e714b0bb11ffdf6fa317672 (diff)
[FIX] web_editor: prevent crash when dropping snippets
For some unknown reasons, the editor sometimes crashes when dropping a snippet. As a temporary fix, the non-critical line that causes the problem is try/catch protected by this commit.
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/rte.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js
index 20c70e9d235..7748ccf7762 100644
--- a/addons/web_editor/static/src/js/rte.js
+++ b/addons/web_editor/static/src/js/rte.js
@@ -280,7 +280,15 @@ var RTE = Widget.extend({
} else {
rng = $editable.data('range') || rng;
}
- rng.select();
+ try {
+ // TODO this line might break for unknown reasons. I suppose that
+ // the created range is an invalid one. As it might be tricky to
+ // adapt that line and that it is not a critical one, temporary fix
+ // is to ignore the errors that this generates.
+ rng.select();
+ } catch (e) {
+ console.log('error', e);
+ }
history.recordUndo($editable, event, internal_history);
},
/**