diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b52b0b7..13d5b31 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,9 @@
-
-
+
-
+
@@ -44,6 +43,7 @@
"RunOnceActivity.ShowReadmeOnStart": "true",
"Vitest.mergeText.executor": "Run",
"Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run",
+ "Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
"git-widget-placeholder": "main",
"ignore.virus.scanning.warn.message": "true",
"kotlin-language-version-configured": "true",
@@ -87,34 +87,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -137,8 +110,6 @@
-
-
@@ -161,7 +132,7 @@
-
+
@@ -403,7 +374,15 @@
1719153044395
-
+
+
+ 1719154187887
+
+
+
+ 1719154187887
+
+
@@ -424,7 +403,6 @@
-
@@ -449,7 +427,8 @@
-
+
+
diff --git a/src/components/result/ToolTextResult.tsx b/src/components/result/ToolTextResult.tsx
index 6b14acf..3a4c80b 100644
--- a/src/components/result/ToolTextResult.tsx
+++ b/src/components/result/ToolTextResult.tsx
@@ -3,7 +3,8 @@ import { Box, Stack, TextField } from '@mui/material';
import Button from '@mui/material/Button';
import DownloadIcon from '@mui/icons-material/Download';
import ContentPasteIcon from '@mui/icons-material/ContentPaste';
-import React from 'react';
+import React, { useContext } from 'react';
+import { CustomSnackBarContext } from '../../contexts/CustomSnackBarContext';
export default function ToolTextResult({
title = 'Result',
@@ -12,6 +13,28 @@ export default function ToolTextResult({
title?: string;
value: string;
}) {
+ const { showSnackBar } = useContext(CustomSnackBarContext);
+ const handleCopy = () => {
+ navigator.clipboard
+ .writeText(value)
+ .then(() => showSnackBar('Text copied', 'success'))
+ .catch((err) => {
+ showSnackBar('Failed to copy: ' + err, 'error');
+ });
+ };
+ const handleDownload = () => {
+ const filename = 'output-omni-tools.txt';
+
+ const blob = new Blob([value], { type: 'text/plain' });
+ const url = window.URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = filename;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(url);
+ };
return (
@@ -19,8 +42,12 @@ export default function ToolTextResult({
- }>Save as
- }>Copy to clipboard
+ }>
+ Save as
+
+ }>
+ Copy to clipboard
+
);