From b4dc64028cb2affc3a8a487cf6c04285e64329b1 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Fri, 2 Dec 2022 17:42:18 +0100 Subject: [PATCH] :bug: (textBubble) Fix link parsing in text editor --- .../bubbles/textBubble/components/TextBubbleContent.tsx | 9 +++++---- apps/builder/src/lib/plate.tsx | 9 +++++---- docker-compose.build.yml | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx b/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx index 4622de750..302e04acb 100644 --- a/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx +++ b/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx @@ -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 === '' - ? `

Click to edit...

` - : parseVariableHighlight(block.content.html, typebot), + __html: isEmpty(block.content.plainText) + ? `

Click to edit...

` + : parseVariableHighlight(block.content.html, typebot), }} /> ) diff --git a/apps/builder/src/lib/plate.tsx b/apps/builder/src/lib/plate.tsx index 5796ab4de..ef9503f0d 100644 --- a/apps/builder/src/lib/plate.tsx +++ b/apps/builder/src/lib/plate.tsx @@ -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:'), }, }), ], diff --git a/docker-compose.build.yml b/docker-compose.build.yml index 716f94209..f67b1acdc 100644 --- a/docker-compose.build.yml +++ b/docker-compose.build.yml @@ -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: .