forked from AkkomaGang/akkoma-fe
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
This commit is contained in:
commit
2dd99c7dd9
1 changed files with 2 additions and 2 deletions
|
@ -75,7 +75,7 @@ const PostStatusForm = {
|
||||||
const firstchar = this.textAtCaret.charAt(0)
|
const firstchar = this.textAtCaret.charAt(0)
|
||||||
if (firstchar === '@') {
|
if (firstchar === '@') {
|
||||||
const matchedUsers = filter(this.users, (user) => (String(user.name + user.screen_name)).toUpperCase()
|
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) {
|
if (matchedUsers.length <= 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ const PostStatusForm = {
|
||||||
}))
|
}))
|
||||||
} else if (firstchar === ':') {
|
} else if (firstchar === ':') {
|
||||||
if (this.textAtCaret === ':') { return }
|
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) {
|
if (matchedEmoji.length <= 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue