fix: 保留文本格式(换行和段落) - #71
Conversation
- Add whiteSpace: 'pre-wrap' to ItemCard text display - Add whiteSpace: 'pre-wrap' to ShareCard text display - Fixes issue #70 where multi-paragraph text was compressed Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: minorcell <120795714+minorcell@users.noreply.github.com>
Code Review SummaryOverall, this is a well-implemented fix with correct CSS usage. The Key Finding: Documentation gaps need addressing. The PR description should mention that ItemDialog.tsx already uses this pattern (lines 196, 272), and inline comments would help future maintainers understand why this property is critical for issue #70. |
| whiteSpace: "pre-wrap", | ||
| lineHeight: 1.9, | ||
| color: "text.primary", | ||
| pl: 2, |
There was a problem hiding this comment.
Consider adding an inline comment explaining why whiteSpace: "pre-wrap" is needed:
sx={{
// Preserve line breaks and spaces to prevent text collapsing (fixes #70)
whiteSpace: "pre-wrap",
lineHeight: 1.9,
// ...
}}This helps future maintainers understand the purpose and prevents accidental removal.
| whiteSpace: "pre-wrap", | ||
| fontFamily: "'Noto Serif SC', 'Songti SC', serif" | ||
| }}> | ||
| {truncateText(item.content, maxLength)} |
There was a problem hiding this comment.
Same as ItemCard.tsx - consider adding a comment:
wordBreak: "break-word",
// Preserve line breaks and spaces (fixes #70)
whiteSpace: "pre-wrap",
fontFamily: "'Noto Serif SC', 'Songti SC', serif"This ensures the exported share card maintains consistent formatting with the display views.
Requested by @minorcell
修复 #70:保存的文本内容现在能正确保留原始格式
问题描述
之前保存的文本内容会丢失格式,多个段落被压缩成一个段落,换行符也消失了。
修复方案
在文本显示组件中添加 CSS 属性
whiteSpace: "pre-wrap",该属性可以:修改文件
src/components/ItemCard.tsx (第194行)
whiteSpace: "pre-wrap"src/components/ShareCard.tsx (第111行)
whiteSpace: "pre-wrap"测试建议
Generated with codeagent