stop event propagation from tag prompt

pull/1/head
ansuz 7 years ago
parent c936e5ae73
commit 1f35798194

@ -191,6 +191,8 @@ define([
var listener; var listener;
var close = Util.once(function (result, ev) { var close = Util.once(function (result, ev) {
ev.stopPropagation();
ev.preventDefault();
var $frame = $(tagger).fadeOut(150, function () { var $frame = $(tagger).fadeOut(150, function () {
stopListening(listener); stopListening(listener);
$frame.remove(); $frame.remove();
@ -198,17 +200,21 @@ define([
}); });
}); });
var $ok = findOKButton(tagger).click(function () { var $ok = findOKButton(tagger).click(function (e) {
var tokens = field.getTokens(); var tokens = field.getTokens();
close(tokens); close(tokens, e);
}); });
var $cancel = findCancelButton(tagger).click(function () { var $cancel = findCancelButton(tagger).click(function (e) {
close(null); close(null, e);
}); });
listenForKeys(function () { listenForKeys(function () {
$ok.click(); $ok.click();
}, function () { }, function () {
$cancel.click(); $cancel.click();
}, tagger);
$(tagger).on('click submit', function (e) {
e.stopPropagation();
}); });
document.body.appendChild(tagger); document.body.appendChild(tagger);

Loading…
Cancel
Save