From a6c10712f0ad9cfb7af8b221cc8f2e8ac9fc9313 Mon Sep 17 00:00:00 2001
From: yzqzss <30341059+yzqzss@users.noreply.github.com>
Date: Sat, 17 Feb 2024 02:12:53 +0000
Subject: [PATCH] feat: `uglyHighlight` by using `dangerouslySetInnerHTML`
everywhere :)
---
src/components/PostCard.tsx | 20 ++++++++++++++++----
tailwind.config.cjs | 3 +++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/components/PostCard.tsx b/src/components/PostCard.tsx
index d1d5c5e..81fac5f 100644
--- a/src/components/PostCard.tsx
+++ b/src/components/PostCard.tsx
@@ -5,15 +5,18 @@ import {
} from '@ant-design/icons';
import { Card, Tag } from 'antd';
import dayjs from 'dayjs';
+import { useLocation } from 'react-router-dom';
import type { Post } from '../api/types';
import { PRIMARY_COLOR } from '../constant';
-// TODO: 关键字高亮
const PostCard = ({ post }: { post: Post }) => {
+ const location = useLocation();
+ const params = new URLSearchParams(location.search);
+ const fullTextFlag = params.get('f') === 'true';
return (