|
@@ -7,7 +7,6 @@ import { Subscribe } from 'unstated';
|
|
|
import Button from 'react-bootstrap/es/Button';
|
|
import Button from 'react-bootstrap/es/Button';
|
|
|
import Tab from 'react-bootstrap/es/Tab';
|
|
import Tab from 'react-bootstrap/es/Tab';
|
|
|
import Tabs from 'react-bootstrap/es/Tabs';
|
|
import Tabs from 'react-bootstrap/es/Tabs';
|
|
|
-import * as toastr from 'toastr';
|
|
|
|
|
import UserPicture from '../User/UserPicture';
|
|
import UserPicture from '../User/UserPicture';
|
|
|
import ReactUtils from '../ReactUtils';
|
|
import ReactUtils from '../ReactUtils';
|
|
|
|
|
|
|
@@ -129,7 +128,18 @@ class CommentEditor extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
uploadHandler(file) {
|
|
uploadHandler(file) {
|
|
|
- this.props.commentContainer.uploadAttachment(file)
|
|
|
|
|
|
|
+ // const endpoint = '/attachments.add';
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ // create a FromData instance
|
|
|
|
|
+ const formData = new FormData();
|
|
|
|
|
+ formData.append('_csrf', this.props.data.crowi.csrfToken);
|
|
|
|
|
+ formData.append('file', file);
|
|
|
|
|
+ formData.append('path', this.props.data.pagePath);
|
|
|
|
|
+ formData.append('page_id', this.props.data.pageId || 0);
|
|
|
|
|
+
|
|
|
|
|
+ // post
|
|
|
|
|
+ this.props.data.crowi.apiPost(endpoint, formData)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
const attachment = res.attachment;
|
|
const attachment = res.attachment;
|
|
|
const fileName = attachment.originalName;
|
|
const fileName = attachment.originalName;
|
|
@@ -147,18 +157,19 @@ class CommentEditor extends React.Component {
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
this.editor.terminateUploadingState();
|
|
this.editor.terminateUploadingState();
|
|
|
});
|
|
});
|
|
|
|
|
+ */
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- apiErrorHandler(error) {
|
|
|
|
|
- toastr.error(error.message, 'Error occured', {
|
|
|
|
|
- closeButton: true,
|
|
|
|
|
- progressBar: true,
|
|
|
|
|
- newestOnTop: false,
|
|
|
|
|
- showDuration: '100',
|
|
|
|
|
- hideDuration: '100',
|
|
|
|
|
- timeOut: '3000',
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // apiErrorHandler(error) {
|
|
|
|
|
+ // toastr.error(error.message, 'Error occured', {
|
|
|
|
|
+ // closeButton: true,
|
|
|
|
|
+ // progressBar: true,
|
|
|
|
|
+ // newestOnTop: false,
|
|
|
|
|
+ // showDuration: '100',
|
|
|
|
|
+ // hideDuration: '100',
|
|
|
|
|
+ // timeOut: '3000',
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
getCommentHtml() {
|
|
getCommentHtml() {
|
|
|
return (
|
|
return (
|