diff --git a/js/comfyui-manager.js b/js/comfyui-manager.js index 063851ea..bf523a68 100644 --- a/js/comfyui-manager.js +++ b/js/comfyui-manager.js @@ -113,7 +113,7 @@ let share_option = 'all'; // copied style from https://github.com/pythongosssss/ComfyUI-Custom-Scripts const style = ` -#comfyworkflows-button { +#workflowgallery-button { width: 310px; height: 27px; padding: 0px !important; @@ -237,7 +237,7 @@ const style = ` .pysssss-workflow-popup-2 ~ .litecontextmenu { transform: scale(1.3); } -#comfyworkflows-button-menu { +#workflowgallery-button-menu { z-index: 10000000000 !important; } #cm-manual-button-menu { @@ -831,7 +831,7 @@ class ManagerMenuDialog extends ComfyDialog { { title: "Close", callback: () => { - this.close(); + LiteGraph.closeAllContextMenus(); }, } ], @@ -849,67 +849,15 @@ class ManagerMenuDialog extends ComfyDialog { ]), $el("button", { - id: 'comfyworkflows-button', - type: "button", - textContent: "Workflow Gallery", - onclick: () => { window.open("https://comfyworkflows.com/", "comfyui-workflow-gallery"); } + id: 'workflowgallery-button', + type: "button", + textContent: "Workflow Gallery", + onclick: this.handleWorkflowGalleryButtonClick, }, [ - $el("div.pysssss-workflow-arrow-2", { - id: `comfyworkflows-button-arrow`, - onclick: (e) => { - e.preventDefault(); - e.stopPropagation(); - - LiteGraph.closeAllContextMenus(); - const menu = new LiteGraph.ContextMenu( - [ - { - title: "Share your art", - callback: () => { - if (share_option === 'openart') { - showOpenArtShareDialog(); - return; - } else if (share_option === 'matrix' || share_option === 'comfyworkflows') { - showShareDialog(share_option); - return; - } - - if(!ShareDialogChooser.instance) { - ShareDialogChooser.instance = new ShareDialogChooser(); - } - ShareDialogChooser.instance.show(); - }, - }, - { - title: "Open 'openart.ai'", - callback: () => { - window.open("https://openart.ai/workflows/dev", "comfyui-workflow-gallery"); - }, - }, - { - title: "Open 'comfyworkflows.com'", - callback: () => { - window.open("https://comfyworkflows.com/", "comfyui-workflow-gallery"); - }, - }, - { - title: "Close", - callback: () => { - this.close(); - }, - } - ], - { - event: e, - scale: 1.3, - }, - window - ); - // set the id so that we can override the context menu's z-index to be above the comfyui manager menu - menu.root.id = "comfyworkflows-button-menu"; - menu.root.classList.add("pysssss-workflow-popup-2"); - }, - }) + $el("div.pysssss-workflow-arrow-2", { + id: `comfyworkflows-button-arrow`, + onclick: this.handleWorkflowGalleryButtonClick + }) ]), $el("button.cm-button", { @@ -948,7 +896,7 @@ class ManagerMenuDialog extends ComfyDialog { $el("div.cm-menu-column", [...this.createControlsMid()]), $el("div.cm-menu-column", [...this.createControlsRight()]) ]), - + $el("br", {}, []), close_button, ] @@ -963,6 +911,59 @@ class ManagerMenuDialog extends ComfyDialog { show() { this.element.style.display = "block"; } + + handleWorkflowGalleryButtonClick(e) { + e.preventDefault(); + e.stopPropagation(); + LiteGraph.closeAllContextMenus(); + const menu = new LiteGraph.ContextMenu( + [ + { + title: "Share your art", + callback: () => { + if (share_option === 'openart') { + showOpenArtShareDialog(); + return; + } else if (share_option === 'matrix' || share_option === 'comfyworkflows') { + showShareDialog(share_option); + return; + } + + if (!ShareDialogChooser.instance) { + ShareDialogChooser.instance = new ShareDialogChooser(); + } + ShareDialogChooser.instance.show(); + }, + }, + { + title: "Open 'openart.ai'", + callback: () => { + window.open("https://openart.ai/workflows/dev", "comfyui-workflow-gallery"); + }, + }, + { + title: "Open 'comfyworkflows.com'", + callback: () => { + window.open("https://comfyworkflows.com/", "comfyui-workflow-gallery"); + }, + }, + { + title: "Close", + callback: () => { + LiteGraph.closeAllContextMenus(); + }, + } + ], + { + event: e, + scale: 1.3, + }, + window + ); + // set the id so that we can override the context menu's z-index to be above the comfyui manager menu + menu.root.id = "workflowgallery-button-menu"; + menu.root.classList.add("pysssss-workflow-popup-2"); + } }