Conversation
…ction PDF (and other formats without usable text selection) could not take notes: the selection popover's highlight/note buttons are format-gated (disabled: isPdf), and scanned PDFs have no text layer at all. Adds a page-level note fallback, reusing the existing highlight-with-note storage (zero schema/sync changes): - NotebookPanel header gains an add-note button (all formats; opens the inline editor anchored to the current position) - ReaderView.handleAddPageNote captures tab.currentCfi (PDF: page-level fake CFI that resolves back to the page; EPUB: current location CFI), current page number and chapter title - The editor shows page context instead of quoted text when the note has no selected text; saving an empty page-level note is disabled (it would be an invisible row) - List rendering falls back to a page-note placeholder when highlight.text is empty (NotebookPanel + NotesPage) - Clicking the note navigates via the existing navigateToCfi path — PDF fake CFIs resolve back to the recorded page The PDF selection popover gate stays as-is (per product decision); this button is the fallback entry.
…r labels
- Header button icon NotebookPen -> Plus (an add affordance, not edit)
- Remove the duplicated icon+label left inside the save button by the
previous patch (rendered as two 保存 buttons)
- Page-level note labels show the page number parsed from the fixed-layout
fake CFI ("第N页笔记"); reflowable books fall back to the generic badge
(chapter title below provides context)
…refix
i18n resources merge all locale files into a single translation namespace
(reader.json's content is top-level, not nested under a reader key), so
t("reader.notebook.pageNoteWithPage") looked up a nonexistent path and
rendered the literal key. Use notebook.pageNoteWithPage / notebook.pageNoteBadge.
NotesPage was already on the helper and picked up the fix automatically.
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.
问题
添加笔记的现有入口只有"划词":选中文字 → 弹出菜单 → 高亮/添加笔记。但部分格式不支持这个流程——PDF 的选择弹窗中高亮/笔记按钮被禁用(
SelectionPopover中disabled: isPdf的格式门槛),扫描版 PDF 更是没有文字层可选。结果:这类格式的书籍完全无法添加笔记。方案:页级笔记兜底
在阅读器的笔记本面板头部新增"添加页级笔记"按钮(所有格式可见):
实现要点
highlights表,本就在同步范围内)。页级笔记 =text为空串、cfi为当前位置的 Highlight 行;epubcfi(/6/N),N=(页码)×2),可反向解析出页码用于列表标题(第 N 页笔记);EPUB 等流式格式的 CFI 不含页码,回退显示通用占位(下方的章节名提供上下文);highlight.text为空的条目在笔记本面板和首页笔记页显示斜体占位("页级笔记" / "第 N 页笔记"),不再渲染空引号;isPdf门槛保持不变(PDF 划词路径质量不稳,本 PR 不放开;页级按钮是兜底入口)。验证
已知小瑕疵
导出笔记时,页级笔记的"引用文本"渲染为空引号(导出器尚未对空 text 做占位处理),后续可在导出器过滤。
注:本次代码修改和PR信息由AI生成