I'm late for a couple of years, and it seems that you might have avoided "recreating the wheel," but I thought I'd add my two cents in case you (OP) or anyone else wanted to try using this functionality from scratch.
Mention "mention" - the management utility has 3 components:
Autocomplete module : the component responsible for collecting and displaying a set of elements that can be used to create a mention, taking into account the string.
Mentioned Tracking Module : a component responsible for tracking mentioned-related data; at a minimum distance, the location, as well as the surface and significant (if any) values ββof each reference should be monitored in all modifications of the text of the input element to which the utility is attached.
Mentioning visual differentiation module : component responsible for differentiating the reference text from the rest of the text in the input element to which the utility is attached
Given this breakdown of such a utility, it should be clear that the first and second steps in the original message are those that can be taken when implementing mention control modules and autofill modules, respectively.
Further progress towards the implementation of the three modules in plain English would be tedious; its much better to look at the code! Fortunately, I made the Mentionator solution, which is reliable (more than all the other solutions offered here), well-structured, easy to follow, and commented abundantly. Therefore, it is worth seeing if you just want a ready-made solution or reference material to create your own.
Kevin source share