mirror of
https://github.com/plebbit/seedit.git
synced 2026-02-06 12:01:04 -05:00
fix(post): title could display some markdown syntax
This commit is contained in:
@@ -160,8 +160,10 @@ const Post = ({ index, post = {} }: PostProps) => {
|
||||
const [upvoted, upvote] = useUpvote(post);
|
||||
const [downvoted, downvote] = useDownvote(post);
|
||||
const postScore = getPostScore(upvoteCount, downvoteCount, state);
|
||||
const postTitle = (title?.length > 300 ? title?.slice(0, 300) + '...' : title) || (content?.length > 300 ? content?.slice(0, 300) + '...' : content);
|
||||
const highlightedTitle = searchQuery ? highlightMatchedText(postTitle || '', searchQuery) : postTitle;
|
||||
const postTitle =
|
||||
(title?.length > 300 ? title?.slice(0, 300) + '...' : title) ||
|
||||
(content?.length > 300 ? content?.slice(0, 300) + '...' : content)?.replace(' ', ' ')?.replace('>', '')?.replace('<', '')?.trim();
|
||||
const displayedTitle = searchQuery ? highlightMatchedText(postTitle || '', searchQuery) : postTitle;
|
||||
|
||||
const hasThumbnail = getHasThumbnail(commentMediaInfo, link);
|
||||
const hostname = getHostname(link);
|
||||
@@ -236,11 +238,11 @@ const Post = ({ index, post = {} }: PostProps) => {
|
||||
<p className={styles.title}>
|
||||
{isInPostPageView && link ? (
|
||||
<a href={link} className={linkClass} target='_blank' rel='noopener noreferrer' onClick={handlePostClick}>
|
||||
{highlightedTitle ?? '-'}
|
||||
{displayedTitle ?? '-'}
|
||||
</a>
|
||||
) : (
|
||||
<Link className={linkClass} to={cid ? `/p/${subplebbitAddress}/c/${cid}` : `/profile/${post?.index}`} onClick={handlePostClick}>
|
||||
{highlightedTitle ?? '-'}
|
||||
{displayedTitle ?? '-'}
|
||||
</Link>
|
||||
)}
|
||||
{flair && (
|
||||
|
||||
Reference in New Issue
Block a user