mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-07 06:00:03 +00:00
Fix saved keybinding persistence (#2176)
This commit is contained in:
@@ -84,11 +84,11 @@ export const useKeybindingService = () => {
|
||||
// Allow setting multiple values at once in settingStore
|
||||
await settingStore.set(
|
||||
'Comfy.Keybinding.NewBindings',
|
||||
Object.values(keybindingStore.userKeybindings.value)
|
||||
Object.values(keybindingStore.getUserKeybindings())
|
||||
)
|
||||
await settingStore.set(
|
||||
'Comfy.Keybinding.UnsetBindings',
|
||||
Object.values(keybindingStore.userUnsetKeybindings.value)
|
||||
Object.values(keybindingStore.getUserUnsetKeybindings())
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,20 @@ export const useKeybindingStore = defineStore('keybinding', () => {
|
||||
*/
|
||||
const userUnsetKeybindings = ref<Record<string, KeybindingImpl>>({})
|
||||
|
||||
/**
|
||||
* Get user-defined keybindings.
|
||||
*/
|
||||
function getUserKeybindings() {
|
||||
return userKeybindings.value
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user-defined keybindings that unset default keybindings.
|
||||
*/
|
||||
function getUserUnsetKeybindings() {
|
||||
return userUnsetKeybindings.value
|
||||
}
|
||||
|
||||
const keybindingByKeyCombo = computed<Record<string, KeybindingImpl>>(() => {
|
||||
const result: Record<string, KeybindingImpl> = {
|
||||
...defaultKeybindings.value
|
||||
@@ -262,8 +276,8 @@ export const useKeybindingStore = defineStore('keybinding', () => {
|
||||
|
||||
return {
|
||||
keybindings,
|
||||
userKeybindings,
|
||||
userUnsetKeybindings,
|
||||
getUserKeybindings,
|
||||
getUserUnsetKeybindings,
|
||||
getKeybinding,
|
||||
getKeybindingsByCommandId,
|
||||
getKeybindingByCommandId,
|
||||
|
||||
Reference in New Issue
Block a user