mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-26 17:54:14 +00:00
Support cross domain/application copy/paste (#6087)
 Browsers place very heavy restrictions on what can be copied and pasted. See: - https://alexharri.com/blog/clipboard - https://www.w3.org/TR/clipboard-apis/#mandatory-data-types-x ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6087-Experimental-cross-domain-application-copy-paste-28e6d73d36508154a0a8deeb392f43a4) by [Unito](https://www.unito.io)
This commit is contained in:
30
src/workbench/eventHelpers.ts
Normal file
30
src/workbench/eventHelpers.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Utility functions for handling workbench events
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used by clipboard handlers to determine if copy/paste events should be
|
||||
* intercepted for graph operations vs. allowing default browser behavior
|
||||
* for text inputs and other UI elements.
|
||||
*
|
||||
* @param target - The event target to check
|
||||
* @returns true if copy paste events will be handled by target
|
||||
*/
|
||||
export function shouldIgnoreCopyPaste(target: EventTarget | null): boolean {
|
||||
return (
|
||||
target instanceof HTMLTextAreaElement ||
|
||||
(target instanceof HTMLInputElement &&
|
||||
![
|
||||
'button',
|
||||
'checkbox',
|
||||
'file',
|
||||
'hidden',
|
||||
'image',
|
||||
'radio',
|
||||
'range',
|
||||
'reset',
|
||||
'search',
|
||||
'submit'
|
||||
].includes(target.type))
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user