mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
copy and paste in the menu
This commit is contained in:
@@ -18,7 +18,7 @@ import { useDialogService } from '@/services/dialogService'
|
||||
import { useLitegraphService } from '@/services/litegraphService'
|
||||
import { useWorkflowService } from '@/services/workflowService'
|
||||
import type { ComfyCommand } from '@/stores/commandStore'
|
||||
import { useTitleEditorStore } from '@/stores/graphStore'
|
||||
import { useCanvasStore, useTitleEditorStore } from '@/stores/graphStore'
|
||||
import { useQueueSettingsStore, useQueueStore } from '@/stores/queueStore'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
@@ -156,6 +156,30 @@ export function useCoreCommands(): ComfyCommand[] {
|
||||
await getTracker()?.redo?.()
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.Edit.Copy',
|
||||
icon: 'pi pi-copy',
|
||||
label: 'Copy',
|
||||
function: () => {
|
||||
// Leverage existing copy logic
|
||||
const canvas = useCanvasStore().canvas
|
||||
if (canvas?.selectedItems) {
|
||||
canvas.copyToClipboard()
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.Edit.Paste',
|
||||
icon: 'pi pi-clipboard',
|
||||
label: 'Paste',
|
||||
function: () => {
|
||||
// Leverage existing paste logic, position at last interaction point
|
||||
const canvas = useCanvasStore().canvas
|
||||
if (canvas) {
|
||||
canvas.pasteFromClipboard()
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.ClearWorkflow',
|
||||
icon: 'pi pi-trash',
|
||||
|
||||
@@ -173,5 +173,15 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
key: 'f'
|
||||
},
|
||||
commandId: 'Workspace.ToggleFocusMode'
|
||||
},
|
||||
{
|
||||
combo: { ctrl: true, key: 'c' },
|
||||
commandId: 'Comfy.Edit.Copy',
|
||||
targetElementId: 'graph-canvas'
|
||||
},
|
||||
{
|
||||
combo: { ctrl: true, key: 'v' },
|
||||
commandId: 'Comfy.Edit.Paste',
|
||||
targetElementId: 'graph-canvas'
|
||||
}
|
||||
]
|
||||
|
||||
@@ -11,6 +11,7 @@ export const CORE_MENU_COMMANDS = [
|
||||
]
|
||||
],
|
||||
[['Edit'], ['Comfy.Undo', 'Comfy.Redo']],
|
||||
[['Edit'], ['Comfy.Edit.Copy', 'Comfy.Edit.Paste']],
|
||||
[['Edit'], ['Comfy.RefreshNodeDefinitions']],
|
||||
[['Edit'], ['Comfy.ClearWorkflow']],
|
||||
[['Edit'], ['Comfy.OpenClipspace']],
|
||||
|
||||
Reference in New Issue
Block a user