[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
This commit is contained in:
Nicolas Lempereur
2015-10-26 15:25:30 +01:00
parent 058db89876
commit cb23864262
+4 -1
View File
@@ -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);