Format <SEP> separators as newlines in properties view for non editable value

- Convert <SEP> to semicolon + newline
- Apply formatting to text and tooltip
This commit is contained in:
yangdx 2025-09-23 13:10:06 +08:00
parent 367f3df038
commit cc0eed1c8c

View file

@ -206,6 +206,18 @@ const PropertyRow = ({
return translation === translationKey ? name : translation
}
// Utility function to convert <SEP> to newlines
const formatValueWithSeparators = (value: any): string => {
if (typeof value === 'string') {
return value.replace(/<SEP>/g, ';\n')
}
return typeof value === 'string' ? value : JSON.stringify(value, null, 2)
}
// Format the value to convert <SEP> to newlines
const formattedValue = formatValueWithSeparators(value)
const formattedTooltip = tooltip || formatValueWithSeparators(value)
// Use EditablePropertyRow for editable fields (description, entity_id and keywords)
if (isEditable && (name === 'description' || name === 'entity_id' || name === 'keywords')) {
return (
@ -233,8 +245,8 @@ const PropertyRow = ({
<Text
className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis"
tooltipClassName="max-w-80 -translate-x-13"
text={value}
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}
text={formattedValue}
tooltip={formattedTooltip}
side="left"
onClick={onClick}
/>