shift enter is linebreak, enter is save

This commit is contained in:
Devin Howard 2017-01-25 16:37:35 -05:00
parent 5af79e405d
commit 88a971de77

View file

@ -4,6 +4,14 @@ import { RIETextArea } from 'riek'
import Util from '../../Metamaps/Util'
class MdTextArea extends RIETextArea {
keyDown = (event) => {
// we'll handle Enter on our own, thanks
const ESC = 27
if (event.keyCode === ESC) {
this.cancelEditing()
}
}
renderNormalComponent = () => {
const value = this.state.newValue || this.props.value
@ -36,7 +44,7 @@ class Desc extends Component {
editProps={{
onKeyPress: e => {
const ENTER = 13
if (e.shiftKey && e.which === ENTER) {
if (!e.shiftKey && e.which === ENTER) {
e.preventDefault()
this.props.onChange({ desc: e.target.value })
}