diff options
| author | kaniini <nenolod@gmail.com> | 2018-08-26 20:32:00 +0000 |
|---|---|---|
| committer | kaniini <nenolod@gmail.com> | 2018-08-26 20:32:00 +0000 |
| commit | 2dd99c7dd95e6af2c177172c09370a5193016f3b (patch) | |
| tree | 34562ecf8c4b1c6f0bca8d59cec4ca078bb2dd86 | |
| parent | 257da5c740fd1f00bbedeff2ba66cbbcb6fcd74a (diff) | |
| parent | 74a6df8a551e1103e3ed70d2561dd3a488fba17e (diff) | |
Merge branch 'emoji-shortcode-startswith' into 'develop'
For user and emoji shortcode autocomplete, match using startsWith() instead of match().
Closes #135
See merge request pleroma/pleroma-fe!320
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 7d40bc3c..06a428ff 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -75,7 +75,7 @@ const PostStatusForm = { const firstchar = this.textAtCaret.charAt(0) if (firstchar === '@') { const matchedUsers = filter(this.users, (user) => (String(user.name + user.screen_name)).toUpperCase() - .match(this.textAtCaret.slice(1).toUpperCase())) + .startsWith(this.textAtCaret.slice(1).toUpperCase())) if (matchedUsers.length <= 0) { return false } @@ -89,7 +89,7 @@ const PostStatusForm = { })) } else if (firstchar === ':') { if (this.textAtCaret === ':') { return } - const matchedEmoji = filter(this.emoji.concat(this.customEmoji), (emoji) => emoji.shortcode.match(this.textAtCaret.slice(1))) + const matchedEmoji = filter(this.emoji.concat(this.customEmoji), (emoji) => emoji.shortcode.startsWith(this.textAtCaret.slice(1))) if (matchedEmoji.length <= 0) { return false } |
