Trigger autocomplete when : follows a newline too

This commit is contained in:
Toby Zerner 2016-02-22 21:51:24 +10:30
parent 6e414568db
commit 88bbd8ef3b
2 changed files with 4 additions and 4 deletions

View File

@ -186,8 +186,8 @@ System.register('flarum/emoji/addComposerAutocomplete', ['flarum/extend', 'flaru
// check what user typed, emoji names only contains alphanumeric,
// underline, '+' and '-'
if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break;
// make sure ':' followed by a whitespace
if (character === ':' && (i == 0 || value.substr(i - 1, 1) === ' ')) {
// make sure ':' followed by a whitespace or newline
if (character === ':' && (i == 0 || /\s/.test(value.substr(i - 1, 1)))) {
emojiStart = i + 1;
break;
}

View File

@ -54,8 +54,8 @@ export default function addComposerAutocomplete() {
// check what user typed, emoji names only contains alphanumeric,
// underline, '+' and '-'
if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break;
// make sure ':' followed by a whitespace
if (character === ':' && (i == 0 || value.substr(i-1, 1) === ' ')) {
// make sure ':' followed by a whitespace or newline
if (character === ':' && (i == 0 || /\s/.test(value.substr(i - 1, 1)))) {
emojiStart = i + 1;
break;
}