2015-01-30 09:52:19 +08:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
2015-02-02 14:27:59 +08:00
|
|
|
import TaggedArray from '../../../utils/tagged-array';
|
|
|
|
import ActionButton from './action-button';
|
|
|
|
|
2015-01-30 09:52:19 +08:00
|
|
|
export default Ember.Component.extend({
|
2015-02-03 14:29:53 +08:00
|
|
|
disabled: false,
|
|
|
|
|
2015-02-02 14:27:59 +08:00
|
|
|
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'));
|
|
|
|
}
|
|
|
|
}
|
2015-01-30 09:52:19 +08:00
|
|
|
});
|