|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
|
import ReactUtils from '../ReactUtils';
|
|
|
|
|
|
+import Editor from '../PageEditor/Editor';
|
|
|
import CommentPreview from '../PageComment/CommentPreview';
|
|
|
|
|
|
import Button from 'react-bootstrap/es/Button';
|
|
|
@@ -28,6 +29,7 @@ export default class CommentForm extends React.Component {
|
|
|
isMarkdown: true,
|
|
|
html: '',
|
|
|
key: 1,
|
|
|
+ editorOptions: this.props.editorOptions,
|
|
|
};
|
|
|
|
|
|
this.updateState = this.updateState.bind(this);
|
|
|
@@ -38,11 +40,11 @@ export default class CommentForm extends React.Component {
|
|
|
|
|
|
updateState(event) {
|
|
|
const target = event.target;
|
|
|
- const value = target.type === 'checkbox' ? target.checked : target.value;
|
|
|
- const name = target.name;
|
|
|
+ // const value = target.type === 'checkbox' ? target.checked : target.value;
|
|
|
+ // const name = target.name;
|
|
|
|
|
|
this.setState({
|
|
|
- [name]: value
|
|
|
+ // [name]: value
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -129,6 +131,7 @@ export default class CommentForm extends React.Component {
|
|
|
const creatorsPage = `/user/${username}`;
|
|
|
const comment = this.state.comment;
|
|
|
const commentPreview = this.state.isMarkdown ? this.getCommentHtml(): ReactUtils.nl2br(comment);
|
|
|
+ const emojiStrategy = this.props.crowi.getEmojiStrategy();
|
|
|
|
|
|
return (
|
|
|
<div>
|
|
|
@@ -144,8 +147,21 @@ export default class CommentForm extends React.Component {
|
|
|
<div className="comment-write">
|
|
|
<Tabs activeKey={this.state.key} id="comment-form-tabs" onSelect={this.handleSelect} animation={false}>
|
|
|
<Tab eventKey={1} title="Write">
|
|
|
- <textarea className="comment-form-comment form-control" id="comment-form-comment" name="comment" required placeholder="Write comments here..." value={this.state.comment} onChange={this.updateState} >
|
|
|
- </textarea>
|
|
|
+ {/* <textarea className="comment-form-comment form-control" id="comment-form-comment" name="comment" required placeholder="Write comments here..." value={this.state.comment} onChange={this.updateState} >
|
|
|
+ </textarea> */}
|
|
|
+ <Editor ref="editor" type="text"
|
|
|
+ value={this.state.comment}
|
|
|
+ editorOptions={this.state.editorOptions}
|
|
|
+ isMobile={this.props.crowi.isMobile}
|
|
|
+ // isUploadable={this.state.isUploadable}
|
|
|
+ // isUploadableFile={this.state.isUploadableFile}
|
|
|
+ emojiStrategy={emojiStrategy}
|
|
|
+ // onScroll={this.onEditorScroll}
|
|
|
+ // onScrollCursorIntoView={this.onEditorScrollCursorIntoView}
|
|
|
+ onChange={this.updateState}
|
|
|
+ // onSave={this.onSave}
|
|
|
+ // onUpload={this.onUpload}
|
|
|
+ />
|
|
|
</Tab>
|
|
|
{ this.state.isMarkdown == true &&
|
|
|
<Tab eventKey={2} title="Preview">
|