client/src/components/NoteInput.js
changeset 29 4cfeabef7d5e
parent 26 930e486ad0a8
child 35 97106bacb24e
equal deleted inserted replaced
28:abf9f3ff2635 29:4cfeabef7d5e
     1 import React, {Component} from 'react';
     1 import React, { Component } from 'react';
       
     2 import { connect } from 'react-redux';
       
     3 import { bindActionCreators } from 'redux';
     2 import { Form, FormGroup, Button, Label, Row, Col } from 'react-bootstrap';
     4 import { Form, FormGroup, Button, Label, Row, Col } from 'react-bootstrap';
     3 import moment from 'moment';
     5 import moment from 'moment';
     4 
     6 
     5 import PropTypes from 'prop-types';
     7 import PropTypes from 'prop-types';
     6 import SlateEditor from './SlateEditor';
     8 import SlateEditor from './SlateEditor';
     7 import Clock from './Clock'
     9 import Clock from './Clock'
       
    10 import * as notesActions from '../actions/notesActions';
     8 
    11 
     9 class NoteInput extends Component {
    12 class NoteInput extends Component {
    10 
    13 
    11   state = {
    14   state = {
    12     buttonDisabled: false,
    15     buttonDisabled: false,
    26     const plain = this.refs.editor.asPlain();
    29     const plain = this.refs.editor.asPlain();
    27     const raw = this.refs.editor.asRaw();
    30     const raw = this.refs.editor.asRaw();
    28     const html = this.refs.editor.asHtml();
    31     const html = this.refs.editor.asHtml();
    29     const categories = this.refs.editor.asCategories();
    32     const categories = this.refs.editor.asCategories();
    30 
    33 
    31     this.props.addNote(this.props.session, {
    34     this.props.notesActions.addNote(this.props.session, {
    32       plain: plain,
    35       plain: plain,
    33       raw: raw,
    36       raw: raw,
    34       html: html,
    37       html: html,
    35 
    38 
    36       startedAt: this.state.startedAt,
    39       startedAt: this.state.startedAt,
    82       </Form>
    85       </Form>
    83     );
    86     );
    84   }
    87   }
    85 }
    88 }
    86 
    89 
       
    90 function mapStateToProps(state, props) {
       
    91   return {};
       
    92 }
       
    93 
       
    94 function mapDispatchToProps(dispatch) {
       
    95   return {
       
    96     notesActions: bindActionCreators(notesActions, dispatch),
       
    97   }
       
    98 }
       
    99 
    87 NoteInput.propTypes = {
   100 NoteInput.propTypes = {
    88   addNote: PropTypes.func.isRequired
   101   addNote: PropTypes.func.isRequired
    89 };
   102 };
    90 
   103 
    91 export default NoteInput;
   104 export default connect(mapStateToProps, mapDispatchToProps)(NoteInput);