refactor: enhance Markdown component and update FormContentPreview props

This commit is contained in:
twwu 2025-12-26 12:55:46 +08:00
parent 5a1e6269d5
commit 062896cb9c
3 changed files with 19 additions and 4 deletions

View File

@ -29,7 +29,13 @@ export const Markdown = (props: MarkdownProps) => {
return (
<div className={cn('markdown-body', '!text-text-primary', props.className)}>
<ReactMarkdown pluginInfo={pluginInfo} latexContent={latexContent} customComponents={customComponents} customDisallowedElements={props.customDisallowedElements} />
<ReactMarkdown
pluginInfo={pluginInfo}
latexContent={latexContent}
customComponents={customComponents}
customDisallowedElements={props.customDisallowedElements}
rehypePlugins={props.rehypePlugins}
/>
</div>
)
}

View File

@ -14,14 +14,14 @@ import { Note, rehypeNotes, rehypeVariable, Variable } from './variable-in-markd
const i18nPrefix = 'workflow.nodes.humanInput'
type Props = {
type FormContentPreviewProps = {
content: string
formInputs: FormInputItem[]
userActions: UserAction[]
onClose: () => void
}
const FormContentPreview: FC<Props> = ({
const FormContentPreview: FC<FormContentPreviewProps> = ({
content,
formInputs,
userActions,
@ -85,4 +85,5 @@ const FormContentPreview: FC<Props> = ({
</div>
)
}
export default React.memo(FormContentPreview)

View File

@ -95,7 +95,15 @@ const Panel: FC<NodePanelProps<HumanInputNodeType>> = ({
/>
</div>
<div className="flex items-center ">
<Button variant="ghost" className="flex items-center space-x-1 px-2 text-components-button-ghost-text" onClick={togglePreview}>
<Button
variant="ghost"
size="small"
className={cn(
'flex items-center space-x-1 px-2',
isPreview && 'bg-state-accent-active text-text-accent',
)}
onClick={togglePreview}
>
<RiEyeLine className="size-3.5" />
<div className="system-xs-medium">{t(`${i18nPrefix}.formContent.preview`)}</div>
</Button>