[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.
This commit is contained in:
@@ -330,10 +330,11 @@ var RTE = Widget.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// start element observation
|
// start element observation
|
||||||
$(document).on('content_changed', '.o_editable', function (event) {
|
$(document).on('content_changed', '.o_editable', function (ev) {
|
||||||
self.trigger('change', this);
|
self.trigger('change', this);
|
||||||
if(!$(this).hasClass('o_dirty')) {
|
if (!ev.__isDirtyHandled) {
|
||||||
$(this).addClass('o_dirty');
|
$(this).addClass('o_dirty');
|
||||||
|
ev.__isDirtyHandled = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -366,6 +367,10 @@ var RTE = Widget.extend({
|
|||||||
|
|
||||||
var editables = history.getEditableHasUndo();
|
var editables = history.getEditableHasUndo();
|
||||||
|
|
||||||
|
$('.o_editable')
|
||||||
|
.destroy()
|
||||||
|
.removeClass('o_editable o_is_inline_editable');
|
||||||
|
|
||||||
var defs = $('.o_dirty')
|
var defs = $('.o_dirty')
|
||||||
.removeAttr('contentEditable')
|
.removeAttr('contentEditable')
|
||||||
.removeClass('o_dirty oe_carlos_danger o_is_inline_editable')
|
.removeClass('o_dirty oe_carlos_danger o_is_inline_editable')
|
||||||
|
|||||||
Reference in New Issue
Block a user