summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/lib/summernote/src/js
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2019-10-07 09:48:14 +0000
committerfw-bot <otis@odoo.com>2019-10-09 12:19:46 +0000
commitcfe06f6d6841d49f1293f0514ba159920171c2b0 (patch)
tree0c665e565a096e851b849a98ae84253cfd6787e8 /addons/web_editor/static/lib/summernote/src/js
parentbadd0c0bb249be40e8b2463cbbba7dd3f8e87b14 (diff)
[FIX] web_editor: don't crash if anchorNode is Reserved.
When on Firefox, with sale_product_matrix and sale_quotation_builder installed, clicking anywhere on the matrix (after opening it) raises a traceback. It is due to the fact that isBody tries to access anchorNode.nodeName, which is unexpectedly unaccessible as anchorNode is {Reserved}. Due to the absence of clear documentation of the possible reasons of this problem, it was decided to reuse the existing fallback on 'return null', which avoids the traceback. closes odoo/odoo#38277 X-original-commit: 70c484e72bffc9ab759df3c376ad9157acec3965 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Diffstat (limited to 'addons/web_editor/static/lib/summernote/src/js')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/core/range.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/addons/web_editor/static/lib/summernote/src/js/core/range.js b/addons/web_editor/static/lib/summernote/src/js/core/range.js
index 5c2dbe3b32c..20556b1d4fb 100644
--- a/addons/web_editor/static/lib/summernote/src/js/core/range.js
+++ b/addons/web_editor/static/lib/summernote/src/js/core/range.js
@@ -660,9 +660,15 @@ define([
var selection = document.getSelection();
if (!selection || selection.rangeCount === 0) {
return null;
- } else if (dom.isBody(selection.anchorNode)) {
- // Firefox: returns entire body as range on initialization. We won't never need it.
- return null;
+ } else {
+ try {
+ if (dom.isBody(selection.anchorNode)) {
+ // Firefox: returns entire body as range on initialization. We won't never need it.
+ return null;
+ }
+ } catch (e) {
+ return null;
+ }
}
var nativeRng = selection.getRangeAt(0);