Browse Source

Merge branch 'master' of Hepper/comment into master

AdamFu 5 years ago
parent
commit
cfd2c2169c

+ 29
- 28
lib/components/Editor/index.js View File

206
         }
206
         }
207
         return item;
207
         return item;
208
       });
208
       });
209
+      this.props.handleChangeFileList(fileList);
209
       this.setState({ fileMap: fileMap, fileList: fileList });
210
       this.setState({ fileMap: fileMap, fileList: fileList });
210
     }
211
     }
211
 
212
 
218
   }, {
219
   }, {
219
     key: "handleSubmit",
220
     key: "handleSubmit",
220
     value: function handleSubmit() {
221
     value: function handleSubmit() {
221
-      var _this2 = this;
222
-
223
       var maxLength = this.props.maxLength;
222
       var maxLength = this.props.maxLength;
224
       var _state = this.state,
223
       var _state = this.state,
225
           value = _state.value,
224
           value = _state.value,
244
           files.push("" + _constant.OSS_LINK + fileMap[item.uid]);
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
     key: "resetState",
269
     key: "resetState",
277
   }, {
278
   }, {
278
     key: "render",
279
     key: "render",
279
     value: function render() {
280
     value: function render() {
280
-      var _this3 = this;
281
+      var _this2 = this;
281
 
282
 
282
       var _props = this.props,
283
       var _props = this.props,
283
           value = _props.value,
284
           value = _props.value,
320
           _react2.default.createElement(TextArea, {
321
           _react2.default.createElement(TextArea, {
321
             value: inputValue,
322
             value: inputValue,
322
             onChange: function onChange(e) {
323
             onChange: function onChange(e) {
323
-              return _this3.handleChange(e.target.value);
324
+              return _this2.handleChange(e.target.value);
324
             },
325
             },
325
             rows: rows,
326
             rows: rows,
326
             placeholder: placeholder,
327
             placeholder: placeholder,
348
                     _react2.default.createElement(_Emoji2.default, {
349
                     _react2.default.createElement(_Emoji2.default, {
349
                       onClick: this.handleClickEmoji,
350
                       onClick: this.handleClickEmoji,
350
                       ref: function ref(node) {
351
                       ref: function ref(node) {
351
-                        _this3.emoji = node;
352
+                        _this2.emoji = node;
352
                       }
353
                       }
353
                     })
354
                     })
354
                   ),
355
                   ),
367
                   autoAdjustOverflow: false,
368
                   autoAdjustOverflow: false,
368
                   overlayStyle: { zIndex: 999 },
369
                   overlayStyle: { zIndex: 999 },
369
                   onVisibleChange: closeUploadWhenBlur ? function (visible) {
370
                   onVisibleChange: closeUploadWhenBlur ? function (visible) {
370
-                    _this3.handleShowUpload(visible);
371
+                    _this2.handleShowUpload(visible);
371
                   } : null,
372
                   } : null,
372
                   content: _react2.default.createElement(
373
                   content: _react2.default.createElement(
373
                     "div",
374
                     "div",
408
                 },
409
                 },
409
                 imageToolIcon ? _react2.default.cloneElement(imageToolIcon, {
410
                 imageToolIcon ? _react2.default.cloneElement(imageToolIcon, {
410
                   onClick: function onClick() {
411
                   onClick: function onClick() {
411
-                    return _this3.handleShowUpload(true);
412
+                    return _this2.handleShowUpload(true);
412
                   }
413
                   }
413
                 }) : _react2.default.createElement(_icon2.default, {
414
                 }) : _react2.default.createElement(_icon2.default, {
414
                   type: "picture",
415
                   type: "picture",
415
                   className: "comment-toolbar-icon",
416
                   className: "comment-toolbar-icon",
416
                   style: { marginLeft: 10 },
417
                   style: { marginLeft: 10 },
417
                   onClick: function onClick() {
418
                   onClick: function onClick() {
418
-                    return _this3.handleShowUpload(true);
419
+                    return _this2.handleShowUpload(true);
419
                   }
420
                   }
420
                 })
421
                 })
421
               ) : null
422
               ) : null
429
                 _button2.default,
430
                 _button2.default,
430
                 {
431
                 {
431
                   onClick: function onClick() {
432
                   onClick: function onClick() {
432
-                    return _this3.handleSubmit();
433
+                    return _this2.handleSubmit();
433
                   },
434
                   },
434
                   type: "primary",
435
                   type: "primary",
435
                   loading: btnLoading,
436
                   loading: btnLoading,

+ 1
- 1
lib/components/Editor/index.js.map
File diff suppressed because it is too large
View File


+ 3
- 3
lib/version.json View File

1
 {
1
 {
2
     "name":       "comment",
2
     "name":       "comment",
3
-    "buildDate":  1561033676404,
3
+    "buildDate":  1561169930396,
4
     "version":    "1.0.4",
4
     "version":    "1.0.4",
5
-    "numCommits": 149,
6
-    "hash":       "955d349",
5
+    "numCommits": 151,
6
+    "hash":       "1d304ca",
7
     "dirty":      true
7
     "dirty":      true
8
 }
8
 }

+ 22
- 21
src/components/Editor/index.js View File

113
       }
113
       }
114
       return item;
114
       return item;
115
     });
115
     });
116
+    this.props.handleChangeFileList(fileList);
116
     this.setState({ fileMap, fileList });
117
     this.setState({ fileMap, fileList });
117
   }
118
   }
118
 
119
 
142
         files.push(`${OSS_LINK}${fileMap[item.uid]}`);
143
         files.push(`${OSS_LINK}${fileMap[item.uid]}`);
143
       });
144
       });
144
     }
145
     }
145
-    if (this.props.beforeSubmit) {
146
-      Promise.resolve(this.props.beforeSubmit({ text: value, files })).then(
147
-        res => {
148
-          if (!(res === false)) {
149
-            this.props.onSubmit({ text: value, files }, () => {
150
-              this.resetState();
151
-              if (this.props.onCommentSuccess) {
152
-                this.props.onCommentSuccess();
153
-              }
154
-            });
155
-          }
156
-        }
157
-      );
158
-    } else {
159
-      this.props.onSubmit({ text: value, files }, () => {
160
-        this.resetState();
161
-        if (this.props.onCommentSuccess) {
162
-          this.props.onCommentSuccess();
163
-        }
164
-      });
165
-    }
146
+    // if (this.props.beforeSubmit) {
147
+    //   Promise.resolve(this.props.beforeSubmit({ text: value, files })).then(
148
+    //     res => {
149
+    //       if (!(res === false)) {
150
+    //         this.props.onSubmit({ text: value, files }, () => {
151
+    //           this.resetState();
152
+    //           if (this.props.onCommentSuccess) {
153
+    //             this.props.onCommentSuccess();
154
+    //           }
155
+    //         });
156
+    //       }
157
+    //     }
158
+    //   );
159
+    // } else {
160
+    //   this.props.onSubmit({ text: value, files }, () => {
161
+    //     this.resetState();
162
+    //     if (this.props.onCommentSuccess) {
163
+    //       this.props.onCommentSuccess();
164
+    //     }
165
+    //   });
166
+    // }
166
   }
167
   }
167
 
168
 
168
   resetState() {
169
   resetState() {