fix(reader): 全局禁用原生右键菜单,并优化阅读区选中文本的 AI 触发交互#399
Open
rmtd418 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动说明
这个 PR 主要处理阅读器里的两个交互问题:
背景
当前桌面端在阅读区域内右键时,会弹出系统原生右键菜单。
这个菜单对当前阅读场景没有实际帮助,反而会干扰已有的阅读器交互,看起来也比较突兀。
另外,选中文本后的 AI 触发原本更依赖弹出的操作菜单,交互链路偏长。这个 PR 顺手把相关触发逻辑做了收敛。
具体改动
1. 全局禁用原生右键菜单
在桌面端应用层统一拦截
contextmenu事件,避免继续弹出系统原生右键菜单。效果:
2. 优化选中文本后的 AI 触发交互
阅读区选中文本后,将选区的多个
rect合并为一个整体矩形边界。交互调整为:
Ask AI这样做的目的:
影响范围
改动文件:
packages/app/src/components/layout/AppLayout.tsxpackages/app/src/components/reader/ReaderView.tsxpackages/app/src/components/reader/SelectionPopover.tsx测试说明
我这边只在 Windows 桌面端 做了实际测试。
未对 macOS / Linux / 移动端做验证。
本次验证基于本地同步时的上游
main:8546d631.3.3已验证场景:
说明
这个 PR 只处理交互层问题,不涉及协议、模型或后端逻辑调整。