mirror of
https://github.com/readest/readest.git
synced 2026-07-09 16:00:16 +00:00
fix(kosync): populate chapter field on synced annotations (#4134)
Some checks failed
Deploy to vercel on merge / build_and_deploy (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL Advanced / Analyze (rust) (push) Has been cancelled
PR checks / rust_lint (push) Has been cancelled
PR checks / build_web_app (push) Has been cancelled
PR checks / test_web_app (push) Has been cancelled
PR checks / build_tauri_app (push) Has been cancelled
Some checks failed
Deploy to vercel on merge / build_and_deploy (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL Advanced / Analyze (rust) (push) Has been cancelled
PR checks / rust_lint (push) Has been cancelled
PR checks / build_web_app (push) Has been cancelled
PR checks / test_web_app (push) Has been cancelled
PR checks / build_tauri_app (push) Has been cancelled
Annotations and bookmarks inserted into KOReader via the Readest sync plugin were missing the chapter field, which native KOReader highlights stamp at creation time. Downstream tools that group highlights by chapter (e.g. obsidian-koreader-highlights, KOReader's own Markdown exporter) treated these as orphans. Resolve the chapter title from the xpointer using the same TOC call that ReaderHighlight uses natively, and include it on both annotation and bookmark item tables. Closes #4133
This commit is contained in:
parent
615dc82c17
commit
058d58b4f2
1 changed files with 6 additions and 0 deletions
|
|
@ -300,6 +300,10 @@ function SyncAnnotations:pull(ui, settings, client, book_hash, meta_hash, dialog
|
|||
|
||||
-- Resolve KOReader page number from xpointer
|
||||
local pageno = ui.document:getPageFromXPointer(xp0) or note.page
|
||||
-- Resolve chapter title so downstream tools can group by chapter,
|
||||
-- matching native KOReader highlight creation behavior.
|
||||
local chapter = ui.toc and ui.toc:getTocTitleByPage(xp0) or nil
|
||||
if chapter == "" then chapter = nil end
|
||||
|
||||
if note_type == "bookmark" then
|
||||
if existing_bookmarks[xp0] then goto continue end
|
||||
|
|
@ -309,6 +313,7 @@ function SyncAnnotations:pull(ui, settings, client, book_hash, meta_hash, dialog
|
|||
page = xp0,
|
||||
text = note.text or "",
|
||||
note = note.note or "",
|
||||
chapter = chapter,
|
||||
pageno = pageno,
|
||||
datetime = datetime_str,
|
||||
datetime_updated = datetime_updated_str,
|
||||
|
|
@ -335,6 +340,7 @@ function SyncAnnotations:pull(ui, settings, client, book_hash, meta_hash, dialog
|
|||
note = note.note or "",
|
||||
drawer = drawer,
|
||||
color = READEST_TO_KO_COLOR[note.color] or "yellow",
|
||||
chapter = chapter,
|
||||
pageno = pageno,
|
||||
datetime = datetime_str,
|
||||
datetime_updated = datetime_updated_str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue