mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-05 16:28:49 +01:00
🎨 快照回车绑定
This commit is contained in:
parent
ea245973ad
commit
7ee9691a8c
2 changed files with 8 additions and 2 deletions
|
|
@ -66,9 +66,9 @@ export class Dialog {
|
|||
});
|
||||
}
|
||||
|
||||
public bindInput(inputElement: HTMLInputElement, enterEvent?: () => void) {
|
||||
public bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void) {
|
||||
inputElement.focus();
|
||||
inputElement.addEventListener("keydown", (event) => {
|
||||
inputElement.addEventListener("keydown", (event: KeyboardEvent) => {
|
||||
if (event.isComposing) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -423,6 +423,9 @@ export const openHistory = () => {
|
|||
const textareaElement = genRepoDialog.element.querySelector("textarea");
|
||||
textareaElement.focus();
|
||||
const btnsElement = genRepoDialog.element.querySelectorAll(".b3-button");
|
||||
genRepoDialog.bindInput(textareaElement, () => {
|
||||
(btnsElement[1] as HTMLButtonElement).click();
|
||||
});
|
||||
btnsElement[0].addEventListener("click", () => {
|
||||
genRepoDialog.destroy();
|
||||
});
|
||||
|
|
@ -475,6 +478,9 @@ export const openHistory = () => {
|
|||
btnsElement[0].addEventListener("click", () => {
|
||||
genTagDialog.destroy();
|
||||
});
|
||||
genTagDialog.bindInput(inputElement, () => {
|
||||
(btnsElement[1] as HTMLButtonElement).click();
|
||||
});
|
||||
btnsElement[1].addEventListener("click", () => {
|
||||
fetchPost("/api/repo/tagSnapshot", {
|
||||
id: target.parentElement.getAttribute("data-id"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue