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/18037

Vanessa2ce8ecbf72cf
diff --git a/app/src/constants.ts b/app/src/constants.ts
index 8b22aaf519..34c9a8f135 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -309,6 +309,8 @@ export abstract class Constants {
public static readonly TIMEOUT_INPUT = 256;
public static readonly TIMEOUT_LOAD = 300;
public static readonly TIMEOUT_LONGPRESS = 400;
+ // 鼠标拖拽启动的短暂时间下限:平板鼠标合成 touch 拖拽文件树/画廊/列表操作等元素时,按下后需经过该时间才进拖拽,避免点击 + 号/箭头时抖动误触发 dragstart
+ public static readonly TIMEOUT_MOUSE_DRAG_DELAY = 150;
public static readonly TIMEOUT_MULTIPLE_SELECT = 1500;
public static readonly TIMEOUT_TRANSITION = 300;
public static readonly TIMEOUT_COUNT = 1000;
diff --git a/app/src/util/touchDragBridge.ts b/app/src/util/touchDragBridge.ts
index 961b11f352..6287263dd8 100644
--- a/app/src/util/touchDragBridge.ts
+++ b/app/src/util/touchDragBridge.ts
@@ -24,11 +24,13 @@ const shouldYieldToScroll = (gate: LongPressGate, clientX: number, clientY: numb
}
if (gate.isMouse) {
// 鼠标无滚动冲突(滚动走滚轮),跳过手指的 400ms 长按门槛
- // 但仍需区分点击与拖拽:桌面原生 DnD 在 mousedown 后会短暂等待(系统级约 3-10px + 短时判定)
- // 这里用位移门槛 + 短暂时间下限双重判定,避免点击 + 号/箭头时抖动误触发 dragstart
- // (误触发会合成 dragstart → 文档树加 disablehover → + 号消失、子元素 pointer-events:none)
- const MOUSE_DRAG_DELAY = 150;
- return Date.now() - gate.touchStartTime < MOUSE_DRAG_DELAY;
+ // 但文件树/画廊/列表操作等元素同一手势既可能点击(+ 号、箭头)也可能拖拽,需短暂时间下限区分
+ // 避免点击抖动误触发 dragstart → 文档树加 disablehover → + 号消失、子元素 pointer-events:none
+ // 块标等 requireLongPress=false 的元素本就是要拖的,按下即拖,与桌面原生一致
+ if (gate.requireLongPress) {
+ return Date.now() - gate.touchStartTime < Constants.TIMEOUT_MOUSE_DRAG_DELAY;
+ }
+ return false;
}
if (!gate.requireLongPress) {
return false;