summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2015-09-25 12:00:26 +0200
committerChristophe Matthieu <chm@odoo.com>2015-09-25 16:06:21 +0200
commit4ba0232bf841e982c084358c60df049cca6e021a (patch)
treed490eecfe8e23c5f9708f10681e207c72971d06e /addons/web_editor/static/src/js
parent743f26a7968b1a876cf1b28d30305d811dd63ebe (diff)
[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.
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/rte.js11
1 files 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);