diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-05-28 11:51:50 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-05-28 12:20:07 +0200 |
| commit | ea0fcd52d923d4dfaf87ad1cc0ce6d3e32c16477 (patch) | |
| tree | d4cb2d2cfa7e3e969d3055fe682ce04042927449 /addons | |
| parent | 34f567dd397a016e526c3923024ee1cf9234ca5d (diff) | |
[FIX] web_editor: properly save a t-field in a t-ignore environment
When a t-field element was in an editable t-ignore environement,
modifying it was leaving the edit mode style attached to it. This
was because of:
1) When the t-field element was changed, it was marked dirty but
also its parent editable container. Fixing this, only solves
the case where only the t-field (and not one of its neighbors)
is changed but it was worth fixing anyway.
2) Before saving an element, the potential 'o_editable' and
summernote classes were not removed of its descendant and were
thus saved.
Bug found with task-38069, merged in stable as it might occur there
too.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web_editor/static/src/js/rte.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js index adbc7d4bd49..2940fcfa44f 100644 --- a/addons/web_editor/static/src/js/rte.js +++ b/addons/web_editor/static/src/js/rte.js @@ -330,10 +330,11 @@ var RTE = Widget.extend({ }); // start element observation - $(document).on('content_changed', '.o_editable', function (event) { + $(document).on('content_changed', '.o_editable', function (ev) { self.trigger('change', this); - if(!$(this).hasClass('o_dirty')) { + if (!ev.__isDirtyHandled) { $(this).addClass('o_dirty'); + ev.__isDirtyHandled = true; } }); @@ -366,6 +367,10 @@ var RTE = Widget.extend({ var editables = history.getEditableHasUndo(); + $('.o_editable') + .destroy() + .removeClass('o_editable o_is_inline_editable'); + var defs = $('.o_dirty') .removeAttr('contentEditable') .removeClass('o_dirty oe_carlos_danger o_is_inline_editable') |
