diff --git a/app/w/components/workflow-block/components/sub-block/components/short-input.tsx b/app/w/components/workflow-block/components/sub-block/components/short-input.tsx index 25e63972ec..e86d4e19b9 100644 --- a/app/w/components/workflow-block/components/sub-block/components/short-input.tsx +++ b/app/w/components/workflow-block/components/sub-block/components/short-input.tsx @@ -24,13 +24,25 @@ export function ShortInput({ const inputRef = useRef(null) const [isFocused, setIsFocused] = useState(false) const [value, setValue] = useSubBlockValue(blockId, subBlockId) + const overlayRef = useRef(null) - // Auto-scroll effect for input + // Sync scroll position between input and overlay + const handleScroll = (e: React.UIEvent) => { + if (overlayRef.current) { + overlayRef.current.scrollLeft = e.currentTarget.scrollLeft + } + } + + // Update the auto-scroll effect to handle both input and overlay useEffect(() => { if (inputRef.current && isFocused) { const input = inputRef.current const scrollPosition = (input.selectionStart ?? 0) * 8 input.scrollLeft = scrollPosition - input.offsetWidth / 2 + + if (overlayRef.current) { + overlayRef.current.scrollLeft = input.scrollLeft + } } }, [value, isFocused]) @@ -72,24 +84,55 @@ export function ShortInput({ ? '•'.repeat(value?.toString().length ?? 0) : value?.toString() ?? '' + // Add this function to format the text with tags + const formatDisplayText = (text: string) => { + if (!text) return null + + // Split the text by tag pattern + const parts = text.split(/(<[^>]+>)/g) + + return parts.map((part, index) => { + // Check if the part matches tag pattern + if (part.match(/^<[^>]+>$/)) { + return ( + + {part} + + ) + } + return {part} + }) + } + // Component render return ( - setValue(e.target.value)} - onFocus={() => setIsFocused(true)} - onBlur={() => setIsFocused(false)} - onDrop={handleDrop} - onDragOver={handleDragOver} - autoComplete="off" - /> +
+ setValue(e.target.value)} + onFocus={() => setIsFocused(true)} + onBlur={() => setIsFocused(false)} + onDrop={handleDrop} + onDragOver={handleDragOver} + onScroll={handleScroll} + autoComplete="off" + /> +
+ {password && !isFocused + ? '•'.repeat(value?.toString().length ?? 0) + : formatDisplayText(value?.toString() ?? '')} +
+
) }