paper-burner/css/history_detail/04-features/chunk-compare.css

166 lines
4.7 KiB
CSS
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.

/* ====================
* 分块对比视图样式
* ==================== */
/* 分块对比区域的标题栏,包含标题和切换按钮 */
.chunk-compare-title-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1em; /* 调整标题和内容之间的间距 */
}
.chunk-compare-title-bar h3 {
margin: 0; /* 移除h3的默认外边距 */
}
/* 切换原文/译文位置按钮 */
#swap-chunks-btn {
background: var(--color-slate-50);
border: 1px solid var(--color-slate-200);
border-radius: var(--radius-sm);
padding: 6px 12px;
cursor: pointer;
font-size: 1rem;
line-height: 1;
color: var(--text-secondary);
transition: all 0.2s ease;
}
#swap-chunks-btn:hover {
background-color: var(--color-slate-100);
border-color: var(--color-slate-300);
color: var(--text-primary);
}
/* 分块对比主容器,垂直排列块对 */
.chunk-compare-container {
display: flex;
flex-direction: column;
gap: 1.5rem; /* 增加间距 */
}
/* 单个原文/译文对比块对,水平排列 */
.chunk-pair {
display: flex;
gap: 1.5rem;
border-bottom: 1px solid var(--color-slate-100);
padding-bottom: 1.5rem;
}
.chunk-pair:last-child {
border-bottom: none;
}
/* 块对中的单个块(原文或译文) */
.chunk-pair > div {
flex: 1;
min-width: 0;
background: var(--color-slate-50);
padding: 16px;
border-radius: var(--radius-md);
border: 1px solid var(--color-slate-200);
transition: all 0.2s ease; /* 添加过渡效果 */
}
/* 3.5.3 分块联动 (Chunk Sync):悬停时同时高亮原文和译文 */
.chunk-pair:hover > div {
background-color: var(--color-primary-50);
border-color: var(--color-primary-200);
box-shadow: var(--shadow-sm);
}
/* 表格对比对:整体轻微蓝色提示 */
.align-flex.table-pair .align-block {
background: var(--color-primary-50);
border-color: var(--color-primary-200);
}
.align-flex.table-pair .align-title span {
color: var(--color-primary-700);
}
.chunk-pair h4 {
margin-top: 0;
font-size: 0.875rem;
font-weight: 600;
color: var(--text-secondary);
border-bottom: 1px solid var(--color-slate-200); /* 改为实线 */
padding-bottom: 8px;
margin-bottom: 12px;
}
/* 确保分块内容区域在内容过长时可以横向滚动 */
.chunk-compare-container .markdown-body {
overflow-x: auto; /* 为分块内容区域添加横向滚动条 */
}
/* 公式在对比模式下的专用修复:避免“挤成一团” */
.chunk-compare-container .katex-display,
.chunk-compare-container .katex-display-fixed {
/* 允许 KaTeX 自己决定换行/高度,而不是强行 nowrap */
white-space: normal !important;
display: block;
width: 100%;
text-align: center;
padding-right: 0 !important; /* 在对比模式下不预留右侧空间,改用“编号换行”方案 */
line-height: 1.5; /* 提高行高,避免窄屏时高度不足 */
/* 关键修复:允许纵向溢出显示,否则第二行会被 clip 掉 */
overflow-y: visible !important;
overflow-x: visible;
}
.chunk-compare-container .katex-display > .katex,
.chunk-compare-container .katex-display-fixed > .katex {
max-width: 100% !important;
}
/* 防止 KaTeX 内层再发生裁剪 */
.chunk-compare-container .katex { overflow: visible !important; }
/* 对比模式下,将右侧编号(\tag、编号放到下一行右对齐避免与主体重叠 */
.chunk-compare-container .katex-display .katex-tag,
.chunk-compare-container .katex-display .tag,
.chunk-compare-container .katex .katex-tag,
.chunk-compare-container .katex .tag {
position: static !important;
display: block !important;
height: auto !important;
transform: none !important;
margin: 4px 0 0 0 !important;
text-align: right !important;
white-space: nowrap;
}
/* 在对比半栏中,适度缩小公式字号,提升适配性 */
.chunk-compare-container .katex,
.chunk-compare-container .katex-display,
.chunk-compare-container .katex-display-fixed {
font-size: 0.96em;
}
@media (max-width: 1024px) {
.chunk-compare-container .katex,
.chunk-compare-container .katex-display,
.chunk-compare-container .katex-display-fixed {
font-size: 0.94em;
}
}
@media (max-width: 768px) {
.chunk-compare-container .katex-display,
.chunk-compare-container .katex-display-fixed {
margin: 10px 0;
}
}
/* 降低对比模式下公式失败的可视噪音(黄底提示,避免“红框”误报) */
.chunk-compare-container .katex-fallback {
background-color: #fffbe6; /* 淡黄 */
border: 1px dashed #facc15; /* 金色 */
color: #7c5e00;
}
.chunk-compare-container .katex-error,
.chunk-compare-container .katex-error.katex-block,
.chunk-compare-container .katex-error.katex-inline {
background-color: #fffbe6;
border-color: #facc15;
color: #7c5e00;
}