fix(knowledge-graph): improve tooltip styling and text wrapping
- Add max-width constraint to node and edge tooltip containers - Enable word breaking and preserve whitespace formatting for edge descriptions - Prevent tooltip overflow and improve readability of long description text
This commit is contained in:
@@ -292,7 +292,7 @@ const KnowledgeGraph: FC<KnowledgeGraphProps> = ({ data, loading = false }) => {
|
|||||||
if (params.dataType === 'node') {
|
if (params.dataType === 'node') {
|
||||||
const node = params.data as KnowledgeNode
|
const node = params.data as KnowledgeNode
|
||||||
return `
|
return `
|
||||||
<div>
|
<div class="rb:max-w-[560px]">
|
||||||
<div><strong>${node.entity_name}</strong></div>
|
<div><strong>${node.entity_name}</strong></div>
|
||||||
<div>类型: ${node.entity_type}</div>
|
<div>类型: ${node.entity_type}</div>
|
||||||
<div>重要度: ${(node.pagerank * 100).toFixed(2)}%</div>
|
<div>重要度: ${(node.pagerank * 100).toFixed(2)}%</div>
|
||||||
@@ -301,10 +301,10 @@ const KnowledgeGraph: FC<KnowledgeGraphProps> = ({ data, loading = false }) => {
|
|||||||
} else if (params.dataType === 'edge') {
|
} else if (params.dataType === 'edge') {
|
||||||
const edge = params.data as KnowledgeEdge
|
const edge = params.data as KnowledgeEdge
|
||||||
return `
|
return `
|
||||||
<div>
|
<div class="rb:max-w-[560px]">
|
||||||
<div><strong>关系</strong></div>
|
<div><strong>关系</strong></div>
|
||||||
<div>权重: ${edge.weight}</div>
|
<div>权重: ${edge.weight}</div>
|
||||||
<div>${edge.description}</div>
|
<div class="rb:break-words rb:whitespace-pre-wrap">${edge.description}</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user