fix(frontend): 保留 Mermaid 大图文字并完善图表与卡片交互
This commit is contained in:
@@ -7,7 +7,21 @@ export function appendDiagramControls(container: HTMLElement) {
|
||||
const button = document.createElement('button')
|
||||
button.type = 'button'
|
||||
button.dataset.diagramAction = action
|
||||
button.textContent = label
|
||||
const paths: Record<string, string> = {
|
||||
out: 'M8 11h6 M15 15l5 5 M17 10a7 7 0 1 1-14 0a7 7 0 0 1 14 0',
|
||||
in: 'M8 10h6 M11 7v6 M15 15l5 5 M17 10a7 7 0 1 1-14 0a7 7 0 0 1 14 0',
|
||||
reset: 'M3 10a9 9 0 1 1 2 8 M3 3v7h7',
|
||||
view: 'M3 9V3h6 M15 3h6v6 M21 15v6h-6 M9 21H3v-6',
|
||||
}
|
||||
const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
||||
icon.setAttribute('viewBox', '0 0 24 24')
|
||||
icon.setAttribute('width', '16'); icon.setAttribute('height', '16')
|
||||
icon.setAttribute('aria-hidden', 'true')
|
||||
const path = document.createElementNS(icon.namespaceURI, 'path')
|
||||
path.setAttribute('d', paths[action!]!)
|
||||
path.setAttribute('fill', 'none'); path.setAttribute('stroke', 'currentColor'); path.setAttribute('stroke-width', '1.8')
|
||||
icon.append(path)
|
||||
button.append(icon, document.createTextNode(label!))
|
||||
controls.append(button)
|
||||
}
|
||||
container.append(controls)
|
||||
|
||||
Reference in New Issue
Block a user