diff -r 75dc1e794cf4 -r 7634b424f426 client/src/components/NoteInput.js --- a/client/src/components/NoteInput.js Wed Jun 21 14:12:45 2017 +0200 +++ b/client/src/components/NoteInput.js Thu Jun 22 10:47:10 2017 +0200 @@ -1,12 +1,13 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { Form, FormControl, Button, Label } from 'react-bootstrap'; +import { Form, FormControl, Label } from 'react-bootstrap'; import moment from 'moment'; import PropTypes from 'prop-types'; import SlateEditor from './SlateEditor'; import * as notesActions from '../actions/notesActions'; +import * as userActions from '../actions/userActions'; class NoteInput extends Component { @@ -25,6 +26,7 @@ } onAddNoteClick = () => { + const plain = this.refs.editor.asPlain(); const raw = this.refs.editor.asRaw(); const html = this.refs.editor.asHtml(); @@ -44,6 +46,10 @@ setTimeout(() => this.refs.editor.focus(), 250); } + onCheckboxChange = (e) => { + this.props.userActions.setAutoSubmit(e.target.checked); + } + componentDidMount() { const text = this.refs.editor.asPlain(); this.setState({ buttonDisabled: text.length === 0 }); @@ -68,7 +74,13 @@
); } } function mapStateToProps(state, props) { - return {}; + return { + autoSubmit: state.autoSubmit + }; } function mapDispatchToProps(dispatch) { return { notesActions: bindActionCreators(notesActions, dispatch), + userActions: bindActionCreators(userActions, dispatch), } }