mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Store current toc node information when creating highlights
This commit is contained in:
parent
1cfc3c8c78
commit
5ce9010cc3
@ -237,7 +237,7 @@ class AnnotationsManager: # {{{
|
||||
x = 2 * (spine_index + 1)
|
||||
return f'epubcfi(/{x}{h.start_cfi})'
|
||||
|
||||
def add_highlight(self, msg, style, notes):
|
||||
def add_highlight(self, msg, style, notes, toplevel_toc_node, toc_node):
|
||||
now = Date().toISOString()
|
||||
for uuid in msg.removed_highlights:
|
||||
self.remove_highlight(uuid)
|
||||
@ -255,6 +255,10 @@ class AnnotationsManager: # {{{
|
||||
}
|
||||
if notes:
|
||||
annot.notes = notes
|
||||
if toplevel_toc_node?.title:
|
||||
annot.top_level_section_title = toplevel_toc_node.title
|
||||
if toc_node?.title:
|
||||
annot.lowest_level_section_title = toc_node.title
|
||||
self.sync_annots_to_server('highlights')
|
||||
|
||||
def highlights_for_currently_showing(self):
|
||||
|
@ -965,7 +965,8 @@ class SelectionBar:
|
||||
_('Highlighting failed'),
|
||||
_('Failed to apply highlighting, try adjusting extent of highlight')
|
||||
)
|
||||
self.annotations_manager.add_highlight(msg, self.current_highlight_style.style, notes)
|
||||
self.annotations_manager.add_highlight(
|
||||
msg, self.current_highlight_style.style, notes, self.view.current_toc_toplevel_node, self.view.current_toc_node)
|
||||
elif msg.type is 'edit-highlight':
|
||||
if self.state is WAITING:
|
||||
self.create_highlight()
|
||||
|
Loading…
x
Reference in New Issue
Block a user