Skip to content

Commit 5c4d1c2

Browse files
Fix copy/paste on firefox (#432)
1 parent 711205b commit 5c4d1c2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/scripts/app.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,9 @@ export class ComfyApp {
11551155
*/
11561156
#addCopyHandler() {
11571157
document.addEventListener('copy', (e) => {
1158+
if (!(e.target instanceof Element)) {
1159+
return
1160+
}
11581161
if (
11591162
(e.target instanceof HTMLTextAreaElement &&
11601163
e.target.type === 'textarea') ||
@@ -1163,13 +1166,12 @@ export class ComfyApp {
11631166
// Default system copy
11641167
return
11651168
}
1169+
const isTargetInGraph =
1170+
e.target.classList.contains('litegraph') ||
1171+
e.target.classList.contains('graph-canvas-container')
11661172

11671173
// copy nodes and clear clipboard
1168-
if (
1169-
e.target instanceof Element &&
1170-
e.target.classList.contains('litegraph') &&
1171-
this.canvas.selected_nodes
1172-
) {
1174+
if (isTargetInGraph && this.canvas.selected_nodes) {
11731175
this.canvas.copyToClipboard()
11741176
e.clipboardData.setData('text', ' ') //clearData doesn't remove images from clipboard
11751177
e.preventDefault()

0 commit comments

Comments
 (0)