Skip to content

Commit

Permalink
Close #341
Browse files Browse the repository at this point in the history
  • Loading branch information
ganzorig committed Feb 19, 2018
1 parent 33b2d4e commit 121f685
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/modules/inbox/components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,30 +320,28 @@ export default class Editor extends Component {
}

keyBindingFn(e) {
// handle enter in editor
if (e.key === 'Enter') {
// select response template
if (this.state.templatesState) {
this.onSelectTemplate();

return null;
}
// call parent's method to save content
this.props.onShifEnter();

// handle shift + enter in editor
if (e.metaKey || e.ctrlKey) {
// call parent's method to save content
this.props.onShifEnter();
// clear content
const state = this.state.editorState;

// clear content
const state = this.state.editorState;

const editorState = EditorState.push(
state,
ContentState.createFromText('')
);
const editorState = EditorState.push(
state,
ContentState.createFromText('')
);

this.setState({ editorState });
this.setState({ editorState });

return null;
}
return null;
}

return getDefaultKeyBinding(e);
Expand Down

0 comments on commit 121f685

Please sign in to comment.