mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-18 21:49:31 +02:00
fix: ToolFileInput.tsx
This commit is contained in:
@@ -26,12 +26,17 @@ export default function ToolFileInput({
|
|||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const handleCopy = () => {
|
const handleCopy = () => {
|
||||||
navigator.clipboard
|
if (value) {
|
||||||
.writeText(value?.name ?? '')
|
const blob = new Blob([value], { type: value.type });
|
||||||
.then(() => showSnackBar('Text copied', 'success'))
|
const clipboardItem = new ClipboardItem({ [value.type]: blob });
|
||||||
.catch((err) => {
|
|
||||||
showSnackBar('Failed to copy: ' + err, 'error');
|
navigator.clipboard
|
||||||
});
|
.write([clipboardItem])
|
||||||
|
.then(() => showSnackBar('File copied', 'success'))
|
||||||
|
.catch((err) => {
|
||||||
|
showSnackBar('Failed to copy: ' + err, 'error');
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
Reference in New Issue
Block a user