MindMap/frontend/debug-mindelixir-styles.html

197 lines
6.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mind Elixir样式调试</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background: #f5f5f5;
}
.test-container {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
margin-bottom: 20px;
}
.test-title {
color: #333;
border-bottom: 2px solid #007bff;
padding-bottom: 10px;
margin-bottom: 20px;
}
/* 模拟Mind Elixir的样式 */
.topic {
background: #fff;
border: 1px solid #ddd;
border-radius: 4px;
padding: 8px;
margin: 10px 0;
position: relative;
}
.topic-text {
font-weight: 500;
color: #333;
margin-bottom: 4px;
line-height: 1.4;
}
/* 我们的markdown样式 */
.topic .topic-text.markdown-content {
font-size: 12px;
line-height: 1.3;
}
.topic .topic-text.markdown-content table {
border-collapse: collapse;
width: 100%;
margin: 4px 0;
font-size: 11px;
border: 1px solid #ddd !important;
}
.topic .topic-text.markdown-content table th,
.topic .topic-text.markdown-content table td {
border: 1px solid #ddd !important;
padding: 2px 4px !important;
text-align: left !important;
vertical-align: top !important;
}
.topic .topic-text.markdown-content table th {
background-color: #f5f5f5 !important;
font-weight: 600 !important;
}
.topic .topic-text.markdown-content table tr:nth-child(even) {
background-color: #f9f9f9 !important;
}
/* 对比:普通表格样式 */
.normal-table {
border-collapse: collapse;
width: 100%;
margin: 4px 0;
font-size: 11px;
border: 1px solid #ddd;
}
.normal-table th,
.normal-table td {
border: 1px solid #ddd;
padding: 2px 4px;
text-align: left;
vertical-align: top;
}
.normal-table th {
background-color: #f5f5f5;
font-weight: 600;
}
.normal-table tr:nth-child(even) {
background-color: #f9f9f9;
}
</style>
</head>
<body>
<div class="test-container">
<h1 class="test-title">Mind Elixir样式调试</h1>
<h3>测试1模拟Mind Elixir节点中的表格</h3>
<div class="topic">
<div class="topic-text markdown-content">
<table>
<thead>
<tr>
<th>评估维度</th>
<th>权重</th>
<th>评分标准</th>
<th>计算公式</th>
</tr>
</thead>
<tbody>
<tr>
<td>完整性</td>
<td>0.3</td>
<td>缺失值比例 < 5%</td>
<td>完整性 = 1 - 缺失值数量/总数据量</td>
</tr>
<tr>
<td>准确性</td>
<td>0.3</td>
<td>误差率 < 3%</td>
<td>准确性 = 1 - 错误记录数/总记录数</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3>测试2普通表格对比</h3>
<table class="normal-table">
<thead>
<tr>
<th>评估维度</th>
<th>权重</th>
<th>评分标准</th>
<th>计算公式</th>
</tr>
</thead>
<tbody>
<tr>
<td>完整性</td>
<td>0.3</td>
<td>缺失值比例 < 5%</td>
<td>完整性 = 1 - 缺失值数量/总数据量</td>
</tr>
<tr>
<td>准确性</td>
<td>0.3</td>
<td>误差率 < 3%</td>
<td>准确性 = 1 - 错误记录数/总记录数</td>
</tr>
</tbody>
</table>
<h3>测试3检查样式是否被覆盖</h3>
<div id="style-check"></div>
</div>
<script>
// 检查样式是否被正确应用
const topicText = document.querySelector('.topic-text.markdown-content');
const table = topicText.querySelector('table');
const computedStyle = window.getComputedStyle(table);
const styleCheck = document.getElementById('style-check');
styleCheck.innerHTML = `
<p><strong>表格样式检查:</strong></p>
<p>border-collapse: ${computedStyle.borderCollapse}</p>
<p>border: ${computedStyle.border}</p>
<p>width: ${computedStyle.width}</p>
<p>font-size: ${computedStyle.fontSize}</p>
<p>margin: ${computedStyle.margin}</p>
`;
// 检查第一个单元格的样式
const firstCell = table.querySelector('td');
const cellStyle = window.getComputedStyle(firstCell);
styleCheck.innerHTML += `
<p><strong>单元格样式检查:</strong></p>
<p>border: ${cellStyle.border}</p>
<p>padding: ${cellStyle.padding}</p>
<p>text-align: ${cellStyle.textAlign}</p>
<p>vertical-align: ${cellStyle.verticalAlign}</p>
`;
</script>
</body>
</html>