Vanessa 2024-11-15 00:38:44 +08:00
parent cb2560ffda
commit 5e3d472edb
3 changed files with 6 additions and 0 deletions

View file

@ -876,6 +876,9 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {
}
if (event.key === "Delete" || (event.key === "Backspace" && isMac())) {
window.siyuan.menus.menu.remove();
if (document.querySelector(`.b3-dialog--open[data-key="${Constants.DIALOG_CONFIRM}"]`)) {
return;
}
deleteFiles(liElements);
return true;
}

View file

@ -126,6 +126,7 @@ export abstract class Constants {
public static readonly LOCAL_EMOJIS = "local-emojis";
// dialog
public static readonly DIALOG_CONFIRM = "dialog-confirm";
public static readonly DIALOG_OPENCARD = "dialog-opencard";
public static readonly DIALOG_MAKECARD = "dialog-makecard";
public static readonly DIALOG_VIEWCARDS = "dialog-viewcards";

View file

@ -1,5 +1,6 @@
import {isMobile} from "../util/functions";
import {Dialog} from "./index";
import {Constants} from "../constants";
export const confirmDialog = (title: string, text: string,
confirm?: (dialog?: Dialog) => void,
@ -33,4 +34,5 @@ export const confirmDialog = (title: string, text: string,
}
dialog.destroy();
});
dialog.element.setAttribute("data-key", Constants.DIALOG_CONFIRM);
};