mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
Type LGraphNode.pasteFile (#2455)
This commit is contained in:
@@ -54,8 +54,7 @@ export const usePaste = () => {
|
|||||||
graph.change()
|
graph.change()
|
||||||
}
|
}
|
||||||
const blob = item.getAsFile()
|
const blob = item.getAsFile()
|
||||||
// @ts-expect-error: Property 'pasteFile' does not exist on type 'LGraphNode'.
|
imageNode?.pasteFile?.(blob)
|
||||||
imageNode?.pasteFile(blob)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -730,8 +730,7 @@ export const ComfyWidgets: Record<string, ComfyWidgetConstructor> = {
|
|||||||
return handled
|
return handled
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error
|
node.pasteFile = function (file: File) {
|
||||||
node.pasteFile = function (file) {
|
|
||||||
if (file.type.startsWith('image/')) {
|
if (file.type.startsWith('image/')) {
|
||||||
const is_pasted =
|
const is_pasted =
|
||||||
file.name === 'image.png' && file.lastModified - Date.now() < 2000
|
file.name === 'image.png' && file.lastModified - Date.now() < 2000
|
||||||
|
|||||||
2
src/types/litegraph-augmentation.d.ts
vendored
2
src/types/litegraph-augmentation.d.ts
vendored
@@ -102,6 +102,8 @@ declare module '@comfyorg/litegraph' {
|
|||||||
imageOffset?: number
|
imageOffset?: number
|
||||||
/** Set by DOM widgets */
|
/** Set by DOM widgets */
|
||||||
freeWidgetSpace?: number
|
freeWidgetSpace?: number
|
||||||
|
/** Callback for pasting an image file into the node */
|
||||||
|
pasteFile?(file: File): void
|
||||||
}
|
}
|
||||||
|
|
||||||
interface INodeSlot {
|
interface INodeSlot {
|
||||||
|
|||||||
Reference in New Issue
Block a user