Open donnapep opened 8 years ago
I'll take a look at this when I have a chance. That PLACEHOLDER/regex solution has never sat easily with me.
@donnapep I can't replicate your exact issue, but I do see that if you try and add @users without any space in between (@usera@userb
) it collapses down to one user.
Do you think that https://github.com/Kindling/react-tinymce-mention/commit/ca268b1bcb5652301f8b03ba7962ea79e319c9d6 would handle this better?
@deltamualpha I sorta ended up doing my own thing, but you might be interested in this.
Only trick is that you'll need to know the length of the mention text (this.state.query
in the above snippet) in order for this to work.
@donnapep Ah, clever! I found myself wishing I had that in this case... might be worth a refactor to add that to the props being passed around.
@deltamualpha Yeah, I'd looked at submitting a PR but then realized it wasn't going to be as simple as I'd hoped. Good luck!
When you add a mention on a line, press Enter to move to a new line, and then immediately add another mention on the next line, the first mention is replaced by the new mention you just added.
For example, if I try to add:
@joeblow @henry
It will be converted to:
@henry
In
_renderMentionIntoEditor
, after the placeholder text is inserted into the editor,editor.getContent()
will return something like<p>@joeblow</p><p>@h__PLACEHOLDER__</p>
. Notice there is no whitespace between the paragraph tags, so the regex ends up replacing the wrong thing.Thx.