Evo пре 4 година
родитељ
комит
eb03b3e300
7 измењених фајлова са 47 додато и 40 уклоњено
  1. 37
    30
      lib/components/Editor/index.js
  2. 1
    1
      lib/components/Editor/index.js.map
  3. 2
    1
      lib/index.js
  4. 1
    1
      lib/index.js.map
  5. 2
    3
      lib/utils.js
  6. 1
    1
      lib/utils.js.map
  7. 3
    3
      lib/version.json

+ 37
- 30
lib/components/Editor/index.js Прегледај датотеку

@@ -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);

+ 1
- 1
lib/components/Editor/index.js.map
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 2
- 1
lib/index.js Прегледај датотеку

@@ -75,7 +75,8 @@ var Index = function (_React$Component) {
75 75
               fileList: fileList
76 76
             });
77 77
           },
78
-          allowEnterSubmit: true
78
+          allowEnterSubmit: true,
79
+          limitOne: true
79 80
         }))
80 81
       );
81 82
     }

+ 1
- 1
lib/index.js.map
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 2
- 3
lib/utils.js Прегледај датотеку

@@ -1,11 +1,10 @@
1
-'use strict';
1
+"use strict";
2 2
 
3 3
 Object.defineProperty(exports, "__esModule", {
4 4
   value: true
5 5
 });
6
-
7 6
 /**
8 7
  * 575: 为了和media query中的判断保持一致
9 8
  */
10
-var isMobile = exports.isMobile = typeof window.orientation === 'number' && document.body.offsetWidth < 575;
9
+var isMobile = exports.isMobile = typeof window.orientation === "number" && document.body.offsetWidth < 575;
11 10
 //# sourceMappingURL=utils.js.map

+ 1
- 1
lib/utils.js.map Прегледај датотеку

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/utils.js"],"names":["isMobile","window","orientation","document","body","offsetWidth"],"mappings":";;;;;;AACA;;;AAGO,IAAMA,8BAAW,OAAOC,OAAOC,WAAd,KAA8B,QAA9B,IAA0CC,SAASC,IAAT,CAAcC,WAAd,GAA4B,GAAvF","file":"utils.js","sourcesContent":["\n/**\n * 575: 为了和media query中的判断保持一致\n */\nexport const isMobile = typeof window.orientation === 'number' && document.body.offsetWidth < 575"]}
1
+{"version":3,"sources":["../src/utils.js"],"names":["isMobile","window","orientation","document","body","offsetWidth"],"mappings":";;;;;AAAA;;;AAGO,IAAMA,8BACX,OAAOC,OAAOC,WAAd,KAA8B,QAA9B,IAA0CC,SAASC,IAAT,CAAcC,WAAd,GAA4B,GADjE","file":"utils.js","sourcesContent":["/**\n * 575: 为了和media query中的判断保持一致\n */\nexport const isMobile =\n  typeof window.orientation === \"number\" && document.body.offsetWidth < 575;\n"]}

+ 3
- 3
lib/version.json Прегледај датотеку

@@ -1,8 +1,8 @@
1 1
 {
2 2
     "name":       "comment",
3
-    "buildDate":  1582452764350,
3
+    "buildDate":  1582467062540,
4 4
     "version":    "1.0.4",
5
-    "numCommits": 203,
6
-    "hash":       "e963be4",
5
+    "numCommits": 204,
6
+    "hash":       "016964f",
7 7
     "dirty":      true
8 8
 }