Vanessa 2023-08-28 10:50:03 +08:00
parent 5d4e497a58
commit b09a276a7d
9 changed files with 25 additions and 4 deletions

View file

@ -56,6 +56,7 @@ import {openRecentDocs} from "../business/openRecentDocs";
import {App} from "../index";
import {commandPanel} from "../plugin/commandPanel";
import {toggleDockBar} from "../layout/dock/util";
import {workspaceMenu} from "../menus/workspace";
const getRightBlock = (element: HTMLElement, x: number, y: number) => {
let index = 1;
@ -579,6 +580,11 @@ export const globalShortcut = (app: App) => {
return;
}
if (bindMenuKeydown(event)) {
event.preventDefault();
return;
}
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
const viewCardsDialog = window.siyuan.dialogs.find(item => {
if (item.element.getAttribute("data-key") === "viewCards") {
@ -763,6 +769,12 @@ export const globalShortcut = (app: App) => {
return;
}
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.mainMenu.custom, event)) {
workspaceMenu(app, document.querySelector("#barWorkspace").getBoundingClientRect());
event.preventDefault();
return;
}
if (matchHotKey(window.siyuan.config.keymap.general.goForward.custom, event)) {
goForward(app);
event.preventDefault();
@ -1308,7 +1320,9 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {
hasClosestByClassName(target, "protyle", true)) {
return false;
}
if (bindMenuKeydown(event)) {
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
(event.code.startsWith("Arrow") || event.code === "Enter") &&
!event.altKey && !event.shiftKey && !isCtrl(event)) {
event.preventDefault();
return true;
}