Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/13207

Vanessa84da440f6afb
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 992d192687..c368c70a35 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -12,7 +12,7 @@ import {Model} from "../layout/Model";
import "../assets/scss/mobile.scss";
import {Menus} from "../menus";
import {addBaseURL, parseSiYuanUriInfo, setNoteBook} from "../util/pathName";
-import {handleTouchEnd, handleTouchMove, handleTouchStart} from "./util/touch";
+import {clearLongPress, handleTouchEnd, handleTouchMove, handleTouchStart} from "./util/touch";
import {fetchGet, fetchPost} from "../util/fetch";
import {initFramework} from "./util/initFramework";
import {initAssets} from "../util/assets";
@@ -178,6 +178,11 @@ class App {
document.addEventListener("touchstart", handleTouchStart, false);
document.addEventListener("touchmove", handleTouchMove, false);
document.addEventListener("touchend", handleTouchEnd, false);
+ document.addEventListener("touchcancel", handleTouchEnd, false);
+ // 系统长按选中文本会接管触摸事件,touchend 可能收不到,用 pointerup 兜底清除多选定定时器
+ window.addEventListener("pointerup", () => {
+ clearLongPress();
+ });
window.addEventListener("keyup", () => {
window.siyuan.ctrlIsPressed = false;
window.siyuan.shiftIsPressed = false;
diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts
index 4a4fef763e..500f077a0a 100644
--- a/app/src/mobile/util/touch.ts
+++ b/app/src/mobile/util/touch.ts
@@ -35,7 +35,7 @@ const popSide = (render = true) => {
};
// 清除长按进入多选的定时器
-const clearLongPress = () => {
+export const clearLongPress = () => {
if (longPressTimer) {
clearTimeout(longPressTimer);
longPressTimer = undefined;