fix: make tag parsing work better #3038
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Trimming strings the way this currently works makes it awkward to enter tags with spaces in them; because the list is re-parsed and regenerated every keystroke, the spaces vanish as soon as they're input. Changing the split into a regex gives us the power to only care about spaces on either side of a comma and eliminate those, while leaving spaces inside tags just where they need to be. Note that this, cosmetically, requires no spaces around commas in the list (so "a,b,c" instead of "a, b, c") because otherwise it breaks the ability to backspace past a ", " unit - the backspace will delete the space, then the comma will regenerate it.
A real fix to this would involve changing when the form decides to re-parse and regenerate values (so we only do it when either swapping to/from JSON view or on hitting the Done button), but I don't know if we have that option.
Task Item
closes #3037