From 44d4387ca1857e44bb8b7b4e10b4ac4bb6f9bc84 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 6 May 2024 00:26:43 +0800 Subject: [PATCH] :sparkles: fix https://github.com/siyuan-note/siyuan/issues/10342 --- app/src/mobile/util/keydown.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/src/mobile/util/keydown.ts b/app/src/mobile/util/keydown.ts index 4a7073e0d..1a37a1362 100644 --- a/app/src/mobile/util/keydown.ts +++ b/app/src/mobile/util/keydown.ts @@ -9,10 +9,35 @@ export const mobileKeydown = (app: App, event: KeyboardEvent) => { return; } const protyle = getCurrentEditor().protyle; - Object.keys(window.siyuan.config.keymap.general).find((key) => { + const matchGeneral = Object.keys(window.siyuan.config.keymap.general).find((key) => { if (matchHotKey(window.siyuan.config.keymap.general[key].custom, event)) { execByCommand({command: key, app, protyle, previousRange: protyle.toolbar.range}); return true; } }); + + if (matchGeneral) { + event.preventDefault(); + return; + } + + let matchCommand = false; + app.plugins.find(item => { + item.commands.find(command => { + if (command.callback && + !command.fileTreeCallback && !command.editorCallback && !command.dockCallback && !command.globalCallback + && matchHotKey(command.customHotkey, event)) { + matchCommand = true; + command.callback(); + return true; + } + }); + if (matchCommand) { + return true; + } + }); + if (matchCommand) { + event.preventDefault(); + return true; + } }