Closed romansp closed 3 weeks ago
HAHAHAHA I was about to add this feature request too! 😂
Instead of passing as an array of delimiter, maybe we allow string | RegExp
as prop?
Instead of passing as an array of delimiter, maybe we allow
string | RegExp
as prop?
I agree string | RegExp
would be the best since it already fits String.prototype.split
and String.prototype.replaceAll
so this feature just comes pretty much for free.
But string[]
just seems more ergonomic to use than RegExp
to be honest. We would also need to validate passed RegExp
to have global
flag set as it's required for replaceAll
. Or print warning when it isn't global
.
So maybe string | string[] | RegExp
as prop?
Describe the feature
Improve
TagsInputInput
to allow multiple delimiters so that multiple formats of pasted data can be supported.For example I use
TagsInput
component to collect and submit list of email. Occasionally this list will be pasted from other sources for example it may be comma-separated list or tabular data like google sheets.Data example
Proposed usage
Additionally it would need to strip out empty entries after string split for
modelValue
to be accurate.Originally for my use-case I was thinking to avoid default
addOnPaste
and implement custom@paste
handler, but wondering if there's interest to have this functionality built in.Additional information