[FIX] web_editor: fix onChange event

Ensure the `onChange()` callback is called
after each history steps in the editor.

Call the `_doAction()` directly, to avoid using the
disabled `_doDebouncedAction()`.

task-2760436

closes odoo/odoo#89339

X-original-commit: 18eaabcb4dab4682e3a94e16dbe66ff3c6f35a77
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
This commit is contained in:
Sébastien Geelen (sge)
2022-04-22 08:03:38 +02:00
parent ebf29ba6ee
commit 77178fe5ae
2 changed files with 2 additions and 2 deletions
@@ -489,7 +489,6 @@ export class OdooEditor extends EventTarget {
this.observer = new MutationObserver(records => {
records = this.filterMutationRecords(records);
if (!records.length) return;
this.dispatchEvent(new Event('contentChanged'));
clearTimeout(this.observerTimeout);
if (this._observerTimeoutUnactive.size === 0) {
this.observerTimeout = setTimeout(() => {
@@ -722,6 +721,7 @@ export class OdooEditor extends EventTarget {
this._checkStepUnbreakable = true;
this._recordHistorySelection();
this.dispatchEvent(new Event('historyStep'));
this.dispatchEvent(new Event('contentChanged'));
this.multiselectionRefresh();
}
// apply changes according to some records
@@ -465,7 +465,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
* @param {OdooEvent} ev
*/
_onChange: function (ev) {
this._doDebouncedAction.apply(this, arguments);
this._doAction();
},
/**
* Allows Enter keypress in a textarea (source mode)