From 401cd9c126859b1cd6164b7d3cbceaf9cd3ecd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E5=8F=89=E6=A0=91=E6=A0=91?= Date: Sun, 25 Jan 2026 22:07:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(NewPostNotification):=20=E5=BD=93=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E6=88=96=E6=8F=8F=E8=BF=B0=E5=8F=98=E6=9B=B4=E6=97=B6?= =?UTF-8?q?=E4=B9=9F=E8=AE=A1=E7=AE=97=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前仅当内容变更时才计算差异,导致标题或描述变更时用户看不到具体变化。 现在当内容未变但描述或标题变更时,也计算并显示相应的差异。 --- src/components/widget/NewPostNotification.astro | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/widget/NewPostNotification.astro b/src/components/widget/NewPostNotification.astro index 148dbcdf7..644db52fa 100644 --- a/src/components/widget/NewPostNotification.astro +++ b/src/components/widget/NewPostNotification.astro @@ -493,8 +493,19 @@ const contentChanged = post.content !== stored.content; if (titleChanged || dateChanged || descriptionChanged || contentChanged) { - // Calculate diff only if content changed - const diff = contentChanged ? computeDiff(stored.content, post.content) : null; + // Calculate diff for content + let diff = null; + + if (contentChanged) { + diff = computeDiff(stored.content, post.content); + } else if (descriptionChanged) { + // If content is same but description changed, show description diff + diff = computeDiff(stored.description, post.description); + // Add a label to indicate this is description diff? + // The UI doesn't support labels inside diff yet, but at least user sees the text change. + } else if (titleChanged) { + diff = computeDiff(stored.title, post.title); + } detectedChanges.push({ ...post,