# HG changeset patch # User Alexandre Segura # Date 1497974042 -7200 # Node ID aecde527900af5e09849935842675d13d543840a # Parent 4088f8dc6b5255704780919c45172d8a1e35ee87 Introduce adding note on "enter" key. diff -r 4088f8dc6b52 -r aecde527900a client/src/components/NoteInput.js --- a/client/src/components/NoteInput.js Tue Jun 20 16:08:12 2017 +0200 +++ b/client/src/components/NoteInput.js Tue Jun 20 17:54:02 2017 +0200 @@ -1,12 +1,11 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { Form, FormControl, Button, Label, Row, Col, Panel } from 'react-bootstrap'; +import { Form, FormControl, Button, Label } from 'react-bootstrap'; import moment from 'moment'; import PropTypes from 'prop-types'; import SlateEditor from './SlateEditor'; -import Clock from './Clock' import * as notesActions from '../actions/notesActions'; class NoteInput extends Component { @@ -67,19 +66,9 @@ render() { return (
- - - - { this.renderTiming() } - - - - - -
- +
{ + + if (data.key === 'enter') { + if (typeof this.props.onEnterKeyDown === 'function') { + e.preventDefault(); + this.props.onEnterKeyDown(); + return state; + } + } + if (!data.isMod) return let mark