Skip to content

Commit

Permalink
client: expose function to set code (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcruz authored Apr 19, 2018
1 parent f0fcc4c commit 59e5dfb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/src/components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Editor extends React.Component<Props, State> {

componentDidMount() {
window.addEventListener('resize', this.handleResize);
window.setCode = this.setCode;
}

componentWillUnmount() {
Expand Down Expand Up @@ -76,6 +77,10 @@ class Editor extends React.Component<Props, State> {
},
];

setCode = (code: string) => {
this.setState({ code });
};

handleChange = (newCode: string) => {
this.setState({ code: newCode });
};
Expand Down

0 comments on commit 59e5dfb

Please sign in to comment.