diff --git a/extensions/emoji/js/src/forum/addComposerAutocomplete.js b/extensions/emoji/js/src/forum/addComposerAutocomplete.js index a717a0bc2..b465bb20d 100644 --- a/extensions/emoji/js/src/forum/addComposerAutocomplete.js +++ b/extensions/emoji/js/src/forum/addComposerAutocomplete.js @@ -7,22 +7,21 @@ import TextEditorButton from 'flarum/components/TextEditorButton'; import getEmojiIconCode from './helpers/getEmojiIconCode'; import KeyboardNavigatable from 'flarum/utils/KeyboardNavigatable'; -import AutocompleteDropdown from './components/AutocompleteDropdown'; +import AutocompleteDropdown from './fragments/AutocompleteDropdown'; export default function addComposerAutocomplete() { const emojiKeys = Object.keys(emojiMap); - extend(TextEditor.prototype, 'config', function(original, isInitialized) { - if (isInitialized) return; + extend(TextEditor.prototype, 'oncreate', function() { const $container = $('
'); - const dropdown = new AutocompleteDropdown({items: []}); + const dropdown = new AutocompleteDropdown(); const $textarea = this.$('textarea').wrap(''); let emojiStart; let typed; const applySuggestion = (replacement) => { - this.props.composer.editor.replaceBeforeCursor(emojiStart - 1, replacement + ' '); + this.attrs.composer.editor.replaceBeforeCursor(emojiStart - 1, replacement + ' '); dropdown.hide(); }; @@ -125,7 +124,7 @@ export default function addComposerAutocomplete() { })).map(makeSuggestion); if (suggestions.length) { - dropdown.props.items = suggestions; + dropdown.items = suggestions; m.render($container[0], dropdown.render()); dropdown.show(); @@ -158,7 +157,7 @@ export default function addComposerAutocomplete() { extend(TextEditor.prototype, 'toolbarItems', function(items) { items.add('emoji', ( -