mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 00:39:49 +00:00
Always show extension panel in settings dialog (#2002)
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -9,6 +9,16 @@ import { useMenuItemStore } from './menuItemStore'
|
||||
import { useBottomPanelStore } from './workspace/bottomPanelStore'
|
||||
import { useWidgetStore } from './widgetStore'
|
||||
|
||||
/**
|
||||
* These extensions are always active, even if they are disabled in the setting.
|
||||
* TODO(https://github.com/Comfy-Org/ComfyUI_frontend/issues/1996):
|
||||
* Migrate logic to out of extensions/core, as features provided
|
||||
* by these extensions are now essential to core.
|
||||
*/
|
||||
export const ALWAYS_ENABLED_EXTENSIONS: readonly string[] = [
|
||||
'Comfy.ColorPalette'
|
||||
]
|
||||
|
||||
export const useExtensionStore = defineStore('extension', () => {
|
||||
// For legacy reasons, the name uniquely identifies an extension
|
||||
const extensionByName = ref<Record<string, ComfyExtension>>({})
|
||||
@@ -32,6 +42,10 @@ export const useExtensionStore = defineStore('extension', () => {
|
||||
return extensions.value.filter((ext) => isExtensionEnabled(ext.name))
|
||||
})
|
||||
|
||||
function isExtensionAlwaysEnabled(name: string) {
|
||||
return ALWAYS_ENABLED_EXTENSIONS.includes(name)
|
||||
}
|
||||
|
||||
function registerExtension(extension: ComfyExtension) {
|
||||
if (!extension.name) {
|
||||
throw new Error("Extensions must have a 'name' property.")
|
||||
@@ -80,6 +94,10 @@ export const useExtensionStore = defineStore('extension', () => {
|
||||
// allowed since v1.3.12.
|
||||
// https://github.com/Comfy-Org/ComfyUI_frontend/issues/1176
|
||||
disabledExtensionNames.value.add('pysssss.SnapToGrid')
|
||||
|
||||
for (const name of ALWAYS_ENABLED_EXTENSIONS) {
|
||||
disabledExtensionNames.value.delete(name)
|
||||
}
|
||||
}
|
||||
|
||||
// Some core extensions are registered before the store is initialized, e.g.
|
||||
@@ -95,6 +113,7 @@ export const useExtensionStore = defineStore('extension', () => {
|
||||
enabledExtensions,
|
||||
inactiveDisabledExtensionNames,
|
||||
isExtensionEnabled,
|
||||
isExtensionAlwaysEnabled,
|
||||
registerExtension,
|
||||
loadDisabledExtensionNames
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user