mirror of
https://github.com/flarum/framework.git
synced 2025-02-25 16:51:20 +08:00

- Make it modular so that different entry points can show different things and respond differently (reply, new discussion, edit post) - Resizable - Fullscreen - Confirm on close
37 lines
877 B
JavaScript
37 lines
877 B
JavaScript
import Ember from 'ember';
|
|
|
|
import TaggedArray from '../../../utils/tagged-array';
|
|
import ActionButton from './action-button';
|
|
|
|
export default Ember.Component.extend({
|
|
classNames: ['text-editor'],
|
|
|
|
didInsertElement: function() {
|
|
var controlItems = TaggedArray.create();
|
|
this.trigger('populateControls', controlItems);
|
|
this.set('controlItems', controlItems);
|
|
|
|
var component = this;
|
|
this.$('textarea').bind('keydown', 'meta+return', function() {
|
|
component.send('submit');
|
|
});
|
|
},
|
|
|
|
populateControls: function(controls) {
|
|
var component = this;
|
|
var submit = ActionButton.create({
|
|
label: this.get('submitLabel'),
|
|
className: 'btn btn-primary',
|
|
action: function() {
|
|
component.send('submit');
|
|
}
|
|
});
|
|
controls.pushObjectWithTag(submit, 'submit');
|
|
},
|
|
|
|
actions: {
|
|
submit: function() {
|
|
this.sendAction('submit', this.get('value'));
|
|
}
|
|
}
|
|
}); |