Skip to content

Commit

Permalink
🚸 Properly parse single break lines in streaming bubble
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed May 29, 2024
1 parent 176e3a5 commit 3d09ad1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/embeds/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.84",
"version": "0.2.85",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",
Expand Down
22 changes: 16 additions & 6 deletions packages/embeds/js/src/components/bubbles/StreamingBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@ export const StreamingBubble = (props: Props) => {
.map((block, index) => {
if (index % 2 === 0) {
return block.split('\n\n').map((line) =>
domPurify.sanitize(marked.parse(line.replace(/【.+】/g, '')), {
ADD_ATTR: ['target'],
})
domPurify.sanitize(
marked.parse(line.replace(/【.+】/g, ''), {
breaks: true,
}),
{
ADD_ATTR: ['target'],
}
)
)
} else {
return [
domPurify.sanitize(marked.parse('```' + block + '```'), {
ADD_ATTR: ['target'],
}),
domPurify.sanitize(
marked.parse('```' + block + '```', {
breaks: true,
}),
{
ADD_ATTR: ['target'],
}
),
]
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.84",
"version": "0.2.85",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.84",
"version": "0.2.85",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 3d09ad1

Please sign in to comment.