[FIX] web_editor: no rerender when content is reset with empty string
This event listener was added for the `historyStep` event of the editor in [1] as a proxy for the `input` event of the editable node. This was wrong because the `historyStep` event is also triggered at other times than when the user makes an input. In particular, it is called when switching records. In such case, the new value from props can be '' which is not suitable for edition, so it is replaced with '<p><br></p>'. But since that happens in a function that is going to call `_historyStep` and the editing value was just changed to something else that the value received in props, the listener from [1] would make it dirty and thus trigger a re-render etc. This commit fixes the issue by modifying the listener in such a way that it listens to the proper event it was intended to target. [1]: f56e3bca2456f04616982a9a0e77b8d4c5a0abff X-original-commit: 384ff11f06ba86360f1993cf0c8a17c2dbaa11de Part-of: odoo/odoo#113811
This commit is contained in:
@@ -314,7 +314,7 @@ export class HtmlField extends Component {
|
||||
this.wysiwyg.toolbar.$el.append($codeviewButtonToolbar);
|
||||
$codeviewButtonToolbar.click(this.toggleCodeView.bind(this));
|
||||
}
|
||||
this.wysiwyg.odooEditor.addEventListener("historyStep", () =>
|
||||
this.wysiwyg.odooEditor.editable.addEventListener("input", () =>
|
||||
this.props.setDirty(this._isDirty())
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user