summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGorash <chm@odoo.com>2019-05-13 09:24:51 +0000
committerGorash <chm@odoo.com>2019-05-22 11:49:52 +0000
commit4cbbab3d2823e7ba99137e5d0d91ad3ca259ce4d (patch)
treef07fc1bd7d4b223b30d9e557e5517d7cbec85fd5
parent9fd27ff1018f88032c92d876e9528299f825029f (diff)
[FIX] web_editor: don't close all modal on click an 'x' help modal
We monkey patch summernote here to fix the issue, but the summernote will not update and are removed in V13.
-rw-r--r--addons/web_editor/static/lib/summernote/summernote.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/addons/web_editor/static/lib/summernote/summernote.js b/addons/web_editor/static/lib/summernote/summernote.js
index 0f9dfaef656..5cebec404d9 100644
--- a/addons/web_editor/static/lib/summernote/summernote.js
+++ b/addons/web_editor/static/lib/summernote/summernote.js
@@ -147,7 +147,7 @@ var dialog = renderer.create('<div class="modal" aria-hidden="false" tabindex="-
(options.title
? ' <div class="modal-header">' +
' <h4 class="modal-title">' + options.title + '</h4>' +
- ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>' +
+ ' <button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>' +
' </div>' : ''),
' <div class="modal-body">' + options.body + '</div>',
(options.footer
@@ -229,11 +229,16 @@ var ui = {
onDialogHidden: function ($dialog, handler) {
$dialog.one('hidden.bs.modal', handler);
},
- showDialog: function ($dialog) {
+ showDialog: function ($dialog, onClose) {
+ $dialog.find('.close').on('click', function (ev) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ onClose();
+ });
$dialog.modal('show');
},
hideDialog: function ($dialog) {
- $dialog.modal('hide');
+ $dialog.detach().modal('hide');
},
createLayout: function ($note, options) {
var $editor = (options.airMode ? ui.airEditor([
@@ -5986,7 +5991,7 @@ var LinkDialog = /** @class */ (function () {
deferred.reject();
}
});
- _this.ui.showDialog(_this.$dialog);
+ _this.ui.showDialog(_this.$dialog, _this.destroy.bind(_this));
}).promise();
};
/**
@@ -6174,7 +6179,7 @@ var ImageDialog = /** @class */ (function () {
deferred.reject();
}
});
- _this.ui.showDialog(_this.$dialog);
+ _this.ui.showDialog(_this.$dialog, _this.destroy.bind(_this));
});
};
return ImageDialog;
@@ -6464,7 +6469,7 @@ var VideoDialog = /** @class */ (function () {
deferred.reject();
}
});
- _this.ui.showDialog(_this.$dialog);
+ _this.ui.showDialog(_this.$dialog, _this.destroy.bind(_this));
});
};
return VideoDialog;
@@ -6530,7 +6535,7 @@ var HelpDialog = /** @class */ (function () {
_this.context.triggerEvent('dialog.shown');
deferred.resolve();
});
- _this.ui.showDialog(_this.$dialog);
+ _this.ui.showDialog(_this.$dialog, _this.destroy.bind(_this));
}).promise();
};
HelpDialog.prototype.show = function () {