mirror of https://github.com/langgenius/dify.git
fix: The HTTP Request node panel supports line break and overflow handling for variable values (#33359)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
b66097b5f3
commit
0dcfac5b84
|
|
@ -1,5 +1,6 @@
|
||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import type { InitialConfigType } from '@lexical/react/LexicalComposer'
|
||||||
import type {
|
import type {
|
||||||
EditorState,
|
EditorState,
|
||||||
LexicalCommand,
|
LexicalCommand,
|
||||||
|
|
@ -153,7 +154,10 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
||||||
shortcutPopups = [],
|
shortcutPopups = [],
|
||||||
}) => {
|
}) => {
|
||||||
const { eventEmitter } = useEventEmitterContextContext()
|
const { eventEmitter } = useEventEmitterContextContext()
|
||||||
const initialConfig = {
|
const initialConfig: InitialConfigType = {
|
||||||
|
theme: {
|
||||||
|
paragraph: 'group-[.clamp]:line-clamp-5 group-focus/editable:!line-clamp-none',
|
||||||
|
},
|
||||||
namespace: 'prompt-editor',
|
namespace: 'prompt-editor',
|
||||||
nodes: [
|
nodes: [
|
||||||
CodeNode,
|
CodeNode,
|
||||||
|
|
@ -214,7 +218,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
||||||
contentEditable={(
|
contentEditable={(
|
||||||
<ContentEditable
|
<ContentEditable
|
||||||
className={cn(
|
className={cn(
|
||||||
'text-text-secondary outline-none',
|
'group/editable text-text-secondary outline-none group-[.clamp]:max-h-24 group-[.clamp]:overflow-y-auto',
|
||||||
compact ? 'text-[13px] leading-5' : 'text-sm leading-6',
|
compact ? 'text-[13px] leading-5' : 'text-sm leading-6',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,11 @@ const Editor: FC<Props> = ({
|
||||||
const setShowInputFieldPanel = useStore(s => s.setShowInputFieldPanel)
|
const setShowInputFieldPanel = useStore(s => s.setShowInputFieldPanel)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(className, 'relative')}>
|
<div className={cn(className, 'relative min-h-8')}>
|
||||||
<>
|
<>
|
||||||
<PromptEditor
|
<PromptEditor
|
||||||
instanceId={instanceId}
|
instanceId={instanceId}
|
||||||
className={cn(promptMinHeightClassName, '!leading-[18px]')}
|
className={cn(promptMinHeightClassName, 'leading-[18px]')}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
placeholderClassName={placeholderClassName}
|
placeholderClassName={placeholderClassName}
|
||||||
value={value}
|
value={value}
|
||||||
|
|
@ -118,7 +118,7 @@ const Editor: FC<Props> = ({
|
||||||
{/* to patch Editor not support dynamic change editable status */}
|
{/* to patch Editor not support dynamic change editable status */}
|
||||||
{readOnly && <div className="absolute inset-0 z-10"></div>}
|
{readOnly && <div className="absolute inset-0 z-10"></div>}
|
||||||
{isFocus && (
|
{isFocus && (
|
||||||
<div className={cn('absolute z-10', insertVarTipToLeft ? 'left-[-12px] top-1.5' : ' right-1 top-[-9px]')}>
|
<div className={cn('absolute z-10', insertVarTipToLeft ? 'left-[-12px] top-1.5' : 'right-1 top-[-9px]')}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
popupContent={`${t('common.insertVarTip', { ns: 'workflow' })}`}
|
popupContent={`${t('common.insertVarTip', { ns: 'workflow' })}`}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,12 @@ const InputItem: FC<Props> = ({
|
||||||
}, [onRemove])
|
}, [onRemove])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(className, 'hover:cursor-text hover:bg-state-base-hover', 'relative flex !h-[30px] items-center')}>
|
<div className={cn(className, 'hover:cursor-text hover:bg-state-base-hover', 'relative flex')}>
|
||||||
{(!readOnly)
|
{(!readOnly)
|
||||||
? (
|
? (
|
||||||
<Input
|
<Input
|
||||||
instanceId={instanceId}
|
instanceId={instanceId}
|
||||||
className={cn(isFocus ? 'bg-components-input-bg-active' : 'bg-width', 'h-full w-0 grow px-3 py-1')}
|
className={cn(isFocus ? 'bg-components-input-bg-active' : '', 'clamp group w-0 grow px-3 py-1')}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
|
|
@ -73,7 +73,6 @@ const InputItem: FC<Props> = ({
|
||||||
onFocusChange={setIsFocus}
|
onFocusChange={setIsFocus}
|
||||||
placeholder={t('nodes.http.insertVarPlaceholder', { ns: 'workflow' })!}
|
placeholder={t('nodes.http.insertVarPlaceholder', { ns: 'workflow' })!}
|
||||||
placeholderClassName="!leading-[21px]"
|
placeholderClassName="!leading-[21px]"
|
||||||
promptMinHeightClassName="h-full"
|
|
||||||
insertVarTipToLeft={insertVarTipToLeft}
|
insertVarTipToLeft={insertVarTipToLeft}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
@ -85,7 +84,7 @@ const InputItem: FC<Props> = ({
|
||||||
{hasValue && (
|
{hasValue && (
|
||||||
<Input
|
<Input
|
||||||
instanceId={instanceId}
|
instanceId={instanceId}
|
||||||
className={cn(isFocus ? 'border-components-input-border-active bg-components-input-bg-active shadow-xs' : 'border-components-input-border-hover bg-components-input-bg-normal', 'h-full w-0 grow rounded-lg border px-3 py-[6px]')}
|
className={cn(isFocus ? 'border-components-input-border-active bg-components-input-bg-active shadow-xs' : 'border-components-input-border-hover bg-components-input-bg-normal', 'clamp group h-full w-0 grow rounded-lg border px-3 py-[6px]')}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
|
|
|
||||||
|
|
@ -6853,9 +6853,6 @@
|
||||||
"no-restricted-imports": {
|
"no-restricted-imports": {
|
||||||
"count": 1
|
"count": 1
|
||||||
},
|
},
|
||||||
"tailwindcss/no-unnecessary-whitespace": {
|
|
||||||
"count": 1
|
|
||||||
},
|
|
||||||
"ts/no-explicit-any": {
|
"ts/no-explicit-any": {
|
||||||
"count": 1
|
"count": 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue