readerannotation: add comments to the annotation structure

reviewable/pr11563/r3
hius07 2 months ago committed by GitHub
parent 529dca752e
commit c239a2a280
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -12,6 +12,7 @@ function ReaderAnnotation:buildAnnotation(bm, highlights, update_pageno)
hl = {} hl = {}
if bm.highlighted then -- orphaned bookmark if bm.highlighted then -- orphaned bookmark
hl.drawer = self.view.highlight.saved_drawer hl.drawer = self.view.highlight.saved_drawer
hl.color = self.view.highlight.saved_color
if self.ui.paging then if self.ui.paging then
if bm.pos0.page == bm.pos1.page then if bm.pos0.page == bm.pos1.page then
hl.pboxes = self.document:getPageBoxesFromPositions(bm.page, bm.pos0, bm.pos1) hl.pboxes = self.document:getPageBoxesFromPositions(bm.page, bm.pos0, bm.pos1)
@ -22,19 +23,20 @@ function ReaderAnnotation:buildAnnotation(bm, highlights, update_pageno)
end end
end end
return { -- annotation structure return { -- annotation
datetime = bm.datetime, datetime = bm.datetime, -- creation time, not changeable
drawer = hl.drawer, drawer = hl.drawer, -- highlight drawer
text = bm.notes, color = hl.color, -- highlight color
text_edited = hl.edited, text = bm.notes, -- highlighted text, editable
note = bm.text, text_edited = hl.edited, -- true if highlighted text has been edited
chapter = bm.chapter, note = bm.text, -- user's note, editable
page = bm.page, chapter = bm.chapter, -- book chapter title
pageno = pageno, pageno = pageno, -- book page number
pos0 = bm.pos0, page = bm.page, -- highlight location, xPointer or number (pdf)
pos1 = bm.pos1, pos0 = bm.pos0, -- highlight start position, xPointer or table (pdf)
pboxes = hl.pboxes, pos1 = bm.pos1, -- highlight end position, xPointer or table (pdf)
ext = hl.ext, pboxes = hl.pboxes, -- pdf pboxes, used only and changeable by addMarkupAnnotation
ext = hl.ext, -- pdf multi-page highlight
} }
end end
@ -55,6 +57,7 @@ function ReaderAnnotation.buildHighlight(an)
return { return {
datetime = an.datetime, datetime = an.datetime,
drawer = an.drawer, drawer = an.drawer,
color = an.color,
text = an.text, text = an.text,
edited = an.text_edited, edited = an.text_edited,
chapter = an.chapter, chapter = an.chapter,

Loading…
Cancel
Save