From 4ba0232bf841e982c084358c60df049cca6e021a Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 25 Sep 2015 12:00:26 +0200 Subject: [PATCH] [FIX] web_editor: apply o_dirty class on change Before: if a user blur a editable area without editing, the editor is removed and all bind are remove. The 'content_changed' bind are removed and the 'o_dirty' class is never apply. --- addons/web_editor/static/src/js/rte.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js index 0e1f5a61d5a..8ba34b8866a 100644 --- a/addons/web_editor/static/src/js/rte.js +++ b/addons/web_editor/static/src/js/rte.js @@ -316,16 +316,15 @@ var RTE = Widget.extend({ $node.addClass('o_is_inline_editable'); } - // start element observation - $node.one('content_changed', function () { - $(this).addClass('o_dirty'); - }); - $node.data('initInnerHTML', $node.html()); }); - $(document).on('content_changed', '.o_editable', function () { + // start element observation + $(document).on('content_changed', '.o_editable', function (event) { self.trigger('change', this); + if(!$(this).hasClass('o_dirty')) { + $(this).addClass('o_dirty'); + } }); $('#wrapwrap, .o_editable').on('click', '*', this, this.onClick);