Skip to content

Commit

Permalink
🐛 Fix link parsing when using variables
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno authored and jmgoncalves97 committed Jan 17, 2025
1 parent 01b913c commit 1388bb9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/bot-engine/parseBubbleBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {
} from '@typebot.io/schemas'
import { deepParseVariables } from './variables/deepParseVariables'
import { isEmpty, isNotEmpty } from '@typebot.io/lib/utils'
import { getVariablesToParseInfoInText } from './variables/parseVariables'
import {
getVariablesToParseInfoInText,
parseVariables,
} from './variables/parseVariables'
import { TDescendant, createPlateEditor } from '@udecode/plate-common'
import {
createDeserializeMdPlugin,
Expand Down Expand Up @@ -155,12 +158,16 @@ const parseVariablesInRichText = (
element.children.length === 1 &&
'text' in element.children[0] &&
(element.children[0].text as string).startsWith('{{') &&
(element.children[0].text as string).endsWith('}}')
(element.children[0].text as string).endsWith('}}') &&
element.type !== 'a'
? 'variable'
: element.type

parsedElements.push({
...element,
url: element.url
? parseVariables(variables)(element.url as string)
: undefined,
type,
children: parseVariablesInRichText(element.children as TDescendant[], {
variables,
Expand Down

0 comments on commit 1388bb9

Please sign in to comment.