client/src/components/NoteInput.js
changeset 161 a642639dbc07
parent 157 5c3af4f10e92
child 171 03334a31130a
equal deleted inserted replaced
160:183b128a4189 161:a642639dbc07
     1 import React, { Component } from 'react';
     1 import React, { Component } from 'react';
     2 import PropTypes from 'prop-types';
     2 import PropTypes from 'prop-types';
     3 import SlateEditor from './SlateEditor';
     3 import SlateEditor from './SlateEditor';
     4 import { now } from '../utils';
     4 import { now } from '../utils';
     5 
     5 import './NoteInput.css';
     6 
     6 
     7 class NoteInput extends Component {
     7 class NoteInput extends Component {
     8 
     8 
     9   state = {
     9   state = {
    10     buttonDisabled: false,
    10     buttonDisabled: false,
    33       raw: raw,
    33       raw: raw,
    34       html: html,
    34       html: html,
    35       startedAt: this.state.startedAt,
    35       startedAt: this.state.startedAt,
    36       finishedAt: now(),
    36       finishedAt: now(),
    37       categories: categories,
    37       categories: categories,
       
    38 
    38       // marginComment: marginComment,
    39       // marginComment: marginComment,
    39     });
    40     });
       
    41 
    40 
    42 
    41     this.refs.editor.clear();
    43     this.refs.editor.clear();
    42     setTimeout(() => this.refs.editor.focus(), 250);
    44     setTimeout(() => this.refs.editor.focus(), 250);
    43   }
    45   }
    44 
    46 
    52   }
    54   }
    53 
    55 
    54   render() {
    56   render() {
    55     return (
    57     return (
    56       <form>
    58       <form>
    57         <div className="editor p-3 mb-3">
    59         <div className="editor mb-3">
    58           <div className="editor-left w-100 border-0 pl-3 pb-3 sticky-bottom">
    60           <div className="editor-left sticky-bottom px-2">
    59             <SlateEditor ref="editor"
    61             <SlateEditor ref="editor"
    60               onChange={this.onEditorChange}
    62               onChange={this.onEditorChange}
    61               onEnterKeyDown={this.onAddNoteClick}
    63               onEnterKeyDown={this.onAddNoteClick}
    62               onButtonClick={this.onAddNoteClick}
    64               onButtonClick={this.onAddNoteClick}
    63               onCheckboxChange={this.onCheckboxChange}
    65               onCheckboxChange={this.onCheckboxChange}