PLT-4098 Don't show @mention suggestions if word chars immediately precede at sign (#4399)

* PLT-4098 Don't show @mention suggestions if word chars immediately precede at sign

* PLT-4098 Simplify detection of word chars preceding @mentions
This commit is contained in:
Thomas Hopkins
2016-11-02 03:47:12 -07:00
committed by Joram Wilander
parent 1d0303cfb5
commit b05f82e231

View File

@@ -112,7 +112,7 @@ export default class AtMentionProvider {
handlePretextChanged(suggestionId, pretext) {
clearTimeout(this.timeoutId);
const captured = (/@([a-z0-9\-\._]*)$/i).exec(pretext.toLowerCase());
const captured = (/(?:^|\W)@([a-z0-9\-\._]*)$/i).exec(pretext.toLowerCase());
if (captured) {
const prefix = captured[1];
@@ -146,7 +146,7 @@ export default class AtMentionProvider {
AppDispatcher.handleServerAction({
type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS,
id: suggestionId,
matchedPretext: captured[0],
matchedPretext: `@${captured[1]}`,
terms: mentions,
items: users,
component: AtMentionSuggestion