|
@@ -269,22 +269,26 @@ var Editor = function (_React$Component) {
|
269
|
269
|
}, {
|
270
|
270
|
key: "invokeFileListChange",
|
271
|
271
|
value: function invokeFileListChange(fileList) {
|
272
|
|
- this.props.handleChangeFileList(fileList);
|
|
272
|
+ var _props2 = this.props,
|
|
273
|
+ limitOne = _props2.limitOne,
|
|
274
|
+ handleChangeFileList = _props2.handleChangeFileList;
|
|
275
|
+
|
|
276
|
+ handleChangeFileList(fileList);
|
273
|
277
|
this.setState({ fileList: fileList });
|
274
|
|
- if (_utils.isMobile) {
|
|
278
|
+ if (limitOne && _utils.isMobile) {
|
275
|
279
|
var file = fileList[0];
|
276
|
|
- if (file && file.status === 'done' && !file.thumbUrl.includes('data:image')) {
|
|
280
|
+ if (file && file.status === "done" && !file.thumbUrl.includes("data:image")) {
|
277
|
281
|
this.setState({ uploadVisible: false });
|
278
|
282
|
}
|
279
|
283
|
}
|
280
|
284
|
}
|
281
|
|
- }, {
|
282
|
|
- key: "handlePaste",
|
283
|
|
-
|
284
|
285
|
|
285
|
286
|
/**
|
286
|
287
|
* 粘贴回调
|
287
|
288
|
*/
|
|
289
|
+
|
|
290
|
+ }, {
|
|
291
|
+ key: "handlePaste",
|
288
|
292
|
value: function handlePaste(e) {
|
289
|
293
|
var _this2 = this;
|
290
|
294
|
|
|
@@ -399,10 +403,10 @@ var Editor = function (_React$Component) {
|
399
|
403
|
}, {
|
400
|
404
|
key: "checkDisabledSubmit",
|
401
|
405
|
value: function checkDisabledSubmit() {
|
402
|
|
- var _props2 = this.props,
|
403
|
|
- btnDisabled = _props2.btnDisabled,
|
404
|
|
- value = _props2.value,
|
405
|
|
- fileList = _props2.fileList;
|
|
406
|
+ var _props3 = this.props,
|
|
407
|
+ btnDisabled = _props3.btnDisabled,
|
|
408
|
+ value = _props3.value,
|
|
409
|
+ fileList = _props3.fileList;
|
406
|
410
|
|
407
|
411
|
if (btnDisabled) {
|
408
|
412
|
return true;
|
|
@@ -445,24 +449,24 @@ var Editor = function (_React$Component) {
|
445
|
449
|
value: function render() {
|
446
|
450
|
var _this4 = this;
|
447
|
451
|
|
448
|
|
- var _props3 = this.props,
|
449
|
|
- value = _props3.value,
|
450
|
|
- rows = _props3.rows,
|
451
|
|
- showEmoji = _props3.showEmoji,
|
452
|
|
- showUpload = _props3.showUpload,
|
453
|
|
- multiple = _props3.multiple,
|
454
|
|
- emojiPopoverPlacement = _props3.emojiPopoverPlacement,
|
455
|
|
- uploadPopoverPlacement = _props3.uploadPopoverPlacement,
|
456
|
|
- uploadOverlayClassName = _props3.uploadOverlayClassName,
|
457
|
|
- fileList = _props3.fileList,
|
458
|
|
- maxUpload = _props3.maxUpload,
|
459
|
|
- btnLoading = _props3.btnLoading,
|
460
|
|
- button = _props3.button,
|
461
|
|
- emojiToolIcon = _props3.emojiToolIcon,
|
462
|
|
- imageToolIcon = _props3.imageToolIcon,
|
463
|
|
- maxLength = _props3.maxLength,
|
464
|
|
- autoFocus = _props3.autoFocus,
|
465
|
|
- app = _props3.app;
|
|
452
|
+ var _props4 = this.props,
|
|
453
|
+ value = _props4.value,
|
|
454
|
+ rows = _props4.rows,
|
|
455
|
+ showEmoji = _props4.showEmoji,
|
|
456
|
+ showUpload = _props4.showUpload,
|
|
457
|
+ multiple = _props4.multiple,
|
|
458
|
+ emojiPopoverPlacement = _props4.emojiPopoverPlacement,
|
|
459
|
+ uploadPopoverPlacement = _props4.uploadPopoverPlacement,
|
|
460
|
+ uploadOverlayClassName = _props4.uploadOverlayClassName,
|
|
461
|
+ fileList = _props4.fileList,
|
|
462
|
+ maxUpload = _props4.maxUpload,
|
|
463
|
+ btnLoading = _props4.btnLoading,
|
|
464
|
+ button = _props4.button,
|
|
465
|
+ emojiToolIcon = _props4.emojiToolIcon,
|
|
466
|
+ imageToolIcon = _props4.imageToolIcon,
|
|
467
|
+ maxLength = _props4.maxLength,
|
|
468
|
+ autoFocus = _props4.autoFocus,
|
|
469
|
+ app = _props4.app;
|
466
|
470
|
|
467
|
471
|
var placeholder = this.props.placeholder || _reactIntlUniversal2.default.get("editor.placeholder");
|
468
|
472
|
var btnSubmitText = this.props.btnSubmitText || _reactIntlUniversal2.default.get("editor.SubmitBtn");
|
|
@@ -666,7 +670,9 @@ Editor.propTypes = {
|
666
|
670
|
onError: _propTypes2.default.func,
|
667
|
671
|
maxLength: _propTypes2.default.number,
|
668
|
672
|
// Enter事件相关
|
669
|
|
- allowEnterSubmit: _propTypes2.default.bool
|
|
673
|
+ allowEnterSubmit: _propTypes2.default.bool,
|
|
674
|
+ // 私信仅允许选中一个,此处可以优化为通用的limit
|
|
675
|
+ limitOne: _propTypes2.default.bool
|
670
|
676
|
};
|
671
|
677
|
|
672
|
678
|
Editor.defaultProps = {
|
|
@@ -688,7 +694,8 @@ Editor.defaultProps = {
|
688
|
694
|
app: {},
|
689
|
695
|
handleChangeFileList: function handleChangeFileList() {},
|
690
|
696
|
// Enter事件相关
|
691
|
|
- allowEnterSubmit: false
|
|
697
|
+ allowEnterSubmit: false,
|
|
698
|
+ limitOne: false
|
692
|
699
|
};
|
693
|
700
|
|
694
|
701
|
exports.default = (0, _Comment2.default)(Editor);
|