mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary Show a non-blocking warning in the keybinding edit dialog when users try to bind shortcuts that browsers intercept (e.g. Ctrl+T, Ctrl+W, F12). ## Changes - **What**: Add `RESERVED_BY_BROWSER` set of known browser-intercepted shortcuts, `isBrowserReserved` getter on `KeyComboImpl`, and a warning `<Message>` in the keybinding edit dialog. Users can still save the binding. ## Review Focus Whether the list of browser-reserved shortcuts is comprehensive enough, and whether a non-blocking warning (vs blocking) is the right UX choice. ## Before https://github.com/user-attachments/assets/5abfc062-5ed1-4fcd-b394-ff98221d82a8 ## After https://github.com/user-attachments/assets/12a49e24-051f-4579-894a-164dbf1cb7b7 Fixes #1087 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9406-feat-Warn-when-binding-browser-reserved-shortcuts-31a6d73d36508162a021e88ab76914f6) by [Unito](https://www.unito.io) --------- Co-authored-by: Kelly Yang <124ykl@gmail.com> Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: jaeone94 <89377375+jaeone94@users.noreply.github.com> Co-authored-by: Benjamin Lu <benjaminlu1107@gmail.com> Co-authored-by: Comfy Org PR Bot <snomiao+comfy-pr@gmail.com> Co-authored-by: christian-byrne <72887196+christian-byrne@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: AustinMroz <austin@comfy.org> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Terry Jia <terryjia88@gmail.com> Co-authored-by: Alexander Brown <DrJKL0424@gmail.com> Co-authored-by: Dante <bunggl@naver.com> Co-authored-by: Deep Mehta <42841935+deepme987@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: Jin Yi <jin12cc@gmail.com> Co-authored-by: Yourz <crazilou@vip.qq.com> Co-authored-by: pythongosssss <125205205+pythongosssss@users.noreply.github.com>
133 lines
4.1 KiB
Vue
133 lines
4.1 KiB
Vue
<template>
|
|
<div class="flex h-full flex-col">
|
|
<Tabs
|
|
:key="$i18n.locale"
|
|
v-model:value="bottomPanelStore.activeBottomPanelTabId"
|
|
style="--p-tabs-tablist-background: var(--comfy-menu-bg)"
|
|
>
|
|
<TabList
|
|
pt:tab-list="border-none h-full flex items-center py-2 border-b-1 border-solid"
|
|
class="bg-transparent"
|
|
>
|
|
<div class="flex w-full justify-between">
|
|
<div class="tabs-container font-inter">
|
|
<Tab
|
|
v-for="tab in bottomPanelStore.bottomPanelTabs"
|
|
:key="tab.id"
|
|
:value="tab.id"
|
|
class="m-1 mx-2 border-none font-inter"
|
|
:class="{
|
|
'tab-list-single-item':
|
|
bottomPanelStore.bottomPanelTabs.length === 1
|
|
}"
|
|
:pt:root="
|
|
(x: TabPassThroughMethodOptions) => ({
|
|
class: {
|
|
'p-3 rounded-lg': true,
|
|
'pointer-events-none':
|
|
bottomPanelStore.bottomPanelTabs.length === 1,
|
|
'bg-secondary-background text-secondary-foreground':
|
|
x.context.active &&
|
|
bottomPanelStore.bottomPanelTabs.length > 1,
|
|
'text-muted-foreground':
|
|
!x.context.active ||
|
|
bottomPanelStore.bottomPanelTabs.length <= 1
|
|
}
|
|
})
|
|
"
|
|
>
|
|
<span class="font-normal">
|
|
{{ getTabDisplayTitle(tab) }}
|
|
</span>
|
|
</Tab>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<Button
|
|
v-if="isShortcutsTabActive"
|
|
variant="muted-textonly"
|
|
size="sm"
|
|
@click="openKeybindingSettings"
|
|
>
|
|
<i class="pi pi-cog" />
|
|
{{ $t('shortcuts.manageShortcuts') }}
|
|
</Button>
|
|
<Button
|
|
class="justify-self-end"
|
|
variant="muted-textonly"
|
|
size="sm"
|
|
:aria-label="t('g.close')"
|
|
@click="closeBottomPanel"
|
|
>
|
|
<i class="pi pi-times" />
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</TabList>
|
|
</Tabs>
|
|
<!-- h-0 to force the div to grow -->
|
|
<div class="h-0 grow">
|
|
<ExtensionSlot
|
|
v-if="
|
|
bottomPanelStore.bottomPanelVisible &&
|
|
bottomPanelStore.activeBottomPanelTab
|
|
"
|
|
:extension="bottomPanelStore.activeBottomPanelTab"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Tab from 'primevue/tab'
|
|
import type { TabPassThroughMethodOptions } from 'primevue/tab'
|
|
import TabList from 'primevue/tablist'
|
|
import Tabs from 'primevue/tabs'
|
|
import { computed } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import ExtensionSlot from '@/components/common/ExtensionSlot.vue'
|
|
import Button from '@/components/ui/button/Button.vue'
|
|
import { useSettingsDialog } from '@/platform/settings/composables/useSettingsDialog'
|
|
import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
|
|
import type { BottomPanelExtension } from '@/types/extensionTypes'
|
|
|
|
const bottomPanelStore = useBottomPanelStore()
|
|
const settingsDialog = useSettingsDialog()
|
|
const { t } = useI18n()
|
|
|
|
const isShortcutsTabActive = computed(() => {
|
|
const activeTabId = bottomPanelStore.activeBottomPanelTabId
|
|
return (
|
|
activeTabId === 'shortcuts-essentials' ||
|
|
activeTabId === 'shortcuts-view-controls'
|
|
)
|
|
})
|
|
|
|
const shouldCapitalizeTab = (tabId: string): boolean => {
|
|
return tabId !== 'shortcuts-essentials' && tabId !== 'shortcuts-view-controls'
|
|
}
|
|
|
|
const getTabDisplayTitle = (tab: BottomPanelExtension): string => {
|
|
const title = tab.titleKey ? t(tab.titleKey) : tab.title || ''
|
|
return shouldCapitalizeTab(tab.id) ? title.toUpperCase() : title
|
|
}
|
|
|
|
const openKeybindingSettings = async () => {
|
|
settingsDialog.show('keybinding')
|
|
}
|
|
|
|
const closeBottomPanel = () => {
|
|
bottomPanelStore.activePanel = null
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
:deep(.p-tablist-active-bar) {
|
|
display: none;
|
|
}
|
|
|
|
:deep(.p-tab-active) {
|
|
color: inherit;
|
|
}
|
|
</style>
|