Move close modal function to global event

This commit is contained in:
Mojca Lorber 2020-09-22 11:30:05 +02:00
parent 23d6d93074
commit 0ad93d1288

View file

@ -35,6 +35,12 @@ var SmartAnnotation = (function() {
return $html; return $html;
} }
function initAtWhoClose() {
$('.atwho-view').on('click', '.dismiss', function() {
$('.atwho-view').hide();
});
}
// Generates suggestion dropdown filter // Generates suggestion dropdown filter
function generateFilterMenu() { function generateFilterMenu() {
var menu = ''; var menu = '';
@ -138,9 +144,6 @@ var SmartAnnotation = (function() {
$(this).addClass('btn-primary').removeClass('btn-light'); $(this).addClass('btn-primary').removeClass('btn-light');
$(field).click().focus(); $(field).click().focus();
}); });
$currentAtWho.off().on('click', '.dismiss', function() {
$currentAtWho.hide();
});
if ($currentAtWho.find('.tab-pane.active').length === 0) { if ($currentAtWho.find('.tab-pane.active').length === 0) {
let filterType = DEFAULT_SEARCH_FILTER.tag; let filterType = DEFAULT_SEARCH_FILTER.tag;
@ -202,7 +205,8 @@ var SmartAnnotation = (function() {
} }
return { return {
init: init init: init,
initAtWhoClose: initAtWhoClose
}; };
} }
// Closes the atwho popup * needed in repositories to close the popup // Closes the atwho popup * needed in repositories to close the popup
@ -214,6 +218,7 @@ var SmartAnnotation = (function() {
function initialize(field) { function initialize(field) {
var atWho = new SetAtWho(field); var atWho = new SetAtWho(field);
atWho.init(); atWho.init();
atWho.initAtWhoClose();
} }
return Object.freeze({ return Object.freeze({