This commit is contained in:
Vanessa 2023-11-28 09:47:06 +08:00
parent 346897a3d2
commit ed19a91d37
3 changed files with 4 additions and 9 deletions

View File

@ -256,7 +256,7 @@ export const bindMenuKeydown = (event: KeyboardEvent) => {
if (window.siyuan.menus.menu.element.contains(target) && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) { if (window.siyuan.menus.menu.element.contains(target) && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) {
return false; return false;
} }
const eventCode = Constants.KEYCODELIST[event.keyCode] const eventCode = Constants.KEYCODELIST[event.keyCode];
if (eventCode === "↓" || eventCode === "↑") { if (eventCode === "↓" || eventCode === "↑") {
const currentElement = window.siyuan.menus.menu.element.querySelector(".b3-menu__item--current"); const currentElement = window.siyuan.menus.menu.element.querySelector(".b3-menu__item--current");
let actionMenuElement; let actionMenuElement;

View File

@ -3,16 +3,12 @@ import {fetchPost} from "../../util/fetch";
import {writeText} from "../util/compatibility"; import {writeText} from "../util/compatibility";
import { import {
focusBlock, focusBlock,
focusByOffset,
getSelectionOffset, getSelectionOffset,
setFirstNodeRange, setFirstNodeRange,
} from "../util/selection"; } from "../util/selection";
import {netImg2LocalAssets} from "../breadcrumb/action"; import {netImg2LocalAssets} from "../breadcrumb/action";
/// #if !MOBILE
import {openBacklink, openGraph, openOutline} from "../../layout/dock/util";
/// #endif
import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "./getBlock"; import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "./getBlock";
import {hasClosestByAttribute, hasClosestByMatchTag} from "../util/hasClosest"; import {hasClosestByMatchTag} from "../util/hasClosest";
import {hideElements} from "../ui/hideElements"; import {hideElements} from "../ui/hideElements";
import {countBlockWord} from "../../layout/status"; import {countBlockWord} from "../../layout/status";
import {scrollCenter} from "../../util/highlightById"; import {scrollCenter} from "../../util/highlightById";
@ -21,8 +17,7 @@ import {onGet} from "../util/onGet";
import {Constants} from "../../constants"; import {Constants} from "../../constants";
import * as dayjs from "dayjs"; import * as dayjs from "dayjs";
export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent, nodeElement?: HTMLElement, range?: Range) => { export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent, nodeElement?: HTMLElement) => {
const target = event.target as HTMLElement;
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyHPath.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.copyHPath.custom, event)) {
fetchPost("/api/filetree/getHPathByID", { fetchPost("/api/filetree/getHPathByID", {
id: protyle.block.rootID id: protyle.block.rootID

View File

@ -976,7 +976,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
return true; return true;
} }
/// #if !MOBILE /// #if !MOBILE
if (commonHotkey(protyle, event, nodeElement, range)) { if (commonHotkey(protyle, event, nodeElement)) {
return true; return true;
} }
/// #endif /// #endif