[PARKED] annotations refactoring - #3728
Conversation
…tence, remove a streamerNoHttp route to list annotations.
|
Manual Test Procedure Use the files in:
Start from a clean Thorium state for Setup
Test Cases
Cleanup After each independent test, delete the imported annotations or remove/reimport the EPUB so the next test starts clean. For the conflict test, keep the seed annotations before importing the conflict file. |
|
Readium Annotation Import: During Readium annotation import, Thorium stores the imported annotation data under
Example: // Imported file
target.source = "OPS/chapter.xhtml"
// Thorium spine
"chapter.xhtml"
// Stored note
readiumAnnotation.import.target.source = "chapter.xhtml"
readiumAnnotation.import.originalTarget.source = "OPS/chapter.xhtml"If the source cannot be matched to the publication spine, the note is still imported, but marked unresolved: readiumAnnotation.import.unresolved.reason = "source-mismatch"Resolution Algorithm After import, the reader tries to convert It uses Supported selectors are: CfiSelector
FragmentSelector with EPUB CFI
CssSelector
TextPositionSelector
TextQuoteSelectorIf multiple selectors resolve to the same range, Thorium chooses the highest-priority candidate: CfiSelector / FragmentSelector: 50
CssSelector: 40
TextPositionSelector: 30
TextQuoteSelector: 20If no usable match is found, the note remains unresolved with reasons such as: source-mismatch
unsupported-selector
selector-not-found
ambiguous-matchExport Behavior For Unresolved Notes On export, Thorium does not reuse: readiumAnnotation.import.target.selector
readiumAnnotation.import.originalTarget.selectorThe export converter only serializes: readiumAnnotation.export.selector || []The exported locatorExtended.locator.href || ""Therefore, for an unresolved imported note that has no target: {
source: "",
selector: []
}If the imported note is later resolved into a |
Fixes #3643
Fixes #3726
Fixes #3613
This PR refactors annotation and bookmark handling into a unified publication notes model. It introduces a shared
publication-notesdomain layer used across persistence, import/export, reader state, filtering, pagination, and display.Feature Changes
Change Analysis
The refactor moves annotation/bookmark behavior away from scattered reader-specific note state and toward a more explicit publication-scoped notes domain. This makes import/export, persistence, and UI listing behavior more consistent, while keeping the reader-facing workflows intact.
The biggest functional improvement is the import pipeline: imported annotation sets now produce a structured preview and report before changes are applied, making conflict and unresolved-selector handling more transparent. The UI can distinguish clean imports, conflicts, already-imported notes, unsupported selectors, and annotations that could not be resolved against the current publication content.