Skip to content

手机端上缺失高亮功能 #154

@swiftwind0405

Description

@swiftwind0405

下面是AI给的修复建议,供大佬参考。

问题大概率在这里:

  • TextHighlighter.tsx 之前只监听了 mouseup
  • H5/移动端长按选择文本通常触发的是 selectionchange、touchend、pointerup,不一定触发 mouseup
  • 所以移动端选中了文字,但 Huntly 没检测到选区,自然不会弹出高亮按钮

源码:

  • 文件:huntly/app/client/src/components/highlights/TextHighlighter.tsx
  • 改动:
    • 增加 selectionchange
    • 增加 touchend
    • 增加 pointerup
    • 加了 80ms debounce,等移动端浏览器完成选区更新
    • 给内容区域补了 WebkitUserSelect: 'text' 和 touchAction: 'auto'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions