[FIX] web_editor: remove warning on save

Pop-up warning was appearing when saving website pages.

task-2666177

closes odoo/odoo#79842

X-original-commit: 2b35640d9e1fb7f037eee1983a19876879936d67
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
This commit is contained in:
Sébastien Geelen (sge)
2021-11-16 13:03:17 +00:00
parent f0d392ad7b
commit 3a02d3970d
@@ -212,11 +212,12 @@ const Wysiwyg = Widget.extend({
}, options));
await this._insertSnippetMenu();
window.addEventListener('beforeunload', (event) => {
this._onBeforeUnload = (event) => {
if (this.isDirty()) {
event.returnValue = _t('This document is not saved!');
}
});
};
window.addEventListener('beforeunload', this._onBeforeUnload);
}
if (this.options.getContentEditableAreas) {
$(this.options.getContentEditableAreas()).find('*').off('mousedown mouseup click');
@@ -676,7 +677,7 @@ const Wysiwyg = Widget.extend({
await this._saveViewBlocks();
this.trigger_up('edition_was_stopped');
window.onbeforeunload = null;
window.removeEventListener('beforeunload', this._onBeforeUnload);
if (reload) {
window.location.reload();
}