diff --git a/addons/web_editor/static/src/js/backend/html_field.js b/addons/web_editor/static/src/js/backend/html_field.js index 93834caad1b..477d5bd6786 100644 --- a/addons/web_editor/static/src/js/backend/html_field.js +++ b/addons/web_editor/static/src/js/backend/html_field.js @@ -397,15 +397,21 @@ export class HtmlField extends Component { } async commitChanges({ urgent } = {}) { if (this._isDirty() || urgent) { + let toInlinePromise; + if (this.wysiwyg) { + this.wysiwyg.odooEditor.observerUnactive('commitChanges'); + await this.wysiwyg.savePendingImages(); + if (this.props.isInlineStyle) { + // Avoid listening to changes made during the _toInline process. + toInlinePromise = this._toInline(); + } + } if (urgent) { await this.updateValue(); } if (this.wysiwyg) { - // Avoid listening to changes made during the _toInline process. - this.wysiwyg.odooEditor.observerUnactive('commitChanges'); - await this.wysiwyg.savePendingImages(); if (this.props.isInlineStyle) { - await this._toInline(); + await toInlinePromise; } this.wysiwyg.odooEditor.observerActive('commitChanges'); }