mirror of
https://github.com/flarum/framework.git
synced 2025-06-10 19:33:37 +08:00
Improve post composer + replying
- 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
This commit is contained in:
@ -1,9 +1,37 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
import TaggedArray from '../../../utils/tagged-array';
|
||||
import ActionButton from './action-button';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
actions: {
|
||||
save: function() {
|
||||
this.sendAction('save', this.get('value'));
|
||||
}
|
||||
}
|
||||
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'));
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user