mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
51 lines
1.5 KiB
Vue
51 lines
1.5 KiB
Vue
<template>
|
|
<router-view />
|
|
<ProgressSpinner
|
|
v-if="isLoading"
|
|
class="absolute inset-0 flex justify-center items-center h-screen"
|
|
/>
|
|
<GlobalDialog />
|
|
<BlockUI full-screen :blocked="isLoading" />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useEventListener } from '@vueuse/core'
|
|
import BlockUI from 'primevue/blockui'
|
|
import ProgressSpinner from 'primevue/progressspinner'
|
|
import { computed, onMounted } from 'vue'
|
|
|
|
import GlobalDialog from '@/components/dialog/GlobalDialog.vue'
|
|
import config from '@/config'
|
|
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
|
|
|
import { isElectron, showNativeMenu } from './utils/envUtil'
|
|
|
|
const workspaceStore = useWorkspaceStore()
|
|
const isLoading = computed<boolean>(() => workspaceStore.spinner)
|
|
const handleKey = (e: KeyboardEvent) => {
|
|
workspaceStore.shiftDown = e.shiftKey
|
|
}
|
|
useEventListener(window, 'keydown', handleKey)
|
|
useEventListener(window, 'keyup', handleKey)
|
|
|
|
const showContextMenu = (event: PointerEvent) => {
|
|
const { target } = event
|
|
switch (true) {
|
|
case target instanceof HTMLTextAreaElement:
|
|
case target instanceof HTMLInputElement && target.type === 'text':
|
|
// TODO: Context input menu explicitly for text input
|
|
showNativeMenu({ type: 'text' })
|
|
return
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
window['__COMFYUI_FRONTEND_VERSION__'] = config.app_version
|
|
console.log('ComfyUI Front-end version:', config.app_version)
|
|
|
|
if (isElectron()) {
|
|
document.addEventListener('contextmenu', showContextMenu)
|
|
}
|
|
})
|
|
</script>
|