mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 09:03:36 +08:00
Make text editor's controller accessible
This commit is contained in:
parent
41d2d0b1c6
commit
222b81e917
|
@ -11,6 +11,14 @@ export default class ComposerBody extends Component {
|
||||||
this.loading = m.prop(false);
|
this.loading = m.prop(false);
|
||||||
this.disabled = m.prop(false);
|
this.disabled = m.prop(false);
|
||||||
this.content = m.prop(this.props.originalContent);
|
this.content = m.prop(this.props.originalContent);
|
||||||
|
this.editor = new TextEditor({
|
||||||
|
submitLabel: this.props.submitLabel,
|
||||||
|
placeholder: this.props.placeholder,
|
||||||
|
disabled: this.loading(),
|
||||||
|
onchange: this.content,
|
||||||
|
onsubmit: this.onsubmit.bind(this),
|
||||||
|
value: this.content()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
view() {
|
view() {
|
||||||
|
@ -18,14 +26,7 @@ export default class ComposerBody extends Component {
|
||||||
avatar(this.props.user, {className: 'composer-avatar'}),
|
avatar(this.props.user, {className: 'composer-avatar'}),
|
||||||
m('div.composer-body', [
|
m('div.composer-body', [
|
||||||
m('ul.composer-header', listItems(this.headerItems().toArray())),
|
m('ul.composer-header', listItems(this.headerItems().toArray())),
|
||||||
m('div.composer-editor', TextEditor.component({
|
m('div.composer-editor', this.editor.view())
|
||||||
submitLabel: this.props.submitLabel,
|
|
||||||
placeholder: this.props.placeholder,
|
|
||||||
disabled: this.loading(),
|
|
||||||
onchange: this.content,
|
|
||||||
onsubmit: this.onsubmit.bind(this),
|
|
||||||
value: this.content()
|
|
||||||
}))
|
|
||||||
]),
|
]),
|
||||||
LoadingIndicator.component({className: 'composer-loading'+(this.loading() ? ' active' : '')})
|
LoadingIndicator.component({className: 'composer-loading'+(this.loading() ? ' active' : '')})
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user