mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 00:51:17 -08:00
ran formatter fixed lint issues, primarily getting rid of "any"s and swapping to .toSorted()
13 lines
386 B
TypeScript
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]
|
|
);
|