From 1388bb937705d4fb7a8fa53055ae0ff6adac490f Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 12 Oct 2023 17:20:11 +0200 Subject: [PATCH] :bug: Fix link parsing when using variables Closes #764 --- packages/bot-engine/parseBubbleBlock.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/bot-engine/parseBubbleBlock.ts b/packages/bot-engine/parseBubbleBlock.ts index ca8bcb0b404..71091a4108b 100644 --- a/packages/bot-engine/parseBubbleBlock.ts +++ b/packages/bot-engine/parseBubbleBlock.ts @@ -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, @@ -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,