Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert move floating menu to Vue #853

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions src/components/appMenu/floating/FloatingMenu.vue

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/graph/GraphCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</template>
</LiteGraphCanvasSplitterOverlay>
<TitleEditor />
<FloatingMenu />
<canvas ref="canvasRef" id="graph-canvas" tabindex="1" />
</teleport>
<NodeSearchboxPopover />
Expand All @@ -19,7 +18,6 @@ import SideToolbar from '@/components/sidebar/SideToolbar.vue'
import LiteGraphCanvasSplitterOverlay from '@/components/LiteGraphCanvasSplitterOverlay.vue'
import NodeSearchboxPopover from '@/components/searchbox/NodeSearchBoxPopover.vue'
import NodeTooltip from '@/components/graph/NodeTooltip.vue'
import FloatingMenu from '@/components/appMenu/floating/FloatingMenu.vue'
import { ref, computed, onUnmounted, onMounted, watchEffect } from 'vue'
import { app as comfyApp } from '@/scripts/app'
import { useSettingStore } from '@/stores/settingStore'
Expand Down
15 changes: 5 additions & 10 deletions src/scripts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,10 @@ export class ComfyUI {
this.history.update()
})

// For testing. Legacy ui tests don't have vue app initialized.
if (window['IS_TEST']) {
this.setup(document.body)
}
this.setup(document.body)
}

setup(containerElement: HTMLElement) {
const settingStore = useSettingStore()

const fileInput = $el('input', {
id: 'comfy-file-input',
type: 'file',
Expand Down Expand Up @@ -593,7 +588,7 @@ export class ComfyUI {
textContent: 'Save',
onclick: () => {
let filename = 'workflow.json'
if (settingStore.get('Comfy.PromptFilename')) {
if (useSettingStore().get('Comfy.PromptFilename')) {
filename = prompt('Save workflow as:', filename)
if (!filename) return
if (!filename.toLowerCase().endsWith('.json')) {
Expand Down Expand Up @@ -624,7 +619,7 @@ export class ComfyUI {
style: { width: '100%', display: 'none' },
onclick: () => {
let filename = 'workflow_api.json'
if (settingStore.get('Comfy.PromptFilename')) {
if (useSettingStore().get('Comfy.PromptFilename')) {
filename = prompt('Save workflow (API) as:', filename)
if (!filename) return
if (!filename.toLowerCase().endsWith('.json')) {
Expand Down Expand Up @@ -670,7 +665,7 @@ export class ComfyUI {
textContent: 'Clear',
onclick: () => {
if (
!settingStore.get('Comfy.ConfirmClear') ||
!useSettingStore().get('Comfy.ConfirmClear') ||
confirm('Clear workflow?')
) {
app.clean()
Expand All @@ -685,7 +680,7 @@ export class ComfyUI {
textContent: 'Load Default',
onclick: async () => {
if (
!settingStore.get('Comfy.ConfirmClear') ||
!useSettingStore().get('Comfy.ConfirmClear') ||
confirm('Load default workflow?')
) {
app.resetView()
Expand Down
8 changes: 7 additions & 1 deletion src/stores/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ export const CORE_SETTINGS: SettingParams[] = [
id: 'Comfy.DevMode',
name: 'Enable dev mode options (API save, etc.)',
type: 'boolean',
defaultValue: false
defaultValue: false,
onChange: (value) => {
const element = document.getElementById('comfy-dev-save-api-button')
if (element) {
element.style.display = value ? 'flex' : 'none'
}
}
}
]
1 change: 0 additions & 1 deletion tests-ui/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export async function start(config: StartConfig = {}): Promise<StartResult> {

Object.assign(localStorage, config.localStorage ?? {})
document.body.innerHTML = html.toString()
window['IS_TEST'] = true

mockApi(config)
mockSettingStore()
Expand Down
Loading