rc-mention
react mention component
Props
- placeholder(string)
- onChange(func)
- onMentionTrigger(func) trigger person select(addCallback as argument)
- formatDisplay(func) format person display in editor
- formatValue(func) format person value after change
Demo Usage
Component { superprops; thisstate = value: '' } { // has addFn callback // open select modal someAPIselectmodal } { thisrefseditor; } { let { this }; return <div className="demos"> <MentionEditor ref="editor" placeholder="type '@' to open mention modal" onMentionTrigger=thischoosePerson onChange=onChange /> <div><span className="mentionBtn" onClick=thistriggerMention>@ someone</span></div> </div> }ReactDOM;
use rangy lib
Rangy is for ie browsers(lt9).
Just include lib and enjoy(Available in v2).
<!-- if you want to use rangy for lt9 ie browsers -->