mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1918054 [[Enhancement - Content server viewer] Clicking Esc to go back in the Highlight page doesn't work if one highlight is selected](https://bugs.launchpad.net/calibre/+bug/1918054)
This commit is contained in:
parent
f463c1dd97
commit
dc41e4e30e
@ -808,7 +808,7 @@ def delete_selection(annotations_manager, view):
|
||||
)
|
||||
|
||||
|
||||
def highlight_entry(h, onclick, view):
|
||||
def highlight_entry(h, onclick, view, hide_panel):
|
||||
|
||||
def action(func, ev):
|
||||
ev.stopPropagation(), ev.preventDefault()
|
||||
@ -828,7 +828,12 @@ def highlight_entry(h, onclick, view):
|
||||
class_='title-row',
|
||||
E.div(class_='title', swatch, E.div(style='margin-left: 1rem', h.highlighted_text)),
|
||||
E.div(style='margin-left: 1rem', onclick=def(ev): ev.stopPropagation();,
|
||||
E.input(type='checkbox', onchange=item_select_toggled)),
|
||||
E.input(type='checkbox', onchange=item_select_toggled, onkeydown=def(ev):
|
||||
if ev.key is 'Escape':
|
||||
ev.stopPropagation()
|
||||
ev.preventDefault()
|
||||
hide_panel()
|
||||
)),
|
||||
),
|
||||
E.div(
|
||||
class_='actions',
|
||||
@ -847,7 +852,7 @@ def highlight_entry(h, onclick, view):
|
||||
return ans
|
||||
|
||||
|
||||
def create_highlights_panel(annotations_manager, book, container, onclick):
|
||||
def create_highlights_panel(annotations_manager, hide_panel, book, container, onclick):
|
||||
next_button = E.div(class_='simple-link ac-button', svgicon('chevron-down'), title=_('Next match'))
|
||||
prev_button = E.div(class_='simple-link ac-button', svgicon('chevron-up'), title=_('Previous match'))
|
||||
prev_button.addEventListener('click', def(ev): find_previous();)
|
||||
@ -917,5 +922,5 @@ def create_highlights_panel(annotations_manager, book, container, onclick):
|
||||
c.appendChild(g)
|
||||
ic = g.lastChild
|
||||
for h in highlights:
|
||||
ic.appendChild(highlight_entry(h, onclick, annotations_manager.view))
|
||||
ic.appendChild(highlight_entry(h, onclick, annotations_manager.view, hide_panel))
|
||||
# }}}
|
||||
|
@ -720,7 +720,7 @@ class Overlay:
|
||||
self.hide()
|
||||
ui_operations.toggle_highlights()
|
||||
return
|
||||
self.panels.push(TOCOverlay(self, create_highlights_panel.bind(None, self.view.annotations_manager), _('Highlights')))
|
||||
self.panels.push(TOCOverlay(self, create_highlights_panel.bind(None, self.view.annotations_manager, self.hide_current_panel), _('Highlights')))
|
||||
self.show_current_panel()
|
||||
|
||||
def show_goto(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user