Progress
This commit is contained in:
36
app/javascript/gabsocial/components/composer.js
Normal file
36
app/javascript/gabsocial/components/composer.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import {
|
||||
Editor,
|
||||
EditorState,
|
||||
RichUtils
|
||||
} from 'draft-js'
|
||||
|
||||
export default class Composer extends PureComponent {
|
||||
|
||||
state = {
|
||||
editorState: EditorState.createEmpty(),
|
||||
}
|
||||
|
||||
onChange = (editorState) => {
|
||||
this.setState({ editorState })
|
||||
}
|
||||
|
||||
onBoldClick() {
|
||||
this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, 'BOLD'));
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
|
||||
{/*<button onClick={this.onBoldClick.bind(this)}>Bold</button>*/}
|
||||
|
||||
<Editor
|
||||
editorState={this.state.editorState}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user