matiastucci / vue-input-tag

:bookmark: Vue.js 2.0 Input Tag Component
https://tucci.me/vue-input-tag
MIT License
537 stars 130 forks source link

Add trim option to input-tag #100

Closed serge1peshcoff closed 5 years ago

serge1peshcoff commented 5 years ago

Should close #98.

I've added the trim option to InputTag so it'd trim the new tags if set to true. I've changed the addNew method a little bit for that, but it shouldn't break anything that's already there.

I don't know the requirements for making a PR for this repo, so let me know if it can be improved.

serge1peshcoff commented 5 years ago

@matiastucci can you check? would be lovely to have this PR checked (and merged if possible) as soon as possible as I have a few working projects depending on it, and this should fix a lot of stuff in my projects

matiastucci commented 5 years ago

Cool, thanks!

I'm thinking that maybe we can add a property like beforeAddingTag, or whatever, were the user can pass a callback method and we run that before adding the new tag. So in that case you have more flexibility to do whatever you want to do. What do you think?

serge1peshcoff commented 5 years ago

@matiastucci I'd leave both of them to have more flexibility, what do you think? I don't think a lot of people would need that callback function, that's why I suggest it.

matiastucci commented 5 years ago

I thought it some more and I prefer only adding a callback before inserting the tag: https://github.com/matiastucci/vue-input-tag/pull/101/files

Thanks for taking the time to create a PR though. If you have any problem using the new prop just let me know. It's already published in 2.0.4.