react-tagsinput icon indicating copy to clipboard operation
react-tagsinput copied to clipboard

Flag for onChange prop to tell if it was called by `_addTag` or `_removeTag`

Open ilias-t opened this issue 7 years ago • 2 comments

Just a suggestion, in order to distinguish between when a tag was added vs when one was removed, I would suggest passing in a fourth parameter (type boolean) to the onChange prop that is true when called by _addTag and false when called by _removeTag. If ppl think it's a decent idea happy to make a PR.

ilias-t avatar Jun 08 '17 23:06 ilias-t

I think this already possible by checking if oldValue.length < value.length in the handling of onChange but I will consider adding it if it is wanted.

olahol avatar Sep 16 '17 11:09 olahol

Thank you for your work on react-tagsinput @olahol (also the contributors). I checked the documentation to find something like the proposed solution but in the end found your comment working (I would eventually do that but I thought there would be an in-component use for such a thing.

Having an action provided to onChange as the fourth argument with either add or remove (or just a boolean true if it is an insert, false for remove) would make it better but if you think this is unneccessary, shall we maybe include your solution on the docs so that people would use it immediately?

I am also happy to make a PR if you are interested in updating the FAQ section

nynevi avatar Dec 13 '17 08:12 nynevi