mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 05:01:55 +08:00
FEATURE: Show autocomplete when enable_inline_emoji_translation is true.
This commit is contained in:

committed by
Régis Hanol

parent
e9bbdef156
commit
79d987e483
@ -410,9 +410,11 @@ export default Ember.Component.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onKeyUp(text, cp) {
|
onKeyUp(text, cp) {
|
||||||
const matches = /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi.exec(
|
const regex = self.siteSettings.enable_inline_emoji_translation
|
||||||
text.substring(0, cp)
|
? /(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi
|
||||||
);
|
: /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi;
|
||||||
|
|
||||||
|
const matches = regex.exec(text.substring(0, cp));
|
||||||
|
|
||||||
if (matches && matches[1]) {
|
if (matches && matches[1]) {
|
||||||
return [matches[1]];
|
return [matches[1]];
|
||||||
|
@ -1364,7 +1364,7 @@ QUnit.test("emoji - enable_inline_emoji_translation", assert => {
|
|||||||
assert.cookedOptions(
|
assert.cookedOptions(
|
||||||
"test:smile:test",
|
"test:smile:test",
|
||||||
{ siteSettings: { enable_inline_emoji_translation: true } },
|
{ siteSettings: { enable_inline_emoji_translation: true } },
|
||||||
`<p>test<img src="/images/emoji/twitter/smile.png?v=${v}" title=":smile:" class="emoji" alt=":smile:">test</p>`
|
`<p>test<img src="/images/emoji/emoji_one/smile.png?v=${v}" title=":smile:" class="emoji" alt=":smile:">test</p>`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user