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