fix(catalog): greentext and markdown styling shouldn't appear

This commit is contained in:
Tom (plebeius.eth)
2024-09-17 17:03:59 +02:00
parent 8c91219134
commit 7742e1c9b0
3 changed files with 18 additions and 3 deletions
+16 -1
View File
@@ -17,6 +17,7 @@ import PostMenuDesktop from '../post-desktop/post-menu-desktop';
import styles from './catalog-row.module.css';
import Markdown from '../markdown';
import _ from 'lodash';
import { ContentPreview } from '../../views/home/popular-threads-box';
interface CatalogPostMediaProps {
commentMediaInfo: any;
@@ -186,7 +187,21 @@ const CatalogPost = ({ post }: { post: Comment }) => {
});
const postContent = (
<div className={`${styles.teaser} ${hidden && styles.hidden}`}>{hidden ? <b>({t('hidden')})</b> : <Markdown title={title} content={content} />}</div>
<div className={`${styles.teaser} ${hidden && styles.hidden}`}>
{hidden ? (
<b>({t('hidden')})</b>
) : (
<>
{title && (
<span>
<b>{title}</b>
{content ? ': ' : ''}
</span>
)}
{content && <ContentPreview content={content} maxLength={9999} />}
</>
)}
</div>
);
const { imageSize, showOPComment } = useCatalogStyleStore();
+1 -1
View File
@@ -1 +1 @@
export { default } from './popular-threads-box';
export { default, ContentPreview } from './popular-threads-box';
@@ -18,7 +18,7 @@ interface PopularThreadProps {
boardShortAddress: string;
}
const ContentPreview = ({ content, maxLength = 99 }: { content: string; maxLength?: number }) => {
export const ContentPreview = ({ content, maxLength = 99 }: { content: string; maxLength?: number }) => {
const plainText = removeMarkdown(content).trim().replaceAll('&nbsp;', '').replace(/\n\n/g, '\n').replaceAll('\n\n', '');
const truncatedText = plainText.length > maxLength ? `${plainText.substring(0, maxLength).trim()}...` : plainText;