fix(route): [Coolapk] Wrong html tag wrapping (#7601)

This commit is contained in:
techmoe 2021-05-31 00:04:18 +08:00 committed by GitHub
parent 832e3ff8d1
commit 82749371ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -38,7 +38,12 @@ const getHeaders = () => ({
const parseTuwenFromRaw = (raw) =>
raw.map((i) => {
if (i.type === 'text') {
return `<p>${i.message}</p>`;
const output = i.message
.split('\n')
.filter((t) => t !== '')
.map((t) => `<p>${t}</p>`)
.join('');
return output;
} else if (i.type === 'image') {
return `<div class="img-container" style="text-align: center;">
<img src="${i.url}">