mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add actions for highlighting to viewer chrome
This commit is contained in:
parent
74897b4ec2
commit
c9fe151075
@ -311,10 +311,18 @@ class MainOverlay: # {{{
|
||||
if full_screen_actions.length:
|
||||
actions_div.appendChild(E.ul(*full_screen_actions))
|
||||
|
||||
highlight_action = ac(_('Highlight'), _('Highlight text in the book'),
|
||||
def(): self.overlay.hide(), self.overlay.view.initiate_create_annotation();, 'highlight')
|
||||
|
||||
if runtime.is_standalone_viewer:
|
||||
actions_div.appendChild(E.ul(
|
||||
ac(_('Lookup/search word'), _('Lookup or search for the currently selected word'),
|
||||
def(): self.overlay.hide(), ui_operations.toggle_lookup();, 'library')
|
||||
,
|
||||
highlight_action,
|
||||
ac(_('Browse highlights'), _('Browse all highlights'),
|
||||
def(): self.overlay.hide(), ui_operations.toggle_highlights();, 'image')
|
||||
,
|
||||
))
|
||||
copy_actions = E.ul()
|
||||
if self.overlay.view.currently_showing.selected_text:
|
||||
@ -343,6 +351,8 @@ class MainOverlay: # {{{
|
||||
ac(_('Quit'), _('Close the viewer'),
|
||||
def(): self.overlay.hide(), ui_operations.quit();, 'remove'),
|
||||
))
|
||||
else:
|
||||
actions_div.appendChild(E.ul(highlight_action))
|
||||
container.appendChild(set_css(E.div(class_=MAIN_OVERLAY_TS_CLASS, # top section
|
||||
onclick=def (evt):evt.stopPropagation();,
|
||||
|
||||
|
@ -433,7 +433,7 @@ class View:
|
||||
elif data.name is 'toggle_highlights':
|
||||
ui_operations.toggle_highlights()
|
||||
elif data.name is 'create_annotation':
|
||||
self.iframe_wrapper.send_message('create_annotation')
|
||||
self.initiate_create_annotation()
|
||||
elif data.name is 'new_bookmark':
|
||||
ui_operations.new_bookmark()
|
||||
elif data.name is 'toggle_inspector':
|
||||
@ -1193,6 +1193,9 @@ class View:
|
||||
else:
|
||||
self.show_name(sr.file_name, initial_position={'type':'search_result', 'search_result':sr, 'replace_history':True})
|
||||
|
||||
def initiate_create_annotation(self):
|
||||
self.iframe_wrapper.send_message('create_annotation')
|
||||
|
||||
def highlight_action(self, uuid, which):
|
||||
if self.create_annotation.is_visible:
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user