Support cross domain/application copy/paste (#6087)

![AnimateDiff_00001](https://github.com/user-attachments/assets/8ae88dc5-bba8-40c0-9cc2-5e81f579761d)


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:
AustinMroz
2025-10-20 10:03:15 -07:00
committed by GitHub
parent 55d2b300a6
commit 8eac19d06e
4 changed files with 71 additions and 30 deletions

View 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))
)
}