mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ensure iframe is focused after controls help is shown
This commit is contained in:
parent
102be318d8
commit
b480086d00
@ -80,4 +80,5 @@ ui_operations = {
|
||||
'update_font_size': None,
|
||||
'goto_bookpos': None,
|
||||
'delete_book': None,
|
||||
'focus_iframe': None,
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ class ReadUI:
|
||||
ui_operations.update_font_size = self.update_font_size.bind(self)
|
||||
ui_operations.goto_bookpos = self.goto_bookpos.bind(self)
|
||||
ui_operations.delete_book = self.delete_book.bind(self)
|
||||
ui_operations.focus_iframe = self.focus_iframe.bind(self)
|
||||
|
||||
def on_resize(self):
|
||||
self.view.on_resize()
|
||||
@ -162,6 +163,9 @@ class ReadUI:
|
||||
def delete_book(self, book, proceed):
|
||||
self.db.delete_book(book, proceed)
|
||||
|
||||
def focus_iframe(self):
|
||||
self.view.focus_iframe()
|
||||
|
||||
def update_color_scheme(self):
|
||||
self.view.update_color_scheme()
|
||||
|
||||
|
@ -47,7 +47,8 @@ def show_controls_help():
|
||||
if not show_controls_help.listener_added:
|
||||
show_controls_help.listener_added = True
|
||||
container.addEventListener('click', def():
|
||||
document.getElementById('controls-help-overlay').style.display = 'none'
|
||||
document.getElementById('controls-help-overlay').style.display = 'none'
|
||||
ui_operations.focus_iframe()
|
||||
)
|
||||
def msg(txt):
|
||||
return set_css(E.div(txt), padding='1ex 1em', text_align='center', margin='auto')
|
||||
|
@ -251,6 +251,8 @@ if window is window.top:
|
||||
view.update_color_scheme()
|
||||
ui_operations.update_font_size = def():
|
||||
view.update_font_size()
|
||||
ui_operations.focus_iframe = def():
|
||||
view.focus_iframe()
|
||||
ui_operations.goto_bookpos = def(cfi):
|
||||
return view.goto_bookpos(cfi)
|
||||
ui_operations.toggle_toc = def():
|
||||
@ -267,6 +269,7 @@ if window is window.top:
|
||||
to_python.report_cfi(request_id, data)
|
||||
ui_operations.ask_for_open = def(path):
|
||||
to_python.ask_for_open(path)
|
||||
|
||||
document.body.appendChild(E.div(id='view'))
|
||||
window.onerror = onerror
|
||||
create_modal_container()
|
||||
|
Loading…
x
Reference in New Issue
Block a user