react-taggy
react-taggy copied to clipboard
Add onClick and onHighlight callbacks
Hi @johncmunson , thanks a lot for this simple, yet useful library!
I added callbacks when a tag is clicked or the text is highlighted, plus fixed small things
It was mentioned in this issue: https://github.com/johncmunson/react-taggy/issues/2
Here are the detailed changes:
- Add a
clickTag(event, tag, elemIndex)prop to pass a function triggered when a tag is clicked (useful to edit or delete tags) - Add a
onHighlight(event, text, spanIndex, start, end)prop to pass a function triggered when text is highlighted using the mouse (useful to add new tags) - Additional properties passed to the
spansobjects are now kept (instead of just addingstart,endandtoken) - Fix bug when the
spansarray is not sorted by start position
You can see it in action here (after running the prediction): https://collaboratory.semanticscience.org