From 3c70c1e46356ca6a18b5f9a1d7af1c8f2763d6c2 Mon Sep 17 00:00:00 2001 From: bymyself Date: Sun, 6 Oct 2024 09:08:16 -0700 Subject: [PATCH] Show keybinding on topbar dropdown menus (#1127) * Show keybinding on topbar dropdown menus, resolve #1092 * Add text-muted to tailwind config * Add Playwright test * Preserve Primevue classes in menu item template * Extend MenuItem * Revert adding undo/redo to core keybindings * Change test selector * refactor * Extract as component * refactor * nit * fix extension API --------- Co-authored-by: huchenlei --- browser_tests/menu.spec.ts | 10 +++ src/components/actionbar/ComfyQueueButton.vue | 1 + src/components/topbar/CommandMenubar.vue | 55 ++++++++++++ src/components/topbar/TopMenubar.vue | 29 +------ src/stores/commandStore.ts | 55 +++++++++++- src/stores/menuItemStore.ts | 85 ++++++++----------- tailwind.config.js | 4 + 7 files changed, 159 insertions(+), 80 deletions(-) create mode 100644 src/components/topbar/CommandMenubar.vue diff --git a/browser_tests/menu.spec.ts b/browser_tests/menu.spec.ts index 801ac3d66f..5b7561f11b 100644 --- a/browser_tests/menu.spec.ts +++ b/browser_tests/menu.spec.ts @@ -499,6 +499,16 @@ test.describe('Menu', () => { }) expect(isTextCutoff).toBe(false) }) + + test('Displays keybinding next to item', async ({ comfyPage }) => { + const workflowMenuItem = + await comfyPage.menu.topbar.getMenuItem('Workflow') + await workflowMenuItem.click() + const exportTag = comfyPage.page.locator('.keybinding-tag', { + hasText: 'Ctrl + s' + }) + expect(await exportTag.count()).toBe(1) + }) }) // Only test 'Top' to reduce test time. diff --git a/src/components/actionbar/ComfyQueueButton.vue b/src/components/actionbar/ComfyQueueButton.vue index c36f78deb0..b816678491 100644 --- a/src/components/actionbar/ComfyQueueButton.vue +++ b/src/components/actionbar/ComfyQueueButton.vue @@ -47,6 +47,7 @@ import SplitButton from 'primevue/splitbutton' import Button from 'primevue/button' import BatchCountEdit from './BatchCountEdit.vue' +import ButtonGroup from 'primevue/buttongroup' import { useI18n } from 'vue-i18n' import { AutoQueueMode, diff --git a/src/components/topbar/CommandMenubar.vue b/src/components/topbar/CommandMenubar.vue new file mode 100644 index 0000000000..cfa79486e7 --- /dev/null +++ b/src/components/topbar/CommandMenubar.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/src/components/topbar/TopMenubar.vue b/src/components/topbar/TopMenubar.vue index b6680c0252..1e79ee84c9 100644 --- a/src/components/topbar/TopMenubar.vue +++ b/src/components/topbar/TopMenubar.vue @@ -7,15 +7,7 @@ :class="{ dropzone: isDropZone, 'dropzone-active': isDroppable }" >

ComfyUI

- +
@@ -27,11 +19,10 @@