mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +01:00
This commit is contained in:
parent
dd7679eac6
commit
eb22eb9fb9
2 changed files with 25 additions and 9 deletions
|
|
@ -87,15 +87,25 @@ export class Dialog {
|
|||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
const confirmElement = document.querySelector("#confirmDialogConfirmBtn");
|
||||
if (event.key === "Escape") {
|
||||
this.destroy();
|
||||
if (confirmElement) {
|
||||
confirmElement.previousElementSibling.previousElementSibling.dispatchEvent(new CustomEvent("click"));
|
||||
} else {
|
||||
this.destroy();
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (!event.shiftKey && !isCtrl(event) && event.key === "Enter" && enterEvent) {
|
||||
enterEvent();
|
||||
if (confirmElement) {
|
||||
confirmElement.dispatchEvent(new CustomEvent("click"));
|
||||
} else {
|
||||
enterEvent();
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue