mirror of
https://github.com/flarum/framework.git
synced 2025-02-18 12:12:44 +08:00
Add mention button to text editor toolbar
This commit is contained in:
parent
d34c7745f8
commit
dd500ec54b
|
@ -2,6 +2,8 @@ import getCaretCoordinates from 'textarea-caret';
|
|||
|
||||
import { extend } from 'flarum/extend';
|
||||
import ComposerBody from 'flarum/components/ComposerBody';
|
||||
import TextEditor from 'flarum/components/TextEditor';
|
||||
import TextEditorButton from 'flarum/components/TextEditorButton';
|
||||
import avatar from 'flarum/helpers/avatar';
|
||||
import usernameHelper from 'flarum/helpers/username';
|
||||
import highlight from 'flarum/helpers/highlight';
|
||||
|
@ -189,4 +191,12 @@ export default function addComposerAutocomplete() {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
extend(TextEditor.prototype, 'toolbarItems', function(items) {
|
||||
items.add('mention', (
|
||||
<TextEditorButton onclick={() => this.insertAtCursor('@')} icon="fas fa-at">
|
||||
{app.translator.trans('flarum-mentions.forum.composer.mention_tooltip')}
|
||||
</TextEditorButton>
|
||||
));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user