Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,9 @@ export class ComfyApp {
})
return
} else {
console.error('Invalid workflow structure, trying parameters fallback')
console.error(
'Invalid workflow structure, trying parameters fallback'
)
this.showErrorOnFileLoad(file)
}
} catch (err) {
Expand Down
15 changes: 11 additions & 4 deletions src/workbench/eventHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
* Utility functions for handling workbench events
*/

/**
* Check if there is selected text in the document.
*/
function hasTextSelection(): boolean {
const selection = window.getSelection()
return selection !== null && selection.toString().trim().length > 0
}

/**
* Used by clipboard handlers to determine if copy/paste events should be
* intercepted for graph operations vs. allowing default browser behavior
Expand All @@ -12,7 +20,7 @@ import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
* @returns true if copy paste events will be handled by target
*/
export function shouldIgnoreCopyPaste(target: EventTarget | null): boolean {
return (
const isTextInput =
target instanceof HTMLTextAreaElement ||
(target instanceof HTMLInputElement &&
![
Expand All @@ -26,7 +34,6 @@ export function shouldIgnoreCopyPaste(target: EventTarget | null): boolean {
'reset',
'search',
'submit'
].includes(target.type)) ||
useCanvasStore().linearMode
)
].includes(target.type))
return isTextInput || useCanvasStore().linearMode || hasTextSelection()
}