mirror of
https://github.com/flarum/core.git
synced 2025-08-08 17:36:38 +02:00
Trigger autocomplete when :
follows a newline too
This commit is contained in:
4
extensions/emoji/js/forum/dist/extension.js
vendored
4
extensions/emoji/js/forum/dist/extension.js
vendored
@@ -186,8 +186,8 @@ System.register('flarum/emoji/addComposerAutocomplete', ['flarum/extend', 'flaru
|
|||||||
// check what user typed, emoji names only contains alphanumeric,
|
// check what user typed, emoji names only contains alphanumeric,
|
||||||
// underline, '+' and '-'
|
// underline, '+' and '-'
|
||||||
if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break;
|
if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break;
|
||||||
// make sure ':' followed by a whitespace
|
// make sure ':' followed by a whitespace or newline
|
||||||
if (character === ':' && (i == 0 || value.substr(i - 1, 1) === ' ')) {
|
if (character === ':' && (i == 0 || /\s/.test(value.substr(i - 1, 1)))) {
|
||||||
emojiStart = i + 1;
|
emojiStart = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -54,8 +54,8 @@ export default function addComposerAutocomplete() {
|
|||||||
// check what user typed, emoji names only contains alphanumeric,
|
// check what user typed, emoji names only contains alphanumeric,
|
||||||
// underline, '+' and '-'
|
// underline, '+' and '-'
|
||||||
if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break;
|
if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break;
|
||||||
// make sure ':' followed by a whitespace
|
// make sure ':' followed by a whitespace or newline
|
||||||
if (character === ':' && (i == 0 || value.substr(i-1, 1) === ' ')) {
|
if (character === ':' && (i == 0 || /\s/.test(value.substr(i - 1, 1)))) {
|
||||||
emojiStart = i + 1;
|
emojiStart = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user