mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 18:22:40 +00:00
Fix copy/paste on firefox (#432)
This commit is contained in:
@@ -1155,6 +1155,9 @@ export class ComfyApp {
|
|||||||
*/
|
*/
|
||||||
#addCopyHandler() {
|
#addCopyHandler() {
|
||||||
document.addEventListener('copy', (e) => {
|
document.addEventListener('copy', (e) => {
|
||||||
|
if (!(e.target instanceof Element)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
(e.target instanceof HTMLTextAreaElement &&
|
(e.target instanceof HTMLTextAreaElement &&
|
||||||
e.target.type === 'textarea') ||
|
e.target.type === 'textarea') ||
|
||||||
@@ -1163,13 +1166,12 @@ export class ComfyApp {
|
|||||||
// Default system copy
|
// Default system copy
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const isTargetInGraph =
|
||||||
|
e.target.classList.contains('litegraph') ||
|
||||||
|
e.target.classList.contains('graph-canvas-container')
|
||||||
|
|
||||||
// copy nodes and clear clipboard
|
// copy nodes and clear clipboard
|
||||||
if (
|
if (isTargetInGraph && this.canvas.selected_nodes) {
|
||||||
e.target instanceof Element &&
|
|
||||||
e.target.classList.contains('litegraph') &&
|
|
||||||
this.canvas.selected_nodes
|
|
||||||
) {
|
|
||||||
this.canvas.copyToClipboard()
|
this.canvas.copyToClipboard()
|
||||||
e.clipboardData.setData('text', ' ') //clearData doesn't remove images from clipboard
|
e.clipboardData.setData('text', ' ') //clearData doesn't remove images from clipboard
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
Reference in New Issue
Block a user