[FIX] web_editor: fixed the traceback on close modal dialog

The issue here is, for modal dialogs (eg newsletter popup), when we close
the dialog, the modal is destroyed and so after the delayed execution due to
timeout, the dialog will not be available and it will generate the issue.

removed delayed execution for the traceback, which is relevant to
the modal dialogs.

task-2075232

closes odoo/odoo#38914

X-original-commit: 93deb25f873f5c4aba239b050e543b23685f5ba0
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
jpr-odoo
2019-10-17 06:26:32 +00:00
committed by fw-bot
parent d534cc71c2
commit 3422b96a73
@@ -674,13 +674,19 @@ var RTEWidget = Widget.extend({
if (this && this.$last && (!$editable.length || this.$last[0] !== $editable[0])) {
var $destroy = this.$last;
history.splitNext();
_.delay(function () {
// In some special cases, we need to clear the timeout.
var lastTimerId = _.delay(function () {
var id = $destroy.data('note-id');
$destroy.destroy().removeData('note-id').removeAttr('data-note-id');
$('#note-popover-'+id+', #note-handle-'+id+', #note-dialog-'+id+'').remove();
}, 150); // setTimeout to remove flickering when change to editable zone (re-create an editor)
this.$last = null;
// for modal dialogs (eg newsletter popup), when we close the dialog, the modal is
// destroyed immediately and so after the delayed execution due to timeout, dialog will
// not be available, leading to trace-back, so we need to clearTimeout for the dialogs.
if ($destroy.hasClass('modal-body')) {
clearTimeout(lastTimerId);
}
}
if ($editable.length && (!this.$last || this.$last[0] !== $editable[0])) {
$editable.summernote(this._getConfig($editable));