mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-22 15:54:09 +00:00
[Extension API] Custom commands and keybindings (#1075)
* Add keybinding schema * nit * Keybinding store * nit * wip * Bind condition on ComfyCommand * Add settings * nit * Revamp keybinding store * Add tests * Add load keybinding * load extension keybindings * Load extension commands * Handle keybindings * test * Keybinding playwright test * Update README * nit * Remove log * Remove system stats fromt logging.ts
This commit is contained in:
@@ -53,6 +53,8 @@ import type { ToastMessageOptions } from 'primevue/toast'
|
||||
import { useWorkspaceStore } from '@/stores/workspaceStateStore'
|
||||
import { useExecutionStore } from '@/stores/executionStore'
|
||||
import { IWidget } from '@comfyorg/litegraph'
|
||||
import { useKeybindingStore } from '@/stores/keybindingStore'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
|
||||
export const ANIM_PREVIEW_WIDGET = '$$comfy_animation_preview'
|
||||
|
||||
@@ -2951,6 +2953,10 @@ export class ComfyApp {
|
||||
if (this.extensions.find((ext) => ext.name === extension.name)) {
|
||||
throw new Error(`Extension named '${extension.name}' already registered.`)
|
||||
}
|
||||
if (this.vueAppReady) {
|
||||
useKeybindingStore().loadExtensionKeybindings(extension)
|
||||
useCommandStore().loadExtensionCommands(extension)
|
||||
}
|
||||
this.extensions.push(extension)
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +377,5 @@ export class ComfyLogging {
|
||||
if (!this.enabled) return
|
||||
const source = 'ComfyUI.Logging'
|
||||
this.addEntry(source, 'debug', { UserAgent: navigator.userAgent })
|
||||
const systemStats = await api.getSystemStats()
|
||||
this.addEntry(source, 'debug', systemStats)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,10 @@ import { downloadBlob } from '../../utils'
|
||||
import { ComfyButtonGroup } from '../components/buttonGroup'
|
||||
import './menu.css'
|
||||
|
||||
// Import ComfyButton to make sure it's shimmed and exported by vite
|
||||
import { ComfyButton } from '../components/button'
|
||||
import { ComfySplitButton } from '../components/splitButton'
|
||||
import { ComfyPopup } from '../components/popup'
|
||||
console.debug(
|
||||
`Keep following definitions ${ComfyButton} ${ComfySplitButton} ${ComfyPopup}`
|
||||
)
|
||||
// Export to make sure following components are shimmed and exported by vite
|
||||
export { ComfyButton } from '../components/button'
|
||||
export { ComfySplitButton } from '../components/splitButton'
|
||||
export { ComfyPopup } from '../components/popup'
|
||||
|
||||
export class ComfyAppMenu {
|
||||
app: ComfyApp
|
||||
|
||||
Reference in New Issue
Block a user