diff options
Diffstat (limited to 'addons/web_editor/static/src/js/backend.js')
| -rw-r--r-- | addons/web_editor/static/src/js/backend.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 72bf61cbb7f..08712a05d0e 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -51,7 +51,7 @@ var FieldTextHtmlSimple = widget.extend({ } return config; }, - start: function() { + start: function () { var def = this._super.apply(this, arguments); this.$translate.remove(); this.$translate = $(); @@ -59,7 +59,7 @@ var FieldTextHtmlSimple = widget.extend({ this.$content.trigger('mouseup'); return def; }, - initialize_content: function() { + initialize_content: function () { var self = this; this.$textarea = this.$("textarea").val(this.get('value') || "<p><br/></p>"); this.$content = $(); @@ -118,20 +118,20 @@ var FieldTextHtmlSimple = widget.extend({ return value; }, focus: function() { - if (this.get("effective_readonly")) { + if (!(!this.get("effective_readonly") && this.$textarea)) { return false; } // on IE an error may occur when creating range on not displayed element try { - return this.$content.focusInEnd(); + return this.$textarea.focusInEnd(); } catch (e) { - return this.$content.focus(); + return this.$textarea.focus(); } }, resize: function() { this.$('iframe').css('height', '0px').css('height', Math.max(30, Math.min(this.$content[0] ? this.$content[0].scrollHeight : 0, 500)) + 'px'); }, - render_value: function() { + render_value: function () { var value = this.get('value'); this.$textarea.val(value || ''); this.$content.html(this.text_to_html(value)); @@ -148,10 +148,10 @@ var FieldTextHtmlSimple = widget.extend({ this.$('.note-toolbar').find('button[data-event="undo"]').attr('disabled', false); } }, - is_false: function() { + is_false: function () { return !this.get('value') || this.get('value') === "<p><br/></p>" || !this.get('value').match(/\S/); }, - before_save: function() { + before_save: function () { if (this.options['style-inline']) { transcoder.class_to_style(this.$content); transcoder.font_to_img(this.$content); @@ -268,7 +268,7 @@ var FieldTextHtml = widget.extend({ return src; }, - initialize_content: function() { + initialize_content: function () { this.$el.closest('.modal-body').css('max-height', 'none'); this.$iframe = this.$el.find('iframe'); this.document = null; @@ -334,7 +334,7 @@ var FieldTextHtml = widget.extend({ self.initialize_content(); }); }, - render_value: function() { + render_value: function () { if (this.lang !== this.view.dataset.context.lang || this.$iframe.attr('src').match(/[?&]edit_translations=1/)) { return; } @@ -354,7 +354,7 @@ var FieldTextHtml = widget.extend({ } } }, - is_false: function() { + is_false: function () { return this.get('value') === false || !this.$content.html() || !this.$content.html().match(/\S/); }, before_save: function () { |
