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

group comments (bad way)

This commit is contained in:
Fedor Katurov 2019-10-12 15:17:07 +07:00
parent 6bf14e6d5c
commit 39b0a2d568
6 changed files with 35 additions and 16 deletions

View file

@ -71,5 +71,7 @@ export const formatCommentText = (author, text: string) =>
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.split('\n')
.map((el, index) => (index === 0 ? `<p><b>${author}</b>: ${el}</p>` : `<p>${el}</p>`))
.map((el, index) =>
index === 0 ? `${author ? `<p><b>${author}</b>: ` : ''}${el}</p>` : `<p>${el}</p>`
)
.join('');