Unverified Commit 1d06eba6 authored by Joel's avatar Joel Committed by GitHub

fix: prompt and preview not show html like tag (#201)

parent 93e99fb3
......@@ -58,6 +58,8 @@ const OpeningStatement: FC<IOpeningStatementProps> = ({
const coloredContent = (tempValue || '')
.replace(regex, varHighlightHTML({ name: '$1' })) // `<span class="${highLightClassName}">{{$1}}</span>`
.replace(/\n/g, '<br />')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
const handleEdit = () => {
......
......@@ -75,7 +75,7 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
<div
className="max-h-48 overflow-y-auto text-sm text-gray-700 break-all"
dangerouslySetInnerHTML={{
__html: format(replaceStringWithValuesWithFormat(promptTemplate, promptVariables, inputs)),
__html: format(replaceStringWithValuesWithFormat(promptTemplate.replace(/</g, '&lt;').replace(/>/g, '&gt;'), promptVariables, inputs)),
}}
>
</div>
......
......@@ -70,6 +70,8 @@ const BlockInput: FC<IBlockInputProps> = ({
const coloredContent = (currentValue || '')
.replace(regex, varHighlightHTML({ name: '$1' })) // `<span class="${highLightClassName}">{{$1}}</span>`
.replace(/\n/g, '<br />')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
// Not use useCallback. That will cause out callback get old data.
const handleSubmit = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment