diff --git a/src/pyj/read_book/search.pyj b/src/pyj/read_book/search.pyj index 1b129b806f..e296060010 100644 --- a/src/pyj/read_book/search.pyj +++ b/src/pyj/read_book/search.pyj @@ -70,6 +70,9 @@ class SearchOverlay: def is_visible(self): return self.container.style.display is not 'none' + def set_text(self, text): + self.container.querySelector('input').value = text or '' + def hide(self): self.container.style.display = 'none' diff --git a/src/pyj/read_book/shortcuts.pyj b/src/pyj/read_book/shortcuts.pyj index 5b229f517a..fef350b56a 100644 --- a/src/pyj/read_book/shortcuts.pyj +++ b/src/pyj/read_book/shortcuts.pyj @@ -192,6 +192,18 @@ SHORTCUTS = { 'ui', _('Toggle full screen'), ), + + 'reload_book': desc( + v"['F5', 'Ctrl+r']", + 'ui', + _('Reload book'), + ), + + 'search_for_selection': desc( + v"['Ctrl+s']", + 'ui', + _('Search for next occurrence of selected text'), + ), } diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index fc70765ea6..3dadf5d6e6 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -243,6 +243,12 @@ class View: self.bump_font_size({'increase': False}) elif data.name is 'toggle_full_screen': ui_operations.toggle_full_screen() + elif data.name is 'reload_book': + ui_operations.reload_book() + elif data.name is 'search_for_selection': + if self.currently_showing.selected_text: + self.search_overlay.set_text(self.currently_showing.selected_text) + self.search_overlay.find_next() def on_selection_change(self, data): self.currently_showing.selected_text = data.text