fix(CommentItem): 修改评论内容为文本格式,优化防抖检查注释

style(main.css): 添加白空格处理,优化动画效果
This commit is contained in:
anghunk
2026-01-26 17:47:22 +08:00
parent 39200072af
commit 298f1dc98f
2 changed files with 8 additions and 5 deletions

View File

@@ -197,10 +197,10 @@ export class CommentItem extends Component {
] ]
}); });
// 设置评论内容的 HTML // 设置评论内容的 TEXT
const contentEl = root.querySelector('.cwd-comment-content'); const contentEl = root.querySelector('.cwd-comment-content');
if (contentEl) { if (contentEl) {
contentEl.innerHTML = comment.contentHtml; contentEl.innerHTML = comment.contentText;
} }
// 创建回复编辑器 // 创建回复编辑器
@@ -343,7 +343,7 @@ export class CommentItem extends Component {
const commentId = String(this.props.comment.id); const commentId = String(this.props.comment.id);
// 防抖检查1秒内同一评论只能操作一次 // 防抖检查1 秒内同一评论只能操作一次
const now = Date.now(); const now = Date.now();
const debounceKey = `${this.getUserId()}_${commentId}`; const debounceKey = `${this.getUserId()}_${commentId}`;
const lastClick = CommentItem._likeDebounce.get(debounceKey); const lastClick = CommentItem._likeDebounce.get(debounceKey);
@@ -424,7 +424,7 @@ export class CommentItem extends Component {
/** /**
* 检查是否已点赞 * 检查是否已点赞
* @param {string|number} commentId - 评论ID * @param {string|number} commentId - 评论 ID
* @returns {boolean} 是否已点赞 * @returns {boolean} 是否已点赞
*/ */
hasLiked(commentId) { hasLiked(commentId) {

View File

@@ -395,6 +395,7 @@
line-height: 1.6; line-height: 1.6;
color: var(--cwd-text, #24292f); color: var(--cwd-text, #24292f);
word-wrap: break-word; word-wrap: break-word;
white-space: pre-wrap;
margin-top: 10px; margin-top: 10px;
} }
@@ -573,9 +574,11 @@
0% { 0% {
transform: scale(1); transform: scale(1);
} }
50% { 50% {
transform: scale(1.2); transform: scale(1.2);
} }
100% { 100% {
transform: scale(1.05); transform: scale(1.05);
} }
@@ -980,4 +983,4 @@
background: transparent; background: transparent;
padding: 0; padding: 0;
color: #db850d; color: #db850d;
} }