[FIX] web_editor: prevent traceback on destroy link tools
When saving a mailing with the link tools open, link tools' destroy is called after OdooEditor's destroy, causing a traceback when link tools tries to set a history step. task-2733825 closes odoo/odoo#84354 X-original-commit: f565f965fdc15d744efd38cfca9b098e24181e7e Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -179,6 +179,7 @@ export class OdooEditor extends EventTarget {
|
||||
// --------------
|
||||
|
||||
this.document = options.document || document;
|
||||
this.isDestroyed = false;
|
||||
|
||||
this.isMobile = matchMedia('(max-width: 767px)').matches;
|
||||
this.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
@@ -348,6 +349,7 @@ export class OdooEditor extends EventTarget {
|
||||
this._resizeObserver.disconnect();
|
||||
clearInterval(this._snapshotInterval);
|
||||
this._pluginCall('destroy', []);
|
||||
this.isDestroyed = true;
|
||||
}
|
||||
|
||||
sanitize() {
|
||||
|
||||
@@ -66,7 +66,9 @@ const LinkTools = Link.extend({
|
||||
this.$button.removeClass('active');
|
||||
this.options.wysiwyg.odooEditor.observerActive();
|
||||
this.applyLinkToDom(this._getData());
|
||||
this.options.wysiwyg.odooEditor.historyStep();
|
||||
if (!this.options.wysiwyg.odooEditor.isDestroyed) {
|
||||
this.options.wysiwyg.odooEditor.historyStep();
|
||||
}
|
||||
this._observer.disconnect();
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user