Fixed small formating errors

pull/66/head
s8613 2025-06-14 10:25:52 +02:00
parent 1846b24de8
commit a8a4981b81
1 changed files with 15 additions and 18 deletions

View File

@ -50,7 +50,13 @@ function ExtractedResultsPage() {
if (!settingData || settingData.length === 0) {
return "";
}
return settingData[0]?.entity || "";
let value = settingData[0]?.entity || "";
value = value
.replace(/[\r\n]/g, ' ')
.replace(/\s+/g, ' ')
.trim();
value = value.replace(/\t/g, ' ');
return value;
});
return values.join('\t');
};
@ -59,11 +65,13 @@ function ExtractedResultsPage() {
try {
const textToCopy = prepareClipboardData();
// Use the modern Clipboard API if available
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(textToCopy);
await navigator.clipboard.write([
new ClipboardItem({
'text/plain': new Blob([textToCopy], { type: 'text/plain' })
})
]);
} else {
// Fallback for older browsers or non-secure contexts
const textArea = document.createElement("textarea");
textArea.value = textToCopy;
textArea.style.position = "fixed";
@ -76,14 +84,12 @@ function ExtractedResultsPage() {
textArea.remove();
}
// Show success feedback
setCopied(true);
setSnackbarOpen(true);
setTimeout(() => setCopied(false), 2000);
} catch (err) {
console.error('Failed to copy text: ', err);
// You could show an error snackbar here if needed
console.error('Fallback to copy failed');
}
};
@ -157,17 +163,8 @@ function ExtractedResultsPage() {
<PDFViewer pitchBookId={pitchBook} currentPage={currentPage} />
</Paper>
<Box mt={2} display="flex" justifyContent="flex-end" gap={2}>
<Button
variant="contained"
sx={{
backgroundColor: copied ? "#4caf50" : "#383838",
'&:hover': {
backgroundColor: copied ? "#45a049" : "#555555",
},
transition: "all 0.3s ease",
}}
onClick={handleCopyToClipboard}
>
<Button variant="contained" sx={{ backgroundColor: "#383838" }}
onClick={handleCopyToClipboard}>
<ContentPasteIcon sx={{ fontSize: 18, mr: 1 }} />
{copied ? "Kopiert!" : "Kennzahlenzeile kopieren"}
</Button>