|
@@ -206,6 +206,7 @@ var Editor = function (_React$Component) {
|
206
|
206
|
}
|
207
|
207
|
return item;
|
208
|
208
|
});
|
|
209
|
+ this.props.handleChangeFileList(fileList);
|
209
|
210
|
this.setState({ fileMap: fileMap, fileList: fileList });
|
210
|
211
|
}
|
211
|
212
|
|
|
@@ -218,8 +219,6 @@ var Editor = function (_React$Component) {
|
218
|
219
|
}, {
|
219
|
220
|
key: "handleSubmit",
|
220
|
221
|
value: function handleSubmit() {
|
221
|
|
- var _this2 = this;
|
222
|
|
-
|
223
|
222
|
var maxLength = this.props.maxLength;
|
224
|
223
|
var _state = this.state,
|
225
|
224
|
value = _state.value,
|
|
@@ -244,25 +243,27 @@ var Editor = function (_React$Component) {
|
244
|
243
|
files.push("" + _constant.OSS_LINK + fileMap[item.uid]);
|
245
|
244
|
});
|
246
|
245
|
}
|
247
|
|
- if (this.props.beforeSubmit) {
|
248
|
|
- Promise.resolve(this.props.beforeSubmit({ text: value, files: files })).then(function (res) {
|
249
|
|
- if (!(res === false)) {
|
250
|
|
- _this2.props.onSubmit({ text: value, files: files }, function () {
|
251
|
|
- _this2.resetState();
|
252
|
|
- if (_this2.props.onCommentSuccess) {
|
253
|
|
- _this2.props.onCommentSuccess();
|
254
|
|
- }
|
255
|
|
- });
|
256
|
|
- }
|
257
|
|
- });
|
258
|
|
- } else {
|
259
|
|
- this.props.onSubmit({ text: value, files: files }, function () {
|
260
|
|
- _this2.resetState();
|
261
|
|
- if (_this2.props.onCommentSuccess) {
|
262
|
|
- _this2.props.onCommentSuccess();
|
263
|
|
- }
|
264
|
|
- });
|
265
|
|
- }
|
|
246
|
+ // if (this.props.beforeSubmit) {
|
|
247
|
+ // Promise.resolve(this.props.beforeSubmit({ text: value, files })).then(
|
|
248
|
+ // res => {
|
|
249
|
+ // if (!(res === false)) {
|
|
250
|
+ // this.props.onSubmit({ text: value, files }, () => {
|
|
251
|
+ // this.resetState();
|
|
252
|
+ // if (this.props.onCommentSuccess) {
|
|
253
|
+ // this.props.onCommentSuccess();
|
|
254
|
+ // }
|
|
255
|
+ // });
|
|
256
|
+ // }
|
|
257
|
+ // }
|
|
258
|
+ // );
|
|
259
|
+ // } else {
|
|
260
|
+ // this.props.onSubmit({ text: value, files }, () => {
|
|
261
|
+ // this.resetState();
|
|
262
|
+ // if (this.props.onCommentSuccess) {
|
|
263
|
+ // this.props.onCommentSuccess();
|
|
264
|
+ // }
|
|
265
|
+ // });
|
|
266
|
+ // }
|
266
|
267
|
}
|
267
|
268
|
}, {
|
268
|
269
|
key: "resetState",
|
|
@@ -277,7 +278,7 @@ var Editor = function (_React$Component) {
|
277
|
278
|
}, {
|
278
|
279
|
key: "render",
|
279
|
280
|
value: function render() {
|
280
|
|
- var _this3 = this;
|
|
281
|
+ var _this2 = this;
|
281
|
282
|
|
282
|
283
|
var _props = this.props,
|
283
|
284
|
value = _props.value,
|
|
@@ -320,7 +321,7 @@ var Editor = function (_React$Component) {
|
320
|
321
|
_react2.default.createElement(TextArea, {
|
321
|
322
|
value: inputValue,
|
322
|
323
|
onChange: function onChange(e) {
|
323
|
|
- return _this3.handleChange(e.target.value);
|
|
324
|
+ return _this2.handleChange(e.target.value);
|
324
|
325
|
},
|
325
|
326
|
rows: rows,
|
326
|
327
|
placeholder: placeholder,
|
|
@@ -348,7 +349,7 @@ var Editor = function (_React$Component) {
|
348
|
349
|
_react2.default.createElement(_Emoji2.default, {
|
349
|
350
|
onClick: this.handleClickEmoji,
|
350
|
351
|
ref: function ref(node) {
|
351
|
|
- _this3.emoji = node;
|
|
352
|
+ _this2.emoji = node;
|
352
|
353
|
}
|
353
|
354
|
})
|
354
|
355
|
),
|
|
@@ -367,7 +368,7 @@ var Editor = function (_React$Component) {
|
367
|
368
|
autoAdjustOverflow: false,
|
368
|
369
|
overlayStyle: { zIndex: 999 },
|
369
|
370
|
onVisibleChange: closeUploadWhenBlur ? function (visible) {
|
370
|
|
- _this3.handleShowUpload(visible);
|
|
371
|
+ _this2.handleShowUpload(visible);
|
371
|
372
|
} : null,
|
372
|
373
|
content: _react2.default.createElement(
|
373
|
374
|
"div",
|
|
@@ -408,14 +409,14 @@ var Editor = function (_React$Component) {
|
408
|
409
|
},
|
409
|
410
|
imageToolIcon ? _react2.default.cloneElement(imageToolIcon, {
|
410
|
411
|
onClick: function onClick() {
|
411
|
|
- return _this3.handleShowUpload(true);
|
|
412
|
+ return _this2.handleShowUpload(true);
|
412
|
413
|
}
|
413
|
414
|
}) : _react2.default.createElement(_icon2.default, {
|
414
|
415
|
type: "picture",
|
415
|
416
|
className: "comment-toolbar-icon",
|
416
|
417
|
style: { marginLeft: 10 },
|
417
|
418
|
onClick: function onClick() {
|
418
|
|
- return _this3.handleShowUpload(true);
|
|
419
|
+ return _this2.handleShowUpload(true);
|
419
|
420
|
}
|
420
|
421
|
})
|
421
|
422
|
) : null
|
|
@@ -429,7 +430,7 @@ var Editor = function (_React$Component) {
|
429
|
430
|
_button2.default,
|
430
|
431
|
{
|
431
|
432
|
onClick: function onClick() {
|
432
|
|
- return _this3.handleSubmit();
|
|
433
|
+ return _this2.handleSubmit();
|
433
|
434
|
},
|
434
|
435
|
type: "primary",
|
435
|
436
|
loading: btnLoading,
|