From cb238642625196b2be3c4c2e59f91cb6d608599c Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 23 Oct 2015 13:17:25 +0200 Subject: [PATCH] [FIX] web_editor: ie issue with range within undisplayed In IE11, when adding a range to a selection that can fail if this range is not displayed (display non on itself or an ancestor) or is not already inserted in the dom. e.g: IE fails in the following situation: http://jsfiddle.net/7cmf2tt9/7/ The feature causing this situation is minimal : it only set the cursor at the end of a FieldTextHtmlSimple widget (the default widget for fields.Html). This commit thus only ignore that error. note: this is not an issue on IE Edge. closes #9216 opw-652347 --- addons/web_editor/static/src/js/backend.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index f5af01ec89c..e7c6d93853d 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -106,7 +106,10 @@ var FieldTextHtmlSimple = widget.extend({ var value = this.get('value'); this.$textarea.val(value || ''); this.$content.html(this.text_to_html(value)); - this.$content.focusInEnd(); + // on ie an error may occur when creating range on not displayed element + try { + this.$content.focusInEnd(); + } catch (e) {} var history = this.$content.data('NoteHistory'); if (history && history.recordUndo()) { this.$('.note-toolbar').find('button[data-event="undo"]').attr('disabled', false);