-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Feature: Support Readium Annotation format (import/export) #2521
Comments
Current implementation in Thorium :Thorium currently support the export of all annotations set from a publication in a first version of the Readium Annotation format, based on this model . The export of annotations is possible for each publication and is accessible by a button in the catalog menu of the library window. This button opens a system modal window to choose the folder in which the annotation will be saved. Implementation here Readium Annotation format exported from children litterature publication : {
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "urn:uuid:79fba412-0ebe-45dd-8ad5-99699cbdfc72",
"type": "AnnotationSet",
"generator": {
"id": "https://github.com/edrlab/thorium-reader/releases/tag/v3.1.0-alpha.1",
"type": "Software",
"name": "Thorium 3.1.0-alpha.1",
"homepage": "https://thorium.edrlab.org"
},
"generated": "2024-09-03T13:54:04.287Z",
"label": "Annotations set",
"about": {
"dc:identifier": [
"urn:isbn:code.google.com.epub-samples.cc-shared-culture"
],
"dc:format": "application/epub+zip",
"dc:title": "Creative Commons - A Shared Culture",
"dc:publisher": [
"Creative Commons"
],
"dc:creator": [
"Jesse Dylan"
],
"dc:date": "",
"dc:source": "urn:uuid:74f0d5ae-5e83-48b9-a08c-701d7911eb9d"
},
"total": 1,
"items": [
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "urn:uuid:181819eb-c7bd-4310-a00c-d64954d86b02",
"created": "2024-09-03T13:54:04.288Z",
"modified": "2024-09-03T13:54:04.288Z",
"type": "Annotation",
"hash": "",
"body": {
"type": "TextualBody",
"value": "The work of Creative Commons",
"format": "text/plain",
"color": "#fad0c3"
},
"target": {
"source": "EPUB/xhtml/p50.xhtml",
"meta": {
"headings": [
{
"level": 2,
"txt": "a new kind of folk culture"
}
],
"page": ""
},
"selector": [
{
"type": "TextQuoteSelector",
"exact": "The work of Creative Commons",
"prefix": "d get the law out of the way. ",
"suffix": " is really about laying\n the in"
},
{
"type": "ProgressionSelector",
"value": 0.14235545602605862
},
{
"type": "DomRangeSelector",
"startContainerElementCssSelector": "p:nth-child(2)",
"startContainerChildTextNodeIndex": 0,
"startOffset": 133,
"endContainerElementCssSelector": "p:nth-child(2)",
"endContainerChildTextNodeIndex": 0,
"endOffset": 161
},
{
"type": "FragmentSelector",
"conformsTo": "http://www.idpf.org/epub/linking/cfi/epub-cfi.html",
"value": "epubcfi(/4/2/4,/1:133,/1:161)"
}
]
}
}
]
} The 4 selectors are generated here Taking AnnotationTo create an annotation select/highlight text while reading the publication.
|
This a Work In Progress Issue description. I will append comments here to describe each point. |
Importing annotationsLaurent quote from GDocs :
flowchart TD
A["Import file by button"]
B["Parsing Annotation set"]
C["Matching between annotation id and publication id"]
D["Looking for id conflicts"]
E["User modal confirmation"]
F1["Abort"]
F2["Confirm import"]
G["New annotations imported to publication database"]
A --> B
B --> C
C --> D
D --> E
E --> F1
E --> F2
F2 --> G
Implementation flowchart: In main process triggered by an action with the pubId :
|
exporting annotationsLaurent quotes from GDocs :
Thanks to this PR #2538 (#2521 (comment)). We can now filter annotations list with tags name, color, and drawType (highlight). The goal is to use the tags filter component to choose a set of annotations to export. In the annotations list header, there are 3 buttons: "filter", "delete", "export". Filter to open the filter component modal. Delete to open the delete confirmation modal and remove the annotation set currently filtered. Export to open the export annotation set modal and allows you to choose the title name, the file format and the save directory. Implementation details of the Pull Request merged : #2551 :
thorium-reader/src/renderer/reader/components/ReaderMenu.tsx Lines 821 to 838 in f7b410e
|
Annotation tags managementLaurent quotes in GDocs
Use Cases
|
About the import of an annotation set, after parsing the file, Thorium should display a modal containing:
The user has the choice to abort the import or confirm. |
The update spec is in https://github.com/readium/annotations |
Goal : Import/export in Thorium of JSON serialized user annotations in Readium Annotation format
Resources :
Use Cases :
A user annotates a publication. When he closes the publication, his annotations are saved in Thorium. As soon as he re-opens the publication, his annotations re-appear.
A user decides to export from Thorium an EPUB publication he has previously annotated. He selects the option to save his annotations in the publication. The exported EPUB contains his annotations. If he imports the publication in another reading application which supports this specification, his annotations re-appear.
A user decides to export from his reading application the annotations he has created in a publication. He chooses a file name and a destination folder and validates his choice. An annotation file is created on his computer. If he imports this file into another reading application which supports this specification, and if the reading application already contains this publication, his annotations now appear in the publication.
A teacher reads an ebook and prepares annotations. He exports an annotation file and shares this file with his students. The students import the ebook and the detached file into their reading application: the annotations made by the teacher now appear in the ebook. The students can now add their own annotations to the ebook, and these student annotations will not be mixed with the annotations created by their teacher.
Key Features :
Support of the Readium Annotation Format, subset of the W3C annotation model, cf google docs
User annotation serialized in JSON Readium Annotation Format is tied to the publication (ebook). Export of all publication user annotations in one JSON file is not possible.
Export to JSON Readium Annotation of a file saved in the folder chosen by the user with the name: <title of the collection>.annotation.
Import of the file .annotation only in Library Window by drag and drop or click on the import annotation button in catalog menu of the publication.
Export of the file .annotation only in Library Window by click on the export annotation button in catalog menu of the publication
Export of the publication (ebooks) with Readium Annotation Set saved in it by click on the the "save publication as" button of the catalog menu.
When importing, a matching phase between the publication ID and the publication identification ID of the Readium Annotation document is necessary. In case of identification conflict, the choice must be left to the user.
When importing a Readium Annotation file, a modal appears to the user to identify the corresponding publication, the number of annotations to import, the management of conflicts between 2 uniquely identified annotations, the name of the collection (title of the collection by default) and finally the possibility to continue or cancel the import.
When exporting a Readium Annotation file, a modal appears allowing you to choose the set of annotations to export by their tag identifier, (annotation not identified by tags included).
Tag management by annotation in reader window. Add/Remove/Update tags for each annotation in the reading window. Filter annotation by tags name.
The text was updated successfully, but these errors were encountered: