mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 18:05:55 +01:00
use bootstrap modal to confirm note deletion which fixes #582
This commit is contained in:
@@ -7,8 +7,11 @@ const $custom = $("#confirm-dialog-custom");
|
||||
const DELETE_NOTE_BUTTON_ID = "confirm-dialog-delete-note";
|
||||
|
||||
let resolve;
|
||||
let $originallyFocused; // element focused before the dialog was opened so we can return to it afterwards
|
||||
|
||||
function confirm(message) {
|
||||
$originallyFocused = $(':focus');
|
||||
|
||||
$custom.hide();
|
||||
|
||||
glob.activeDialog = $dialog;
|
||||
@@ -55,6 +58,11 @@ $dialog.on("hidden.bs.modal", () => {
|
||||
if (resolve) {
|
||||
resolve(false);
|
||||
}
|
||||
|
||||
if ($originallyFocused) {
|
||||
$originallyFocused.focus();
|
||||
$originallyFocused = null;
|
||||
}
|
||||
});
|
||||
|
||||
function doResolve(ret) {
|
||||
|
||||
Reference in New Issue
Block a user