fix: add container to the buttons injected into the right menu

This commit is contained in:
EmmanuelMr18 2025-01-10 01:08:42 -06:00
parent 73853a60ff
commit 230cee40d2

View File

@ -2120,7 +2120,7 @@ function addQueueButtons(buttonConfigs = DEFAULT_BUTTONS) {
// Function to add butons to the menu right // Function to add butons to the menu right
function addMenuRightButtons(buttonConfigs) { function addMenuRightButtons(buttonConfigs) {
const menuRightButtons = document.querySelector('.comfyui-menu-right') const menuRightButtons = document.querySelector('.comfyui-menu-right .flex')
if (!menuRightButtons) return if (!menuRightButtons) return
@ -2129,19 +2129,22 @@ function addMenuRightButtons(buttonConfigs) {
for (const button of existingButtons) { for (const button of existingButtons) {
button.remove() button.remove()
} }
if (!menuRightButtons) return const container = document.createElement('div')
container.className = 'comfyui-button-group mx-2'
for (const config of buttonConfigs) { for (const config of buttonConfigs) {
const button = createMenuRightButton(config) const button = createMenuRightButton(config)
menuRightButtons.appendChild(button) container.appendChild(button)
} }
menuRightButtons.appendChild(container)
} }
function createMenuRightButton(config) { function createMenuRightButton(config) {
const button = document.createElement('button') const button = document.createElement('button')
button.id = `cd-button-${config.id}` button.id = `cd-button-${config.id}`
button.className = 'p-button p-component p-button-secondary p-button-md' button.className = `p-button p-component p-button-secondary p-button-md ${config.btnClasses}`
button.innerHTML = ` button.innerHTML = `
<span class="p-button-icon pi ${config.icon}"></span> <span class="p-button-icon pi ${config.icon}"></span>
<span class="p-button-label">${config.label}</span> <span class="p-button-label">${config.label}</span>