From 17a1c05728b904f83f2857013c16bd594b07d933 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 25 May 2023 23:38:06 +0800 Subject: [PATCH] fix: var highlight problme (#214) --- .../features/chat-group/opening-statement/index.tsx | 5 +++-- web/app/components/base/block-input/index.tsx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx b/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx index 185e107ca6..391881841b 100644 --- a/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx +++ b/web/app/components/app/configuration/features/chat-group/opening-statement/index.tsx @@ -56,10 +56,11 @@ const OpeningStatement: FC = ({ }, [value]) const coloredContent = (tempValue || '') - .replace(regex, varHighlightHTML({ name: '$1' })) // `{{$1}}` - .replace(/\n/g, '
') .replace(//g, '>') + .replace(regex, varHighlightHTML({ name: '$1' })) // `{{$1}}` + .replace(/\n/g, '
') + const handleEdit = () => { diff --git a/web/app/components/base/block-input/index.tsx b/web/app/components/base/block-input/index.tsx index 440fd63d13..796d1c06a5 100644 --- a/web/app/components/base/block-input/index.tsx +++ b/web/app/components/base/block-input/index.tsx @@ -68,10 +68,11 @@ const BlockInput: FC = ({ }) const coloredContent = (currentValue || '') - .replace(regex, varHighlightHTML({ name: '$1' })) // `{{$1}}` - .replace(/\n/g, '
') .replace(//g, '>') + .replace(regex, varHighlightHTML({ name: '$1' })) // `{{$1}}` + .replace(/\n/g, '
') + // Not use useCallback. That will cause out callback get old data. const handleSubmit = () => {