diff --git a/extensions/emoji/js/src/forum/addComposerAutocomplete.js b/extensions/emoji/js/src/forum/addComposerAutocomplete.js
index b465bb20d..1c64aa678 100644
--- a/extensions/emoji/js/src/forum/addComposerAutocomplete.js
+++ b/extensions/emoji/js/src/forum/addComposerAutocomplete.js
@@ -4,10 +4,11 @@ import emojiMap from 'simple-emoji-map';
import { extend } from 'flarum/extend';
import TextEditor from 'flarum/components/TextEditor';
import TextEditorButton from 'flarum/components/TextEditorButton';
-import getEmojiIconCode from './helpers/getEmojiIconCode';
import KeyboardNavigatable from 'flarum/utils/KeyboardNavigatable';
import AutocompleteDropdown from './fragments/AutocompleteDropdown';
+import getEmojiIconCode from './helpers/getEmojiIconCode';
+import cdn from './cdn';
export default function addComposerAutocomplete() {
const emojiKeys = Object.keys(emojiMap);
@@ -76,7 +77,7 @@ export default function addComposerAutocomplete() {
onmouseenter={function() {
dropdown.setIndex($(this).parent().index() - 1);
}}>
-
+
{name}
);
diff --git a/extensions/emoji/js/src/forum/cdn.js b/extensions/emoji/js/src/forum/cdn.js
new file mode 100644
index 000000000..bba87b58a
--- /dev/null
+++ b/extensions/emoji/js/src/forum/cdn.js
@@ -0,0 +1,5 @@
+import twemoji from 'twemoji';
+
+export const version = /([0-9]+).[0-9]+.[0-9]+/g.exec(twemoji.base)[1];
+
+export default `https://cdn.jsdelivr.net/gh/twitter/twemoji@${version}/assets/`;
diff --git a/extensions/emoji/js/src/forum/renderEmoji.js b/extensions/emoji/js/src/forum/renderEmoji.js
index 378d7cc1c..84cdf28af 100644
--- a/extensions/emoji/js/src/forum/renderEmoji.js
+++ b/extensions/emoji/js/src/forum/renderEmoji.js
@@ -5,12 +5,14 @@ import twemoji from 'twemoji';
import { override } from 'flarum/extend';
import Post from 'flarum/models/Post';
+import base from './cdn';
+
export default function renderEmoji() {
override(Post.prototype, 'contentHtml', function(original) {
const contentHtml = original();
if (this.oldContentHtml !== contentHtml) {
- this.emojifiedContentHtml = twemoji.parse(contentHtml);
+ this.emojifiedContentHtml = twemoji.parse(contentHtml, { base });
this.oldContentHtml = contentHtml;
}
@@ -20,6 +22,6 @@ export default function renderEmoji() {
override(s9e.TextFormatter, 'preview', (original, text, element) => {
original(text, element);
- twemoji.parse(element);
+ twemoji.parse(element, { base });
});
}