2
0

🐛 (textBubble) Fix link parsing in text editor

This commit is contained in:
Baptiste Arnaud
2022-12-02 17:42:18 +01:00
parent bdf7c0d5c0
commit b4dc64028c
3 changed files with 12 additions and 8 deletions

View File

@ -3,6 +3,7 @@ import { useTypebot } from '@/features/editor'
import { TextBubbleBlock } from 'models'
import React from 'react'
import { parseVariableHighlight } from '@/utils/helpers'
import { isEmpty } from 'utils'
type Props = {
block: TextBubbleBlock
@ -17,11 +18,11 @@ export const TextBubbleContent = ({ block }: Props) => {
flexDir={'column'}
opacity={block.content.html === '' ? '0.5' : '1'}
className="slate-html-container"
color={isEmpty(block.content.plainText) ? 'gray.500' : 'inherit'}
dangerouslySetInnerHTML={{
__html:
block.content.html === ''
? `<p>Click to edit...</p>`
: parseVariableHighlight(block.content.html, typebot),
__html: isEmpty(block.content.plainText)
? `<p>Click to edit...</p>`
: parseVariableHighlight(block.content.html, typebot),
}}
/>
)

View File

@ -23,10 +23,11 @@ export const platePlugins = createPlugins(
renderAfterEditable: PlateFloatingLink,
options: {
isUrl: (url: string) =>
url.startsWith('http') ||
url.startsWith('mailto') ||
url.startsWith('tel') ||
url.startsWith('sms'),
url.startsWith('http:') ||
url.startsWith('https:') ||
url.startsWith('mailto:') ||
url.startsWith('tel:') ||
url.startsWith('sms:'),
},
}),
],

View File

@ -27,6 +27,8 @@ services:
- ENCRYPTION_SECRET=SgVkYp2s5v8y/B?E(H+MbQeThWmZq4t6
- ADMIN_EMAIL=me@email.com
- NEXTAUTH_URL_INTERNAL=http://host.docker.internal:8080
- GITHUB_CLIENT_ID=37a279454d016598c2df
- GITHUB_CLIENT_SECRET=4b288a509352b591cd4478e3ac901668b2f8ed03
typebot-viewer:
build:
context: .