mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 13:09:33 -06:00
DEV: Apply code review.
This commit is contained in:
parent
79d987e483
commit
a8e8473ea5
@ -410,12 +410,17 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
onKeyUp(text, cp) {
|
||||
// Regular expressions used to extract emoji name from text.
|
||||
// The space version requires a ' ' (space) before the emoji name
|
||||
// (i.e. ' :smile'), while the other one does not and is used
|
||||
// when enable_inline_emoji_translation is true.
|
||||
const noSpaceColonEmoji = /(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi;
|
||||
const spaceColonEmoji = /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi;
|
||||
|
||||
const regex = self.siteSettings.enable_inline_emoji_translation
|
||||
? /(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi
|
||||
: /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi;
|
||||
|
||||
? noSpaceColonEmoji
|
||||
: spaceColonEmoji;
|
||||
const matches = regex.exec(text.substring(0, cp));
|
||||
|
||||
if (matches && matches[1]) {
|
||||
return [matches[1]];
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ function applyEmoji(
|
||||
|
||||
for (i = 0; i < content.length - 1; i++) {
|
||||
let offset = 0;
|
||||
let emojiName = getEmojiName(content, i, state, inlineEmoji);
|
||||
const emojiName = getEmojiName(content, i, state, inlineEmoji);
|
||||
let token = null;
|
||||
|
||||
if (emojiName) {
|
||||
|
Loading…
Reference in New Issue
Block a user