From 06ef184c3023c9ce16430699b025ef5253bfe5e2 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 15 Dec 2023 09:25:52 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/9878 --- app/src/boot/globalEvent/keydown.ts | 2 +- app/src/card/openCard.ts | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index 344746656..d403868eb 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -1042,7 +1042,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => { const target = event.target as HTMLElement; if (isNotCtrl(event) && !event.shiftKey && !event.altKey && !["INPUT", "TEXTAREA"].includes(target.tagName) && - ["0", "1", "2", "3", "4", "j", "k", "l", ";", "s", " ", "p"].includes(event.key.toLowerCase())) { + ["0", "1", "2", "3", "4", "j", "k", "l", ";", "s", " ", "p", "enter"].includes(event.key.toLowerCase())) { let cardElement: Element; window.siyuan.dialogs.find(item => { if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.riffCard.custom) { diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.ts index cc2f96e7b..c93d2fd87 100644 --- a/app/src/card/openCard.ts +++ b/app/src/card/openCard.ts @@ -73,7 +73,7 @@ ${window.siyuan.config.flashcard.list ? "card__block--hideli" : ""}" data-type=" (p) - +
@@ -99,7 +99,7 @@ ${window.siyuan.config.flashcard.list ? "card__block--hideli" : ""}" data-type="
- @@ -201,7 +201,7 @@ export const bindCardEvent = (options: { type = "3"; } else if (event.detail === "4" || event.detail === ";") { type = "4"; - } else if (event.detail === " ") { + } else if (event.detail === " " || event.detail === "enter") { type = "-1"; } else if (event.detail === "p") { type = "-2"; @@ -336,17 +336,17 @@ export const bindCardEvent = (options: { hideElements(["toolbar", "hint", "util"], editor.protyle); if (type === "-1") { // 显示答案 if (actionElements[0].classList.contains("fn__none")) { + type = "3" + } else { + editor.protyle.element.classList.remove("card__block--hidemark", "card__block--hideli", "card__block--hidesb", "card__block--hideh"); + actionElements[0].classList.add("fn__none"); + actionElements[1].querySelectorAll(".b3-button").forEach((element, btnIndex) => { + element.previousElementSibling.textContent = options.blocks[index].nextDues[btnIndex]; + }); + actionElements[1].classList.remove("fn__none"); return; } - editor.protyle.element.classList.remove("card__block--hidemark", "card__block--hideli", "card__block--hidesb", "card__block--hideh"); - actionElements[0].classList.add("fn__none"); - actionElements[1].querySelectorAll(".b3-button").forEach((element, btnIndex) => { - element.previousElementSibling.textContent = options.blocks[index].nextDues[btnIndex]; - }); - actionElements[1].classList.remove("fn__none"); - return; - } - if (type === "-2") { // 上一步 + } else if (type === "-2") { // 上一步 if (actionElements[0].classList.contains("fn__none")) { return; }