File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,13 @@ export const Quote = <T extends object>(
1111 const { as, render, ...reset } = Comp ;
1212 const Elm = as || 'span' ;
1313 const elmProps = { ...other , ...reset } ;
14+ // Trim the leading and trailing spaces in children,
15+ // and set it to undefined if it's an empty string or contains only spaces.
16+ // https://github.com/uiwjs/react-json-view/issues/86
17+ if ( typeof elmProps . children === 'string' ) {
18+ const trimmed = elmProps . children . trim ( ) ;
19+ elmProps . children = trimmed || undefined ;
20+ }
1421 let result = { value, parentValue, keyName, keys : keys || ( keyName ? [ keyName ] : [ ] ) } ;
1522 const child = render && typeof render === 'function' && render ( elmProps , result ) ;
1623 if ( child ) return child ;
You can’t perform that action at this time.
0 commit comments