From aef01e1148139958c2b3ee0d5766af4d2484000b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 9 Jul 2022 10:03:46 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5379 --- app/src/util/globalShortcut.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index eeead8d07..847b707e0 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -552,8 +552,16 @@ export const globalShortcut = () => { event.stopPropagation(); let activeTabElement = document.querySelector(".block__icons--active"); if (activeTabElement && activeTabElement.getBoundingClientRect().width > 0) { - const type = activeTabElement.parentElement.className.split("sy__")[1] as TDockType; - getDockByType(type).toggleModel(type, false, true); + let type: TDockType + Array.from(activeTabElement.parentElement.classList).find(item => { + if (item.startsWith("sy__")) { + type = item.replace("sy__", "") as TDockType; + return true; + } + }); + if (type) { + getDockByType(type).toggleModel(type, false, true); + } return; } activeTabElement = document.querySelector(".layout__wnd--active .item--focus");