Files
Sable/src/app/hooks/useFilePasteHandler.ts
T
7w1 1717ca872f migrate to oxlint and oxfmt
ran formatter
fixed lint issues, primarily getting rid of "any"s and swapping to .toSorted()
2026-04-16 22:15:13 -05:00

13 lines
386 B
TypeScript

import type { ClipboardEventHandler } from 'react';
import { useCallback } from 'react';
import { getDataTransferFiles } from '$utils/dom';
export const useFilePasteHandler = (onPaste: (file: File[]) => void): ClipboardEventHandler =>
useCallback(
(evt) => {
const files = getDataTransferFiles(evt.clipboardData);
if (files) onPaste(files);
},
[onPaste]
);