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:
parent
367f3df038
commit
cc0eed1c8c
1 changed files with 14 additions and 2 deletions
|
|
@ -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}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue