From 57aaca755575b36118f3e4e34e1efa95710772ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Wed, 15 Mar 2023 15:55:13 +0000 Subject: [PATCH] [FIX] web_editor: prevent inline content on blur Avoid inlining the content of html_field during blur to ensure we don't break edition. Blur occurred when opening dynamic placeholder popup or media modal. If, during those process, we inline the document content, the Editor will lose the reference to the current caret position inside the document. Because Elements where overridden or changed by the `toInline` function. If the editor cannot put the caret back in the previous correct position, it will put it back at the end of the document. And thus inserting the dynamicPlaceholder or new media element at the wrong place inside the document. task-3222474 X-original-commit: 28efe94a08d2747936ac4aa78f1d9e53545ee8b2 Part-of: odoo/odoo#124020 --- addons/web_editor/static/src/js/backend/html_field.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 01d5518e726..64186cdd09b 100644 --- a/addons/web_editor/static/src/js/backend/html_field.js +++ b/addons/web_editor/static/src/js/backend/html_field.js @@ -604,7 +604,10 @@ export class HtmlField extends Component { } } _onWysiwygBlur() { - this.commitChanges(); + // Avoid save on blur if the html field is in inline mode. + if (!this.props.isInlineStyle) { + this.commitChanges(); + } } async _onReadonlyClickChecklist(ev) { if (ev.offsetX > 0) {