diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index cb0ccae..cf6cb57 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,18 +4,10 @@
-
-
-
+
-
-
-
-
-
+
-
-
@@ -137,7 +129,7 @@
-
+
@@ -347,7 +339,15 @@
1719096551866
-
+
+
+ 1719102365836
+
+
+
+ 1719102365836
+
+
@@ -390,7 +390,8 @@
-
+
+
diff --git a/src/components/input/ToolTextInput.tsx b/src/components/input/ToolTextInput.tsx
index 171c49c..3d27244 100644
--- a/src/components/input/ToolTextInput.tsx
+++ b/src/components/input/ToolTextInput.tsx
@@ -3,7 +3,8 @@ import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';
import PublishIcon from '@mui/icons-material/Publish';
import ContentPasteIcon from '@mui/icons-material/ContentPaste';
-import React from 'react';
+import React, { useContext, useRef } from 'react';
+import { CustomSnackBarContext } from '../../contexts/CustomSnackBarContext';
export default function ToolTextInput({
value,
@@ -14,6 +15,34 @@ export default function ToolTextInput({
value: string;
onChange: (value: string) => void;
}) {
+ const { showSnackBar } = useContext(CustomSnackBarContext);
+ const fileInputRef = useRef(null);
+
+ const handleCopy = () => {
+ navigator.clipboard
+ .writeText(value)
+ .then(() => showSnackBar('Text copied', 'success'))
+ .catch((err) => {
+ showSnackBar('Failed to copy: ', 'error');
+ });
+ };
+ const handleFileChange = (event: React.ChangeEvent) => {
+ const file = event.target.files?.[0];
+ if (file) {
+ const reader = new FileReader();
+ reader.onload = (e) => {
+ const text = e.target?.result;
+ if (typeof text === 'string') {
+ onChange(text);
+ }
+ };
+ reader.readAsText(file);
+ }
+ };
+
+ const handleImportClick = () => {
+ fileInputRef.current?.click();
+ };
return (
@@ -27,9 +56,20 @@ export default function ToolTextInput({
rows={10}
/>
- }>Import from file
- }>Copy to clipboard
+ }>
+ Import from file
+
+ }>
+ Copy to clipboard
+
+
);
}
diff --git a/src/pages/string/split/meta.ts b/src/pages/string/split/meta.ts
index fb399a2..cfc92db 100644
--- a/src/pages/string/split/meta.ts
+++ b/src/pages/string/split/meta.ts
@@ -5,7 +5,7 @@ import image from '../../../assets/text.png';
export const tool = defineTool('string', {
path: 'split',
name: 'Text splitter',
- image: image,
+ image,
description:
"World's simplest browser-based utility for splitting text. Load your text in the input form on the left and you'll automatically get pieces of this text on the right. Powerful, free, and fast. Load text – get chunks.",
keywords: ['text', 'split'],