mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-16 01:57:04 +08:00
Add commands to toggle visibility of manager and custom nodes manager menus (#1505)
* Add commands for manager keybindings * use more consistent isVisible condition check * remove hide method in favor of super class's close method * fix formatting * fix tabs formatting
This commit is contained in:
parent
cf0d038978
commit
2e55bc470c
@ -1275,10 +1275,22 @@ class ManagerMenuDialog extends ComfyDialog {
|
||||
this.element = $el("div.comfy-modal", { id:'cm-manager-dialog', parent: document.body }, [ content ]);
|
||||
}
|
||||
|
||||
get isVisible() {
|
||||
return this.element?.style?.display !== "none";
|
||||
}
|
||||
|
||||
show() {
|
||||
this.element.style.display = "block";
|
||||
}
|
||||
|
||||
toggleVisibility() {
|
||||
if (this.isVisible) {
|
||||
this.close();
|
||||
} else {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
handleWorkflowGalleryButtonClick(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -1396,6 +1408,41 @@ app.registerExtension({
|
||||
}
|
||||
],
|
||||
|
||||
commands: [
|
||||
{
|
||||
id: "Comfy.Manager.Menu.ToggleVisibility",
|
||||
label: "Toggle Manager Menu Visibility",
|
||||
icon: "mdi mdi-puzzle",
|
||||
function: () => {
|
||||
if (!manager_instance) {
|
||||
setManagerInstance(new ManagerMenuDialog());
|
||||
manager_instance.show();
|
||||
} else {
|
||||
manager_instance.toggleVisibility();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "Comfy.Manager.CustomNodesManager.ToggleVisibility",
|
||||
label: "Toggle Custom Nodes Manager Visibility",
|
||||
icon: "pi pi-server",
|
||||
function: () => {
|
||||
if (CustomNodesManager.instance?.isVisible) {
|
||||
CustomNodesManager.instance.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!manager_instance) {
|
||||
setManagerInstance(new ManagerMenuDialog());
|
||||
}
|
||||
if (!CustomNodesManager.instance) {
|
||||
CustomNodesManager.instance = new CustomNodesManager(app, self);
|
||||
}
|
||||
CustomNodesManager.instance.show(CustomNodesManager.ShowMode.NORMAL);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
init() {
|
||||
$el("style", {
|
||||
textContent: style,
|
||||
|
||||
@ -1916,4 +1916,8 @@ export class CustomNodesManager {
|
||||
close() {
|
||||
this.element.style.display = "none";
|
||||
}
|
||||
|
||||
get isVisible() {
|
||||
return this.element?.style?.display !== "none";
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user