diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-01-05 15:51:49 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-01-05 15:51:49 +0100 |
| commit | 31ce19bd7c8ff90aa3a3f34ba13dfbbe00865b3b (patch) | |
| tree | 4f24c985d7f4f7d08af1830f8199b120f35018f7 /addons/web_editor/static | |
| parent | 9b5311e0c94ea2b3ad6c36bc9a4ea63228779b66 (diff) | |
| parent | 97e87a42cdfaed04a6f50d928d86ac6e3bec9f91 (diff) | |
[MERGE] forward port of branch 9.0 up to 97e87a4
Diffstat (limited to 'addons/web_editor/static')
| -rw-r--r-- | addons/web_editor/static/src/js/backend.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 17a2df31c6e..3d3b6cb27ee 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -103,17 +103,23 @@ var FieldTextHtmlSimple = widget.extend({ return value; }, focus: function() { - var input = !this.get("effective_readonly") && this.$textarea; - return input ? input.focus() : false; + if (this.get("effective_readonly")) { + return false; + } + // on IE an error may occur when creating range on not displayed element + try { + return this.$content.focusInEnd(); + } catch (e) { + return this.$content.focus(); + }; }, render_value: function() { var value = this.get('value'); this.$textarea.val(value || ''); this.$content.html(this.text_to_html(value)); - // on ie an error may occur when creating range on not displayed element - try { - this.$content.focusInEnd(); - } catch (e) {} + if (this.$content.is(document.activeElement)) { + this.focus(); + } var history = this.$content.data('NoteHistory'); if (history && history.recordUndo()) { this.$('.note-toolbar').find('button[data-event="undo"]').attr('disabled', false); |
