Type LGraphNode.pasteFile (#2455)

This commit is contained in:
Chenlei Hu
2025-02-06 13:50:48 -05:00
committed by GitHub
parent 1061620783
commit 629ac63f06
3 changed files with 4 additions and 4 deletions

View File

@@ -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
}
}

View File

@@ -730,8 +730,7 @@ export const ComfyWidgets: Record<string, ComfyWidgetConstructor> = {
return handled
}
// @ts-expect-error
node.pasteFile = function (file) {
node.pasteFile = function (file: File) {
if (file.type.startsWith('image/')) {
const is_pasted =
file.name === 'image.png' && file.lastModified - Date.now() < 2000

View File

@@ -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 {