From a6e3ae6b8c08b3e2abfda248b5f77a1781244683 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 21 Nov 2016 14:22:14 +0100 Subject: Revert "[IMP] web_editor: don't lose modified code view content" This reverts commit 897290dd3ff218ddc12dcdc6c936a8725813cefe. It seems it breaks other use case, since this was fixing more a usability thing (need to click back on code view to save code view changes) it is better to revert than to add drawback. A better fix should be introduced, or the solution would be to not fix it and have a warning indicating what needs to be done. opw-693052 --- addons/web_editor/static/src/js/backend.js | 10 ---------- addons/web_editor/static/src/js/rte.summernote.js | 2 -- 2 files changed, 12 deletions(-) (limited to 'addons/web_editor/static/src') diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 6b956c344db..0cd9abb5596 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -161,11 +161,6 @@ var FieldTextHtmlSimple = widget.extend({ return !this.get('value') || this.get('value') === "


" || !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); @@ -379,11 +374,6 @@ 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() ); } diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js index b7d4c191b7e..8cbb80583b7 100644 --- a/addons/web_editor/static/src/js/rte.summernote.js +++ b/addons/web_editor/static/src/js/rte.summernote.js @@ -485,8 +485,6 @@ function prettify_html(html) { } return result; } - -// Change Warning: called with dummy arguments to quit code view before saving $.summernote.pluginEvents.codeview = function (event, editor, layoutInfo) { if (layoutInfo.toolbar) { return eventHandler.modules.codeview.toggle(layoutInfo); -- cgit v1.2.3