Move floating menu to a Vue component (#843)

* Move floating menu to a Vue component

* nit

* Fix jest tests
This commit is contained in:
Chenlei Hu
2024-09-16 14:26:46 +09:00
committed by GitHub
parent d0a4db5f4f
commit 327b67a022
3 changed files with 26 additions and 2 deletions

View File

@@ -372,6 +372,13 @@ export class ComfyUI {
this.history.update()
})
// For testing. Legacy ui tests don't have vue app initialized.
if (!app.vueAppReady) {
this.setup(document.body)
}
}
setup(containerElement: HTMLElement) {
const confirmClear = this.settings.addSetting({
id: 'Comfy.ConfirmClear',
category: ['Comfy', 'Workflow', 'ConfirmClear'],
@@ -497,7 +504,7 @@ export class ComfyUI {
this.menuHamburger = $el(
'div.comfy-menu-hamburger',
{
parent: document.body,
parent: containerElement,
onclick: () => {
this.menuContainer.style.display = 'block'
this.menuHamburger.style.display = 'none'
@@ -506,7 +513,7 @@ export class ComfyUI {
[$el('div'), $el('div'), $el('div')]
) as HTMLDivElement
this.menuContainer = $el('div.comfy-menu', { parent: document.body }, [
this.menuContainer = $el('div.comfy-menu', { parent: containerElement }, [
$el(
'div.drag-handle.comfy-menu-header',
{
@@ -730,6 +737,7 @@ export class ComfyUI {
$el('button', {
id: 'comfy-clipspace-button',
textContent: 'Clipspace',
// @ts-expect-error Move to ComfyApp
onclick: () => app.openClipspace()
}),
$el('button', {