diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index f48836be14b..2d93bb254a8 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -410,9 +410,11 @@ export default Ember.Component.extend({ }, onKeyUp(text, cp) { - const matches = /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi.exec( - text.substring(0, cp) - ); + const regex = self.siteSettings.enable_inline_emoji_translation + ? /(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi + : /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi; + + const matches = regex.exec(text.substring(0, cp)); if (matches && matches[1]) { return [matches[1]]; diff --git a/test/javascripts/lib/pretty-text-test.js.es6 b/test/javascripts/lib/pretty-text-test.js.es6 index 76f54a04850..32670c4129b 100644 --- a/test/javascripts/lib/pretty-text-test.js.es6 +++ b/test/javascripts/lib/pretty-text-test.js.es6 @@ -1364,7 +1364,7 @@ QUnit.test("emoji - enable_inline_emoji_translation", assert => { assert.cookedOptions( "test:smile:test", { siteSettings: { enable_inline_emoji_translation: true } }, - `

test:smile:test

` + `

test:smile:test

` ); });