重构阅读器导览与朗读#467
Merged
Merged
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.
背景
activeIndex/activeSentence。变更
阅读器导览栏
ReaderToolbar收敛成竖向 rail,统一承载正文排版、主题、朗读和文章目录四个入口。ReaderRailPanel统一浮层容器,桌面在左侧展开,窄屏改为 trigger 下方弹层,Escape可关闭,hover leave 160ms 后再收起。ArticleOutlineMinimap,从正文 DOM 的h1/h2/h3构建目录条目,strip 和 panel 使用同一组ReaderOutlineDomEntry,并通过 30% spy line 计算当前章节。reader-outline-*;主动项计算会过滤非法 rect,并按 heading 顺序排序。句子级朗读与重装饰
reader-sentence-dom/reader-sentence-decoration,把文章文本按 sentence span 包裹成data-reader-sentence-index结构,并通过 Range / 文本分段回填真实 DOM。seek定位,不立刻播放;播放/暂停中则从该句继续play。ReaderTtsEngine新增hasCursor/seek(),stop()和 source reload 会清空游标;globalThis.__syncnosReaderPerformance只暴露聚合计数和耗时,方便排查性能但不泄露正文内容。排版与偏好
TextLayoutPanel现在只保留reset,不再提供三套预设按钮。NarrationPanel把语速滑杆改成固定档位按钮,并在 Web Speech 不可用时禁用对应引擎选项。reader_prefs_v1的默认排版基线和 legacy profile 迁移统一到了同一个默认值,contentWidth上限放宽到 2000,tts.rate范围收窄到 0.8-2。reader_prefs_v1。测试
activeIndex、activeSentence、hasCursor和 debug snapshot 的lastError都清空。tts.rate固定值;在 Web Speech 不可用时,期望 Web 引擎选项被禁用。