mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
Clone tag dialog on escape key, but not close modal
This commit is contained in:
@@ -61,6 +61,18 @@ const QnDialogs = {
|
|||||||
input.val(selectedTags.map(function (value) { return value.id; }));
|
input.val(selectedTags.map(function (value) { return value.id; }));
|
||||||
input.trigger("change");
|
input.trigger("change");
|
||||||
|
|
||||||
|
$('.select2-input').on("keyup", function (event) {
|
||||||
|
if (event.keyCode === 27) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
input.select2('close');
|
||||||
|
if (callback !== undefined) {
|
||||||
|
callback(false, input.select2("data"));
|
||||||
|
}
|
||||||
|
$(dialogId).ocdialog('close');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// wrap callback in _.once():
|
// wrap callback in _.once():
|
||||||
// only call callback once and not twice (button handler and close
|
// only call callback once and not twice (button handler and close
|
||||||
// event) but call it for the close event, if ESC or the x is hit
|
// event) but call it for the close event, if ESC or the x is hit
|
||||||
@@ -91,17 +103,19 @@ const QnDialogs = {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$(dialogId).ocdialog({
|
$(dialogId).ocdialog({
|
||||||
closeOnEscape: true,
|
closeOnEscape: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
buttons: buttonlist,
|
buttons: buttonlist,
|
||||||
close: function () {
|
close: function () {
|
||||||
|
input.select2("close");
|
||||||
// callback is already fired if Yes/No is clicked directly
|
// callback is already fired if Yes/No is clicked directly
|
||||||
if (callback !== undefined) {
|
if (callback !== undefined) {
|
||||||
callback(false, input.val());
|
callback(false, input.val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
input.focus();
|
|
||||||
|
$('.select2-input').focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_getMessageTemplate: function () {
|
_getMessageTemplate: function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user