fix: 修复通知中长文本换行问题

在 diff 显示区域为所有行添加 break-all 和 whitespace-pre-wrap 类,确保长单词或URL能正确换行,避免内容溢出。
This commit is contained in:
二叉树树
2026-01-25 21:15:57 +08:00
parent ec4590855e
commit d89978d2a2

View File

@@ -240,9 +240,9 @@
${isUpdated && post.diff ? ` ${isUpdated && post.diff ? `
<div id="${safeId}" class="hidden mt-2 p-2 bg-gray-50 dark:bg-gray-800 rounded text-xs overflow-x-auto border border-gray-200 dark:border-gray-700 max-h-60 overflow-y-auto"> <div id="${safeId}" class="hidden mt-2 p-2 bg-gray-50 dark:bg-gray-800 rounded text-xs overflow-x-auto border border-gray-200 dark:border-gray-700 max-h-60 overflow-y-auto">
${post.diff.map(part => { ${post.diff.map(part => {
const colorClass = part.added ? 'bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 block my-1 p-1 rounded' : const colorClass = part.added ? 'bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 block my-1 p-1 rounded break-all whitespace-pre-wrap' :
part.removed ? 'bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 block my-1 p-1 rounded' : part.removed ? 'bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 block my-1 p-1 rounded break-all whitespace-pre-wrap' :
'text-gray-500 dark:text-gray-400 block my-1 p-1'; 'text-gray-500 dark:text-gray-400 block my-1 p-1 break-all whitespace-pre-wrap';
return `<div class="${colorClass}">${part.value}</div>`; return `<div class="${colorClass}">${part.value}</div>`;
}).join('')} }).join('')}
</div> </div>