mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
feat: input var ui
This commit is contained in:
@ -61,6 +61,7 @@ import { useEventEmitterContextContext } from '@/context/event-emitter'
|
||||
export type PromptEditorProps = {
|
||||
className?: string
|
||||
placeholder?: string
|
||||
placeholderClassName?: string
|
||||
style?: React.CSSProperties
|
||||
value?: string
|
||||
editable?: boolean
|
||||
@ -78,6 +79,7 @@ export type PromptEditorProps = {
|
||||
const PromptEditor: FC<PromptEditorProps> = ({
|
||||
className,
|
||||
placeholder,
|
||||
placeholderClassName,
|
||||
style,
|
||||
value,
|
||||
editable = true,
|
||||
@ -136,7 +138,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
||||
<div className='relative'>
|
||||
<RichTextPlugin
|
||||
contentEditable={<ContentEditable className={`${className} outline-none text-sm text-gray-700 leading-6`} style={style || {}} />}
|
||||
placeholder={<Placeholder value={placeholder} />}
|
||||
placeholder={<Placeholder value={placeholder} className={placeholderClassName} />}
|
||||
ErrorBoundary={LexicalErrorBoundary}
|
||||
/>
|
||||
<ComponentPickerBlock
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import cn from 'classnames'
|
||||
|
||||
const Placeholder = ({
|
||||
value,
|
||||
className,
|
||||
}: {
|
||||
value?: string
|
||||
className?: string
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className='absolute top-0 left-0 h-full w-full text-sm text-gray-300 select-none pointer-events-none leading-6'>
|
||||
<div className={cn(className, 'absolute top-0 left-0 h-full w-full text-sm text-gray-300 select-none pointer-events-none leading-6')}>
|
||||
{value || t('common.promptEditor.placeholder')}
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user