mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Preserve scroll position in list of keyboard shortcuts when customizing a shortcut
This commit is contained in:
parent
fe0cfc3bea
commit
f83e99c9b5
@ -63,6 +63,12 @@ def key_widget(key):
|
|||||||
def close_customize_shortcut(apply_changes):
|
def close_customize_shortcut(apply_changes):
|
||||||
container = get_container()
|
container = get_container()
|
||||||
container.firstChild.style.display = 'block'
|
container.firstChild.style.display = 'block'
|
||||||
|
if close_customize_shortcut.shortcut_being_customized:
|
||||||
|
for item in container.firstChild.querySelectorAll('[data-user-data]'):
|
||||||
|
q = JSON.parse(item.dataset.userData)
|
||||||
|
if q.name is close_customize_shortcut.shortcut_being_customized:
|
||||||
|
item.scrollIntoView()
|
||||||
|
break
|
||||||
container.lastChild.style.display = 'none'
|
container.lastChild.style.display = 'none'
|
||||||
if apply_changes:
|
if apply_changes:
|
||||||
shortcuts = v'[]'
|
shortcuts = v'[]'
|
||||||
@ -110,6 +116,7 @@ def customize_shortcut(sc_name):
|
|||||||
container = get_container()
|
container = get_container()
|
||||||
container.firstChild.style.display = 'none'
|
container.firstChild.style.display = 'none'
|
||||||
container.lastChild.style.display = 'block'
|
container.lastChild.style.display = 'block'
|
||||||
|
close_customize_shortcut.shortcut_being_customized = sc_name
|
||||||
shortcuts = v'[]'
|
shortcuts = v'[]'
|
||||||
for item in container.querySelectorAll('[data-user-data]'):
|
for item in container.querySelectorAll('[data-user-data]'):
|
||||||
q = JSON.parse(item.dataset.userData)
|
q = JSON.parse(item.dataset.userData)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user