From 85a5d76728e93c5826e8f3f5a4953ea5e2abb4aa Mon Sep 17 00:00:00 2001 From: "Thomas Josse (thjo)" Date: Tue, 12 Dec 2023 12:53:49 +0100 Subject: [PATCH] [IMP] web_editor: adding dirtyness check when in collab mode This commit adds a new event listener on the odooEditor which listens for external history steps (if collab mode is enabled), and changes the state of the record's dirtyness when a user receives external steps. This way a user will see that the record has been modified when he is editing a collaborative html field. task-3609594 closes odoo/odoo#145928 Related: odoo/enterprise#51579 Signed-off-by: Nicolas Bayet (nby) --- addons/web_editor/static/src/js/backend/html_field.js | 6 ++++++ 1 file changed, 6 insertions(+) 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 85dd221a7a0..563d7a69b03 100644 --- a/addons/web_editor/static/src/js/backend/html_field.js +++ b/addons/web_editor/static/src/js/backend/html_field.js @@ -315,6 +315,12 @@ export class HtmlField extends Component { this.props.record.model.bus.trigger("FIELD_IS_DIRTY", this._isDirty()) ); + if (this.props.isCollaborative) { + this.wysiwyg.odooEditor.addEventListener("onExternalHistorySteps", () => + this.props.record.model.bus.trigger("FIELD_IS_DIRTY", this._isDirty()) + ); + } + this.isRendered = true; } /**