Permalink
Browse files

added button for styling text

  • Loading branch information...
juliankrispel committed Jun 16, 2017
1 parent 16d29d7 commit 49a546be40fb04465ce00c56d5b5eedb275d803c
Showing with 27 additions and 5 deletions.
  1. +12 −5 src/App.js
  2. +15 −0 src/index.css
View
@@ -24,13 +24,20 @@ class App extends Component {
return 'not-handled';
}
onUnderlineClick = () => {
this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, 'UNDERLINE'));
}
render() {
return (
<Editor
editorState={this.state.editorState}
handleKeyCommand={this.handleKeyCommand}
onChange={this.onChange}
/>
<div>
<button onClick={this.onUnderlineClick}>Underline</button>
<Editor
editorState={this.state.editorState}
handleKeyCommand={this.handleKeyCommand}
onChange={this.onChange}
/>
</div>
);
}
}
View
@@ -10,3 +10,18 @@ body {
border-radius: .3em;
padding: 1em;
}
button{
background: #999;
color: #fff;
border: none;
padding: .5em;
cursor: pointer;
margin-bottom: 1em;
margin-right: 1em;
border-radius: .2em;
}
button:hover{
background: #888;
}

0 comments on commit 49a546b

Please sign in to comment.