From 4fa3956b9036f375004af162f5341ee368bc2b2b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 26 May 2026 14:35:09 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/17760 --- app/src/mobile/util/keydown.ts | 6 ++++-- app/src/mobile/util/touch.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/mobile/util/keydown.ts b/app/src/mobile/util/keydown.ts index 86406ec6c..7f2b5ac15 100644 --- a/app/src/mobile/util/keydown.ts +++ b/app/src/mobile/util/keydown.ts @@ -9,10 +9,12 @@ export const mobileKeydown = (app: App, event: KeyboardEvent) => { if (!event.key || filterHotkey(event, app)) { return; } - const protyle = getCurrentEditor().protyle; 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}); + const protyle = getCurrentEditor()?.protyle; + if (protyle) { + execByCommand({command: key, app, protyle, previousRange: protyle.toolbar.range}); + } return true; } }); diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index b082a2fc2..5cbcf0b28 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -78,7 +78,7 @@ export const handleTouchEnd = (event: TouchEvent) => { } } - if (typeof yDiff === "undefined" && window.siyuan.mobile.editor.protyle.options.render.gutter) { + if (typeof yDiff === "undefined" && window.siyuan.mobile.editor?.protyle.options.render.gutter) { const nodeElement = hasClosestBlock(target); if (nodeElement) { if (nodeElement && (nodeElement.classList.contains("list") || nodeElement.classList.contains("li"))) {