mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-24 07:56:33 +01:00
Allow using keys on delete confirmation popup
This commit is contained in:
parent
ef11d26921
commit
b097ecce99
1 changed files with 13 additions and 1 deletions
|
|
@ -81,6 +81,7 @@ def show(self, container):
|
|||
set_css(container, background_color=get_color('window-background'))
|
||||
container.appendChild(E.div(
|
||||
style='display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%',
|
||||
tabindex='0',
|
||||
E.div(style='margin:1ex 1em; max-width: 80%',
|
||||
E.h2(self.question),
|
||||
E.div(style='display:flex; justify-content:flex-end; margin-top:1rem',
|
||||
|
|
@ -88,8 +89,19 @@ def show(self, container):
|
|||
E.span('\xa0'),
|
||||
create_button(_('Cancel'), action=self.cancel),
|
||||
)
|
||||
)
|
||||
),
|
||||
onkeyup=def(ev):
|
||||
if ev.key is 'Escape':
|
||||
ev.stopPropagation(), ev.preventDefault()
|
||||
self.cancel()
|
||||
elif ev.key is 'Enter' or ev.key is 'Return':
|
||||
ev.stopPropagation(), ev.preventDefault()
|
||||
self.delete_book()
|
||||
))
|
||||
window.setTimeout(self.focus_me, 0)
|
||||
|
||||
def focus_me(self):
|
||||
document.getElementById(self.container_id).lastChild.focus()
|
||||
|
||||
def show_working(self):
|
||||
container = document.getElementById(self.container_id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue