mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-02 19:49:58 +00:00
 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)
31 lines
767 B
TypeScript
31 lines
767 B
TypeScript
/**
|
|
* 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))
|
|
)
|
|
}
|