Skip to content

feat(reading-mode): 在当前会话中打开阅读模式,添加退出按钮#21681

Closed
shellmind112 wants to merge 400 commits intoanomalyco:devfrom
Science-Discovery:feat/reading-mode-inline
Closed

feat(reading-mode): 在当前会话中打开阅读模式,添加退出按钮#21681
shellmind112 wants to merge 400 commits intoanomalyco:devfrom
Science-Discovery:feat/reading-mode-inline

Conversation

@shellmind112
Copy link
Copy Markdown

关联 Issue

Closes #21679

变更说明

问题 1:点击阅读模式不再新开会话

修改 file-tabs.tsx 中的 openPdfInReadingMode:移除 API 调用(不再创建新 reading mode session),直接导航到当前 session 的阅读路由并携带文件路径参数:

/:dir/session/:currentId/reading?pdf=<encodedFilePath>

问题 2:添加退出按钮(工具栏最右侧)

  • pdf-viewer.html + pdf-viewer-aether.js:在 toolbarViewerRight 末尾添加 aetherCloseReadingMode 按钮,full 模式下显示
  • pdf-viewer-aether.css + aether-close-reading-mode.svg:为退出按钮添加样式和 ✕ 图标
  • pdf-viewer-shell-official.tsx:处理 closereadingmode postMessage,触发 onCloseReadingMode 回调
  • reading-pdf-viewer-official.tsx / reading-mode-panel.tsx:透传 onCloseReadingMode prop
  • reading-session.tsx:点击退出时导航回 /:dir/session/:id,reading-session 的 cleanup 逻辑会自动恢复之前的审阅面板和文件树状态

overridePdfUrl 机制

reading-session.tsx 读取 ?pdf 参数并构造文件 URL 传给 ReadingModePanel

  • PDF 直接从文件路径提供,不经过 reading-mode session API
  • ReadingFirstReadGate(AI 预读)在 override 模式下跳过

Test Plan

  • 在文件 Tab 中打开 PDF,点击「打开阅读模式」图标,确认停留在当前会话(不跳转到新会话)
  • 进入阅读模式后,确认工具栏最右侧出现 ✕ 退出按钮
  • 点击退出按钮,确认回到普通会话视图
  • 若之前审阅面板(审查 Tab)已打开,退出后确认其恢复展开状态
  • 文本选中 → Ask 操作仍正常工作(发送到当前会话)

🤖 Generated with Claude Code

Spin-Particle and others added 30 commits March 25, 2026 14:07
* add proxy setting and automatic packaging (with standard yml file)

* update uv manage

* fix bug in packaging
feat: imporve file-tree ui performance
code-JDS and others added 25 commits April 8, 2026 14:45
refactor: simplify directory selection dialog and improve list filter UX
- Move wechat connection state to persistent context module that
  survives dialog close/focus loss
- Remove SSE disconnect -> auto stop bridge logic on server side
- Add POST /wechat/ping heartbeat route for lease renewal
- Add lockHolder to /status response; skip locked UI when self-held
- Add reconnecting/stolen states with auto-retry and preemption detection
- Simplify dialog-wechat to pure presentation layer
Change output format to: <项目> · <会话> · <mode> · <model>
Remove redundant status lines from /session, /project, /model outputs
fix(wechat): decouple connection lifecycle from dialog visibility
When the web page is closed without disconnecting WeChat, the file-based
lock persists with a stale clientId. A new page generates a fresh clientId
that doesn't match, causing a deadlock ("微信已被其他客户端连接").

Three-pronged fix:
- Auto-expire locks older than 30s (ping interval is 10s, so 3 missed
  pings means the client is dead)
- Add forceLock API and /wechat/start?force=true for manual takeover
- Release lock on beforeunload via navigator.sendBeacon
Time-only format (e.g. 12:53) was ambiguous across sessions.
Now displays YYYY-MM-DD-HH:mm (e.g. 2026-04-08-12:53) for both
the chat message header and the fork dialog.
fix(wechat): allow lock recovery when page is closed without disconnect
…tory

When AETHER_WORK_DIR is not set, the WeChat bridge previously fell back
to Path.cwd(), which resolves to the Aether installation directory.
Now it queries /project/recent and picks the most recently active
project, falling back to the user's home directory if no projects exist.
fix: harden legacy database migration flow
fix(wechat-bridge): use most recently active project as default directory
Replace the multi-database merge path with a conservative latest-db copy so missing targets can be recovered without risking existing user data.
Clarify how users start Aether after web installs and keep the devtest Windows installer in sync with the generated launcher flow.
…eplies

fix: ensure session for slash replies
…d-controls

feat(wechat-bridge): add WeChat slash command controls
fix: rollback risky legacy db merge flow
…dance

feat: add devtest installers and launch guidance
…conversation

- Clicking "Open in Reading Mode" now navigates to the current session's
  reading route (?pdf=<path>) instead of creating a new dedicated session
- Add exit button (✕) at the far right of the PDF viewer toolbar; clicking
  it navigates back to the regular session view and restores the previous
  review panel / file tree state
- ReadingModePanel accepts overridePdfUrl prop to serve PDF directly from
  file path, bypassing the reading-mode session API
- ReadingFirstReadGate is skipped when using override URL

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@shellmind112
Copy link
Copy Markdown
Author

误提,关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

阅读模式:点击后新开会话,且无退出按钮

10 participants