1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

fixed comment block separation

This commit is contained in:
Fedor Katurov 2021-02-24 15:28:11 +07:00
parent 5dbf4245bf
commit 1fc04e62a6
3 changed files with 16 additions and 8 deletions

View file

@ -49,6 +49,14 @@ const CommentContent: FC<IProps> = memo(
[can_edit, comment, onEditClick, onLockClick]
);
const blocks = useMemo(
() =>
!!comment.text.trim()
? formatCommentText(path(['user', 'username'], comment), comment.text)
: [],
[comment]
);
return (
<div className={styles.wrap}>
{comment.text && (
@ -56,7 +64,7 @@ const CommentContent: FC<IProps> = memo(
{menu}
<Group className={styles.renderers}>
{formatCommentText(path(['user', 'username'], comment), comment.text).map(
{blocks.map(
(block, key) =>
COMMENT_BLOCK_RENDERERS[block.type] &&
createElement(COMMENT_BLOCK_RENDERERS[block.type], { block, key })