mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Viewer: Fix error when trying to change more than a single keyboard shortcut at once. Fixes #1858117 [ERROR: Unhandled error: Uncaught TypeError
when setting custom keyboard shortcut in viewer](https://bugs.launchpad.net/calibre/+bug/1858117)
This commit is contained in:
parent
ecdf7f74e0
commit
fc8659e07a
@ -84,7 +84,7 @@ def close_customize_shortcut(apply_changes):
|
||||
item.dataset.userData = JSON.stringify(q)
|
||||
break
|
||||
get_container().dataset.changed = 'true'
|
||||
commit_keyboard(create_keyboard_panel.onchange)
|
||||
commit_keyboard(create_keyboard_panel.onchange, None)
|
||||
|
||||
|
||||
def add_key_widget():
|
||||
@ -184,7 +184,7 @@ def shortcuts_differ(a, b):
|
||||
return False
|
||||
|
||||
|
||||
def commit_keyboard(onchange):
|
||||
def commit_keyboard(onchange, container):
|
||||
sd = get_session_data()
|
||||
vals = {}
|
||||
for item in get_container().querySelectorAll('[data-user-data]'):
|
||||
@ -192,6 +192,7 @@ def commit_keyboard(onchange):
|
||||
if shortcuts_differ(q.shortcuts, shortcuts_definition()[q.name].shortcuts):
|
||||
vals[q.name] = q.shortcuts
|
||||
sd.set('keyboard_shortcuts', vals)
|
||||
create_keyboard_panel.onchange = None
|
||||
if container is not None:
|
||||
create_keyboard_panel.onchange = None
|
||||
if get_container().dataset.changed is 'true':
|
||||
onchange()
|
||||
|
Loading…
x
Reference in New Issue
Block a user