diff --git a/web/src/pages/NotificationsPage.tsx b/web/src/pages/NotificationsPage.tsx index fbde682..6cf90ff 100644 --- a/web/src/pages/NotificationsPage.tsx +++ b/web/src/pages/NotificationsPage.tsx @@ -1,10 +1,19 @@ -import { useEffect, type CSSProperties } from 'react'; +import { useEffect, useState, type CSSProperties } from 'react'; import { useNavigate, useSearchParams } from 'react-router-dom'; import DOMPurify from 'dompurify'; import { Sidebar } from '../components/Sidebar'; import { useNotificationStore } from '../store/notification'; import type { AppNotification, NotificationType } from '../types'; +// 剥 HTML 取纯文本前 N 字,用于列表行缩略预览 +function stripAndTruncate(html: string, maxChars = 60): string { + // 用 DOMParser 而非正则,防 `