mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
use bootstrap modal to confirm note deletion which fixes #582
This commit is contained in:
@@ -5,8 +5,11 @@ const $infoContent = $("#info-dialog-content");
|
||||
const $okButton = $("#info-dialog-ok-button");
|
||||
|
||||
let resolve;
|
||||
let $originallyFocused; // element focused before the dialog was opened so we can return to it afterwards
|
||||
|
||||
function info(message) {
|
||||
$originallyFocused = $(':focus');
|
||||
|
||||
utils.closeActiveDialog();
|
||||
|
||||
glob.activeDialog = $dialog;
|
||||
@@ -24,6 +27,11 @@ $dialog.on("hidden.bs.modal", () => {
|
||||
if (resolve) {
|
||||
resolve();
|
||||
}
|
||||
|
||||
if ($originallyFocused) {
|
||||
$originallyFocused.focus();
|
||||
$originallyFocused = null;
|
||||
}
|
||||
});
|
||||
|
||||
$okButton.click(() => $dialog.modal("hide"));
|
||||
|
||||
Reference in New Issue
Block a user