diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-11-17 14:37:19 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-11-17 14:37:19 +0100 |
| commit | 3b2f4e244f51b37050f61629bf01e6dc38cc4817 (patch) | |
| tree | bf18693943d40de4fb10d894059837a549c7d944 /addons/web_editor/static/src/js/backend.js | |
| parent | 25888f41952e9b9f78fa493b906dfe458a410210 (diff) | |
| parent | 7ee09ed0c14a87502cf92d5de81cd5b8ce846f5b (diff) | |
[MERGE] forward port branch 9.0 up to 7ee09ed
Diffstat (limited to 'addons/web_editor/static/src/js/backend.js')
| -rw-r--r-- | addons/web_editor/static/src/js/backend.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 17ce8c3c1a1..3b414d45cb5 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -161,6 +161,11 @@ var FieldTextHtmlSimple = widget.extend({ return !this.get('value') || this.get('value') === "<p><br/></p>" || !this.get('value').match(/\S/); }, commit_value: function () { + // leave code view before saving + if (this.$content.prev('textarea').length === 1) { + var layoutInfo = { 'editor': function() { return this.$content; }.bind(this) }; + $.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo); + } if (this.options['style-inline']) { transcoder.class_to_style(this.$content); transcoder.font_to_img(this.$content); @@ -374,6 +379,11 @@ var FieldTextHtml = widget.extend({ this._dirty_flag = false; return this.editor.save(); } else if (this._dirty_flag && this.editor && this.editor.buildingBlock) { + // leave code view before saving + if (this.$content.prev('textarea').length === 1) { + var layoutInfo = { 'editor': function() { return this.$content; }.bind(this) }; + $.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo); + } this.editor.buildingBlock.clean_for_save(); this.internal_set_value( this.$content.html() ); } |
