optimize editor default value code (#4794)

This commit is contained in:
heheer
2025-05-12 23:52:22 +08:00
committed by GitHub
parent cac4b1d435
commit bdb1221d94
2 changed files with 5 additions and 11 deletions

View File

@@ -178,12 +178,11 @@ const JSONEditor = ({
return '';
}
try {
if (typeof value === 'object') {
return JSON.stringify(value, null, 2);
} catch (error) {
console.error('JSON stringify error:', error);
return String(value) || '';
}
return String(value);
}, [value]);
const onBlur = useCallback(() => {