mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
feat: process extension settings
This commit is contained in:
@@ -8,6 +8,8 @@ import type { Settings } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import type { TreeNode } from '@/types/treeExplorerTypes'
|
||||
import { processExtensionSettings } from '@/extensions/dispatch'
|
||||
import { useErrorHandling } from '@/composables/useErrorHandling'
|
||||
|
||||
export const getSettingInfo = (setting: SettingParams) => {
|
||||
const parts = setting.category || setting.id.split('.')
|
||||
@@ -46,6 +48,14 @@ export const useSettingStore = defineStore('setting', () => {
|
||||
const settingValues = ref<Record<string, any>>({})
|
||||
const settingsById = ref<Record<string, SettingParams>>({})
|
||||
|
||||
const { wrapWithErrorHandling } = useErrorHandling()
|
||||
processExtensionSettings((settings) => {
|
||||
const _addSetting = wrapWithErrorHandling(addSetting)
|
||||
for (const setting of settings) {
|
||||
_addSetting(setting)
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Check if a setting's value exists, i.e. if the user has set it manually.
|
||||
* @param key - The key of the setting to check.
|
||||
|
||||
@@ -5,6 +5,8 @@ import { computed, ref, toRaw } from 'vue'
|
||||
|
||||
import { RESERVED_BY_TEXT_INPUT } from '@/constants/reservedKeyCombos'
|
||||
import type { KeyCombo, Keybinding } from '@/schemas/keyBindingSchema'
|
||||
import { processExtensionKeybindings } from '@/extensions/dispatch'
|
||||
import { useErrorHandling } from '@/composables/useErrorHandling'
|
||||
|
||||
export class KeybindingImpl implements Keybinding {
|
||||
commandId: string
|
||||
@@ -171,6 +173,14 @@ export const useKeybindingStore = defineStore('keybinding', () => {
|
||||
}
|
||||
)
|
||||
|
||||
const { wrapWithErrorHandling } = useErrorHandling()
|
||||
processExtensionKeybindings((keybindings) => {
|
||||
const addKeybinding = wrapWithErrorHandling(addDefaultKeybinding)
|
||||
for (const keybinding of keybindings) {
|
||||
addKeybinding(new KeybindingImpl(keybinding))
|
||||
}
|
||||
})
|
||||
|
||||
function getKeybindingsByCommandId(commandId: string) {
|
||||
return keybindingsByCommandId.value[commandId] ?? []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user