Skip to content

Commit

Permalink
Type LGraphNode.pasteFile
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Feb 6, 2025
1 parent 1061620 commit 3a203ce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/composables/usePaste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export const usePaste = () => {
graph.change()
}
const blob = item.getAsFile()
// @ts-expect-error: Property 'pasteFile' does not exist on type 'LGraphNode'.
imageNode?.pasteFile(blob)
imageNode?.pasteFile?.(blob)
return
}
}
Expand Down
1 change: 0 additions & 1 deletion src/scripts/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ export const ComfyWidgets: Record<string, ComfyWidgetConstructor> = {
return handled
}

// @ts-expect-error
node.pasteFile = function (file) {
if (file.type.startsWith('image/')) {
const is_pasted =
Expand Down
2 changes: 2 additions & 0 deletions src/types/litegraph-augmentation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ declare module '@comfyorg/litegraph' {
imageOffset?: number
/** Set by DOM widgets */
freeWidgetSpace?: number
/** Callback for pasting an image file into the node */
pasteFile?(file: File): void
}

interface INodeSlot {
Expand Down

0 comments on commit 3a203ce

Please sign in to comment.