mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Migrate onToolbarCreate
to the DiscourseAPI
This commit is contained in:
parent
7b8e313dac
commit
f6aa1ac37a
4 changed files with 30 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
|||
import componentTest from 'helpers/component-test';
|
||||
import { onToolbarCreate } from 'discourse/components/d-editor';
|
||||
import { withPluginApi } from 'discourse/lib/plugin-api';
|
||||
|
||||
moduleForComponent('d-editor', {integration: true});
|
||||
|
||||
|
@ -540,12 +540,14 @@ componentTest('emoji', {
|
|||
template: '{{d-editor value=value}}',
|
||||
setup() {
|
||||
// Test adding a custom button
|
||||
onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: 'emoji',
|
||||
group: 'extras',
|
||||
icon: 'smile-o',
|
||||
action: 'emoji'
|
||||
withPluginApi('0.1', api => {
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: 'emoji',
|
||||
group: 'extras',
|
||||
icon: 'smile-o',
|
||||
action: 'emoji'
|
||||
});
|
||||
});
|
||||
});
|
||||
this.set('value', 'hello world.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue