[FIX] web_editor: make sure html editor does not ignore changes
For some reason, Summernote does not trigger a change event in some cases. It looks like it happens in 'codeview' mode, and when the change in question is only a backspace key event. Maybe it listen for keypress and backspace do not trigger keypress event. In any cases, the situation is that it is not easy to clear an html field: going in edit mode, then selecting the content and pressing backspace will not work before this commit. With this commit, we specifically compare the value in the editor with the current value to determine if the field is dirty.
This commit is contained in:
@@ -43,6 +43,9 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
|
||||
var layoutInfo = this.$textarea.data('layoutInfo');
|
||||
$.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo, false);
|
||||
}
|
||||
if (this._getValue() !== this.value) {
|
||||
this._isDirty = true;
|
||||
}
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user