feat: 7 Vorbereitungs-Module auf 100% — Frontend, Proxy-Routen, Backend-Fixes
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 35s
CI / test-python-backend-compliance (push) Successful in 30s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 19s
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 35s
CI / test-python-backend-compliance (push) Successful in 30s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 19s
Profil: machineBuilder-Felder im POST-Body, PATCH-Handler Scope: API-Route (GET/POST), ScopeDecisionTab Props + Buttons, Export-Druckansicht HTML Anwendung: PUT-Handler, Bearbeiten-Button, Pagination/Search Import: Verlauf laden, DELETE-Route, Offline-Badge, ObjectURL Memory-Leak fix Screening: Security-Backlog Button verdrahtet, Scan-Verlauf Module: Detail-Seite, GET-Proxy, Konfigurieren-Button, Modul-erstellen-Modal, Error-Toast Quellen: 10 Proxy-Routen, Tab-Komponenten umgestellt, Dashboard-Tab, blocked_today Bug fix, Datum-Filter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -126,10 +126,63 @@ export function ScopeExportTab({ decision: decisionProp, answers: answersProp, s
|
||||
})
|
||||
}, [generateMarkdownSummary])
|
||||
|
||||
/** Simple markdown-to-HTML converter for print view */
|
||||
const markdownToHtml = useCallback((md: string): string => {
|
||||
let html = md
|
||||
// Escape HTML entities
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
// Headers
|
||||
html = html.replace(/^### (.+)$/gm, '<h3>$1</h3>')
|
||||
html = html.replace(/^## (.+)$/gm, '<h2>$1</h2>')
|
||||
html = html.replace(/^# (.+)$/gm, '<h1>$1</h1>')
|
||||
// Bold
|
||||
html = html.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
||||
// Tables
|
||||
const lines = html.split('\n')
|
||||
let inTable = false
|
||||
const result: string[] = []
|
||||
for (const line of lines) {
|
||||
if (line.trim().startsWith('|') && line.trim().endsWith('|')) {
|
||||
if (line.includes('---')) continue // separator row
|
||||
const cells = line.split('|').filter(c => c.trim() !== '')
|
||||
if (!inTable) {
|
||||
result.push('<table><thead><tr>')
|
||||
cells.forEach(c => result.push(`<th>${c.trim()}</th>`))
|
||||
result.push('</tr></thead><tbody>')
|
||||
inTable = true
|
||||
} else {
|
||||
result.push('<tr>')
|
||||
cells.forEach(c => result.push(`<td>${c.trim()}</td>`))
|
||||
result.push('</tr>')
|
||||
}
|
||||
} else {
|
||||
if (inTable) {
|
||||
result.push('</tbody></table>')
|
||||
inTable = false
|
||||
}
|
||||
// List items
|
||||
if (line.trim().startsWith('- ')) {
|
||||
result.push(`<li>${line.trim().slice(2)}</li>`)
|
||||
} else if (/^\d+\.\s/.test(line.trim())) {
|
||||
result.push(`<li>${line.trim().replace(/^\d+\.\s/, '')}</li>`)
|
||||
} else if (line.trim() === '') {
|
||||
result.push('<br/>')
|
||||
} else {
|
||||
result.push(`<p>${line}</p>`)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inTable) result.push('</tbody></table>')
|
||||
return result.join('\n')
|
||||
}, [])
|
||||
|
||||
const handlePrintView = useCallback(() => {
|
||||
if (!decision) return
|
||||
|
||||
const markdown = generateMarkdownSummary()
|
||||
const renderedHtml = markdownToHtml(markdown)
|
||||
const htmlContent = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -152,6 +205,7 @@ export function ScopeExportTab({ decision: decisionProp, answers: answersProp, s
|
||||
th { background-color: #f3f4f6; font-weight: 600; }
|
||||
ul { list-style-type: disc; padding-left: 20px; }
|
||||
li { margin: 8px 0; }
|
||||
p { margin: 4px 0; }
|
||||
@media print {
|
||||
body { margin: 20px; }
|
||||
h1, h2, h3 { page-break-after: avoid; }
|
||||
@@ -160,7 +214,7 @@ export function ScopeExportTab({ decision: decisionProp, answers: answersProp, s
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre style="white-space: pre-wrap; font-family: inherit;">${markdown}</pre>
|
||||
${renderedHtml}
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
@@ -171,7 +225,7 @@ export function ScopeExportTab({ decision: decisionProp, answers: answersProp, s
|
||||
printWindow.focus()
|
||||
setTimeout(() => printWindow.print(), 250)
|
||||
}
|
||||
}, [decision, generateMarkdownSummary])
|
||||
}, [decision, generateMarkdownSummary, markdownToHtml])
|
||||
|
||||
if (!decision) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user