mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(catalog): greentext and markdown styling shouldn't appear
This commit is contained in:
@@ -17,6 +17,7 @@ import PostMenuDesktop from '../post-desktop/post-menu-desktop';
|
|||||||
import styles from './catalog-row.module.css';
|
import styles from './catalog-row.module.css';
|
||||||
import Markdown from '../markdown';
|
import Markdown from '../markdown';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import { ContentPreview } from '../../views/home/popular-threads-box';
|
||||||
|
|
||||||
interface CatalogPostMediaProps {
|
interface CatalogPostMediaProps {
|
||||||
commentMediaInfo: any;
|
commentMediaInfo: any;
|
||||||
@@ -186,7 +187,21 @@ const CatalogPost = ({ post }: { post: Comment }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const postContent = (
|
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();
|
const { imageSize, showOPComment } = useCatalogStyleStore();
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export { default } from './popular-threads-box';
|
export { default, ContentPreview } from './popular-threads-box';
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ interface PopularThreadProps {
|
|||||||
boardShortAddress: string;
|
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(' ', '').replace(/\n\n/g, '\n').replaceAll('\n\n', '');
|
const plainText = removeMarkdown(content).trim().replaceAll(' ', '').replace(/\n\n/g, '\n').replaceAll('\n\n', '');
|
||||||
const truncatedText = plainText.length > maxLength ? `${plainText.substring(0, maxLength).trim()}...` : plainText;
|
const truncatedText = plainText.length > maxLength ? `${plainText.substring(0, maxLength).trim()}...` : plainText;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user