shift enter is linebreak, enter is save
This commit is contained in:
parent
5af79e405d
commit
88a971de77
1 changed files with 9 additions and 1 deletions
|
@ -4,6 +4,14 @@ import { RIETextArea } from 'riek'
|
||||||
import Util from '../../Metamaps/Util'
|
import Util from '../../Metamaps/Util'
|
||||||
|
|
||||||
class MdTextArea extends RIETextArea {
|
class MdTextArea extends RIETextArea {
|
||||||
|
keyDown = (event) => {
|
||||||
|
// we'll handle Enter on our own, thanks
|
||||||
|
const ESC = 27
|
||||||
|
if (event.keyCode === ESC) {
|
||||||
|
this.cancelEditing()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderNormalComponent = () => {
|
renderNormalComponent = () => {
|
||||||
const value = this.state.newValue || this.props.value
|
const value = this.state.newValue || this.props.value
|
||||||
|
|
||||||
|
@ -36,7 +44,7 @@ class Desc extends Component {
|
||||||
editProps={{
|
editProps={{
|
||||||
onKeyPress: e => {
|
onKeyPress: e => {
|
||||||
const ENTER = 13
|
const ENTER = 13
|
||||||
if (e.shiftKey && e.which === ENTER) {
|
if (!e.shiftKey && e.which === ENTER) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
this.props.onChange({ desc: e.target.value })
|
this.props.onChange({ desc: e.target.value })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue