diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index aa23bafa1..fcf2b5c20 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -48,6 +48,7 @@ import {webFrame} from "electron"; import {openHistory} from "../history/history"; import {openCard} from "../card/openCard"; import {lockScreen} from "../dialog/processSystem"; +import {isWindow} from "./functions"; const getRightBlock = (element: HTMLElement, x: number, y: number) => { let index = 1; @@ -393,6 +394,7 @@ export const globalShortcut = () => { dialogArrow(switchDialog.element, event); return; } + const isTabWindow = isWindow(); if (event.ctrlKey && !event.metaKey && event.key === "Tab") { if (switchDialog && switchDialog.element.parentElement) { return; @@ -421,13 +423,17 @@ export const globalShortcut = () => { }); } let dockHtml = ""; - getAllDocks().forEach((item, index) => { - dockHtml += `
  • + if (!isTabWindow) { + dockHtml = '"; + } let range: Range; if (getSelection().rangeCount > 0) { range = getSelection().getRangeAt(0).cloneRange(); @@ -437,9 +443,8 @@ export const globalShortcut = () => { title: window.siyuan.languages.switchTab, content: `
    -
    -
      ${dockHtml}
    -
      ${tabHtml}
    +
    ${dockHtml} + ${tabHtml}
    `, @@ -524,7 +529,7 @@ export const globalShortcut = () => { } /// #endif - if (matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) { + if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) { event.preventDefault(); syncGuide(document.querySelector("#barSync")); return; @@ -539,12 +544,12 @@ export const globalShortcut = () => { event.preventDefault(); return; } - if (matchHotKey(window.siyuan.config.keymap.general.dataHistory.custom, event)) { + if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.dataHistory.custom, event)) { openHistory(); event.preventDefault(); return; } - if (!window.siyuan.config.readonly && matchHotKey(window.siyuan.config.keymap.general.config.custom, event)) { + if (!isTabWindow && !window.siyuan.config.readonly && matchHotKey(window.siyuan.config.keymap.general.config.custom, event)) { openSetting(); event.preventDefault(); return; @@ -580,7 +585,7 @@ export const globalShortcut = () => { event.preventDefault(); return; } - if (matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) { + if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) { newDailyNote(); if (target.classList.contains("protyle-wysiwyg") || target.tagName === "TABLE" || @@ -736,12 +741,12 @@ export const globalShortcut = () => { } // 文件树的操作 - if (fileTreeKeydown(event)) { + if (!isTabWindow && fileTreeKeydown(event)) { return; } // 面板的操作 - if (panelTreeKeydown(event)) { + if (!isTabWindow && panelTreeKeydown(event)) { return; } @@ -843,8 +848,12 @@ const dialogArrow = (element: HTMLElement, event: KeyboardEvent) => { currentLiElement.parentElement.firstElementChild.classList.add("b3-list-item--focus"); } } else if (event.key === "ArrowLeft" || event.key === "ArrowRight") { - const sideElement = currentLiElement.parentElement.previousElementSibling || currentLiElement.parentElement.nextElementSibling; - (sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus"); + if (isWindow()) { + currentLiElement.classList.add("b3-list-item--focus"); + } else { + const sideElement = currentLiElement.parentElement.previousElementSibling || currentLiElement.parentElement.nextElementSibling; + (sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus"); + } } else if (event.key === "Enter") { const currentType = currentLiElement.getAttribute("data-type") as TDockType; if (currentType) { @@ -893,20 +902,23 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
  • `; }); let dockHtml = ""; - getAllDocks().forEach((item, index) => { - dockHtml += `
  • + if (!isWindow()) { + dockHtml = '"; + } const dialog = new Dialog({ title: window.siyuan.languages.recentDocs, content: `
    -
    -
      ${dockHtml}
    -
      ${tabHtml}
    +
    ${dockHtml} + ${tabHtml}
    `,