Skip to content
Permalink
Browse files
added button for styling text
  • Loading branch information
Julian Krispel-Samsel committed Jun 16, 2017
1 parent 16d29d7 commit 49a546be40fb04465ce00c56d5b5eedb275d803c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
@@ -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>
);
}
}
@@ -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.