mirror of
https://github.com/saveweb/saveweb-search-frontend.git
synced 2024-09-19 11:15:31 -07:00
fix: dangerouslySetInnerHTML
for author
This commit is contained in:
parent
a6c10712f0
commit
2725c0809f
@ -10,6 +10,7 @@ import { useLocation } from 'react-router-dom';
|
||||
import type { Post } from '../api/types';
|
||||
import { PRIMARY_COLOR } from '../constant';
|
||||
|
||||
// TODO: 不知道咋把 post.author.slice(1) 插进 HTML,暂时把 span 去掉
|
||||
const PostCard = ({ post }: { post: Post }) => {
|
||||
const location = useLocation();
|
||||
const params = new URLSearchParams(location.search);
|
||||
@ -18,13 +19,23 @@ const PostCard = ({ post }: { post: Post }) => {
|
||||
<Card
|
||||
title={<div dangerouslySetInnerHTML={{ __html: post.title }} />}
|
||||
className="w-full"
|
||||
extra={<a href={post.link}>查看原文</a>}
|
||||
extra={
|
||||
<>
|
||||
<a
|
||||
href={`https://box.othing.xyz/i/?a=reader&search=e:${post.id}&ajax=1`}
|
||||
style={{ marginRight: '10px' }}
|
||||
>
|
||||
查看快照
|
||||
</a>
|
||||
<a href={post.link}>查看原文</a>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
{post.author && (
|
||||
<Tag icon={<UserOutlined />} color={PRIMARY_COLOR}>
|
||||
{post.author.slice(1)}
|
||||
{post.author.slice(1).replace(/<\/?span[^>]*>/g, '')}
|
||||
</Tag>
|
||||
)}
|
||||
<Tag icon={<CalendarOutlined />} color={PRIMARY_COLOR}>
|
||||
|
Loading…
Reference in New Issue
Block a user