AppliedMathematicsANU / plexus-form

A dynamic form component for react using JSON-Schema.
MIT License
134 stars 31 forks source link

Whitespace in string values is collapsed to single space character #39

Open martijnvermaat opened 9 years ago

martijnvermaat commented 9 years ago

What's the rationale behind collapsing any stretch of whitespace to a single space character for values of type string?

I can imagine some trimming might be useful (?) but I'm not sure why it should be impossible to enter multiple spaces?

It becomes more problematic when I have a custom input component rendering a string value with textarea. The user cannot enter any newlines since they are replaced by a space character, but that's sort of the point of rendering the textarea.

(There's also the replacement of the unicode soft hyphen which I don't really have a problem with, but I'm not sure why it's done.)

odf commented 9 years ago

Good points! The normalization done on strings should probably be configurable. Or alternatively, we could just leave them as the user types them and make any desired normalizations the responsibility of the caller.