From e014d6e1f79b8f467d02a70c797d2d0eb8814e52 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 4 Apr 2023 19:52:00 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/7881 --- app/src/util/globalShortcut.ts | 42 ++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index e889b8c0b..f73f123d5 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -69,9 +69,13 @@ const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => { let target = event.target as HTMLElement; while (!target.isSameNode(switchDialog.element)) { if (target.classList.contains("b3-list-item")) { - const currentType = target.getAttribute("data-type") as TDockType; + const currentType = target.getAttribute("data-type"); if (currentType) { - getDockByType(currentType).toggleModel(currentType, true); + if (currentType === "riffCard") { + openCard(); + } else { + getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true); + } } else { const currentId = target.getAttribute("data-id"); getAllTabs().find(item => { @@ -358,9 +362,13 @@ export const globalShortcut = () => { currentLiElement.removeAttribute("data-original"); currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus"); } - const currentType = currentLiElement.getAttribute("data-type") as TDockType; + const currentType = currentLiElement.getAttribute("data-type"); if (currentType) { - getDockByType(currentType).toggleModel(currentType, true); + if (currentType === "riffCard") { + openCard() + } else { + getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true); + } if (document.activeElement) { (document.activeElement as HTMLElement).blur(); } @@ -465,9 +473,14 @@ export const globalShortcut = () => { } let dockHtml = ""; if (!isTabWindow) { - dockHtml = '