♻️ Simplify text bubble content shape

Remove html and plainText field because it was redundant

Closes #386
This commit is contained in:
Baptiste Arnaud
2023-04-13 17:04:21 +02:00
parent 2cbf8348c3
commit e0a9824913
70 changed files with 545 additions and 1030 deletions

View File

@@ -1,18 +0,0 @@
import { Variable } from '@typebot.io/schemas'
export const parseVariableHtmlTags = (
content: string,
variables: Variable[]
) => {
const varNames = variables.map((variable) => variable.name)
return content.replace(/\{\{(.*?)\}\}/g, (fullMatch, foundVar) => {
if (content.includes(`href="{{${foundVar}}}"`)) return fullMatch
if (varNames.some((val) => foundVar === val)) {
return `<span style="background-color:#ff8b1a; color:#ffffff; padding: 0.125rem 0.25rem; border-radius: 0.35rem">${fullMatch.replace(
/{{|}}/g,
''
)}</span>`
}
return fullMatch
})
}