Browse Source

Merge branch 'master' of node/npmcomment into master

node 6 years ago
parent
commit
ea0a975f27

+ 7
- 1
CHANGELOG.md View File

1
 # CHANGELOG
1
 # CHANGELOG
2
 
2
 
3
-## 0.4.0
3
+## 0.5.0
4
+
5
+- [x] fix: /oss/sts api
6
+- [x] fix: remove showHeader 
7
+- [x] fix: 去掉昵称的超链接
8
+
9
+## 0.4.1
4
 
10
 
5
 - [x] fix: XSS 注入
11
 - [x] fix: XSS 注入
6
 - [x] feat: Comment 添加 showAlertComment/showAlertReply/showAlertFavor 属性
12
 - [x] feat: Comment 添加 showAlertComment/showAlertReply/showAlertFavor 属性

+ 1
- 2
README.md View File

2
 
2
 
3
 通用评论系统及编辑器
3
 通用评论系统及编辑器
4
 
4
 
5
-**`version 0.4.1`**
5
+**`version 0.5.0`**
6
 
6
 
7
 ```js
7
 ```js
8
 import Comment, { Editor, RenderText } from 'comment';
8
 import Comment, { Editor, RenderText } from 'comment';
20
 | API        | string  | http://api.links123.net/comment/v1 | false    | API 前缀                                     |
20
 | API        | string  | http://api.links123.net/comment/v1 | false    | API 前缀                                     |
21
 | showList   | boolean | true                               | false    | 是否显示评论列表                             |
21
 | showList   | boolean | true                               | false    | 是否显示评论列表                             |
22
 | showEditor | boolean | true                               | false    | 是否显示评论输入框                           |
22
 | showEditor | boolean | true                               | false    | 是否显示评论输入框                           |
23
-| showHeader | boolean | true                               | false    | 是否显示评论顶部的提示                       |
24
 | showAlertComment | boolean | false                               | false    | 评论成功之后,是否通过 Antd 的 Message 组件进行提示  |
23
 | showAlertComment | boolean | false                               | false    | 评论成功之后,是否通过 Antd 的 Message 组件进行提示  |
25
 | showAlertReply | boolean | false                               | false    | 回复成功之后,是否通过 Antd 的 Message 组件进行提示  |
24
 | showAlertReply | boolean | false                               | false    | 回复成功之后,是否通过 Antd 的 Message 组件进行提示  |
26
 | showAlertFavor | boolean | false                               | false    | 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示  |
25
 | showAlertFavor | boolean | false                               | false    | 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示  |

+ 66
- 91
lib/App.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 exports.RenderText = exports.Editor = undefined;
6
 exports.RenderText = exports.Editor = undefined;
7
 
7
 
8
-var _tag = require('antd/es/tag');
9
-
10
-var _tag2 = _interopRequireDefault(_tag);
11
-
12
-var _message2 = require('antd/es/message');
8
+var _message2 = require("antd/es/message");
13
 
9
 
14
 var _message3 = _interopRequireDefault(_message2);
10
 var _message3 = _interopRequireDefault(_message2);
15
 
11
 
17
 
13
 
18
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
14
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
19
 
15
 
20
-require('antd/es/tag/style/css');
21
-
22
-require('antd/es/message/style/css');
16
+require("antd/es/message/style/css");
23
 
17
 
24
-var _react = require('react');
18
+var _react = require("react");
25
 
19
 
26
 var _react2 = _interopRequireDefault(_react);
20
 var _react2 = _interopRequireDefault(_react);
27
 
21
 
28
-var _propTypes = require('prop-types');
22
+var _propTypes = require("prop-types");
29
 
23
 
30
 var _propTypes2 = _interopRequireDefault(_propTypes);
24
 var _propTypes2 = _interopRequireDefault(_propTypes);
31
 
25
 
32
-var _axios = require('axios');
26
+var _axios = require("axios");
33
 
27
 
34
 var _axios2 = _interopRequireDefault(_axios);
28
 var _axios2 = _interopRequireDefault(_axios);
35
 
29
 
36
-var _constant = require('./constant');
30
+var _constant = require("./constant");
37
 
31
 
38
-var _Comment = require('./Comment');
32
+var _Comment = require("./Comment");
39
 
33
 
40
-var _helper = require('./helper');
34
+var _helper = require("./helper");
41
 
35
 
42
-var _CommentInput = require('./components/CommentInput');
36
+var _CommentInput = require("./components/CommentInput");
43
 
37
 
44
 var _CommentInput2 = _interopRequireDefault(_CommentInput);
38
 var _CommentInput2 = _interopRequireDefault(_CommentInput);
45
 
39
 
46
-var _CommentList = require('./components/CommentList');
40
+var _CommentList = require("./components/CommentList");
47
 
41
 
48
 var _CommentList2 = _interopRequireDefault(_CommentList);
42
 var _CommentList2 = _interopRequireDefault(_CommentList);
49
 
43
 
50
-var _Editor = require('./components/Editor');
44
+var _Editor = require("./components/Editor");
51
 
45
 
52
 var _Editor2 = _interopRequireDefault(_Editor);
46
 var _Editor2 = _interopRequireDefault(_Editor);
53
 
47
 
54
-var _RenderText = require('./components/RenderText');
48
+var _RenderText = require("./components/RenderText");
55
 
49
 
56
 var _RenderText2 = _interopRequireDefault(_RenderText);
50
 var _RenderText2 = _interopRequireDefault(_RenderText);
57
 
51
 
58
-var _lang = require('./lang');
52
+var _lang = require("./lang");
59
 
53
 
60
 var _lang2 = _interopRequireDefault(_lang);
54
 var _lang2 = _interopRequireDefault(_lang);
61
 
55
 
62
-require('./App.css');
56
+require("./App.css");
63
 
57
 
64
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
58
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65
 
59
 
102
   }
96
   }
103
 
97
 
104
   _createClass(App, [{
98
   _createClass(App, [{
105
-    key: 'componentWillMount',
99
+    key: "componentWillMount",
106
     value: function componentWillMount() {
100
     value: function componentWillMount() {
107
       this.axios = _axios2.default;
101
       this.axios = _axios2.default;
108
       this.axios.defaults.withCredentials = true;
102
       this.axios.defaults.withCredentials = true;
109
       if (this.props.token) {
103
       if (this.props.token) {
110
-        this.axios.defaults.headers.common['Authorization'] = 'Bearer ' + this.props.token;
104
+        this.axios.defaults.headers.common["Authorization"] = "Bearer " + this.props.token;
111
       }
105
       }
112
     }
106
     }
113
   }, {
107
   }, {
114
-    key: 'componentDidMount',
108
+    key: "componentDidMount",
115
     value: function componentDidMount() {}
109
     value: function componentDidMount() {}
116
 
110
 
117
     /**
111
     /**
121
      */
115
      */
122
 
116
 
123
   }, {
117
   }, {
124
-    key: 'handleChangeLoading',
118
+    key: "handleChangeLoading",
125
     value: function handleChangeLoading(key, value) {
119
     value: function handleChangeLoading(key, value) {
126
       var loading = this.state.loading;
120
       var loading = this.state.loading;
127
 
121
 
134
      */
128
      */
135
 
129
 
136
   }, {
130
   }, {
137
-    key: 'sGetComment',
131
+    key: "sGetComment",
138
     value: function sGetComment() {
132
     value: function sGetComment() {
139
       var _this2 = this;
133
       var _this2 = this;
140
 
134
 
142
           _ref$page = _ref.page,
136
           _ref$page = _ref.page,
143
           page = _ref$page === undefined ? 1 : _ref$page;
137
           page = _ref$page === undefined ? 1 : _ref$page;
144
 
138
 
145
-      this.handleChangeLoading('sGetComment', true);
139
+      this.handleChangeLoading("sGetComment", true);
146
       var _props = this.props,
140
       var _props = this.props,
147
           API = _props.API,
141
           API = _props.API,
148
           type = _props.type,
142
           type = _props.type,
149
           businessId = _props.businessId;
143
           businessId = _props.businessId;
150
 
144
 
151
-      this.axios.get(API + '/comments?type=' + type + '&business_id=' + businessId + '&page=' + page + '&limit=' + _constant.LIMIT).then(function (response) {
145
+      this.axios.get(API + "/comments?type=" + type + "&business_id=" + businessId + "&page=" + page + "&limit=" + _constant.LIMIT).then(function (response) {
152
         var _response$data = response.data,
146
         var _response$data = response.data,
153
             list = _response$data.list,
147
             list = _response$data.list,
154
             page = _response$data.page,
148
             page = _response$data.page,
171
             total: total
165
             total: total
172
           });
166
           });
173
         } else {
167
         } else {
174
-          _message3.default.info('没有更多评论了');
168
+          _message3.default.info("没有更多评论了");
175
           _this2.setState({
169
           _this2.setState({
176
             isNoMoreComment: true
170
             isNoMoreComment: true
177
           });
171
           });
183
         }
177
         }
184
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
178
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
185
       }).finally(function () {
179
       }).finally(function () {
186
-        _this2.handleChangeLoading('sGetComment', false);
180
+        _this2.handleChangeLoading("sGetComment", false);
187
       });
181
       });
188
     }
182
     }
189
 
183
 
192
      */
186
      */
193
 
187
 
194
   }, {
188
   }, {
195
-    key: 'sGetReply',
189
+    key: "sGetReply",
196
     value: function sGetReply() {
190
     value: function sGetReply() {
197
       var _this3 = this;
191
       var _this3 = this;
198
 
192
 
201
           _ref2$page = _ref2.page,
195
           _ref2$page = _ref2.page,
202
           page = _ref2$page === undefined ? 1 : _ref2$page;
196
           page = _ref2$page === undefined ? 1 : _ref2$page;
203
 
197
 
204
-      this.handleChangeLoading('sGetReply', true);
198
+      this.handleChangeLoading("sGetReply", true);
205
       var API = this.props.API;
199
       var API = this.props.API;
206
 
200
 
207
-      this.axios.get(API + '/replies?comment_id=' + commentId + '&page=' + page + '&limit=' + _constant.LIMIT).then(function (response) {
201
+      this.axios.get(API + "/replies?comment_id=" + commentId + "&page=" + page + "&limit=" + _constant.LIMIT).then(function (response) {
208
         if (!response.data.list) {
202
         if (!response.data.list) {
209
-          _message3.default.info('没有更多数据了!');
203
+          _message3.default.info("没有更多数据了!");
210
         }
204
         }
211
         var list = _this3.state.list.map(function (item) {
205
         var list = _this3.state.list.map(function (item) {
212
           if (item.id === commentId) {
206
           if (item.id === commentId) {
238
         }
232
         }
239
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
233
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
240
       }).finally(function () {
234
       }).finally(function () {
241
-        _this3.handleChangeLoading('sGetReply', false);
235
+        _this3.handleChangeLoading("sGetReply", false);
242
       });
236
       });
243
     }
237
     }
244
 
238
 
248
      */
242
      */
249
 
243
 
250
   }, {
244
   }, {
251
-    key: 'sCreateComment',
245
+    key: "sCreateComment",
252
     value: function sCreateComment() {
246
     value: function sCreateComment() {
253
       var _this4 = this;
247
       var _this4 = this;
254
 
248
 
257
 
251
 
258
       var cb = arguments[1];
252
       var cb = arguments[1];
259
 
253
 
260
-      if (!content) return _message3.default.error('评论内容不能为空 ');
261
-      this.handleChangeLoading('sCreateComment', true);
254
+      if (!content) return _message3.default.error("评论内容不能为空 ");
255
+      this.handleChangeLoading("sCreateComment", true);
262
       var _props2 = this.props,
256
       var _props2 = this.props,
263
           API = _props2.API,
257
           API = _props2.API,
264
           type = _props2.type,
258
           type = _props2.type,
265
           businessId = _props2.businessId;
259
           businessId = _props2.businessId;
266
 
260
 
267
-      this.axios(API + '/comments', {
268
-        method: 'post',
261
+      this.axios(API + "/comments", {
262
+        method: "post",
269
         data: {
263
         data: {
270
           type: type,
264
           type: type,
271
           business_id: businessId,
265
           business_id: businessId,
274
         withCredentials: true
268
         withCredentials: true
275
       }).then(function (response) {
269
       }).then(function (response) {
276
         if (_this4.props.showAlertComment) {
270
         if (_this4.props.showAlertComment) {
277
-          _message3.default.success('评论成功!');
271
+          _message3.default.success("评论成功!");
278
         }
272
         }
279
         if ((0, _helper.isFunction)(cb)) cb();
273
         if ((0, _helper.isFunction)(cb)) cb();
280
         // 将数据写入到 list 中
274
         // 将数据写入到 list 中
295
         }
289
         }
296
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
290
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
297
       }).finally(function () {
291
       }).finally(function () {
298
-        _this4.handleChangeLoading('sCreateComment', false);
292
+        _this4.handleChangeLoading("sCreateComment", false);
299
       });
293
       });
300
     }
294
     }
301
 
295
 
306
      */
300
      */
307
 
301
 
308
   }, {
302
   }, {
309
-    key: 'sCreateReply',
303
+    key: "sCreateReply",
310
     value: function sCreateReply(data, cb) {
304
     value: function sCreateReply(data, cb) {
311
       var _this5 = this;
305
       var _this5 = this;
312
 
306
 
313
-      if (!data.content) return _message3.default.error('回复内容不能为空 ');
314
-      this.handleChangeLoading('sCreateReply', true);
307
+      if (!data.content) return _message3.default.error("回复内容不能为空 ");
308
+      this.handleChangeLoading("sCreateReply", true);
315
       var API = this.props.API;
309
       var API = this.props.API;
316
 
310
 
317
-      this.axios(API + '/replies', {
318
-        method: 'post',
311
+      this.axios(API + "/replies", {
312
+        method: "post",
319
         data: data,
313
         data: data,
320
         withCredentials: true
314
         withCredentials: true
321
       }).then(function (response) {
315
       }).then(function (response) {
322
         if (_this5.props.showAlertReply) {
316
         if (_this5.props.showAlertReply) {
323
-          _message3.default.success('回复成功!');
317
+          _message3.default.success("回复成功!");
324
         }
318
         }
325
         if ((0, _helper.isFunction)(cb)) cb();
319
         if ((0, _helper.isFunction)(cb)) cb();
326
         // 将数据写入到 list 中
320
         // 将数据写入到 list 中
344
         }
338
         }
345
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
339
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
346
       }).finally(function () {
340
       }).finally(function () {
347
-        _this5.handleChangeLoading('sCreateReply', false);
341
+        _this5.handleChangeLoading("sCreateReply", false);
348
       });
342
       });
349
     }
343
     }
350
 
344
 
355
      */
349
      */
356
 
350
 
357
   }, {
351
   }, {
358
-    key: 'sCommentFavor',
352
+    key: "sCommentFavor",
359
     value: function sCommentFavor(commentId, favored) {
353
     value: function sCommentFavor(commentId, favored) {
360
       var _this6 = this;
354
       var _this6 = this;
361
 
355
 
362
-      this.handleChangeLoading('sCommentFavor', true);
356
+      this.handleChangeLoading("sCommentFavor", true);
363
       var API = this.props.API;
357
       var API = this.props.API;
364
 
358
 
365
-      this.axios(API + '/comments/' + commentId + '/favor', {
366
-        method: favored ? 'delete' : 'put',
359
+      this.axios(API + "/comments/" + commentId + "/favor", {
360
+        method: favored ? "delete" : "put",
367
         withCredentials: true
361
         withCredentials: true
368
       }).then(function (response) {
362
       }).then(function (response) {
369
         if (_this6.props.showAlertFavor) {
363
         if (_this6.props.showAlertFavor) {
370
-          _message3.default.success(favored ? '取消点赞成功!' : '点赞成功!');
364
+          _message3.default.success(favored ? "取消点赞成功!" : "点赞成功!");
371
         }
365
         }
372
         // 更新 list 中的该项数据的 favored
366
         // 更新 list 中的该项数据的 favored
373
         var list = _this6.state.list.map(function (item) {
367
         var list = _this6.state.list.map(function (item) {
385
         }
379
         }
386
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
380
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
387
       }).finally(function () {
381
       }).finally(function () {
388
-        _this6.handleChangeLoading('sCommentFavor', false);
382
+        _this6.handleChangeLoading("sCommentFavor", false);
389
       });
383
       });
390
     }
384
     }
391
 
385
 
397
      */
391
      */
398
 
392
 
399
   }, {
393
   }, {
400
-    key: 'sReplyFavor',
394
+    key: "sReplyFavor",
401
     value: function sReplyFavor(replyId, commentId, favored) {
395
     value: function sReplyFavor(replyId, commentId, favored) {
402
       var _this7 = this;
396
       var _this7 = this;
403
 
397
 
404
-      this.handleChangeLoading('sReplyFavor', true);
398
+      this.handleChangeLoading("sReplyFavor", true);
405
       var API = this.props.API;
399
       var API = this.props.API;
406
 
400
 
407
-      this.axios(API + '/replies/' + replyId + '/favor', {
408
-        method: favored ? 'delete' : 'put',
401
+      this.axios(API + "/replies/" + replyId + "/favor", {
402
+        method: favored ? "delete" : "put",
409
         data: {
403
         data: {
410
           comment_id: commentId
404
           comment_id: commentId
411
         },
405
         },
412
         withCredentials: true
406
         withCredentials: true
413
       }).then(function (response) {
407
       }).then(function (response) {
414
-        _message3.default.success(favored ? '取消点赞成功!' : '点赞成功!');
408
+        _message3.default.success(favored ? "取消点赞成功!" : "点赞成功!");
415
         // 更新 list 中的该项数据的 favored
409
         // 更新 list 中的该项数据的 favored
416
         var list = _this7.state.list.map(function (item) {
410
         var list = _this7.state.list.map(function (item) {
417
           if (item.id === commentId) {
411
           if (item.id === commentId) {
436
         }
430
         }
437
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
431
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
438
       }).finally(function () {
432
       }).finally(function () {
439
-        _this7.handleChangeLoading('sReplyFavor', false);
433
+        _this7.handleChangeLoading("sReplyFavor", false);
440
       });
434
       });
441
     }
435
     }
442
 
436
 
445
      */
439
      */
446
 
440
 
447
   }, {
441
   }, {
448
-    key: 'sOssSts',
442
+    key: "sOssSts",
449
     value: function sOssSts() {
443
     value: function sOssSts() {
450
       var _this8 = this;
444
       var _this8 = this;
451
 
445
 
452
-      this.handleChangeLoading('sOssSts', true);
453
-      this.axios.get('http://api.links123.net/comment/v1/oss/sts').then(function (response) {
446
+      this.handleChangeLoading("sOssSts", true);
447
+      var API = this.props.API;
448
+
449
+      this.axios.get(API + "/oss/sts").then(function (response) {
454
         _this8.setState({ oss: _extends({}, response.data) });
450
         _this8.setState({ oss: _extends({}, response.data) });
455
       }).catch(function (error) {
451
       }).catch(function (error) {
456
         if (error.response && error.response.data && error.response.data.msg) {
452
         if (error.response && error.response.data && error.response.data.msg) {
459
         }
455
         }
460
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
456
         _message3.default.error(_lang2.default[error.message] || _constant.ERROR_DEFAULT);
461
       }).finally(function () {
457
       }).finally(function () {
462
-        _this8.handleChangeLoading('sOssSts', false);
458
+        _this8.handleChangeLoading("sOssSts", false);
463
       });
459
       });
464
     }
460
     }
465
   }, {
461
   }, {
466
-    key: 'render',
462
+    key: "render",
467
     value: function render() {
463
     value: function render() {
468
       // 添加到 Context 的数据
464
       // 添加到 Context 的数据
469
       var value = _extends({}, this.state, this.props, {
465
       var value = _extends({}, this.state, this.props, {
480
         _Comment.CommentContext.Provider,
476
         _Comment.CommentContext.Provider,
481
         { value: value },
477
         { value: value },
482
         _react2.default.createElement(
478
         _react2.default.createElement(
483
-          'div',
484
-          { className: 'comment' },
485
-          this.props.showHeader && _react2.default.createElement(
486
-            'div',
487
-            { style: { marginBottom: 15 } },
488
-            _react2.default.createElement(
489
-              _tag2.default,
490
-              { className: 'comment-header-tag' },
491
-              '\u7559\u8A00'
492
-            ),
493
-            _react2.default.createElement(
494
-              'span',
495
-              { className: 'comment-header-tip' },
496
-              '\u53E3\u7891'
497
-            ),
498
-            _react2.default.createElement(
499
-              'span',
500
-              { className: 'comment-header-text' },
501
-              '(\u5168\u7AD9\u6311\u51FA\u6BDB\u75C5\u6216\u63D0\u51FA\u5408\u7406\u5EFA\u8BAE\uFF0C\u5956\u52B110\u5230100\u5143\u7EA2\u5305)'
502
-            )
503
-          ),
479
+          "div",
480
+          { className: "comment" },
504
           this.props.showEditor && _react2.default.createElement(_CommentInput2.default, { content: this.props.children }),
481
           this.props.showEditor && _react2.default.createElement(_CommentInput2.default, { content: this.props.children }),
505
           this.props.showList && _react2.default.createElement(
482
           this.props.showList && _react2.default.createElement(
506
-            'div',
483
+            "div",
507
             { style: { marginTop: 20 } },
484
             { style: { marginTop: 20 } },
508
             _react2.default.createElement(_CommentList2.default, null)
485
             _react2.default.createElement(_CommentList2.default, null)
509
           )
486
           )
521
   API: _propTypes2.default.string, // 评论的 API 前缀
498
   API: _propTypes2.default.string, // 评论的 API 前缀
522
   showList: _propTypes2.default.bool, // 是否显示评论列表
499
   showList: _propTypes2.default.bool, // 是否显示评论列表
523
   showEditor: _propTypes2.default.bool, // 是否显示评论输入框
500
   showEditor: _propTypes2.default.bool, // 是否显示评论输入框
524
-  showHeader: _propTypes2.default.bool, // 是否显示评论顶部的提示
525
   showAlertComment: _propTypes2.default.bool, // 评论成功之后,是否通过 Antd 的 Message 组件进行提示
501
   showAlertComment: _propTypes2.default.bool, // 评论成功之后,是否通过 Antd 的 Message 组件进行提示
526
   showAlertReply: _propTypes2.default.bool, // 回复成功之后,是否通过 Antd 的 Message 组件进行提示
502
   showAlertReply: _propTypes2.default.bool, // 回复成功之后,是否通过 Antd 的 Message 组件进行提示
527
   showAlertFavor: _propTypes2.default.bool // 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示
503
   showAlertFavor: _propTypes2.default.bool // 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示
528
 };
504
 };
529
 
505
 
530
 App.defaultProps = {
506
 App.defaultProps = {
531
-  API: 'http://api.links123.net/comment/v1',
507
+  API: "http://api.links123.net/comment/v1",
532
   showList: true,
508
   showList: true,
533
   showEditor: true,
509
   showEditor: true,
534
-  showHeader: true,
535
   showAlertComment: false,
510
   showAlertComment: false,
536
   showAlertReply: false,
511
   showAlertReply: false,
537
   showAlertFavor: false
512
   showAlertFavor: false

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


+ 2
- 2
lib/Comment.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
9
 
9
 
10
 exports.Comment = Comment;
10
 exports.Comment = Comment;
11
 
11
 
12
-var _react = require('react');
12
+var _react = require("react");
13
 
13
 
14
 var _react2 = _interopRequireDefault(_react);
14
 var _react2 = _interopRequireDefault(_react);
15
 
15
 

+ 1
- 1
lib/Comment.js.map View File

1
-{"version":3,"sources":["../src/Comment.js"],"names":["Comment","CommentContext","React","createContext","Component","props","app"],"mappings":";;;;;;;;;QAKgBA,O,GAAAA,O;;AALhB;;;;;;AAEA,IAAMC,iBAAiBC,gBAAMC,aAAN,EAAvB;;AAEA;AACO,SAASH,OAAT,CAAiBI,SAAjB,EAA4B;AACjC;AACA,SAAO,UAASC,KAAT,EAAgB;AACrB;AACA;AACA,WACE;AAAC,oBAAD,CAAgB,QAAhB;AAAA;AACG;AAAA,eAAO,8BAAC,SAAD,eAAeA,KAAf,IAAsB,KAAKC,GAA3B,IAAP;AAAA;AADH,KADF;AAKD,GARD;AASD;;QAEQL,c,GAAAA,c;kBAEMD,O","file":"Comment.js","sourcesContent":["import React from 'react';\n\nconst CommentContext = React.createContext();\n\n// This function takes a component...\nexport function Comment(Component) {\n  // ...and returns another component...\n  return function(props) {\n    // ... and renders the wrapped component with the context theme!\n    // Notice that we pass through any additional props as well\n    return (\n      <CommentContext.Consumer>\n        {app => <Component {...props} app={app} />}\n      </CommentContext.Consumer>\n    );\n  };\n}\n\nexport { CommentContext };\n\nexport default Comment;\n"]}
1
+{"version":3,"sources":["../src/Comment.js"],"names":["Comment","CommentContext","React","createContext","Component","props","app"],"mappings":";;;;;;;;;QAKgBA,O,GAAAA,O;;AALhB;;;;;;AAEA,IAAMC,iBAAiBC,gBAAMC,aAAN,EAAvB;;AAEA;AACO,SAASH,OAAT,CAAiBI,SAAjB,EAA4B;AACjC;AACA,SAAO,UAASC,KAAT,EAAgB;AACrB;AACA;AACA,WACE;AAAC,oBAAD,CAAgB,QAAhB;AAAA;AACG;AAAA,eAAO,8BAAC,SAAD,eAAeA,KAAf,IAAsB,KAAKC,GAA3B,IAAP;AAAA;AADH,KADF;AAKD,GARD;AASD;;QAEQL,c,GAAAA,c;kBAEMD,O","file":"Comment.js","sourcesContent":["import React from \"react\";\n\nconst CommentContext = React.createContext();\n\n// This function takes a component...\nexport function Comment(Component) {\n  // ...and returns another component...\n  return function(props) {\n    // ... and renders the wrapped component with the context theme!\n    // Notice that we pass through any additional props as well\n    return (\n      <CommentContext.Consumer>\n        {app => <Component {...props} app={app} />}\n      </CommentContext.Consumer>\n    );\n  };\n}\n\nexport { CommentContext };\n\nexport default Comment;\n"]}

+ 2
- 2
lib/avatar.js
File diff suppressed because it is too large
View File


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


+ 3
- 3
lib/axios.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _axios = require('axios');
7
+var _axios = require("axios");
8
 
8
 
9
 var _axios2 = _interopRequireDefault(_axios);
9
 var _axios2 = _interopRequireDefault(_axios);
10
 
10
 
11
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
 
12
 
13
 _axios2.default.defaults.withCredentials = true;
13
 _axios2.default.defaults.withCredentials = true;
14
-_axios2.default.defaults.headers.common['Authorization'] = 'Bearer ';
14
+_axios2.default.defaults.headers.common["Authorization"] = "Bearer ";
15
 
15
 
16
 exports.default = _axios2.default;
16
 exports.default = _axios2.default;
17
 //# sourceMappingURL=axios.js.map
17
 //# sourceMappingURL=axios.js.map

+ 1
- 1
lib/axios.js.map View File

1
-{"version":3,"sources":["../src/axios.js"],"names":["axios","defaults","withCredentials","headers","common"],"mappings":";;;;;;AAAA;;;;;;AAEAA,gBAAMC,QAAN,CAAeC,eAAf,GAAiC,IAAjC;AACAF,gBAAMC,QAAN,CAAeE,OAAf,CAAuBC,MAAvB,CAA8B,eAA9B,IAAiD,SAAjD;;kBAEeJ,e","file":"axios.js","sourcesContent":["import axios from 'axios';\n\naxios.defaults.withCredentials = true;\naxios.defaults.headers.common['Authorization'] = 'Bearer ';\n\nexport default axios;\n"]}
1
+{"version":3,"sources":["../src/axios.js"],"names":["axios","defaults","withCredentials","headers","common"],"mappings":";;;;;;AAAA;;;;;;AAEAA,gBAAMC,QAAN,CAAeC,eAAf,GAAiC,IAAjC;AACAF,gBAAMC,QAAN,CAAeE,OAAf,CAAuBC,MAAvB,CAA8B,eAA9B,IAAiD,SAAjD;;kBAEeJ,e","file":"axios.js","sourcesContent":["import axios from \"axios\";\n\naxios.defaults.withCredentials = true;\naxios.defaults.headers.common[\"Authorization\"] = \"Bearer \";\n\nexport default axios;\n"]}

+ 26
- 26
lib/components/CommentBox/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _icon = require('antd/es/icon');
7
+var _icon = require("antd/es/icon");
8
 
8
 
9
 var _icon2 = _interopRequireDefault(_icon);
9
 var _icon2 = _interopRequireDefault(_icon);
10
 
10
 
11
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
11
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
12
 
12
 
13
-require('antd/es/icon/style/css');
13
+require("antd/es/icon/style/css");
14
 
14
 
15
-var _react = require('react');
15
+var _react = require("react");
16
 
16
 
17
 var _react2 = _interopRequireDefault(_react);
17
 var _react2 = _interopRequireDefault(_react);
18
 
18
 
19
-var _propTypes = require('prop-types');
19
+var _propTypes = require("prop-types");
20
 
20
 
21
 var _propTypes2 = _interopRequireDefault(_propTypes);
21
 var _propTypes2 = _interopRequireDefault(_propTypes);
22
 
22
 
23
-var _Comment = require('../../Comment');
23
+var _Comment = require("../../Comment");
24
 
24
 
25
 var _Comment2 = _interopRequireDefault(_Comment);
25
 var _Comment2 = _interopRequireDefault(_Comment);
26
 
26
 
27
-var _ContentItem = require('./../ContentItem');
27
+var _ContentItem = require("./../ContentItem");
28
 
28
 
29
 var _ContentItem2 = _interopRequireDefault(_ContentItem);
29
 var _ContentItem2 = _interopRequireDefault(_ContentItem);
30
 
30
 
31
-require('./index.css');
31
+require("./index.css");
32
 
32
 
33
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
34
 
34
 
63
 
63
 
64
 
64
 
65
   _createClass(CommentBox, [{
65
   _createClass(CommentBox, [{
66
-    key: 'handleToggleReply',
66
+    key: "handleToggleReply",
67
     value: function handleToggleReply() {
67
     value: function handleToggleReply() {
68
       this.setState({ showReply: !this.state.showReply });
68
       this.setState({ showReply: !this.state.showReply });
69
     }
69
     }
74
      */
74
      */
75
 
75
 
76
   }, {
76
   }, {
77
-    key: 'handleGetMoreReply',
77
+    key: "handleGetMoreReply",
78
     value: function handleGetMoreReply(commentId) {
78
     value: function handleGetMoreReply(commentId) {
79
       // 从第一页开始获取评论
79
       // 从第一页开始获取评论
80
       var page = this.state.page;
80
       var page = this.state.page;
91
      */
91
      */
92
 
92
 
93
   }, {
93
   }, {
94
-    key: 'renderReplies',
94
+    key: "renderReplies",
95
     value: function renderReplies(replies, replyCount, isNoMoreReply) {
95
     value: function renderReplies(replies, replyCount, isNoMoreReply) {
96
       var _this2 = this;
96
       var _this2 = this;
97
 
97
 
101
       if (showReply && replies && replies.length) {
101
       if (showReply && replies && replies.length) {
102
         var len = replies.length;
102
         var len = replies.length;
103
         return _react2.default.createElement(
103
         return _react2.default.createElement(
104
-          'div',
104
+          "div",
105
           { style: { marginLeft: 50 } },
105
           { style: { marginLeft: 50 } },
106
           replies.map(function (item, index) {
106
           replies.map(function (item, index) {
107
             if (index === len - 1) {
107
             if (index === len - 1) {
110
                 replyId: item.id,
110
                 replyId: item.id,
111
                 key: item.id,
111
                 key: item.id,
112
                 content: item,
112
                 content: item,
113
-                action: 'replyToReply' // 回复的回复
113
+                action: "replyToReply" // 回复的回复
114
               }), _react2.default.createElement(
114
               }), _react2.default.createElement(
115
-                'div',
116
-                { className: 'comment-more-box', key: 'show_more_button' },
115
+                "div",
116
+                { className: "comment-more-box", key: "show_more_button" },
117
                 !isNoMoreReply && replyCount !== len && _react2.default.createElement(
117
                 !isNoMoreReply && replyCount !== len && _react2.default.createElement(
118
-                  'span',
118
+                  "span",
119
                   {
119
                   {
120
-                    className: 'comment-show-more',
120
+                    className: "comment-show-more",
121
                     onClick: function onClick() {
121
                     onClick: function onClick() {
122
                       return _this2.handleGetMoreReply(commentId);
122
                       return _this2.handleGetMoreReply(commentId);
123
                     }
123
                     }
124
                   },
124
                   },
125
-                  '\u67E5\u770B\u66F4\u591A\u56DE\u590D'
125
+                  "\u67E5\u770B\u66F4\u591A\u56DE\u590D"
126
                 ),
126
                 ),
127
                 _react2.default.createElement(
127
                 _react2.default.createElement(
128
-                  'a',
128
+                  "a",
129
                   {
129
                   {
130
-                    style: { float: 'right' },
130
+                    style: { float: "right" },
131
                     onClick: _this2.handleToggleReply
131
                     onClick: _this2.handleToggleReply
132
                   },
132
                   },
133
-                  _react2.default.createElement(_icon2.default, { type: 'up' }),
134
-                  ' \u6536\u8D77\u56DE\u590D'
133
+                  _react2.default.createElement(_icon2.default, { type: "up" }),
134
+                  " \u6536\u8D77\u56DE\u590D"
135
                 )
135
                 )
136
               )];
136
               )];
137
             }
137
             }
140
               replyId: item.id,
140
               replyId: item.id,
141
               key: item.id,
141
               key: item.id,
142
               content: item,
142
               content: item,
143
-              action: 'replyToReply' // 评论的回复
143
+              action: "replyToReply" // 评论的回复
144
             });
144
             });
145
           })
145
           })
146
         );
146
         );
148
       return null;
148
       return null;
149
     }
149
     }
150
   }, {
150
   }, {
151
-    key: 'render',
151
+    key: "render",
152
     value: function render() {
152
     value: function render() {
153
       var content = this.props.content;
153
       var content = this.props.content;
154
       var showReply = this.state.showReply;
154
       var showReply = this.state.showReply;
155
 
155
 
156
       return _react2.default.createElement(
156
       return _react2.default.createElement(
157
-        'div',
157
+        "div",
158
         null,
158
         null,
159
         _react2.default.createElement(_ContentItem2.default, {
159
         _react2.default.createElement(_ContentItem2.default, {
160
           content: content,
160
           content: content,
161
           onShowReply: this.handleToggleReply,
161
           onShowReply: this.handleToggleReply,
162
           showReply: showReply,
162
           showReply: showReply,
163
           commentId: content.id,
163
           commentId: content.id,
164
-          action: 'reply' // 评论的回复
164
+          action: "reply" // 评论的回复
165
         }),
165
         }),
166
         this.renderReplies(content.replies, content.reply_count, content.isNoMoreReply)
166
         this.renderReplies(content.replies, content.reply_count, content.isNoMoreReply)
167
       );
167
       );

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


+ 16
- 16
lib/components/CommentInput/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
8
 
8
 
9
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10
 
10
 
11
-var _react = require('react');
11
+var _react = require("react");
12
 
12
 
13
 var _react2 = _interopRequireDefault(_react);
13
 var _react2 = _interopRequireDefault(_react);
14
 
14
 
15
-var _propTypes = require('prop-types');
15
+var _propTypes = require("prop-types");
16
 
16
 
17
 var _propTypes2 = _interopRequireDefault(_propTypes);
17
 var _propTypes2 = _interopRequireDefault(_propTypes);
18
 
18
 
19
-var _constant = require('../../constant');
19
+var _constant = require("../../constant");
20
 
20
 
21
-var _Comment = require('../../Comment');
21
+var _Comment = require("../../Comment");
22
 
22
 
23
 var _Comment2 = _interopRequireDefault(_Comment);
23
 var _Comment2 = _interopRequireDefault(_Comment);
24
 
24
 
51
 
51
 
52
 
52
 
53
   _createClass(CommentInput, [{
53
   _createClass(CommentInput, [{
54
-    key: 'handleSubmit',
54
+    key: "handleSubmit",
55
     value: function handleSubmit(_ref, cb) {
55
     value: function handleSubmit(_ref, cb) {
56
       var text = _ref.text,
56
       var text = _ref.text,
57
           files = _ref.files;
57
           files = _ref.files;
60
       if (files && files.length) {
60
       if (files && files.length) {
61
         value += _constant.IMAGE_SPLIT;
61
         value += _constant.IMAGE_SPLIT;
62
         files.forEach(function (file) {
62
         files.forEach(function (file) {
63
-          value += file + ',';
63
+          value += file + ",";
64
         });
64
         });
65
       }
65
       }
66
-      if (value.substr(-1) === ',') {
66
+      if (value.substr(-1) === ",") {
67
         value = value.slice(0, -1);
67
         value = value.slice(0, -1);
68
       }
68
       }
69
 
69
 
73
           replyId = _props.replyId,
73
           replyId = _props.replyId,
74
           callback = _props.callback;
74
           callback = _props.callback;
75
 
75
 
76
-      if (action === 'comment') {
76
+      if (action === "comment") {
77
         this.props.app.sCreateComment({
77
         this.props.app.sCreateComment({
78
           content: value
78
           content: value
79
         }, cb);
79
         }, cb);
80
-      } else if (action === 'reply') {
80
+      } else if (action === "reply") {
81
         this.props.app.sCreateReply({
81
         this.props.app.sCreateReply({
82
           comment_id: commentId,
82
           comment_id: commentId,
83
           content: value
83
           content: value
84
         }, function () {
84
         }, function () {
85
           return callback && callback();
85
           return callback && callback();
86
         });
86
         });
87
-      } else if (action === 'replyToReply') {
87
+      } else if (action === "replyToReply") {
88
         this.props.app.sCreateReply({
88
         this.props.app.sCreateReply({
89
           comment_id: commentId,
89
           comment_id: commentId,
90
           content: value,
90
           content: value,
95
       }
95
       }
96
     }
96
     }
97
   }, {
97
   }, {
98
-    key: 'render',
98
+    key: "render",
99
     value: function render() {
99
     value: function render() {
100
       var _this2 = this;
100
       var _this2 = this;
101
 
101
 
108
           onSubmit: _this2.handleSubmit
108
           onSubmit: _this2.handleSubmit
109
         }, child.props, {
109
         }, child.props, {
110
           // 如果当前的编辑器不是“评论”,则编辑器高度减小一些
110
           // 如果当前的编辑器不是“评论”,则编辑器高度减小一些
111
-          rows: _this2.props.action === 'comment' ? child.props.rows : child.props.rows - 1
111
+          rows: _this2.props.action === "comment" ? child.props.rows : child.props.rows - 1
112
         }));
112
         }));
113
       });
113
       });
114
 
114
 
115
       return _react2.default.createElement(
115
       return _react2.default.createElement(
116
-        'div',
116
+        "div",
117
         null,
117
         null,
118
         childrenWithProps
118
         childrenWithProps
119
       );
119
       );
127
   // comment 评论
127
   // comment 评论
128
   // reply 评论的回复
128
   // reply 评论的回复
129
   // replyToReply 回复的回复
129
   // replyToReply 回复的回复
130
-  action: _propTypes2.default.oneOf(['comment', 'reply', 'replyToReply'])
130
+  action: _propTypes2.default.oneOf(["comment", "reply", "replyToReply"])
131
 };
131
 };
132
 
132
 
133
 CommentInput.defaultProps = {
133
 CommentInput.defaultProps = {
134
-  action: 'comment'
134
+  action: "comment"
135
 };
135
 };
136
 
136
 
137
 exports.default = (0, _Comment2.default)(CommentInput);
137
 exports.default = (0, _Comment2.default)(CommentInput);

+ 1
- 1
lib/components/CommentInput/index.js.map View File

1
-{"version":3,"sources":["../../../src/components/CommentInput/index.js"],"names":["CommentInput","props","state","handleSubmit","bind","cb","text","files","value","length","IMAGE_SPLIT","forEach","file","substr","slice","action","commentId","replyId","callback","app","sCreateComment","content","sCreateReply","comment_id","reply_id","childrenWithProps","React","Children","map","cloneElement","child","onSubmit","rows","Component","propTypes","PropTypes","oneOf","defaultProps"],"mappings":";;;;;;;;;;AAAA;;;;AACA;;;;AACA;;AACA;;;;;;;;;;;;IAEMA,Y;;;AACJ,wBAAYC,KAAZ,EAAmB;AAAA;;AAAA,4HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa,EAAb;AACA,UAAKC,YAAL,GAAoB,MAAKA,YAAL,CAAkBC,IAAlB,OAApB;AAHiB;AAIlB;;AAED;;;;;;;;;uCAK8BC,E,EAAI;AAAA,UAAnBC,IAAmB,QAAnBA,IAAmB;AAAA,UAAbC,KAAa,QAAbA,KAAa;;AAChC,UAAIC,QAAQF,IAAZ;AACA,UAAIC,SAASA,MAAME,MAAnB,EAA2B;AACzBD,iBAASE,qBAAT;AACAH,cAAMI,OAAN,CAAc,gBAAQ;AACpBH,mBAAYI,IAAZ;AACD,SAFD;AAGD;AACD,UAAIJ,MAAMK,MAAN,CAAa,CAAC,CAAd,MAAqB,GAAzB,EAA8B;AAC5BL,gBAAQA,MAAMM,KAAN,CAAY,CAAZ,EAAe,CAAC,CAAhB,CAAR;AACD;;AAV+B,mBAYiB,KAAKb,KAZtB;AAAA,UAYxBc,MAZwB,UAYxBA,MAZwB;AAAA,UAYhBC,SAZgB,UAYhBA,SAZgB;AAAA,UAYLC,OAZK,UAYLA,OAZK;AAAA,UAYIC,QAZJ,UAYIA,QAZJ;;AAahC,UAAIH,WAAW,SAAf,EAA0B;AACxB,aAAKd,KAAL,CAAWkB,GAAX,CAAeC,cAAf,CACE;AACEC,mBAASb;AADX,SADF,EAIEH,EAJF;AAMD,OAPD,MAOO,IAAIU,WAAW,OAAf,EAAwB;AAC7B,aAAKd,KAAL,CAAWkB,GAAX,CAAeG,YAAf,CACE;AACEC,sBAAYP,SADd;AAEEK,mBAASb;AAFX,SADF,EAKE;AAAA,iBAAMU,YAAYA,UAAlB;AAAA,SALF;AAOD,OARM,MAQA,IAAIH,WAAW,cAAf,EAA+B;AACpC,aAAKd,KAAL,CAAWkB,GAAX,CAAeG,YAAf,CACE;AACEC,sBAAYP,SADd;AAEEK,mBAASb,KAFX;AAGEgB,oBAAUP;AAHZ,SADF,EAME;AAAA,iBAAMC,YAAYA,UAAlB;AAAA,SANF;AAQD;AACF;;;6BAEQ;AAAA;;AACP,UAAMO,oBAAoBC,gBAAMC,QAAN,CAAeC,GAAf,CAAmB,KAAK3B,KAAL,CAAWoB,OAA9B,EAAuC,iBAAS;AACxE,eAAOK,gBAAMG,YAAN,CAAmBC,KAAnB;AACL;AACA;AACA;AACA;AACAC,oBAAU,OAAK5B;AALV,WAMF2B,MAAM7B,KANJ;AAOL;AACA+B,gBACE,OAAK/B,KAAL,CAAWc,MAAX,KAAsB,SAAtB,GACIe,MAAM7B,KAAN,CAAY+B,IADhB,GAEIF,MAAM7B,KAAN,CAAY+B,IAAZ,GAAmB;AAXpB,WAAP;AAaD,OAdyB,CAA1B;;AAgBA,aAAO;AAAA;AAAA;AAAMP;AAAN,OAAP;AACD;;;;EAtEwBQ,gB;;AAyE3BjC,aAAakC,SAAb,GAAyB;AACvB;AACA;AACA;AACAnB,UAAQoB,oBAAUC,KAAV,CAAgB,CAAC,SAAD,EAAY,OAAZ,EAAqB,cAArB,CAAhB;AAJe,CAAzB;;AAOApC,aAAaqC,YAAb,GAA4B;AAC1BtB,UAAQ;AADkB,CAA5B;;kBAIe,uBAAQf,YAAR,C","file":"index.js","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { IMAGE_SPLIT } from '../../constant';\nimport Comment from '../../Comment';\n\nclass CommentInput extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {};\n    this.handleSubmit = this.handleSubmit.bind(this);\n  }\n\n  /**\n   * 提交评论\n   * @param {object} { text<string>, files<array> } 需要提交的评论的文本和图片\n   * @param {function} cb 提交成功后的回掉\n   */\n  handleSubmit({ text, files }, cb) {\n    let value = text;\n    if (files && files.length) {\n      value += IMAGE_SPLIT;\n      files.forEach(file => {\n        value += `${file},`;\n      });\n    }\n    if (value.substr(-1) === ',') {\n      value = value.slice(0, -1);\n    }\n\n    const { action, commentId, replyId, callback } = this.props;\n    if (action === 'comment') {\n      this.props.app.sCreateComment(\n        {\n          content: value,\n        },\n        cb\n      );\n    } else if (action === 'reply') {\n      this.props.app.sCreateReply(\n        {\n          comment_id: commentId,\n          content: value,\n        },\n        () => callback && callback()\n      );\n    } else if (action === 'replyToReply') {\n      this.props.app.sCreateReply(\n        {\n          comment_id: commentId,\n          content: value,\n          reply_id: replyId,\n        },\n        () => callback && callback()\n      );\n    }\n  }\n\n  render() {\n    const childrenWithProps = React.Children.map(this.props.content, child => {\n      return React.cloneElement(child, {\n        // 编辑器本身不提交值,但 CommentInput 会提交\n        // CommentInput 主要是负责评论的业务逻辑,提交评论和回复\n        // 默认使用 CommentInput 的 onSubmit 来提交评论\n        // 但也可以使用 Editor 的 props 来覆盖 onSubmit\n        onSubmit: this.handleSubmit,\n        ...child.props,\n        // 如果当前的编辑器不是“评论”,则编辑器高度减小一些\n        rows:\n          this.props.action === 'comment'\n            ? child.props.rows\n            : child.props.rows - 1,\n      });\n    });\n\n    return <div>{childrenWithProps}</div>;\n  }\n}\n\nCommentInput.propTypes = {\n  // comment 评论\n  // reply 评论的回复\n  // replyToReply 回复的回复\n  action: PropTypes.oneOf(['comment', 'reply', 'replyToReply']),\n};\n\nCommentInput.defaultProps = {\n  action: 'comment',\n};\n\nexport default Comment(CommentInput);\n"]}
1
+{"version":3,"sources":["../../../src/components/CommentInput/index.js"],"names":["CommentInput","props","state","handleSubmit","bind","cb","text","files","value","length","IMAGE_SPLIT","forEach","file","substr","slice","action","commentId","replyId","callback","app","sCreateComment","content","sCreateReply","comment_id","reply_id","childrenWithProps","React","Children","map","cloneElement","child","onSubmit","rows","Component","propTypes","PropTypes","oneOf","defaultProps"],"mappings":";;;;;;;;;;AAAA;;;;AACA;;;;AACA;;AACA;;;;;;;;;;;;IAEMA,Y;;;AACJ,wBAAYC,KAAZ,EAAmB;AAAA;;AAAA,4HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa,EAAb;AACA,UAAKC,YAAL,GAAoB,MAAKA,YAAL,CAAkBC,IAAlB,OAApB;AAHiB;AAIlB;;AAED;;;;;;;;;uCAK8BC,E,EAAI;AAAA,UAAnBC,IAAmB,QAAnBA,IAAmB;AAAA,UAAbC,KAAa,QAAbA,KAAa;;AAChC,UAAIC,QAAQF,IAAZ;AACA,UAAIC,SAASA,MAAME,MAAnB,EAA2B;AACzBD,iBAASE,qBAAT;AACAH,cAAMI,OAAN,CAAc,gBAAQ;AACpBH,mBAAYI,IAAZ;AACD,SAFD;AAGD;AACD,UAAIJ,MAAMK,MAAN,CAAa,CAAC,CAAd,MAAqB,GAAzB,EAA8B;AAC5BL,gBAAQA,MAAMM,KAAN,CAAY,CAAZ,EAAe,CAAC,CAAhB,CAAR;AACD;;AAV+B,mBAYiB,KAAKb,KAZtB;AAAA,UAYxBc,MAZwB,UAYxBA,MAZwB;AAAA,UAYhBC,SAZgB,UAYhBA,SAZgB;AAAA,UAYLC,OAZK,UAYLA,OAZK;AAAA,UAYIC,QAZJ,UAYIA,QAZJ;;AAahC,UAAIH,WAAW,SAAf,EAA0B;AACxB,aAAKd,KAAL,CAAWkB,GAAX,CAAeC,cAAf,CACE;AACEC,mBAASb;AADX,SADF,EAIEH,EAJF;AAMD,OAPD,MAOO,IAAIU,WAAW,OAAf,EAAwB;AAC7B,aAAKd,KAAL,CAAWkB,GAAX,CAAeG,YAAf,CACE;AACEC,sBAAYP,SADd;AAEEK,mBAASb;AAFX,SADF,EAKE;AAAA,iBAAMU,YAAYA,UAAlB;AAAA,SALF;AAOD,OARM,MAQA,IAAIH,WAAW,cAAf,EAA+B;AACpC,aAAKd,KAAL,CAAWkB,GAAX,CAAeG,YAAf,CACE;AACEC,sBAAYP,SADd;AAEEK,mBAASb,KAFX;AAGEgB,oBAAUP;AAHZ,SADF,EAME;AAAA,iBAAMC,YAAYA,UAAlB;AAAA,SANF;AAQD;AACF;;;6BAEQ;AAAA;;AACP,UAAMO,oBAAoBC,gBAAMC,QAAN,CAAeC,GAAf,CAAmB,KAAK3B,KAAL,CAAWoB,OAA9B,EAAuC,iBAAS;AACxE,eAAOK,gBAAMG,YAAN,CAAmBC,KAAnB;AACL;AACA;AACA;AACA;AACAC,oBAAU,OAAK5B;AALV,WAMF2B,MAAM7B,KANJ;AAOL;AACA+B,gBACE,OAAK/B,KAAL,CAAWc,MAAX,KAAsB,SAAtB,GACIe,MAAM7B,KAAN,CAAY+B,IADhB,GAEIF,MAAM7B,KAAN,CAAY+B,IAAZ,GAAmB;AAXpB,WAAP;AAaD,OAdyB,CAA1B;;AAgBA,aAAO;AAAA;AAAA;AAAMP;AAAN,OAAP;AACD;;;;EAtEwBQ,gB;;AAyE3BjC,aAAakC,SAAb,GAAyB;AACvB;AACA;AACA;AACAnB,UAAQoB,oBAAUC,KAAV,CAAgB,CAAC,SAAD,EAAY,OAAZ,EAAqB,cAArB,CAAhB;AAJe,CAAzB;;AAOApC,aAAaqC,YAAb,GAA4B;AAC1BtB,UAAQ;AADkB,CAA5B;;kBAIe,uBAAQf,YAAR,C","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { IMAGE_SPLIT } from \"../../constant\";\nimport Comment from \"../../Comment\";\n\nclass CommentInput extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {};\n    this.handleSubmit = this.handleSubmit.bind(this);\n  }\n\n  /**\n   * 提交评论\n   * @param {object} { text<string>, files<array> } 需要提交的评论的文本和图片\n   * @param {function} cb 提交成功后的回掉\n   */\n  handleSubmit({ text, files }, cb) {\n    let value = text;\n    if (files && files.length) {\n      value += IMAGE_SPLIT;\n      files.forEach(file => {\n        value += `${file},`;\n      });\n    }\n    if (value.substr(-1) === \",\") {\n      value = value.slice(0, -1);\n    }\n\n    const { action, commentId, replyId, callback } = this.props;\n    if (action === \"comment\") {\n      this.props.app.sCreateComment(\n        {\n          content: value\n        },\n        cb\n      );\n    } else if (action === \"reply\") {\n      this.props.app.sCreateReply(\n        {\n          comment_id: commentId,\n          content: value\n        },\n        () => callback && callback()\n      );\n    } else if (action === \"replyToReply\") {\n      this.props.app.sCreateReply(\n        {\n          comment_id: commentId,\n          content: value,\n          reply_id: replyId\n        },\n        () => callback && callback()\n      );\n    }\n  }\n\n  render() {\n    const childrenWithProps = React.Children.map(this.props.content, child => {\n      return React.cloneElement(child, {\n        // 编辑器本身不提交值,但 CommentInput 会提交\n        // CommentInput 主要是负责评论的业务逻辑,提交评论和回复\n        // 默认使用 CommentInput 的 onSubmit 来提交评论\n        // 但也可以使用 Editor 的 props 来覆盖 onSubmit\n        onSubmit: this.handleSubmit,\n        ...child.props,\n        // 如果当前的编辑器不是“评论”,则编辑器高度减小一些\n        rows:\n          this.props.action === \"comment\"\n            ? child.props.rows\n            : child.props.rows - 1\n      });\n    });\n\n    return <div>{childrenWithProps}</div>;\n  }\n}\n\nCommentInput.propTypes = {\n  // comment 评论\n  // reply 评论的回复\n  // replyToReply 回复的回复\n  action: PropTypes.oneOf([\"comment\", \"reply\", \"replyToReply\"])\n};\n\nCommentInput.defaultProps = {\n  action: \"comment\"\n};\n\nexport default Comment(CommentInput);\n"]}

+ 17
- 17
lib/components/CommentList/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _spin = require('antd/es/spin');
7
+var _spin = require("antd/es/spin");
8
 
8
 
9
 var _spin2 = _interopRequireDefault(_spin);
9
 var _spin2 = _interopRequireDefault(_spin);
10
 
10
 
11
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
11
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
12
 
12
 
13
-require('antd/es/spin/style/css');
13
+require("antd/es/spin/style/css");
14
 
14
 
15
-var _react = require('react');
15
+var _react = require("react");
16
 
16
 
17
 var _react2 = _interopRequireDefault(_react);
17
 var _react2 = _interopRequireDefault(_react);
18
 
18
 
19
-var _Comment = require('../../Comment');
19
+var _Comment = require("../../Comment");
20
 
20
 
21
 var _Comment2 = _interopRequireDefault(_Comment);
21
 var _Comment2 = _interopRequireDefault(_Comment);
22
 
22
 
23
-var _CommentBox = require('../CommentBox');
23
+var _CommentBox = require("../CommentBox");
24
 
24
 
25
 var _CommentBox2 = _interopRequireDefault(_CommentBox);
25
 var _CommentBox2 = _interopRequireDefault(_CommentBox);
26
 
26
 
27
-require('./index.css');
27
+require("./index.css");
28
 
28
 
29
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
 
30
 
47
   }
47
   }
48
 
48
 
49
   _createClass(CommentList, [{
49
   _createClass(CommentList, [{
50
-    key: 'componentWillMount',
50
+    key: "componentWillMount",
51
     value: function componentWillMount() {
51
     value: function componentWillMount() {
52
       this.props.app.sGetComment();
52
       this.props.app.sGetComment();
53
     }
53
     }
54
   }, {
54
   }, {
55
-    key: 'render',
55
+    key: "render",
56
     value: function render() {
56
     value: function render() {
57
       var _props$app = this.props.app,
57
       var _props$app = this.props.app,
58
           list = _props$app.list,
58
           list = _props$app.list,
65
 
65
 
66
       var spinning = Boolean(loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor);
66
       var spinning = Boolean(loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor);
67
       return _react2.default.createElement(
67
       return _react2.default.createElement(
68
-        'div',
68
+        "div",
69
         null,
69
         null,
70
         _react2.default.createElement(
70
         _react2.default.createElement(
71
           _spin2.default,
71
           _spin2.default,
72
           { spinning: spinning },
72
           { spinning: spinning },
73
           _react2.default.createElement(
73
           _react2.default.createElement(
74
-            'div',
74
+            "div",
75
             null,
75
             null,
76
-            '\u5171 ',
76
+            "\u5171 ",
77
             total,
77
             total,
78
-            ' \u6761\u8BC4\u8BBA'
78
+            " \u6761\u8BC4\u8BBA"
79
           ),
79
           ),
80
           list.map(function (item) {
80
           list.map(function (item) {
81
             return _react2.default.createElement(_CommentBox2.default, { content: item, key: item.id, commentId: item.id });
81
             return _react2.default.createElement(_CommentBox2.default, { content: item, key: item.id, commentId: item.id });
82
           }),
82
           }),
83
           !isNoMoreComment && list.length !== total && _react2.default.createElement(
83
           !isNoMoreComment && list.length !== total && _react2.default.createElement(
84
-            'div',
84
+            "div",
85
             {
85
             {
86
-              className: 'comment-list-show-more',
86
+              className: "comment-list-show-more",
87
               onClick: function onClick() {
87
               onClick: function onClick() {
88
                 return sGetComment({ page: page + 1 });
88
                 return sGetComment({ page: page + 1 });
89
               }
89
               }
90
             },
90
             },
91
             _react2.default.createElement(
91
             _react2.default.createElement(
92
-              'span',
92
+              "span",
93
               null,
93
               null,
94
-              '\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA'
94
+              "\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA"
95
             )
95
             )
96
           )
96
           )
97
         )
97
         )

+ 1
- 1
lib/components/CommentList/index.js.map View File

1
-{"version":3,"sources":["../../../src/components/CommentList/index.js"],"names":["CommentList","props","state","app","sGetComment","list","total","page","loading","isNoMoreComment","spinning","Boolean","sCommentFavor","sReplyFavor","map","item","id","length","Component","propTypes"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;;;;;;;;;;IAEMA,W;;;AACJ,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA,0HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa,EAAb;AAFiB;AAGlB;;;;yCAEoB;AACnB,WAAKD,KAAL,CAAWE,GAAX,CAAeC,WAAf;AACD;;;6BAEQ;AAAA,uBAQH,KAAKH,KAAL,CAAWE,GARR;AAAA,UAELE,IAFK,cAELA,IAFK;AAAA,UAGLC,KAHK,cAGLA,KAHK;AAAA,UAILC,IAJK,cAILA,IAJK;AAAA,UAKLC,OALK,cAKLA,OALK;AAAA,UAMLC,eANK,cAMLA,eANK;AAAA,UAOLL,WAPK,cAOLA,WAPK;;;AAUP,UAAMM,WAAWC,QACfH,QAAQJ,WAAR,IAAuBI,QAAQI,aAA/B,IAAgDJ,QAAQK,WADzC,CAAjB;AAGA,aACE;AAAA;AAAA;AACE;AAAA;AAAA,YAAM,UAAUH,QAAhB;AACE;AAAA;AAAA;AAAA;AAAQJ,iBAAR;AAAA;AAAA,WADF;AAEGD,eAAKS,GAAL,CAAS;AAAA,mBACR,8BAAC,oBAAD,IAAY,SAASC,IAArB,EAA2B,KAAKA,KAAKC,EAArC,EAAyC,WAAWD,KAAKC,EAAzD,GADQ;AAAA,WAAT,CAFH;AAMG,WAACP,eAAD,IACCJ,KAAKY,MAAL,KAAgBX,KADjB,IAEG;AAAA;AAAA;AACE,yBAAU,wBADZ;AAEE,uBAAS;AAAA,uBAAMF,YAAY,EAAEG,MAAMA,OAAO,CAAf,EAAZ,CAAN;AAAA;AAFX;AAIE;AAAA;AAAA;AAAA;AAAA;AAJF;AARN;AADF,OADF;AAoBD;;;;EA3CuBW,gB;;AA8C1BlB,YAAYmB,SAAZ,GAAwB,EAAxB;;kBAEe,uBAAQnB,WAAR,C","file":"index.js","sourcesContent":["import React, { Component } from 'react';\nimport { Spin } from 'antd';\nimport Comment from '../../Comment';\nimport CommentBox from '../CommentBox';\nimport './index.css';\n\nclass CommentList extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {};\n  }\n\n  componentWillMount() {\n    this.props.app.sGetComment();\n  }\n\n  render() {\n    const {\n      list,\n      total,\n      page,\n      loading,\n      isNoMoreComment,\n      sGetComment,\n    } = this.props.app;\n\n    const spinning = Boolean(\n      loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor\n    );\n    return (\n      <div>\n        <Spin spinning={spinning}>\n          <div>共 {total} 条评论</div>\n          {list.map(item => (\n            <CommentBox content={item} key={item.id} commentId={item.id} />\n          ))}\n\n          {!isNoMoreComment &&\n            list.length !== total && (\n              <div\n                className=\"comment-list-show-more\"\n                onClick={() => sGetComment({ page: page + 1 })}\n              >\n                <span>查看更多评论</span>\n              </div>\n            )}\n        </Spin>\n      </div>\n    );\n  }\n}\n\nCommentList.propTypes = {};\n\nexport default Comment(CommentList);\n"]}
1
+{"version":3,"sources":["../../../src/components/CommentList/index.js"],"names":["CommentList","props","state","app","sGetComment","list","total","page","loading","isNoMoreComment","spinning","Boolean","sCommentFavor","sReplyFavor","map","item","id","length","Component","propTypes"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;;;;;;;;;;IAEMA,W;;;AACJ,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA,0HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa,EAAb;AAFiB;AAGlB;;;;yCAEoB;AACnB,WAAKD,KAAL,CAAWE,GAAX,CAAeC,WAAf;AACD;;;6BAEQ;AAAA,uBAQH,KAAKH,KAAL,CAAWE,GARR;AAAA,UAELE,IAFK,cAELA,IAFK;AAAA,UAGLC,KAHK,cAGLA,KAHK;AAAA,UAILC,IAJK,cAILA,IAJK;AAAA,UAKLC,OALK,cAKLA,OALK;AAAA,UAMLC,eANK,cAMLA,eANK;AAAA,UAOLL,WAPK,cAOLA,WAPK;;;AAUP,UAAMM,WAAWC,QACfH,QAAQJ,WAAR,IAAuBI,QAAQI,aAA/B,IAAgDJ,QAAQK,WADzC,CAAjB;AAGA,aACE;AAAA;AAAA;AACE;AAAA;AAAA,YAAM,UAAUH,QAAhB;AACE;AAAA;AAAA;AAAA;AAAQJ,iBAAR;AAAA;AAAA,WADF;AAEGD,eAAKS,GAAL,CAAS;AAAA,mBACR,8BAAC,oBAAD,IAAY,SAASC,IAArB,EAA2B,KAAKA,KAAKC,EAArC,EAAyC,WAAWD,KAAKC,EAAzD,GADQ;AAAA,WAAT,CAFH;AAMG,WAACP,eAAD,IACCJ,KAAKY,MAAL,KAAgBX,KADjB,IAEG;AAAA;AAAA;AACE,yBAAU,wBADZ;AAEE,uBAAS;AAAA,uBAAMF,YAAY,EAAEG,MAAMA,OAAO,CAAf,EAAZ,CAAN;AAAA;AAFX;AAIE;AAAA;AAAA;AAAA;AAAA;AAJF;AARN;AADF,OADF;AAoBD;;;;EA3CuBW,gB;;AA8C1BlB,YAAYmB,SAAZ,GAAwB,EAAxB;;kBAEe,uBAAQnB,WAAR,C","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\nimport { Spin } from \"antd\";\nimport Comment from \"../../Comment\";\nimport CommentBox from \"../CommentBox\";\nimport \"./index.css\";\n\nclass CommentList extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {};\n  }\n\n  componentWillMount() {\n    this.props.app.sGetComment();\n  }\n\n  render() {\n    const {\n      list,\n      total,\n      page,\n      loading,\n      isNoMoreComment,\n      sGetComment\n    } = this.props.app;\n\n    const spinning = Boolean(\n      loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor\n    );\n    return (\n      <div>\n        <Spin spinning={spinning}>\n          <div>共 {total} 条评论</div>\n          {list.map(item => (\n            <CommentBox content={item} key={item.id} commentId={item.id} />\n          ))}\n\n          {!isNoMoreComment &&\n            list.length !== total && (\n              <div\n                className=\"comment-list-show-more\"\n                onClick={() => sGetComment({ page: page + 1 })}\n              >\n                <span>查看更多评论</span>\n              </div>\n            )}\n        </Spin>\n      </div>\n    );\n  }\n}\n\nCommentList.propTypes = {};\n\nexport default Comment(CommentList);\n"]}

+ 63
- 63
lib/components/ContentItem/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _icon = require('antd/es/icon');
7
+var _icon = require("antd/es/icon");
8
 
8
 
9
 var _icon2 = _interopRequireDefault(_icon);
9
 var _icon2 = _interopRequireDefault(_icon);
10
 
10
 
11
-var _tooltip = require('antd/es/tooltip');
11
+var _tooltip = require("antd/es/tooltip");
12
 
12
 
13
 var _tooltip2 = _interopRequireDefault(_tooltip);
13
 var _tooltip2 = _interopRequireDefault(_tooltip);
14
 
14
 
15
-var _avatar = require('antd/es/avatar');
15
+var _avatar = require("antd/es/avatar");
16
 
16
 
17
 var _avatar2 = _interopRequireDefault(_avatar);
17
 var _avatar2 = _interopRequireDefault(_avatar);
18
 
18
 
19
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
19
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
20
 
20
 
21
-require('antd/es/icon/style/css');
21
+require("antd/es/icon/style/css");
22
 
22
 
23
-require('antd/es/tooltip/style/css');
23
+require("antd/es/tooltip/style/css");
24
 
24
 
25
-require('antd/es/avatar/style/css');
25
+require("antd/es/avatar/style/css");
26
 
26
 
27
-var _react = require('react');
27
+var _react = require("react");
28
 
28
 
29
 var _react2 = _interopRequireDefault(_react);
29
 var _react2 = _interopRequireDefault(_react);
30
 
30
 
31
-var _propTypes = require('prop-types');
31
+var _propTypes = require("prop-types");
32
 
32
 
33
 var _propTypes2 = _interopRequireDefault(_propTypes);
33
 var _propTypes2 = _interopRequireDefault(_propTypes);
34
 
34
 
35
-var _dayjs = require('dayjs');
35
+var _dayjs = require("dayjs");
36
 
36
 
37
 var _dayjs2 = _interopRequireDefault(_dayjs);
37
 var _dayjs2 = _interopRequireDefault(_dayjs);
38
 
38
 
39
-require('dayjs/locale/zh-cn');
39
+require("dayjs/locale/zh-cn");
40
 
40
 
41
-var _relativeTime = require('dayjs/plugin/relativeTime');
41
+var _relativeTime = require("dayjs/plugin/relativeTime");
42
 
42
 
43
 var _relativeTime2 = _interopRequireDefault(_relativeTime);
43
 var _relativeTime2 = _interopRequireDefault(_relativeTime);
44
 
44
 
45
-var _Comment = require('../../Comment');
45
+var _Comment = require("../../Comment");
46
 
46
 
47
 var _Comment2 = _interopRequireDefault(_Comment);
47
 var _Comment2 = _interopRequireDefault(_Comment);
48
 
48
 
49
-var _CommentInput = require('../CommentInput');
49
+var _CommentInput = require("../CommentInput");
50
 
50
 
51
 var _CommentInput2 = _interopRequireDefault(_CommentInput);
51
 var _CommentInput2 = _interopRequireDefault(_CommentInput);
52
 
52
 
53
-var _avatar3 = require('../../avatar');
53
+var _avatar3 = require("../../avatar");
54
 
54
 
55
 var _avatar4 = _interopRequireDefault(_avatar3);
55
 var _avatar4 = _interopRequireDefault(_avatar3);
56
 
56
 
57
-var _helper = require('../../helper');
57
+var _helper = require("../../helper");
58
 
58
 
59
-var _constant = require('../../constant');
59
+var _constant = require("../../constant");
60
 
60
 
61
-require('./index.css');
61
+require("./index.css");
62
 
62
 
63
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
63
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
64
 
64
 
68
 
68
 
69
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
69
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
70
 
70
 
71
-_dayjs2.default.locale('zh-cn');
71
+_dayjs2.default.locale("zh-cn");
72
 _dayjs2.default.extend(_relativeTime2.default);
72
 _dayjs2.default.extend(_relativeTime2.default);
73
 
73
 
74
 var CommentItem = function (_Component) {
74
 var CommentItem = function (_Component) {
88
   }
88
   }
89
 
89
 
90
   _createClass(CommentItem, [{
90
   _createClass(CommentItem, [{
91
-    key: 'handleToggleInput',
91
+    key: "handleToggleInput",
92
     value: function handleToggleInput() {
92
     value: function handleToggleInput() {
93
       this.setState({ showInput: !this.state.showInput });
93
       this.setState({ showInput: !this.state.showInput });
94
     }
94
     }
95
   }, {
95
   }, {
96
-    key: 'renderTextWithReply',
96
+    key: "renderTextWithReply",
97
     value: function renderTextWithReply(text, content) {
97
     value: function renderTextWithReply(text, content) {
98
       var newText = text;
98
       var newText = text;
99
       var reply = content.reply;
99
       var reply = content.reply;
102
         // newText = `${newText} //@<a href="/${reply.user_id}">${
102
         // newText = `${newText} //@<a href="/${reply.user_id}">${
103
         //   reply.user_name
103
         //   reply.user_name
104
         // }</a> ${reply.content}`;
104
         // }</a> ${reply.content}`;
105
-        newText = newText + ' //@' + reply.user_name + ' ' + reply.content;
105
+        newText = newText + " //@" + reply.user_name + " " + reply.content;
106
         // newText = (
106
         // newText = (
107
         //   <span>
107
         //   <span>
108
         //     {newText}
108
         //     {newText}
116
       return newText;
116
       return newText;
117
     }
117
     }
118
   }, {
118
   }, {
119
-    key: 'render',
119
+    key: "render",
120
     value: function render() {
120
     value: function render() {
121
       var _props = this.props,
121
       var _props = this.props,
122
           commentId = _props.commentId,
122
           commentId = _props.commentId,
130
 
130
 
131
 
131
 
132
       var newContent = content.content;
132
       var newContent = content.content;
133
-      var images = '';
133
+      var images = "";
134
       if (newContent.indexOf(_constant.IMAGE_SPLIT) !== -1) {
134
       if (newContent.indexOf(_constant.IMAGE_SPLIT) !== -1) {
135
         newContent = newContent.split(_constant.IMAGE_SPLIT);
135
         newContent = newContent.split(_constant.IMAGE_SPLIT);
136
         images = newContent.pop();
136
         images = newContent.pop();
137
-        newContent = newContent.join('');
137
+        newContent = newContent.join("");
138
       }
138
       }
139
 
139
 
140
       return _react2.default.createElement(
140
       return _react2.default.createElement(
141
-        'div',
142
-        { className: 'comment-item-box' },
141
+        "div",
142
+        { className: "comment-item-box" },
143
         _react2.default.createElement(
143
         _react2.default.createElement(
144
-          'div',
145
-          { className: 'comment-item-left' },
146
-          _react2.default.createElement(_avatar2.default, { src: content.user_avatar || _avatar4.default, size: 'large' })
144
+          "div",
145
+          { className: "comment-item-left" },
146
+          _react2.default.createElement(_avatar2.default, { src: content.user_avatar || _avatar4.default, size: "large" })
147
         ),
147
         ),
148
         _react2.default.createElement(
148
         _react2.default.createElement(
149
-          'div',
150
-          { className: 'comment-item-right' },
149
+          "div",
150
+          { className: "comment-item-right" },
151
           _react2.default.createElement(
151
           _react2.default.createElement(
152
-            'div',
152
+            "div",
153
             null,
153
             null,
154
             _react2.default.createElement(
154
             _react2.default.createElement(
155
-              'a',
156
-              { href: '/' + content.user_id },
157
-              content.user_name || '暂无昵称'
155
+              "strong",
156
+              null,
157
+              content.user_name || "暂无昵称"
158
             ),
158
             ),
159
             _react2.default.createElement(
159
             _react2.default.createElement(
160
-              'span',
160
+              "span",
161
               { style: { marginLeft: 10 } },
161
               { style: { marginLeft: 10 } },
162
               _react2.default.createElement(
162
               _react2.default.createElement(
163
                 _tooltip2.default,
163
                 _tooltip2.default,
164
                 {
164
                 {
165
-                  placement: 'top',
166
-                  title: (0, _dayjs2.default)(content.created * 1000).format('YYYY-MM-DD HH:mm:ss')
165
+                  placement: "top",
166
+                  title: (0, _dayjs2.default)(content.created * 1000).format("YYYY-MM-DD HH:mm:ss")
167
                 },
167
                 },
168
                 (0, _dayjs2.default)(content.created * 1000).fromNow()
168
                 (0, _dayjs2.default)(content.created * 1000).fromNow()
169
               )
169
               )
170
             )
170
             )
171
           ),
171
           ),
172
-          _react2.default.createElement('div', {
173
-            className: 'comment-item-content',
172
+          _react2.default.createElement("div", {
173
+            className: "comment-item-content",
174
             dangerouslySetInnerHTML: {
174
             dangerouslySetInnerHTML: {
175
               __html: (0, _helper.renderContent)(this.renderTextWithReply(newContent, content))
175
               __html: (0, _helper.renderContent)(this.renderTextWithReply(newContent, content))
176
             }
176
             }
177
           }),
177
           }),
178
           _react2.default.createElement(
178
           _react2.default.createElement(
179
-            'div',
180
-            { className: 'comment-item-image' },
181
-            images.split(',').map(function (item, index) {
182
-              return _react2.default.createElement('img', {
179
+            "div",
180
+            { className: "comment-item-image" },
181
+            images.split(",").map(function (item, index) {
182
+              return _react2.default.createElement("img", {
183
                 key: index,
183
                 key: index,
184
                 src: item,
184
                 src: item,
185
                 alt: item,
185
                 alt: item,
186
-                style: { maxWidth: '100%' }
186
+                style: { maxWidth: "100%" }
187
               });
187
               });
188
             })
188
             })
189
           ),
189
           ),
190
           _react2.default.createElement(
190
           _react2.default.createElement(
191
-            'div',
192
-            { className: 'comment-item-bottom' },
191
+            "div",
192
+            { className: "comment-item-bottom" },
193
             content.reply_count ? _react2.default.createElement(
193
             content.reply_count ? _react2.default.createElement(
194
-              'div',
194
+              "div",
195
               null,
195
               null,
196
               _react2.default.createElement(
196
               _react2.default.createElement(
197
-                'a',
198
-                { className: 'comment-item-bottom-left', onClick: onShowReply },
197
+                "a",
198
+                { className: "comment-item-bottom-left", onClick: onShowReply },
199
                 content.reply_count,
199
                 content.reply_count,
200
-                ' \u6761\u56DE\u590D',
201
-                showReply ? _react2.default.createElement(_icon2.default, { type: 'up' }) : _react2.default.createElement(_icon2.default, { type: 'down' })
200
+                " \u6761\u56DE\u590D",
201
+                showReply ? _react2.default.createElement(_icon2.default, { type: "up" }) : _react2.default.createElement(_icon2.default, { type: "down" })
202
               )
202
               )
203
             ) : null,
203
             ) : null,
204
             _react2.default.createElement(
204
             _react2.default.createElement(
205
-              'a',
205
+              "a",
206
               {
206
               {
207
                 onClick: this.handleToggleInput,
207
                 onClick: this.handleToggleInput,
208
-                className: 'comment-item-bottom-right'
208
+                className: "comment-item-bottom-right"
209
               },
209
               },
210
-              '\xA0 \u56DE\u590D'
210
+              "\xA0 \u56DE\u590D"
211
             ),
211
             ),
212
             _react2.default.createElement(
212
             _react2.default.createElement(
213
-              'div',
213
+              "div",
214
               {
214
               {
215
-                className: 'comment-item-bottom-right',
215
+                className: "comment-item-bottom-right",
216
                 onClick: function onClick() {
216
                 onClick: function onClick() {
217
                   if (replyId) {
217
                   if (replyId) {
218
                     // 如果有 replyId,则说明是评论的回复
218
                     // 如果有 replyId,则说明是评论的回复
223
                 }
223
                 }
224
               },
224
               },
225
               _react2.default.createElement(_icon2.default, {
225
               _react2.default.createElement(_icon2.default, {
226
-                type: 'like-o',
227
-                className: content.favored ? 'comment-favor comment-favored' : 'comment-favor'
226
+                type: "like-o",
227
+                className: content.favored ? "comment-favor comment-favored" : "comment-favor"
228
               }),
228
               }),
229
-              '\xA0',
229
+              "\xA0",
230
               content.favor_count
230
               content.favor_count
231
             )
231
             )
232
           )
232
           )
250
   // comment 评论
250
   // comment 评论
251
   // reply 评论的回复
251
   // reply 评论的回复
252
   // replyToReply 回复的回复
252
   // replyToReply 回复的回复
253
-  action: _propTypes2.default.oneOf(['comment', 'reply', 'replyToReply']),
253
+  action: _propTypes2.default.oneOf(["comment", "reply", "replyToReply"]),
254
   onShowReply: _propTypes2.default.func
254
   onShowReply: _propTypes2.default.func
255
 };
255
 };
256
 
256
 
257
 CommentItem.defaultProps = {
257
 CommentItem.defaultProps = {
258
-  action: 'comment',
258
+  action: "comment",
259
   onShowReply: function onShowReply() {}
259
   onShowReply: function onShowReply() {}
260
 };
260
 };
261
 
261
 

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


+ 27
- 27
lib/components/Editor/Emoji.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _carousel = require('antd/es/carousel');
7
+var _carousel = require("antd/es/carousel");
8
 
8
 
9
 var _carousel2 = _interopRequireDefault(_carousel);
9
 var _carousel2 = _interopRequireDefault(_carousel);
10
 
10
 
11
-require('antd/es/carousel/style/css');
11
+require("antd/es/carousel/style/css");
12
 
12
 
13
-var _react = require('react');
13
+var _react = require("react");
14
 
14
 
15
 var _react2 = _interopRequireDefault(_react);
15
 var _react2 = _interopRequireDefault(_react);
16
 
16
 
17
-var _emoji = require('../../emoji');
17
+var _emoji = require("../../emoji");
18
 
18
 
19
 var _emoji2 = _interopRequireDefault(_emoji);
19
 var _emoji2 = _interopRequireDefault(_emoji);
20
 
20
 
21
-require('./Emoji.css');
21
+require("./Emoji.css");
22
 
22
 
23
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
 
24
 
45
     _carousel2.default,
45
     _carousel2.default,
46
     null,
46
     null,
47
     _react2.default.createElement(
47
     _react2.default.createElement(
48
-      'div',
48
+      "div",
49
       null,
49
       null,
50
       content[0].map(function (item, index) {
50
       content[0].map(function (item, index) {
51
         return _react2.default.createElement(
51
         return _react2.default.createElement(
52
-          'div',
53
-          { className: 'item', key: item.value },
54
-          _react2.default.createElement('span', { className: 'helper' }),
55
-          _react2.default.createElement('img', {
56
-            src: '' + _emoji.prefixUrl + item.value + '.' + _emoji.ext,
52
+          "div",
53
+          { className: "item", key: item.value },
54
+          _react2.default.createElement("span", { className: "helper" }),
55
+          _react2.default.createElement("img", {
56
+            src: "" + _emoji.prefixUrl + item.value + "." + _emoji.ext,
57
             alt: item.title,
57
             alt: item.title,
58
-            style: { display: 'inline-block' },
58
+            style: { display: "inline-block" },
59
             onClick: function onClick() {
59
             onClick: function onClick() {
60
               return _onClick(item.title);
60
               return _onClick(item.title);
61
             }
61
             }
64
       })
64
       })
65
     ),
65
     ),
66
     _react2.default.createElement(
66
     _react2.default.createElement(
67
-      'div',
67
+      "div",
68
       null,
68
       null,
69
       content[1].map(function (item, index) {
69
       content[1].map(function (item, index) {
70
         return _react2.default.createElement(
70
         return _react2.default.createElement(
71
-          'div',
72
-          { className: 'item', key: item.value },
73
-          _react2.default.createElement('span', { className: 'helper' }),
74
-          _react2.default.createElement('img', {
75
-            src: '' + _emoji.prefixUrl + item.value + '.' + _emoji.ext,
71
+          "div",
72
+          { className: "item", key: item.value },
73
+          _react2.default.createElement("span", { className: "helper" }),
74
+          _react2.default.createElement("img", {
75
+            src: "" + _emoji.prefixUrl + item.value + "." + _emoji.ext,
76
             alt: item.title,
76
             alt: item.title,
77
-            style: { display: 'inline-block' },
77
+            style: { display: "inline-block" },
78
             onClick: function onClick() {
78
             onClick: function onClick() {
79
               return _onClick(item.title);
79
               return _onClick(item.title);
80
             }
80
             }
83
       })
83
       })
84
     ),
84
     ),
85
     _react2.default.createElement(
85
     _react2.default.createElement(
86
-      'div',
86
+      "div",
87
       null,
87
       null,
88
       content[2].map(function (item) {
88
       content[2].map(function (item) {
89
         return _react2.default.createElement(
89
         return _react2.default.createElement(
90
-          'div',
91
-          { className: 'item', key: item.value },
92
-          _react2.default.createElement('span', { className: 'helper' }),
93
-          _react2.default.createElement('img', {
94
-            src: '' + _emoji.prefixUrl + item.value + '.' + _emoji.ext,
90
+          "div",
91
+          { className: "item", key: item.value },
92
+          _react2.default.createElement("span", { className: "helper" }),
93
+          _react2.default.createElement("img", {
94
+            src: "" + _emoji.prefixUrl + item.value + "." + _emoji.ext,
95
             alt: item.title,
95
             alt: item.title,
96
-            style: { display: 'inline-block' },
96
+            style: { display: "inline-block" },
97
             onClick: function onClick() {
97
             onClick: function onClick() {
98
               return _onClick(item.title);
98
               return _onClick(item.title);
99
             }
99
             }

+ 1
- 1
lib/components/Editor/Emoji.js.map View File

1
-{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","onClick","content","i","emoji","length","push","map","item","index","value","prefixUrl","ext","title","display"],"mappings":";;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;AACA;;AAEA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ,OAAiB;AAAA,MAAdC,QAAc,QAAdA,OAAc;;AAC7B,MAAMC,UAAU,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,CAAhB;;AAEA,OAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIC,gBAAMC,MAA1B,EAAkCF,GAAlC,EAAuC;AACrC,QAAIA,IAAI,EAAR,EAAY;AACVD,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD,KAFD,MAEO,IAAIA,IAAI,EAAR,EAAY;AACjBD,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD,KAFM,MAEA,IAAIA,IAAIC,gBAAMC,MAAd,EAAsB;AAC3BH,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD;AACF;AACD,SACE;AAAA;AAAA;AACE;AAAA;AAAA;AACGD,cAAQ,CAAR,EAAWK,GAAX,CAAe,UAACC,IAAD,EAAOC,KAAP;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKD,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH,KADF;AAcE;AAAA;AAAA;AACGX,cAAQ,CAAR,EAAWK,GAAX,CAAe,UAACC,IAAD,EAAOC,KAAP;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKD,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH,KAdF;AA2BE;AAAA;AAAA;AACGX,cAAQ,CAAR,EAAWK,GAAX,CAAe;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH;AA3BF,GADF;AA2CD,CAvDD;;kBAyDeb,K","file":"Emoji.js","sourcesContent":["import React from 'react';\nimport { Carousel } from 'antd';\nimport emoji, { prefixUrl, ext } from '../../emoji';\nimport './Emoji.css';\n// 每页 20  5*4\n// 共 20 * 3 = 60 (实际是 54)\n\n// class Emoji\n\nconst Emoji = ({ onClick }) => {\n  const content = [[], [], []];\n\n  for (let i = 0; i < emoji.length; i++) {\n    if (i < 20) {\n      content[0].push(emoji[i]);\n    } else if (i < 40) {\n      content[1].push(emoji[i]);\n    } else if (i < emoji.length) {\n      content[2].push(emoji[i]);\n    }\n  }\n  return (\n    <Carousel>\n      <div>\n        {content[0].map((item, index) => (\n          <div className=\"item\" key={item.value}>\n            <span className=\"helper\" />\n            <img\n              src={`${prefixUrl}${item.value}.${ext}`}\n              alt={item.title}\n              style={{ display: 'inline-block' }}\n              onClick={() => onClick(item.title)}\n            />\n          </div>\n        ))}\n      </div>\n      <div>\n        {content[1].map((item, index) => (\n          <div className=\"item\" key={item.value}>\n            <span className=\"helper\" />\n            <img\n              src={`${prefixUrl}${item.value}.${ext}`}\n              alt={item.title}\n              style={{ display: 'inline-block' }}\n              onClick={() => onClick(item.title)}\n            />\n          </div>\n        ))}\n      </div>\n      <div>\n        {content[2].map(item => (\n          <div className=\"item\" key={item.value}>\n            <span className=\"helper\" />\n            <img\n              src={`${prefixUrl}${item.value}.${ext}`}\n              alt={item.title}\n              style={{ display: 'inline-block' }}\n              onClick={() => onClick(item.title)}\n            />\n          </div>\n        ))}\n      </div>\n    </Carousel>\n  );\n};\n\nexport default Emoji;\n"]}
1
+{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","onClick","content","i","emoji","length","push","map","item","index","value","prefixUrl","ext","title","display"],"mappings":";;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;AACA;;AAEA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ,OAAiB;AAAA,MAAdC,QAAc,QAAdA,OAAc;;AAC7B,MAAMC,UAAU,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,CAAhB;;AAEA,OAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIC,gBAAMC,MAA1B,EAAkCF,GAAlC,EAAuC;AACrC,QAAIA,IAAI,EAAR,EAAY;AACVD,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD,KAFD,MAEO,IAAIA,IAAI,EAAR,EAAY;AACjBD,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD,KAFM,MAEA,IAAIA,IAAIC,gBAAMC,MAAd,EAAsB;AAC3BH,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD;AACF;AACD,SACE;AAAA;AAAA;AACE;AAAA;AAAA;AACGD,cAAQ,CAAR,EAAWK,GAAX,CAAe,UAACC,IAAD,EAAOC,KAAP;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKD,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH,KADF;AAcE;AAAA;AAAA;AACGX,cAAQ,CAAR,EAAWK,GAAX,CAAe,UAACC,IAAD,EAAOC,KAAP;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKD,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH,KAdF;AA2BE;AAAA;AAAA;AACGX,cAAQ,CAAR,EAAWK,GAAX,CAAe;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH;AA3BF,GADF;AA2CD,CAvDD;;kBAyDeb,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\nimport { Carousel } from \"antd\";\nimport emoji, { prefixUrl, ext } from \"../../emoji\";\nimport \"./Emoji.css\";\n// 每页 20  5*4\n// 共 20 * 3 = 60 (实际是 54)\n\n// class Emoji\n\nconst Emoji = ({ onClick }) => {\n  const content = [[], [], []];\n\n  for (let i = 0; i < emoji.length; i++) {\n    if (i < 20) {\n      content[0].push(emoji[i]);\n    } else if (i < 40) {\n      content[1].push(emoji[i]);\n    } else if (i < emoji.length) {\n      content[2].push(emoji[i]);\n    }\n  }\n  return (\n    <Carousel>\n      <div>\n        {content[0].map((item, index) => (\n          <div className=\"item\" key={item.value}>\n            <span className=\"helper\" />\n            <img\n              src={`${prefixUrl}${item.value}.${ext}`}\n              alt={item.title}\n              style={{ display: \"inline-block\" }}\n              onClick={() => onClick(item.title)}\n            />\n          </div>\n        ))}\n      </div>\n      <div>\n        {content[1].map((item, index) => (\n          <div className=\"item\" key={item.value}>\n            <span className=\"helper\" />\n            <img\n              src={`${prefixUrl}${item.value}.${ext}`}\n              alt={item.title}\n              style={{ display: \"inline-block\" }}\n              onClick={() => onClick(item.title)}\n            />\n          </div>\n        ))}\n      </div>\n      <div>\n        {content[2].map(item => (\n          <div className=\"item\" key={item.value}>\n            <span className=\"helper\" />\n            <img\n              src={`${prefixUrl}${item.value}.${ext}`}\n              alt={item.title}\n              style={{ display: \"inline-block\" }}\n              onClick={() => onClick(item.title)}\n            />\n          </div>\n        ))}\n      </div>\n    </Carousel>\n  );\n};\n\nexport default Emoji;\n"]}

+ 32
- 32
lib/components/Editor/Upload.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _modal = require('antd/es/modal');
7
+var _modal = require("antd/es/modal");
8
 
8
 
9
 var _modal2 = _interopRequireDefault(_modal);
9
 var _modal2 = _interopRequireDefault(_modal);
10
 
10
 
11
-var _upload = require('antd/es/upload');
11
+var _upload = require("antd/es/upload");
12
 
12
 
13
 var _upload2 = _interopRequireDefault(_upload);
13
 var _upload2 = _interopRequireDefault(_upload);
14
 
14
 
15
-var _icon = require('antd/es/icon');
15
+var _icon = require("antd/es/icon");
16
 
16
 
17
 var _icon2 = _interopRequireDefault(_icon);
17
 var _icon2 = _interopRequireDefault(_icon);
18
 
18
 
19
-var _message2 = require('antd/es/message');
19
+var _message2 = require("antd/es/message");
20
 
20
 
21
 var _message3 = _interopRequireDefault(_message2);
21
 var _message3 = _interopRequireDefault(_message2);
22
 
22
 
23
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
23
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
24
 
24
 
25
-require('antd/es/modal/style/css');
25
+require("antd/es/modal/style/css");
26
 
26
 
27
-require('antd/es/upload/style/css');
27
+require("antd/es/upload/style/css");
28
 
28
 
29
-require('antd/es/icon/style/css');
29
+require("antd/es/icon/style/css");
30
 
30
 
31
-require('antd/es/message/style/css');
31
+require("antd/es/message/style/css");
32
 
32
 
33
-var _react = require('react');
33
+var _react = require("react");
34
 
34
 
35
 var _react2 = _interopRequireDefault(_react);
35
 var _react2 = _interopRequireDefault(_react);
36
 
36
 
37
-var _dayjs = require('dayjs');
37
+var _dayjs = require("dayjs");
38
 
38
 
39
 var _dayjs2 = _interopRequireDefault(_dayjs);
39
 var _dayjs2 = _interopRequireDefault(_dayjs);
40
 
40
 
41
-var _shortid = require('shortid');
41
+var _shortid = require("shortid");
42
 
42
 
43
 var _shortid2 = _interopRequireDefault(_shortid);
43
 var _shortid2 = _interopRequireDefault(_shortid);
44
 
44
 
45
-var _constant = require('../../constant');
45
+var _constant = require("../../constant");
46
 
46
 
47
-var _Comment = require('../../Comment');
47
+var _Comment = require("../../Comment");
48
 
48
 
49
 var _Comment2 = _interopRequireDefault(_Comment);
49
 var _Comment2 = _interopRequireDefault(_Comment);
50
 
50
 
51
-require('./Upload.css');
51
+require("./Upload.css");
52
 
52
 
53
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
54
 
54
 
69
 };
69
 };
70
 
70
 
71
 var uploadPath = function uploadPath(path, file) {
71
 var uploadPath = function uploadPath(path, file) {
72
-  return path + '/' + (0, _dayjs2.default)().format('YYYYMMDD') + '/' + _shortid2.default.generate() + '.' + file.type.split('/')[1];
72
+  return path + "/" + (0, _dayjs2.default)().format("YYYYMMDD") + "/" + _shortid2.default.generate() + "." + file.type.split("/")[1];
73
 };
73
 };
74
 
74
 
75
 var UploadToOss = function UploadToOss(oss, path, file) {
75
 var UploadToOss = function UploadToOss(oss, path, file) {
93
 
93
 
94
     _this.state = {
94
     _this.state = {
95
       previewVisible: false,
95
       previewVisible: false,
96
-      previewImage: ''
96
+      previewImage: ""
97
     };
97
     };
98
     _this.handleCancel = _this.handleCancel.bind(_this);
98
     _this.handleCancel = _this.handleCancel.bind(_this);
99
     _this.handlePreview = _this.handlePreview.bind(_this);
99
     _this.handlePreview = _this.handlePreview.bind(_this);
103
   }
103
   }
104
 
104
 
105
   _createClass(App, [{
105
   _createClass(App, [{
106
-    key: 'componentDidMount',
106
+    key: "componentDidMount",
107
     value: function componentDidMount() {
107
     value: function componentDidMount() {
108
       this.props.app.sOssSts();
108
       this.props.app.sOssSts();
109
     }
109
     }
110
   }, {
110
   }, {
111
-    key: 'handleCancel',
111
+    key: "handleCancel",
112
     value: function handleCancel() {
112
     value: function handleCancel() {
113
       this.setState({ previewVisible: false });
113
       this.setState({ previewVisible: false });
114
     }
114
     }
115
   }, {
115
   }, {
116
-    key: 'handlePreview',
116
+    key: "handlePreview",
117
     value: function handlePreview(file) {
117
     value: function handlePreview(file) {
118
       this.setState({
118
       this.setState({
119
         previewImage: file.url || file.thumbUrl,
119
         previewImage: file.url || file.thumbUrl,
121
       });
121
       });
122
     }
122
     }
123
   }, {
123
   }, {
124
-    key: 'handleChange',
124
+    key: "handleChange",
125
     value: function handleChange(_ref) {
125
     value: function handleChange(_ref) {
126
       var fileList = _ref.fileList;
126
       var fileList = _ref.fileList;
127
 
127
 
128
       this.props.onChangeFileList(fileList);
128
       this.props.onChangeFileList(fileList);
129
     }
129
     }
130
   }, {
130
   }, {
131
-    key: 'customRequest',
131
+    key: "customRequest",
132
     value: function customRequest(info) {
132
     value: function customRequest(info) {
133
       var _this2 = this;
133
       var _this2 = this;
134
 
134
 
151
       };
151
       };
152
     }
152
     }
153
   }, {
153
   }, {
154
-    key: 'render',
154
+    key: "render",
155
     value: function render() {
155
     value: function render() {
156
       var _state = this.state,
156
       var _state = this.state,
157
           previewVisible = _state.previewVisible,
157
           previewVisible = _state.previewVisible,
161
           maxUpload = _props.maxUpload;
161
           maxUpload = _props.maxUpload;
162
 
162
 
163
       var uploadButton = _react2.default.createElement(
163
       var uploadButton = _react2.default.createElement(
164
-        'div',
164
+        "div",
165
         null,
165
         null,
166
-        _react2.default.createElement(_icon2.default, { type: 'plus' }),
166
+        _react2.default.createElement(_icon2.default, { type: "plus" }),
167
         _react2.default.createElement(
167
         _react2.default.createElement(
168
-          'div',
169
-          { className: 'ant-upload-text' },
170
-          '\u4E0A\u4F20'
168
+          "div",
169
+          { className: "ant-upload-text" },
170
+          "\u4E0A\u4F20"
171
         )
171
         )
172
       );
172
       );
173
       return _react2.default.createElement(
173
       return _react2.default.createElement(
174
-        'div',
174
+        "div",
175
         null,
175
         null,
176
         _react2.default.createElement(
176
         _react2.default.createElement(
177
           _upload2.default,
177
           _upload2.default,
178
           {
178
           {
179
-            accept: 'image/jpg,image/jpeg,image/png,image/bmp',
180
-            listType: 'picture-card',
179
+            accept: "image/jpg,image/jpeg,image/png,image/bmp",
180
+            listType: "picture-card",
181
             fileList: fileList,
181
             fileList: fileList,
182
             customRequest: this.customRequest,
182
             customRequest: this.customRequest,
183
             onPreview: this.handlePreview,
183
             onPreview: this.handlePreview,
192
             footer: null,
192
             footer: null,
193
             onCancel: this.handleCancel
193
             onCancel: this.handleCancel
194
           },
194
           },
195
-          _react2.default.createElement('img', { alt: 'upload', style: { width: '100%' }, src: previewImage })
195
+          _react2.default.createElement("img", { alt: "upload", style: { width: "100%" }, src: previewImage })
196
         )
196
         )
197
       );
197
       );
198
     }
198
     }

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


+ 1
- 1
lib/components/Editor/index.css View File

30
   box-shadow: none;
30
   box-shadow: none;
31
   border-bottom: 1px solid #eee;
31
   border-bottom: 1px solid #eee;
32
 }
32
 }
33
-.comment-editor [contentEditable='true']:empty:not(:focus):before {
33
+.comment-editor [contentEditable="true"]:empty:not(:focus):before {
34
   content: attr(data-text);
34
   content: attr(data-text);
35
   color: #bfbfbf;
35
   color: #bfbfbf;
36
 }
36
 }

+ 62
- 62
lib/components/Editor/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _button = require('antd/es/button');
7
+var _button = require("antd/es/button");
8
 
8
 
9
 var _button2 = _interopRequireDefault(_button);
9
 var _button2 = _interopRequireDefault(_button);
10
 
10
 
11
-var _popover = require('antd/es/popover');
11
+var _popover = require("antd/es/popover");
12
 
12
 
13
 var _popover2 = _interopRequireDefault(_popover);
13
 var _popover2 = _interopRequireDefault(_popover);
14
 
14
 
15
-var _icon = require('antd/es/icon');
15
+var _icon = require("antd/es/icon");
16
 
16
 
17
 var _icon2 = _interopRequireDefault(_icon);
17
 var _icon2 = _interopRequireDefault(_icon);
18
 
18
 
19
-var _input = require('antd/es/input');
19
+var _input = require("antd/es/input");
20
 
20
 
21
 var _input2 = _interopRequireDefault(_input);
21
 var _input2 = _interopRequireDefault(_input);
22
 
22
 
23
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
23
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
24
 
24
 
25
-require('antd/es/button/style/css');
25
+require("antd/es/button/style/css");
26
 
26
 
27
-require('antd/es/popover/style/css');
27
+require("antd/es/popover/style/css");
28
 
28
 
29
-require('antd/es/icon/style/css');
29
+require("antd/es/icon/style/css");
30
 
30
 
31
-require('antd/es/input/style/css');
31
+require("antd/es/input/style/css");
32
 
32
 
33
-var _react = require('react');
33
+var _react = require("react");
34
 
34
 
35
 var _react2 = _interopRequireDefault(_react);
35
 var _react2 = _interopRequireDefault(_react);
36
 
36
 
37
-var _propTypes = require('prop-types');
37
+var _propTypes = require("prop-types");
38
 
38
 
39
 var _propTypes2 = _interopRequireDefault(_propTypes);
39
 var _propTypes2 = _interopRequireDefault(_propTypes);
40
 
40
 
41
-var _constant = require('../../constant');
41
+var _constant = require("../../constant");
42
 
42
 
43
-var _helper = require('../../helper');
43
+var _helper = require("../../helper");
44
 
44
 
45
-var _Upload = require('./Upload');
45
+var _Upload = require("./Upload");
46
 
46
 
47
 var _Upload2 = _interopRequireDefault(_Upload);
47
 var _Upload2 = _interopRequireDefault(_Upload);
48
 
48
 
49
-var _Emoji = require('./Emoji');
49
+var _Emoji = require("./Emoji");
50
 
50
 
51
 var _Emoji2 = _interopRequireDefault(_Emoji);
51
 var _Emoji2 = _interopRequireDefault(_Emoji);
52
 
52
 
53
-require('./index.css');
53
+require("./index.css");
54
 
54
 
55
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
55
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
56
 
56
 
72
 
72
 
73
     _this.state = {
73
     _this.state = {
74
       showUpload: false,
74
       showUpload: false,
75
-      value: '', // 编辑器里面的值
75
+      value: "", // 编辑器里面的值
76
 
76
 
77
       fileList: [], // 图片列表
77
       fileList: [], // 图片列表
78
       fileMap: {} // 已经上传的图片路径和 uid 的映射 { uid: path }
78
       fileMap: {} // 已经上传的图片路径和 uid 的映射 { uid: path }
88
   }
88
   }
89
 
89
 
90
   _createClass(Editor, [{
90
   _createClass(Editor, [{
91
-    key: 'componentDidMount',
91
+    key: "componentDidMount",
92
     value: function componentDidMount() {
92
     value: function componentDidMount() {
93
       if ((0, _helper.isFunction)(this.props.onRef)) {
93
       if ((0, _helper.isFunction)(this.props.onRef)) {
94
         this.props.onRef(this);
94
         this.props.onRef(this);
102
      */
102
      */
103
 
103
 
104
   }, {
104
   }, {
105
-    key: 'handleChange',
105
+    key: "handleChange",
106
     value: function handleChange(value) {
106
     value: function handleChange(value) {
107
       this.setState({ value: value });
107
       this.setState({ value: value });
108
       if (this.props.onChange) {
108
       if (this.props.onChange) {
119
      */
119
      */
120
 
120
 
121
   }, {
121
   }, {
122
-    key: 'handleClickEmoji',
122
+    key: "handleClickEmoji",
123
     value: function handleClickEmoji(emoji) {
123
     value: function handleClickEmoji(emoji) {
124
       var value = this.state.value;
124
       var value = this.state.value;
125
 
125
 
126
-      value += '[' + emoji + ']';
126
+      value += "[" + emoji + "]";
127
       this.handleChange(value);
127
       this.handleChange(value);
128
     }
128
     }
129
 
129
 
133
      */
133
      */
134
 
134
 
135
   }, {
135
   }, {
136
-    key: 'handleChangeFileList',
136
+    key: "handleChangeFileList",
137
     value: function handleChangeFileList(fileList) {
137
     value: function handleChangeFileList(fileList) {
138
       this.setState({ fileList: fileList });
138
       this.setState({ fileList: fileList });
139
     }
139
     }
144
      */
144
      */
145
 
145
 
146
   }, {
146
   }, {
147
-    key: 'handleShowUpload',
147
+    key: "handleShowUpload",
148
     value: function handleShowUpload(showUpload) {
148
     value: function handleShowUpload(showUpload) {
149
-      if (typeof showUpload === 'boolean') {
149
+      if (typeof showUpload === "boolean") {
150
         this.setState({ showUpload: showUpload });
150
         this.setState({ showUpload: showUpload });
151
       } else {
151
       } else {
152
         this.setState({ showUpload: !this.state.showUpload });
152
         this.setState({ showUpload: !this.state.showUpload });
159
      */
159
      */
160
 
160
 
161
   }, {
161
   }, {
162
-    key: 'handleUpload',
162
+    key: "handleUpload",
163
     value: function handleUpload(_ref) {
163
     value: function handleUpload(_ref) {
164
       var uid = _ref.uid,
164
       var uid = _ref.uid,
165
           path = _ref.path;
165
           path = _ref.path;
176
      */
176
      */
177
 
177
 
178
   }, {
178
   }, {
179
-    key: 'handleSubmit',
179
+    key: "handleSubmit",
180
     value: function handleSubmit() {
180
     value: function handleSubmit() {
181
       var _this2 = this;
181
       var _this2 = this;
182
 
182
 
188
       var files = [];
188
       var files = [];
189
       if (fileList.length) {
189
       if (fileList.length) {
190
         fileList.forEach(function (item) {
190
         fileList.forEach(function (item) {
191
-          files.push('' + _constant.OSS_LINK + fileMap[item.uid]);
191
+          files.push("" + _constant.OSS_LINK + fileMap[item.uid]);
192
         });
192
         });
193
       }
193
       }
194
       this.props.onSubmit({ text: value, files: files }, function () {
194
       this.props.onSubmit({ text: value, files: files }, function () {
196
       });
196
       });
197
     }
197
     }
198
   }, {
198
   }, {
199
-    key: 'resetState',
199
+    key: "resetState",
200
     value: function resetState() {
200
     value: function resetState() {
201
       this.setState({
201
       this.setState({
202
         showUpload: false,
202
         showUpload: false,
203
-        value: '',
203
+        value: "",
204
         fileList: [],
204
         fileList: [],
205
         fileMap: {}
205
         fileMap: {}
206
       });
206
       });
207
     }
207
     }
208
   }, {
208
   }, {
209
-    key: 'render',
209
+    key: "render",
210
     value: function render() {
210
     value: function render() {
211
       var _this3 = this;
211
       var _this3 = this;
212
 
212
 
227
       var handleSubmit = this.handleSubmit;
227
       var handleSubmit = this.handleSubmit;
228
       var disabledSubmit = btnDisabled || !this.props.value && !this.state.value && !this.state.fileList.length;
228
       var disabledSubmit = btnDisabled || !this.props.value && !this.state.value && !this.state.fileList.length;
229
       return _react2.default.createElement(
229
       return _react2.default.createElement(
230
-        'div',
231
-        { className: 'comment-editor' },
230
+        "div",
231
+        { className: "comment-editor" },
232
         _react2.default.createElement(TextArea, {
232
         _react2.default.createElement(TextArea, {
233
           value: value || this.state.value,
233
           value: value || this.state.value,
234
           onChange: function onChange(e) {
234
           onChange: function onChange(e) {
238
           placeholder: placeholder
238
           placeholder: placeholder
239
         }),
239
         }),
240
         _react2.default.createElement(
240
         _react2.default.createElement(
241
-          'div',
242
-          { className: 'comment-toolbar' },
241
+          "div",
242
+          { className: "comment-toolbar" },
243
           _react2.default.createElement(
243
           _react2.default.createElement(
244
-            'div',
245
-            { className: 'comment-toolbar-left' },
244
+            "div",
245
+            { className: "comment-toolbar-left" },
246
             showEmoji && _react2.default.createElement(
246
             showEmoji && _react2.default.createElement(
247
               _popover2.default,
247
               _popover2.default,
248
               {
248
               {
249
-                trigger: 'click',
250
-                placement: 'bottomLeft',
249
+                trigger: "click",
250
+                placement: "bottomLeft",
251
                 autoAdjustOverflow: false,
251
                 autoAdjustOverflow: false,
252
                 content: _react2.default.createElement(
252
                 content: _react2.default.createElement(
253
-                  'div',
253
+                  "div",
254
                   { style: { width: 200 } },
254
                   { style: { width: 200 } },
255
                   _react2.default.createElement(_Emoji2.default, { onClick: this.handleClickEmoji })
255
                   _react2.default.createElement(_Emoji2.default, { onClick: this.handleClickEmoji })
256
                 ),
256
                 ),
257
-                overlayClassName: 'comment-emoji-popover'
257
+                overlayClassName: "comment-emoji-popover"
258
               },
258
               },
259
-              emojiToolIcon || _react2.default.createElement(_icon2.default, { type: 'smile-o', className: 'comment-toolbar-icon' })
259
+              emojiToolIcon || _react2.default.createElement(_icon2.default, { type: "smile-o", className: "comment-toolbar-icon" })
260
             ),
260
             ),
261
             showUpload && _react2.default.createElement(
261
             showUpload && _react2.default.createElement(
262
               _popover2.default,
262
               _popover2.default,
264
                 visible: this.state.showUpload,
264
                 visible: this.state.showUpload,
265
                 overlayStyle: { zIndex: 999 },
265
                 overlayStyle: { zIndex: 999 },
266
                 content: _react2.default.createElement(
266
                 content: _react2.default.createElement(
267
-                  'div',
267
+                  "div",
268
                   {
268
                   {
269
                     style: {
269
                     style: {
270
                       width: 112 * maxUpload,
270
                       width: 112 * maxUpload,
271
                       minHeight: 100,
271
                       minHeight: 100,
272
-                      margin: '0 auto'
272
+                      margin: "0 auto"
273
                     }
273
                     }
274
                   },
274
                   },
275
                   _react2.default.createElement(_Upload2.default, {
275
                   _react2.default.createElement(_Upload2.default, {
279
                     fileList: this.state.fileList
279
                     fileList: this.state.fileList
280
                   })
280
                   })
281
                 ),
281
                 ),
282
-                placement: 'bottomLeft',
282
+                placement: "bottomLeft",
283
                 title: _react2.default.createElement(
283
                 title: _react2.default.createElement(
284
-                  'div',
285
-                  { style: { margin: '5px auto' } },
284
+                  "div",
285
+                  { style: { margin: "5px auto" } },
286
                   _react2.default.createElement(
286
                   _react2.default.createElement(
287
-                    'span',
287
+                    "span",
288
                     null,
288
                     null,
289
-                    '\u4E0A\u4F20\u56FE\u7247',
289
+                    "\u4E0A\u4F20\u56FE\u7247",
290
                     maxUpload >= 2 ? _react2.default.createElement(
290
                     maxUpload >= 2 ? _react2.default.createElement(
291
-                      'span',
292
-                      { style: { color: '#666', fontWeight: 400 } },
293
-                      '(\u60A8\u8FD8\u80FD\u4E0A\u4F20',
291
+                      "span",
292
+                      { style: { color: "#666", fontWeight: 400 } },
293
+                      "(\u60A8\u8FD8\u80FD\u4E0A\u4F20",
294
                       maxUpload - this.state.fileList.length,
294
                       maxUpload - this.state.fileList.length,
295
-                      '\u5F20\u56FE\u7247)'
295
+                      "\u5F20\u56FE\u7247)"
296
                     ) : null
296
                     ) : null
297
                   ),
297
                   ),
298
                   _react2.default.createElement(_icon2.default, {
298
                   _react2.default.createElement(_icon2.default, {
299
-                    type: 'close',
299
+                    type: "close",
300
                     onClick: function onClick() {
300
                     onClick: function onClick() {
301
                       return _this3.handleShowUpload(false);
301
                       return _this3.handleShowUpload(false);
302
                     },
302
                     },
303
                     style: {
303
                     style: {
304
-                      float: 'right',
305
-                      cursor: 'pointer',
304
+                      float: "right",
305
+                      cursor: "pointer",
306
                       marginTop: 4
306
                       marginTop: 4
307
                     }
307
                     }
308
                   })
308
                   })
313
                   return _this3.handleShowUpload(true);
313
                   return _this3.handleShowUpload(true);
314
                 }
314
                 }
315
               }) : _react2.default.createElement(_icon2.default, {
315
               }) : _react2.default.createElement(_icon2.default, {
316
-                type: 'picture',
317
-                className: 'comment-toolbar-icon',
316
+                type: "picture",
317
+                className: "comment-toolbar-icon",
318
                 style: { marginLeft: 10 },
318
                 style: { marginLeft: 10 },
319
                 onClick: function onClick() {
319
                 onClick: function onClick() {
320
                   return _this3.handleShowUpload(true);
320
                   return _this3.handleShowUpload(true);
323
             )
323
             )
324
           ),
324
           ),
325
           _react2.default.createElement(
325
           _react2.default.createElement(
326
-            'div',
327
-            { className: 'comment-toolbar-right' },
326
+            "div",
327
+            { className: "comment-toolbar-right" },
328
             button ? _react2.default.cloneElement(button, {
328
             button ? _react2.default.cloneElement(button, {
329
               onClick: button.props.onClick || handleSubmit
329
               onClick: button.props.onClick || handleSubmit
330
             }) : _react2.default.createElement(
330
             }) : _react2.default.createElement(
333
                 onClick: function onClick() {
333
                 onClick: function onClick() {
334
                   return _this3.handleSubmit();
334
                   return _this3.handleSubmit();
335
                 },
335
                 },
336
-                type: 'primary',
336
+                type: "primary",
337
                 loading: btnLoading,
337
                 loading: btnLoading,
338
                 disabled: disabledSubmit
338
                 disabled: disabledSubmit
339
               },
339
               },
367
 
367
 
368
 Editor.defaultProps = {
368
 Editor.defaultProps = {
369
   rows: 5,
369
   rows: 5,
370
-  placeholder: '说点什么吧...',
370
+  placeholder: "说点什么吧...",
371
   showEmoji: true,
371
   showEmoji: true,
372
   showUpload: true,
372
   showUpload: true,
373
   maxUpload: 1,
373
   maxUpload: 1,
374
-  btnSubmitText: '发表',
374
+  btnSubmitText: "发表",
375
   btnLoading: false,
375
   btnLoading: false,
376
   btnDisabled: false
376
   btnDisabled: false
377
 };
377
 };

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


+ 5
- 5
lib/components/RenderText/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 
6
 
7
-var _react = require('react');
7
+var _react = require("react");
8
 
8
 
9
 var _react2 = _interopRequireDefault(_react);
9
 var _react2 = _interopRequireDefault(_react);
10
 
10
 
11
-var _helper = require('../../helper');
11
+var _helper = require("../../helper");
12
 
12
 
13
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
 
14
 
15
 var App = function App(text) {
15
 var App = function App(text) {
16
-  return _react2.default.createElement('div', {
17
-    className: 'comment-item-content',
16
+  return _react2.default.createElement("div", {
17
+    className: "comment-item-content",
18
     dangerouslySetInnerHTML: {
18
     dangerouslySetInnerHTML: {
19
       __html: (0, _helper.renderContent)(text)
19
       __html: (0, _helper.renderContent)(text)
20
     }
20
     }

+ 1
- 1
lib/components/RenderText/index.js.map View File

1
-{"version":3,"sources":["../../../src/components/RenderText/index.js"],"names":["App","__html","text"],"mappings":";;;;;;AAAA;;;;AACA;;;;AAEA,IAAMA,MAAM,SAANA,GAAM;AAAA,SACV;AACE,eAAU,sBADZ;AAEE,6BAAyB;AACvBC,cAAQ,2BAAcC,IAAd;AADe;AAF3B,IADU;AAAA,CAAZ;;kBASeF,G","file":"index.js","sourcesContent":["import React from 'react';\nimport { renderContent } from '../../helper';\n\nconst App = text => (\n  <div\n    className=\"comment-item-content\"\n    dangerouslySetInnerHTML={{\n      __html: renderContent(text),\n    }}\n  />\n);\n\nexport default App;\n"]}
1
+{"version":3,"sources":["../../../src/components/RenderText/index.js"],"names":["App","__html","text"],"mappings":";;;;;;AAAA;;;;AACA;;;;AAEA,IAAMA,MAAM,SAANA,GAAM;AAAA,SACV;AACE,eAAU,sBADZ;AAEE,6BAAyB;AACvBC,cAAQ,2BAAcC,IAAd;AADe;AAF3B,IADU;AAAA,CAAZ;;kBASeF,G","file":"index.js","sourcesContent":["import React from \"react\";\nimport { renderContent } from \"../../helper\";\n\nconst App = text => (\n  <div\n    className=\"comment-item-content\"\n    dangerouslySetInnerHTML={{\n      __html: renderContent(text)\n    }}\n  />\n);\n\nexport default App;\n"]}

+ 8
- 8
lib/constant.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
-var ERROR_DEFAULT = exports.ERROR_DEFAULT = '出错了!';
6
+var ERROR_DEFAULT = exports.ERROR_DEFAULT = "出错了!";
7
 
7
 
8
 var LIMIT = exports.LIMIT = 10; // 默认 limit
8
 var LIMIT = exports.LIMIT = 10; // 默认 limit
9
 
9
 
10
-var OSS_ENDPOINT = exports.OSS_ENDPOINT = 'oss-cn-beijing.aliyuncs.com';
11
-var OSS_BUCKET = exports.OSS_BUCKET = 'links-comment';
12
-var DRIVER_LICENSE_PATH = exports.DRIVER_LICENSE_PATH = '/comment';
10
+var OSS_ENDPOINT = exports.OSS_ENDPOINT = "oss-cn-beijing.aliyuncs.com";
11
+var OSS_BUCKET = exports.OSS_BUCKET = "links-comment";
12
+var DRIVER_LICENSE_PATH = exports.DRIVER_LICENSE_PATH = "/comment";
13
 
13
 
14
-var OSS_LINK = exports.OSS_LINK = 'http://links-comment.oss-cn-beijing.aliyuncs.com';
14
+var OSS_LINK = exports.OSS_LINK = "http://links-comment.oss-cn-beijing.aliyuncs.com";
15
 
15
 
16
 var MAX_UPLOAD_NUMBER = exports.MAX_UPLOAD_NUMBER = 4;
16
 var MAX_UPLOAD_NUMBER = exports.MAX_UPLOAD_NUMBER = 4;
17
 
17
 
18
 var REGEXP = exports.REGEXP = /\[.+?\]/g;
18
 var REGEXP = exports.REGEXP = /\[.+?\]/g;
19
 
19
 
20
-var AVATAR = exports.AVATAR = '';
20
+var AVATAR = exports.AVATAR = "";
21
 
21
 
22
-var IMAGE_SPLIT = exports.IMAGE_SPLIT = 'IMAGE_SPLIT';
22
+var IMAGE_SPLIT = exports.IMAGE_SPLIT = "IMAGE_SPLIT";
23
 //# sourceMappingURL=constant.js.map
23
 //# sourceMappingURL=constant.js.map

+ 1
- 1
lib/constant.js.map View File

1
-{"version":3,"sources":["../src/constant.js"],"names":["ERROR_DEFAULT","LIMIT","OSS_ENDPOINT","OSS_BUCKET","DRIVER_LICENSE_PATH","OSS_LINK","MAX_UPLOAD_NUMBER","REGEXP","AVATAR","IMAGE_SPLIT"],"mappings":";;;;;AAAO,IAAMA,wCAAgB,MAAtB;;AAEA,IAAMC,wBAAQ,EAAd,C,CAAkB;;AAElB,IAAMC,sCAAe,6BAArB;AACA,IAAMC,kCAAa,eAAnB;AACA,IAAMC,oDAAsB,UAA5B;;AAEA,IAAMC,8BAAW,kDAAjB;;AAEA,IAAMC,gDAAoB,CAA1B;;AAEA,IAAMC,0BAAS,UAAf;;AAEA,IAAMC,0BAAS,EAAf;;AAEA,IAAMC,oCAAc,aAApB","file":"constant.js","sourcesContent":["export const ERROR_DEFAULT = '出错了!';\n\nexport const LIMIT = 10; // 默认 limit\n\nexport const OSS_ENDPOINT = 'oss-cn-beijing.aliyuncs.com';\nexport const OSS_BUCKET = 'links-comment';\nexport const DRIVER_LICENSE_PATH = '/comment';\n\nexport const OSS_LINK = 'http://links-comment.oss-cn-beijing.aliyuncs.com';\n\nexport const MAX_UPLOAD_NUMBER = 4;\n\nexport const REGEXP = /\\[.+?\\]/g;\n\nexport const AVATAR = '';\n\nexport const IMAGE_SPLIT = 'IMAGE_SPLIT';\n"]}
1
+{"version":3,"sources":["../src/constant.js"],"names":["ERROR_DEFAULT","LIMIT","OSS_ENDPOINT","OSS_BUCKET","DRIVER_LICENSE_PATH","OSS_LINK","MAX_UPLOAD_NUMBER","REGEXP","AVATAR","IMAGE_SPLIT"],"mappings":";;;;;AAAO,IAAMA,wCAAgB,MAAtB;;AAEA,IAAMC,wBAAQ,EAAd,C,CAAkB;;AAElB,IAAMC,sCAAe,6BAArB;AACA,IAAMC,kCAAa,eAAnB;AACA,IAAMC,oDAAsB,UAA5B;;AAEA,IAAMC,8BAAW,kDAAjB;;AAEA,IAAMC,gDAAoB,CAA1B;;AAEA,IAAMC,0BAAS,UAAf;;AAEA,IAAMC,0BAAS,EAAf;;AAEA,IAAMC,oCAAc,aAApB","file":"constant.js","sourcesContent":["export const ERROR_DEFAULT = \"出错了!\";\n\nexport const LIMIT = 10; // 默认 limit\n\nexport const OSS_ENDPOINT = \"oss-cn-beijing.aliyuncs.com\";\nexport const OSS_BUCKET = \"links-comment\";\nexport const DRIVER_LICENSE_PATH = \"/comment\";\n\nexport const OSS_LINK = \"http://links-comment.oss-cn-beijing.aliyuncs.com\";\n\nexport const MAX_UPLOAD_NUMBER = 4;\n\nexport const REGEXP = /\\[.+?\\]/g;\n\nexport const AVATAR = \"\";\n\nexport const IMAGE_SPLIT = \"IMAGE_SPLIT\";\n"]}

+ 111
- 111
lib/emoji.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
5
 });
5
 });
6
 var emoji = [{
6
 var emoji = [{
7
-  value: '0',
8
-  title: '捶地'
7
+  value: "0",
8
+  title: "捶地"
9
 }, {
9
 }, {
10
-  value: '1',
11
-  title: '怀疑'
10
+  value: "1",
11
+  title: "怀疑"
12
 }, {
12
 }, {
13
-  value: '2',
14
-  title: '撇嘴'
13
+  value: "2",
14
+  title: "撇嘴"
15
 }, {
15
 }, {
16
-  value: '3',
17
-  title: '色'
16
+  value: "3",
17
+  title: "色"
18
 }, {
18
 }, {
19
-  value: '4',
20
-  title: '发呆'
19
+  value: "4",
20
+  title: "发呆"
21
 }, {
21
 }, {
22
-  value: '5',
23
-  title: '酷'
22
+  value: "5",
23
+  title: "酷"
24
 }, {
24
 }, {
25
-  value: '6',
26
-  title: '害羞'
25
+  value: "6",
26
+  title: "害羞"
27
 }, {
27
 }, {
28
-  value: '7',
29
-  title: '闭嘴'
28
+  value: "7",
29
+  title: "闭嘴"
30
 }, {
30
 }, {
31
-  value: '8',
32
-  title: '睡觉'
31
+  value: "8",
32
+  title: "睡觉"
33
 }, {
33
 }, {
34
-  value: '9',
35
-  title: '大哭'
34
+  value: "9",
35
+  title: "大哭"
36
 }, {
36
 }, {
37
-  value: '10',
38
-  title: '尴尬'
37
+  value: "10",
38
+  title: "尴尬"
39
 }, {
39
 }, {
40
-  value: '11',
41
-  title: '发怒'
40
+  value: "11",
41
+  title: "发怒"
42
 }, {
42
 }, {
43
-  value: '12',
44
-  title: '调皮'
43
+  value: "12",
44
+  title: "调皮"
45
 }, {
45
 }, {
46
-  value: '13',
47
-  title: '呲牙'
46
+  value: "13",
47
+  title: "呲牙"
48
 }, {
48
 }, {
49
-  value: '14',
50
-  title: '微笑'
49
+  value: "14",
50
+  title: "微笑"
51
 }, {
51
 }, {
52
-  value: '15',
53
-  title: '难过'
52
+  value: "15",
53
+  title: "难过"
54
 }, {
54
 }, {
55
-  value: '16',
56
-  title: '帅呆'
55
+  value: "16",
56
+  title: "帅呆"
57
 }, {
57
 }, {
58
-  value: '17',
59
-  title: '折磨'
58
+  value: "17",
59
+  title: "折磨"
60
 }, {
60
 }, {
61
-  value: '18',
62
-  title: '吐'
61
+  value: "18",
62
+  title: "吐"
63
 }, {
63
 }, {
64
-  value: '19',
65
-  title: '偷笑'
64
+  value: "19",
65
+  title: "偷笑"
66
 }, {
66
 }, {
67
-  value: '20',
68
-  title: '可爱'
67
+  value: "20",
68
+  title: "可爱"
69
 }, {
69
 }, {
70
-  value: '21',
71
-  title: '白眼'
70
+  value: "21",
71
+  title: "白眼"
72
 }, {
72
 }, {
73
-  value: '22',
74
-  title: '傲慢'
73
+  value: "22",
74
+  title: "傲慢"
75
 }, {
75
 }, {
76
-  value: '23',
77
-  title: '嘴馋'
76
+  value: "23",
77
+  title: "嘴馋"
78
 }, {
78
 }, {
79
-  value: '24',
80
-  title: '困'
79
+  value: "24",
80
+  title: "困"
81
 }, {
81
 }, {
82
-  value: '25',
83
-  title: '恐慌'
82
+  value: "25",
83
+  title: "恐慌"
84
 }, {
84
 }, {
85
-  value: '26',
86
-  title: '流汗'
85
+  value: "26",
86
+  title: "流汗"
87
 }, {
87
 }, {
88
-  value: '27',
89
-  title: '憨笑'
88
+  value: "27",
89
+  title: "憨笑"
90
 }, {
90
 }, {
91
-  value: '28',
92
-  title: '大兵'
91
+  value: "28",
92
+  title: "大兵"
93
 }, {
93
 }, {
94
-  value: '29',
95
-  title: '奋斗'
94
+  value: "29",
95
+  title: "奋斗"
96
 }, {
96
 }, {
97
-  value: '30',
98
-  title: '疑问'
97
+  value: "30",
98
+  title: "疑问"
99
 }, {
99
 }, {
100
-  value: '31',
101
-  title: '嘘'
100
+  value: "31",
101
+  title: "嘘"
102
 }, {
102
 }, {
103
-  value: '32',
104
-  title: '晕'
103
+  value: "32",
104
+  title: "晕"
105
 }, {
105
 }, {
106
-  value: '33',
107
-  title: '被炸了'
106
+  value: "33",
107
+  title: "被炸了"
108
 }, {
108
 }, {
109
-  value: '34',
110
-  title: '骷髅'
109
+  value: "34",
110
+  title: "骷髅"
111
 }, {
111
 }, {
112
-  value: '35',
113
-  title: '敲打'
112
+  value: "35",
113
+  title: "敲打"
114
 }, {
114
 }, {
115
-  value: '36',
116
-  title: '拜拜'
115
+  value: "36",
116
+  title: "拜拜"
117
 }, {
117
 }, {
118
-  value: '37',
119
-  title: '发抖'
118
+  value: "37",
119
+  title: "发抖"
120
 }, {
120
 }, {
121
-  value: '38',
122
-  title: '亲密'
121
+  value: "38",
122
+  title: "亲密"
123
 }, {
123
 }, {
124
-  value: '39',
125
-  title: '跳'
124
+  value: "39",
125
+  title: "跳"
126
 }, {
126
 }, {
127
-  value: '40',
128
-  title: '猪头'
127
+  value: "40",
128
+  title: "猪头"
129
 }, {
129
 }, {
130
-  value: '41',
131
-  title: '拥抱'
130
+  value: "41",
131
+  title: "拥抱"
132
 }, {
132
 }, {
133
-  value: '42',
134
-  title: '生日蛋糕'
133
+  value: "42",
134
+  title: "生日蛋糕"
135
 }, {
135
 }, {
136
-  value: '43',
137
-  title: '闪电'
136
+  value: "43",
137
+  title: "闪电"
138
 }, {
138
 }, {
139
-  value: '44',
140
-  title: '地雷'
139
+  value: "44",
140
+  title: "地雷"
141
 }, {
141
 }, {
142
-  value: '45',
143
-  title: '刀'
142
+  value: "45",
143
+  title: "刀"
144
 }, {
144
 }, {
145
-  value: '46',
146
-  title: '足球'
145
+  value: "46",
146
+  title: "足球"
147
 }, {
147
 }, {
148
-  value: '47',
149
-  title: '便便'
148
+  value: "47",
149
+  title: "便便"
150
 }, {
150
 }, {
151
-  value: '48',
152
-  title: '咖啡'
151
+  value: "48",
152
+  title: "咖啡"
153
 }, {
153
 }, {
154
-  value: '49',
155
-  title: '米饭'
154
+  value: "49",
155
+  title: "米饭"
156
 }, {
156
 }, {
157
-  value: '50',
158
-  title: '玫瑰'
157
+  value: "50",
158
+  title: "玫瑰"
159
 }, {
159
 }, {
160
-  value: '51',
161
-  title: '枯萎玫瑰'
160
+  value: "51",
161
+  title: "枯萎玫瑰"
162
 }, {
162
 }, {
163
-  value: '52',
164
-  title: '爱心'
163
+  value: "52",
164
+  title: "爱心"
165
 }, {
165
 }, {
166
-  value: '53',
167
-  title: '心碎'
166
+  value: "53",
167
+  title: "心碎"
168
 }];
168
 }];
169
 
169
 
170
-var prefixUrl = exports.prefixUrl = 'https://a.links123.cn/site/src/feed/imgs/qq/';
170
+var prefixUrl = exports.prefixUrl = "https://a.links123.cn/site/src/feed/imgs/qq/";
171
 
171
 
172
-var ext = exports.ext = 'gif';
172
+var ext = exports.ext = "gif";
173
 
173
 
174
 exports.default = emoji;
174
 exports.default = emoji;
175
 //# sourceMappingURL=emoji.js.map
175
 //# sourceMappingURL=emoji.js.map

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


+ 11
- 11
lib/helper.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
9
 exports.htmlEncode = htmlEncode;
9
 exports.htmlEncode = htmlEncode;
10
 exports.renderContent = renderContent;
10
 exports.renderContent = renderContent;
11
 
11
 
12
-var _constant = require('./constant');
12
+var _constant = require("./constant");
13
 
13
 
14
-var _emoji = require('./emoji');
14
+var _emoji = require("./emoji");
15
 
15
 
16
 var _emoji2 = _interopRequireDefault(_emoji);
16
 var _emoji2 = _interopRequireDefault(_emoji);
17
 
17
 
18
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
 
19
 
20
-var emojiObejct = arrayToObject(_emoji2.default, 'title');
20
+var emojiObejct = arrayToObject(_emoji2.default, "title");
21
 
21
 
22
 function isFunction(functionToCheck) {
22
 function isFunction(functionToCheck) {
23
-  return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
23
+  return functionToCheck && {}.toString.call(functionToCheck) === "[object Function]";
24
 }
24
 }
25
 
25
 
26
 function isUrl(userInput) {
26
 function isUrl(userInput) {
47
  * @param {string} str 文本
47
  * @param {string} str 文本
48
  */
48
  */
49
 function htmlEncode(str) {
49
 function htmlEncode(str) {
50
-  if (!str) return '';
51
-  return str.replace(/<\/?(?!a)\w*\b[^>]*>/gim, function (i) {
52
-    return '&#' + i.charCodeAt(0) + ';';
50
+  if (!str) return "";
51
+  return str.replace(/<>/gim, function (i) {
52
+    return "&#" + i.charCodeAt(0) + ";";
53
   });
53
   });
54
 }
54
 }
55
 
55
 
63
   if (newContent.indexOf(_constant.IMAGE_SPLIT) !== -1) {
63
   if (newContent.indexOf(_constant.IMAGE_SPLIT) !== -1) {
64
     newContent = newContent.split(_constant.IMAGE_SPLIT);
64
     newContent = newContent.split(_constant.IMAGE_SPLIT);
65
     newContent.pop();
65
     newContent.pop();
66
-    newContent = newContent.join('');
66
+    newContent = newContent.join("");
67
   }
67
   }
68
 
68
 
69
   return htmlEncode(newContent).replace(_constant.REGEXP, function (a, b) {
69
   return htmlEncode(newContent).replace(_constant.REGEXP, function (a, b) {
72
     // 兼容旧的评
72
     // 兼容旧的评
73
     // 因为旧的评论用 [img url] 方式存储的
73
     // 因为旧的评论用 [img url] 方式存储的
74
     if (isUrl(src)) {
74
     if (isUrl(src)) {
75
-      return '<br/><img src="' + src + '" alt="' + src + '" style="max-width: 100%" />';
75
+      return "<br/><img src=\"" + src + "\" alt=\"" + src + "\" style=\"max-width: 100%\" />";
76
     }
76
     }
77
     var value = emojiObejct[src] ? emojiObejct[src].value : src;
77
     var value = emojiObejct[src] ? emojiObejct[src].value : src;
78
-    return '<img src="' + _emoji.prefixUrl + value + '.' + _emoji.ext + '" alt="' + value + '" />';
78
+    return "<img src=\"" + _emoji.prefixUrl + value + "." + _emoji.ext + "\" alt=\"" + value + "\" />";
79
   });
79
   });
80
 }
80
 }
81
 //# sourceMappingURL=helper.js.map
81
 //# sourceMappingURL=helper.js.map

+ 1
- 1
lib/helper.js.map View File

1
-{"version":3,"sources":["../src/helper.js"],"names":["isFunction","isUrl","arrayToObject","htmlEncode","renderContent","emojiObejct","emoji","functionToCheck","toString","call","userInput","regexp","res","match","array","keyField","reduce","obj","item","str","replace","i","charCodeAt","content","onClick","newContent","indexOf","IMAGE_SPLIT","split","pop","join","REGEXP","a","b","src","slice","value","prefixUrl","ext"],"mappings":";;;;;QAKgBA,U,GAAAA,U;QAMAC,K,GAAAA,K;QAYAC,a,GAAAA,a;QAYAC,U,GAAAA,U;QAYAC,a,GAAAA,a;;AA/ChB;;AACA;;;;;;AAEA,IAAMC,cAAcH,cAAcI,eAAd,EAAqB,OAArB,CAApB;;AAEO,SAASN,UAAT,CAAoBO,eAApB,EAAqC;AAC1C,SACEA,mBAAmB,GAAGC,QAAH,CAAYC,IAAZ,CAAiBF,eAAjB,MAAsC,mBAD3D;AAGD;;AAEM,SAASN,KAAT,CAAeS,SAAf,EAA0B;AAC/B,MAAMC,SAAS,kGAAf;AACA,MAAIC,MAAMF,UAAUG,KAAV,CAAgBF,MAAhB,CAAV;AACA,MAAIC,QAAQ,IAAZ,EAAkB,OAAO,KAAP,CAAlB,KACK,OAAO,IAAP;AACN;;AAED;;;;;AAKO,SAASV,aAAT,CAAuBY,KAAvB,EAA8BC,QAA9B,EAAwC;AAC7C,SAAOD,MAAME,MAAN,CAAa,UAACC,GAAD,EAAMC,IAAN,EAAe;AACjCD,QAAIC,KAAKH,QAAL,CAAJ,IAAsBG,IAAtB;AACA,WAAOD,GAAP;AACD,GAHM,EAGJ,EAHI,CAAP;AAID;;AAED;;;;;AAKO,SAASd,UAAT,CAAoBgB,GAApB,EAAyB;AAC9B,MAAI,CAACA,GAAL,EAAU,OAAO,EAAP;AACV,SAAOA,IAAIC,OAAJ,CAAY,yBAAZ,EAAuC,UAASC,CAAT,EAAY;AACxD,WAAO,OAAOA,EAAEC,UAAF,CAAa,CAAb,CAAP,GAAyB,GAAhC;AACD,GAFM,CAAP;AAGD;;AAED;;;;;AAKO,SAASlB,aAAT,CAAuBmB,OAAvB,EAAgCC,OAAhC,EAAyC;AAC9C,MAAIC,aAAaF,OAAjB;AACA,MAAIE,WAAWC,OAAX,CAAmBC,qBAAnB,MAAoC,CAAC,CAAzC,EAA4C;AAC1CF,iBAAaA,WAAWG,KAAX,CAAiBD,qBAAjB,CAAb;AACAF,eAAWI,GAAX;AACAJ,iBAAaA,WAAWK,IAAX,CAAgB,EAAhB,CAAb;AACD;;AAED,SAAO3B,WAAWsB,UAAX,EAAuBL,OAAvB,CAA+BW,gBAA/B,EAAuC,UAASC,CAAT,EAAYC,CAAZ,EAAe;AAC3D,QAAMC,MAAMF,EAAEG,KAAF,CAAQ,CAAR,EAAW,CAAC,CAAZ,CAAZ;;AAEA;AACA;AACA,QAAIlC,MAAMiC,GAAN,CAAJ,EAAgB;AACd,iCAAyBA,GAAzB,eAAsCA,GAAtC;AACD;AACD,QAAME,QAAQ/B,YAAY6B,GAAZ,IAAmB7B,YAAY6B,GAAZ,EAAiBE,KAApC,GAA4CF,GAA1D;AACA,0BAAoBG,gBAApB,GAAgCD,KAAhC,SAAyCE,UAAzC,eAAsDF,KAAtD;AACD,GAVM,CAAP;AAWD","file":"helper.js","sourcesContent":["import { REGEXP, IMAGE_SPLIT } from './constant';\nimport emoji, { prefixUrl, ext } from './emoji';\n\nconst emojiObejct = arrayToObject(emoji, 'title');\n\nexport function isFunction(functionToCheck) {\n  return (\n    functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'\n  );\n}\n\nexport function isUrl(userInput) {\n  const regexp = /(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\n  var res = userInput.match(regexp);\n  if (res === null) return false;\n  else return true;\n}\n\n/**\n * 将对象数组转换为对象\n * @param {array} array Array of Objects\n * @param {string} keyField string\n */\nexport function arrayToObject(array, keyField) {\n  return array.reduce((obj, item) => {\n    obj[item[keyField]] = item;\n    return obj;\n  }, {});\n}\n\n/**\n * HTML 编码\n * 将 < > 等字符串进行编码\n * @param {string} str 文本\n */\nexport function htmlEncode(str) {\n  if (!str) return '';\n  return str.replace(/<\\/?(?!a)\\w*\\b[^>]*>/gim, function(i) {\n    return '&#' + i.charCodeAt(0) + ';';\n  });\n}\n\n/**\n * 渲染编辑器\n * [x] => <img src=\"x\" />\n * @param {strig} content\n */\nexport function renderContent(content, onClick) {\n  let newContent = content;\n  if (newContent.indexOf(IMAGE_SPLIT) !== -1) {\n    newContent = newContent.split(IMAGE_SPLIT);\n    newContent.pop();\n    newContent = newContent.join('');\n  }\n\n  return htmlEncode(newContent).replace(REGEXP, function(a, b) {\n    const src = a.slice(1, -1);\n\n    // 兼容旧的评\n    // 因为旧的评论用 [img url] 方式存储的\n    if (isUrl(src)) {\n      return `<br/><img src=\"${src}\" alt=\"${src}\" style=\"max-width: 100%\" />`;\n    }\n    const value = emojiObejct[src] ? emojiObejct[src].value : src;\n    return `<img src=\"${prefixUrl}${value}.${ext}\" alt=\"${value}\" />`;\n  });\n}\n"]}
1
+{"version":3,"sources":["../src/helper.js"],"names":["isFunction","isUrl","arrayToObject","htmlEncode","renderContent","emojiObejct","emoji","functionToCheck","toString","call","userInput","regexp","res","match","array","keyField","reduce","obj","item","str","replace","i","charCodeAt","content","onClick","newContent","indexOf","IMAGE_SPLIT","split","pop","join","REGEXP","a","b","src","slice","value","prefixUrl","ext"],"mappings":";;;;;QAKgBA,U,GAAAA,U;QAMAC,K,GAAAA,K;QAYAC,a,GAAAA,a;QAYAC,U,GAAAA,U;QAYAC,a,GAAAA,a;;AA/ChB;;AACA;;;;;;AAEA,IAAMC,cAAcH,cAAcI,eAAd,EAAqB,OAArB,CAApB;;AAEO,SAASN,UAAT,CAAoBO,eAApB,EAAqC;AAC1C,SACEA,mBAAmB,GAAGC,QAAH,CAAYC,IAAZ,CAAiBF,eAAjB,MAAsC,mBAD3D;AAGD;;AAEM,SAASN,KAAT,CAAeS,SAAf,EAA0B;AAC/B,MAAMC,SAAS,kGAAf;AACA,MAAIC,MAAMF,UAAUG,KAAV,CAAgBF,MAAhB,CAAV;AACA,MAAIC,QAAQ,IAAZ,EAAkB,OAAO,KAAP,CAAlB,KACK,OAAO,IAAP;AACN;;AAED;;;;;AAKO,SAASV,aAAT,CAAuBY,KAAvB,EAA8BC,QAA9B,EAAwC;AAC7C,SAAOD,MAAME,MAAN,CAAa,UAACC,GAAD,EAAMC,IAAN,EAAe;AACjCD,QAAIC,KAAKH,QAAL,CAAJ,IAAsBG,IAAtB;AACA,WAAOD,GAAP;AACD,GAHM,EAGJ,EAHI,CAAP;AAID;;AAED;;;;;AAKO,SAASd,UAAT,CAAoBgB,GAApB,EAAyB;AAC9B,MAAI,CAACA,GAAL,EAAU,OAAO,EAAP;AACV,SAAOA,IAAIC,OAAJ,CAAY,OAAZ,EAAqB,UAASC,CAAT,EAAY;AACtC,WAAO,OAAOA,EAAEC,UAAF,CAAa,CAAb,CAAP,GAAyB,GAAhC;AACD,GAFM,CAAP;AAGD;;AAED;;;;;AAKO,SAASlB,aAAT,CAAuBmB,OAAvB,EAAgCC,OAAhC,EAAyC;AAC9C,MAAIC,aAAaF,OAAjB;AACA,MAAIE,WAAWC,OAAX,CAAmBC,qBAAnB,MAAoC,CAAC,CAAzC,EAA4C;AAC1CF,iBAAaA,WAAWG,KAAX,CAAiBD,qBAAjB,CAAb;AACAF,eAAWI,GAAX;AACAJ,iBAAaA,WAAWK,IAAX,CAAgB,EAAhB,CAAb;AACD;;AAED,SAAO3B,WAAWsB,UAAX,EAAuBL,OAAvB,CAA+BW,gBAA/B,EAAuC,UAASC,CAAT,EAAYC,CAAZ,EAAe;AAC3D,QAAMC,MAAMF,EAAEG,KAAF,CAAQ,CAAR,EAAW,CAAC,CAAZ,CAAZ;;AAEA;AACA;AACA,QAAIlC,MAAMiC,GAAN,CAAJ,EAAgB;AACd,kCAAyBA,GAAzB,iBAAsCA,GAAtC;AACD;AACD,QAAME,QAAQ/B,YAAY6B,GAAZ,IAAmB7B,YAAY6B,GAAZ,EAAiBE,KAApC,GAA4CF,GAA1D;AACA,2BAAoBG,gBAApB,GAAgCD,KAAhC,SAAyCE,UAAzC,iBAAsDF,KAAtD;AACD,GAVM,CAAP;AAWD","file":"helper.js","sourcesContent":["import { REGEXP, IMAGE_SPLIT } from \"./constant\";\nimport emoji, { prefixUrl, ext } from \"./emoji\";\n\nconst emojiObejct = arrayToObject(emoji, \"title\");\n\nexport function isFunction(functionToCheck) {\n  return (\n    functionToCheck && {}.toString.call(functionToCheck) === \"[object Function]\"\n  );\n}\n\nexport function isUrl(userInput) {\n  const regexp = /(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\n  var res = userInput.match(regexp);\n  if (res === null) return false;\n  else return true;\n}\n\n/**\n * 将对象数组转换为对象\n * @param {array} array Array of Objects\n * @param {string} keyField string\n */\nexport function arrayToObject(array, keyField) {\n  return array.reduce((obj, item) => {\n    obj[item[keyField]] = item;\n    return obj;\n  }, {});\n}\n\n/**\n * HTML 编码\n * 将 < > 等字符串进行编码\n * @param {string} str 文本\n */\nexport function htmlEncode(str) {\n  if (!str) return \"\";\n  return str.replace(/<>/gim, function(i) {\n    return \"&#\" + i.charCodeAt(0) + \";\";\n  });\n}\n\n/**\n * 渲染编辑器\n * [x] => <img src=\"x\" />\n * @param {strig} content\n */\nexport function renderContent(content, onClick) {\n  let newContent = content;\n  if (newContent.indexOf(IMAGE_SPLIT) !== -1) {\n    newContent = newContent.split(IMAGE_SPLIT);\n    newContent.pop();\n    newContent = newContent.join(\"\");\n  }\n\n  return htmlEncode(newContent).replace(REGEXP, function(a, b) {\n    const src = a.slice(1, -1);\n\n    // 兼容旧的评\n    // 因为旧的评论用 [img url] 方式存储的\n    if (isUrl(src)) {\n      return `<br/><img src=\"${src}\" alt=\"${src}\" style=\"max-width: 100%\" />`;\n    }\n    const value = emojiObejct[src] ? emojiObejct[src].value : src;\n    return `<img src=\"${prefixUrl}${value}.${ext}\" alt=\"${value}\" />`;\n  });\n}\n"]}

+ 15
- 14
lib/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
3
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
 
4
 
5
-var _react = require('react');
5
+var _react = require("react");
6
 
6
 
7
 var _react2 = _interopRequireDefault(_react);
7
 var _react2 = _interopRequireDefault(_react);
8
 
8
 
9
-var _reactDom = require('react-dom');
9
+var _reactDom = require("react-dom");
10
 
10
 
11
 var _reactDom2 = _interopRequireDefault(_reactDom);
11
 var _reactDom2 = _interopRequireDefault(_reactDom);
12
 
12
 
13
-var _App = require('./App');
13
+var _App = require("./App");
14
 
14
 
15
 var _App2 = _interopRequireDefault(_App);
15
 var _App2 = _interopRequireDefault(_App);
16
 
16
 
17
-var _registerServiceWorker = require('./registerServiceWorker');
17
+var _registerServiceWorker = require("./registerServiceWorker");
18
 
18
 
19
 var _registerServiceWorker2 = _interopRequireDefault(_registerServiceWorker);
19
 var _registerServiceWorker2 = _interopRequireDefault(_registerServiceWorker);
20
 
20
 
27
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
27
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
28
 // e.g.
28
 // e.g.
29
 // import { Button, Icon } from "antd";
29
 // import { Button, Icon } from "antd";
30
+// import App, { Editor, RenderText } from "./App";
30
 
31
 
31
 
32
 
32
 var Index = function (_Component) {
33
 var Index = function (_Component) {
38
     var _this = _possibleConstructorReturn(this, (Index.__proto__ || Object.getPrototypeOf(Index)).call(this, props));
39
     var _this = _possibleConstructorReturn(this, (Index.__proto__ || Object.getPrototypeOf(Index)).call(this, props));
39
 
40
 
40
     _this.state = {
41
     _this.state = {
41
-      value: ''
42
+      value: ""
42
     };
43
     };
43
     _this.handleChangeValue = _this.handleChangeValue.bind(_this);
44
     _this.handleChangeValue = _this.handleChangeValue.bind(_this);
44
     _this.handleChangeSubmit = _this.handleChangeSubmit.bind(_this);
45
     _this.handleChangeSubmit = _this.handleChangeSubmit.bind(_this);
46
   }
47
   }
47
 
48
 
48
   _createClass(Index, [{
49
   _createClass(Index, [{
49
-    key: 'handleChangeValue',
50
+    key: "handleChangeValue",
50
     value: function handleChangeValue(value) {
51
     value: function handleChangeValue(value) {
51
       this.setState({ value: value });
52
       this.setState({ value: value });
52
-      console.log('handleChangeValue value: ', value);
53
+      console.log("handleChangeValue value: ", value);
53
     }
54
     }
54
   }, {
55
   }, {
55
-    key: 'handleChangeSubmit',
56
+    key: "handleChangeSubmit",
56
     value: function handleChangeSubmit(_ref) {
57
     value: function handleChangeSubmit(_ref) {
57
       var _this2 = this;
58
       var _this2 = this;
58
 
59
 
64
           _this2.setState({ loading: false });
65
           _this2.setState({ loading: false });
65
         }, 2000);
66
         }, 2000);
66
       });
67
       });
67
-      console.log('submit text: ', text);
68
-      console.log('submit files: ', files);
68
+      console.log("submit text: ", text);
69
+      console.log("submit files: ", files);
69
     }
70
     }
70
   }, {
71
   }, {
71
-    key: 'render',
72
+    key: "render",
72
     value: function render() {
73
     value: function render() {
73
       // 最简单的用法
74
       // 最简单的用法
74
       return _react2.default.createElement(
75
       return _react2.default.createElement(
75
         _App2.default,
76
         _App2.default,
76
-        { type: 1, businessId: 'test' },
77
+        { type: 1, businessId: "test" },
77
         _react2.default.createElement(_App.Editor, { maxUpload: 4 })
78
         _react2.default.createElement(_App.Editor, { maxUpload: 4 })
78
       );
79
       );
79
 
80
 
122
   return Index;
123
   return Index;
123
 }(_react.Component);
124
 }(_react.Component);
124
 
125
 
125
-_reactDom2.default.render(_react2.default.createElement(Index, null), document.getElementById('root-comment'));
126
+_reactDom2.default.render(_react2.default.createElement(Index, null), document.getElementById("root-comment"));
126
 (0, _registerServiceWorker2.default)();
127
 (0, _registerServiceWorker2.default)();
127
 //# sourceMappingURL=index.js.map
128
 //# sourceMappingURL=index.js.map

+ 1
- 1
lib/index.js.map View File

1
-{"version":3,"sources":["../src/index.js"],"names":["Index","props","state","value","handleChangeValue","bind","handleChangeSubmit","setState","console","log","text","files","loading","setTimeout","Component","ReactDOM","render","document","getElementById"],"mappings":";;;;AAAA;;;;AACA;;;;AAGA;;;;AACA;;;;;;;;;;;AAHA;AACA;;;IAIMA,K;;;AACJ,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA,8GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,aAAO;AADI,KAAb;AAGA,UAAKC,iBAAL,GAAyB,MAAKA,iBAAL,CAAuBC,IAAvB,OAAzB;AACA,UAAKC,kBAAL,GAA0B,MAAKA,kBAAL,CAAwBD,IAAxB,OAA1B;AANiB;AAOlB;;;;sCAEiBF,K,EAAO;AACvB,WAAKI,QAAL,CAAc,EAAEJ,YAAF,EAAd;AACAK,cAAQC,GAAR,CAAY,2BAAZ,EAAyCN,KAAzC;AACD;;;6CAEmC;AAAA;;AAAA,UAAfO,IAAe,QAAfA,IAAe;AAAA,UAATC,KAAS,QAATA,KAAS;;AAClC,WAAKJ,QAAL,CAAc,EAAEK,SAAS,IAAX,EAAd,EAAiC,YAAM;AACrCC,mBAAW,YAAM;AACf,iBAAKN,QAAL,CAAc,EAAEK,SAAS,KAAX,EAAd;AACD,SAFD,EAEG,IAFH;AAGD,OAJD;AAKAJ,cAAQC,GAAR,CAAY,eAAZ,EAA6BC,IAA7B;AACAF,cAAQC,GAAR,CAAY,gBAAZ,EAA8BE,KAA9B;AACD;;;6BAEQ;AACP;AACA,aACE;AAAC,qBAAD;AAAA,UAAK,MAAM,CAAX,EAAc,YAAW,MAAzB;AACE,sCAAC,WAAD,IAAQ,WAAW,CAAnB;AADF,OADF;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACD;;;;EAxEiBG,gB;;AA2EpBC,mBAASC,MAAT,CAAgB,8BAAC,KAAD,OAAhB,EAA2BC,SAASC,cAAT,CAAwB,cAAxB,CAA3B;AACA","file":"index.js","sourcesContent":["import React, { Component } from 'react';\nimport ReactDOM from 'react-dom';\n// e.g.\n// import { Button, Icon } from \"antd\";\nimport App, { Editor, RenderText } from './App';\nimport registerServiceWorker from './registerServiceWorker';\n\nclass Index extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      value: '',\n    };\n    this.handleChangeValue = this.handleChangeValue.bind(this);\n    this.handleChangeSubmit = this.handleChangeSubmit.bind(this);\n  }\n\n  handleChangeValue(value) {\n    this.setState({ value });\n    console.log('handleChangeValue value: ', value);\n  }\n\n  handleChangeSubmit({ text, files }) {\n    this.setState({ loading: true }, () => {\n      setTimeout(() => {\n        this.setState({ loading: false });\n      }, 2000);\n    });\n    console.log('submit text: ', text);\n    console.log('submit files: ', files);\n  }\n\n  render() {\n    // 最简单的用法\n    return (\n      <App type={1} businessId=\"test\">\n        <Editor maxUpload={4} />\n      </App>\n    );\n\n    // e.g.\n    // 复杂的用户法\n    // const props = {\n    //   type: 1,\n    //   businessId: \"1\",\n    //   API: \"http://api.links123.net/comment/v1\",\n    //   showList: true\n    // };\n\n    // const editorProps = {\n    //   showEmoji: true,\n    //   placeholder: \"说点什么吧\",\n    //   rows: 5,\n    //   btnLoading: this.state.loading,\n    //   btnDisable: this.state.loading,\n    //   btnSubmitText: \"提交\",\n    //   value: this.state.value,\n    //   onChange: v => this.handleChangeValue(v),\n    //   onSubmit: v => this.handleChangeSubmit(v),\n    //   button: (\n    //     <Button\n    //       type=\"primary\"\n    //       ghost\n    //       // onClick={() => console.log('click btn: ', this.state.value)}\n    //     >\n    //       自定义按钮\n    //     </Button>\n    //   ),\n    //   emojiToolIcon: <Icon type=\"smile\" style={{ fontSize: 23 }} />,\n    //   imageToolIcon: (\n    //     <Icon type=\"cloud-upload-o\" style={{ fontSize: 25, marginLeft: 10 }} />\n    //   )\n    // };\n\n    // return (\n    //   <App {...props}>\n    //     <Editor {...editorProps} />\n    //   </App>\n    // );\n  }\n}\n\nReactDOM.render(<Index />, document.getElementById('root-comment'));\nregisterServiceWorker();\n"]}
1
+{"version":3,"sources":["../src/index.js"],"names":["Index","props","state","value","handleChangeValue","bind","handleChangeSubmit","setState","console","log","text","files","loading","setTimeout","Component","ReactDOM","render","document","getElementById"],"mappings":";;;;AAAA;;;;AACA;;;;AAIA;;;;AACA;;;;;;;;;;;AAJA;AACA;AACA;;;IAIMA,K;;;AACJ,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA,8GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,aAAO;AADI,KAAb;AAGA,UAAKC,iBAAL,GAAyB,MAAKA,iBAAL,CAAuBC,IAAvB,OAAzB;AACA,UAAKC,kBAAL,GAA0B,MAAKA,kBAAL,CAAwBD,IAAxB,OAA1B;AANiB;AAOlB;;;;sCAEiBF,K,EAAO;AACvB,WAAKI,QAAL,CAAc,EAAEJ,YAAF,EAAd;AACAK,cAAQC,GAAR,CAAY,2BAAZ,EAAyCN,KAAzC;AACD;;;6CAEmC;AAAA;;AAAA,UAAfO,IAAe,QAAfA,IAAe;AAAA,UAATC,KAAS,QAATA,KAAS;;AAClC,WAAKJ,QAAL,CAAc,EAAEK,SAAS,IAAX,EAAd,EAAiC,YAAM;AACrCC,mBAAW,YAAM;AACf,iBAAKN,QAAL,CAAc,EAAEK,SAAS,KAAX,EAAd;AACD,SAFD,EAEG,IAFH;AAGD,OAJD;AAKAJ,cAAQC,GAAR,CAAY,eAAZ,EAA6BC,IAA7B;AACAF,cAAQC,GAAR,CAAY,gBAAZ,EAA8BE,KAA9B;AACD;;;6BAEQ;AACP;AACA,aACE;AAAC,qBAAD;AAAA,UAAK,MAAM,CAAX,EAAc,YAAW,MAAzB;AACE,sCAAC,WAAD,IAAQ,WAAW,CAAnB;AADF,OADF;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACD;;;;EAxEiBG,gB;;AA2EpBC,mBAASC,MAAT,CAAgB,8BAAC,KAAD,OAAhB,EAA2BC,SAASC,cAAT,CAAwB,cAAxB,CAA3B;AACA","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\nimport ReactDOM from \"react-dom\";\n// e.g.\n// import { Button, Icon } from \"antd\";\n// import App, { Editor, RenderText } from \"./App\";\nimport App, { Editor } from \"./App\";\nimport registerServiceWorker from \"./registerServiceWorker\";\n\nclass Index extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      value: \"\"\n    };\n    this.handleChangeValue = this.handleChangeValue.bind(this);\n    this.handleChangeSubmit = this.handleChangeSubmit.bind(this);\n  }\n\n  handleChangeValue(value) {\n    this.setState({ value });\n    console.log(\"handleChangeValue value: \", value);\n  }\n\n  handleChangeSubmit({ text, files }) {\n    this.setState({ loading: true }, () => {\n      setTimeout(() => {\n        this.setState({ loading: false });\n      }, 2000);\n    });\n    console.log(\"submit text: \", text);\n    console.log(\"submit files: \", files);\n  }\n\n  render() {\n    // 最简单的用法\n    return (\n      <App type={1} businessId=\"test\">\n        <Editor maxUpload={4} />\n      </App>\n    );\n\n    // e.g.\n    // 复杂的用户法\n    // const props = {\n    //   type: 1,\n    //   businessId: \"1\",\n    //   API: \"http://api.links123.net/comment/v1\",\n    //   showList: true\n    // };\n\n    // const editorProps = {\n    //   showEmoji: true,\n    //   placeholder: \"说点什么吧\",\n    //   rows: 5,\n    //   btnLoading: this.state.loading,\n    //   btnDisable: this.state.loading,\n    //   btnSubmitText: \"提交\",\n    //   value: this.state.value,\n    //   onChange: v => this.handleChangeValue(v),\n    //   onSubmit: v => this.handleChangeSubmit(v),\n    //   button: (\n    //     <Button\n    //       type=\"primary\"\n    //       ghost\n    //       // onClick={() => console.log('click btn: ', this.state.value)}\n    //     >\n    //       自定义按钮\n    //     </Button>\n    //   ),\n    //   emojiToolIcon: <Icon type=\"smile\" style={{ fontSize: 23 }} />,\n    //   imageToolIcon: (\n    //     <Icon type=\"cloud-upload-o\" style={{ fontSize: 25, marginLeft: 10 }} />\n    //   )\n    // };\n\n    // return (\n    //   <App {...props}>\n    //     <Editor {...editorProps} />\n    //   </App>\n    // );\n  }\n}\n\nReactDOM.render(<Index />, document.getElementById(\"root-comment\"));\nregisterServiceWorker();\n"]}

+ 11
- 11
lib/lang/index.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
6
 // 语言包
6
 // 语言包
7
 // 英文短语和中文提示的对应
7
 // 英文短语和中文提示的对应
8
 var data = {
8
 var data = {
9
-  'not found': '没有数据',
10
-  'auth failed': '请先登录',
11
-  'create comment failed': '创建评论失败',
12
-  'comment favor failed': '评论点赞失败',
13
-  'delete comment favor failed': '评论取消点赞失败',
14
-  'get comments failed': '获取评论列表失败',
15
-  'create reply failed': '创建回复失败',
16
-  'reply favor failed': '回复点赞失败',
17
-  'delete reply favor failed': '删除回复点赞失败',
18
-  'get replies failed': '获取回复列表失败'
9
+  "not found": "没有数据",
10
+  "auth failed": "请先登录",
11
+  "create comment failed": "创建评论失败",
12
+  "comment favor failed": "评论点赞失败",
13
+  "delete comment favor failed": "评论取消点赞失败",
14
+  "get comments failed": "获取评论列表失败",
15
+  "create reply failed": "创建回复失败",
16
+  "reply favor failed": "回复点赞失败",
17
+  "delete reply favor failed": "删除回复点赞失败",
18
+  "get replies failed": "获取回复列表失败"
19
 };
19
 };
20
 
20
 
21
 exports.default = data;
21
 exports.default = data;

+ 1
- 1
lib/lang/index.js.map View File

1
-{"version":3,"sources":["../../src/lang/index.js"],"names":["data"],"mappings":";;;;;AAAA;AACA;AACA,IAAMA,OAAO;AACX,eAAa,MADF;AAEX,iBAAe,MAFJ;AAGX,2BAAyB,QAHd;AAIX,0BAAwB,QAJb;AAKX,iCAA+B,UALpB;AAMX,yBAAuB,UANZ;AAOX,yBAAuB,QAPZ;AAQX,wBAAsB,QARX;AASX,+BAA6B,UATlB;AAUX,wBAAsB;AAVX,CAAb;;kBAaeA,I","file":"index.js","sourcesContent":["// 语言包\n// 英文短语和中文提示的对应\nconst data = {\n  'not found': '没有数据',\n  'auth failed': '请先登录',\n  'create comment failed': '创建评论失败',\n  'comment favor failed': '评论点赞失败',\n  'delete comment favor failed': '评论取消点赞失败',\n  'get comments failed': '获取评论列表失败',\n  'create reply failed': '创建回复失败',\n  'reply favor failed': '回复点赞失败',\n  'delete reply favor failed': '删除回复点赞失败',\n  'get replies failed': '获取回复列表失败',\n};\n\nexport default data;\n"]}
1
+{"version":3,"sources":["../../src/lang/index.js"],"names":["data"],"mappings":";;;;;AAAA;AACA;AACA,IAAMA,OAAO;AACX,eAAa,MADF;AAEX,iBAAe,MAFJ;AAGX,2BAAyB,QAHd;AAIX,0BAAwB,QAJb;AAKX,iCAA+B,UALpB;AAMX,yBAAuB,UANZ;AAOX,yBAAuB,QAPZ;AAQX,wBAAsB,QARX;AASX,+BAA6B,UATlB;AAUX,wBAAsB;AAVX,CAAb;;kBAaeA,I","file":"index.js","sourcesContent":["// 语言包\n// 英文短语和中文提示的对应\nconst data = {\n  \"not found\": \"没有数据\",\n  \"auth failed\": \"请先登录\",\n  \"create comment failed\": \"创建评论失败\",\n  \"comment favor failed\": \"评论点赞失败\",\n  \"delete comment favor failed\": \"评论取消点赞失败\",\n  \"get comments failed\": \"获取评论列表失败\",\n  \"create reply failed\": \"创建回复失败\",\n  \"reply favor failed\": \"回复点赞失败\",\n  \"delete reply favor failed\": \"删除回复点赞失败\",\n  \"get replies failed\": \"获取回复列表失败\"\n};\n\nexport default data;\n"]}

+ 14
- 14
lib/registerServiceWorker.js View File

1
-'use strict';
1
+"use strict";
2
 
2
 
3
 Object.defineProperty(exports, "__esModule", {
3
 Object.defineProperty(exports, "__esModule", {
4
   value: true
4
   value: true
15
 // To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
15
 // To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
16
 // This link also includes instructions on opting out of this behavior.
16
 // This link also includes instructions on opting out of this behavior.
17
 
17
 
18
-var isLocalhost = Boolean(window.location.hostname === 'localhost' ||
18
+var isLocalhost = Boolean(window.location.hostname === "localhost" ||
19
 // [::1] is the IPv6 localhost address.
19
 // [::1] is the IPv6 localhost address.
20
-window.location.hostname === '[::1]' ||
20
+window.location.hostname === "[::1]" ||
21
 // 127.0.0.1/8 is considered localhost for IPv4.
21
 // 127.0.0.1/8 is considered localhost for IPv4.
22
 window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
22
 window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
23
 
23
 
24
 function register() {
24
 function register() {
25
-  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
25
+  if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
26
     // The URL constructor is available in all browsers that support SW.
26
     // The URL constructor is available in all browsers that support SW.
27
     var publicUrl = new URL(process.env.PUBLIC_URL, window.location);
27
     var publicUrl = new URL(process.env.PUBLIC_URL, window.location);
28
     if (publicUrl.origin !== window.location.origin) {
28
     if (publicUrl.origin !== window.location.origin) {
32
       return;
32
       return;
33
     }
33
     }
34
 
34
 
35
-    window.addEventListener('load', function () {
36
-      var swUrl = process.env.PUBLIC_URL + '/service-worker.js';
35
+    window.addEventListener("load", function () {
36
+      var swUrl = process.env.PUBLIC_URL + "/service-worker.js";
37
 
37
 
38
       if (isLocalhost) {
38
       if (isLocalhost) {
39
         // This is running on localhost. Lets check if a service worker still exists or not.
39
         // This is running on localhost. Lets check if a service worker still exists or not.
42
         // Add some additional logging to localhost, pointing developers to the
42
         // Add some additional logging to localhost, pointing developers to the
43
         // service worker/PWA documentation.
43
         // service worker/PWA documentation.
44
         navigator.serviceWorker.ready.then(function () {
44
         navigator.serviceWorker.ready.then(function () {
45
-          console.log('This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://goo.gl/SC7cgQ');
45
+          console.log("This web app is being served cache-first by a service " + "worker. To learn more, visit https://goo.gl/SC7cgQ");
46
         });
46
         });
47
       } else {
47
       } else {
48
         // Is not local host. Just register service worker
48
         // Is not local host. Just register service worker
57
     registration.onupdatefound = function () {
57
     registration.onupdatefound = function () {
58
       var installingWorker = registration.installing;
58
       var installingWorker = registration.installing;
59
       installingWorker.onstatechange = function () {
59
       installingWorker.onstatechange = function () {
60
-        if (installingWorker.state === 'installed') {
60
+        if (installingWorker.state === "installed") {
61
           if (navigator.serviceWorker.controller) {
61
           if (navigator.serviceWorker.controller) {
62
             // At this point, the old content will have been purged and
62
             // At this point, the old content will have been purged and
63
             // the fresh content will have been added to the cache.
63
             // the fresh content will have been added to the cache.
64
             // It's the perfect time to display a "New content is
64
             // It's the perfect time to display a "New content is
65
             // available; please refresh." message in your web app.
65
             // available; please refresh." message in your web app.
66
-            console.log('New content is available; please refresh.');
66
+            console.log("New content is available; please refresh.");
67
           } else {
67
           } else {
68
             // At this point, everything has been precached.
68
             // At this point, everything has been precached.
69
             // It's the perfect time to display a
69
             // It's the perfect time to display a
70
             // "Content is cached for offline use." message.
70
             // "Content is cached for offline use." message.
71
-            console.log('Content is cached for offline use.');
71
+            console.log("Content is cached for offline use.");
72
           }
72
           }
73
         }
73
         }
74
       };
74
       };
75
     };
75
     };
76
   }).catch(function (error) {
76
   }).catch(function (error) {
77
-    console.error('Error during service worker registration:', error);
77
+    console.error("Error during service worker registration:", error);
78
   });
78
   });
79
 }
79
 }
80
 
80
 
82
   // Check if the service worker can be found. If it can't reload the page.
82
   // Check if the service worker can be found. If it can't reload the page.
83
   fetch(swUrl).then(function (response) {
83
   fetch(swUrl).then(function (response) {
84
     // Ensure service worker exists, and that we really are getting a JS file.
84
     // Ensure service worker exists, and that we really are getting a JS file.
85
-    if (response.status === 404 || response.headers.get('content-type').indexOf('javascript') === -1) {
85
+    if (response.status === 404 || response.headers.get("content-type").indexOf("javascript") === -1) {
86
       // No service worker found. Probably a different app. Reload the page.
86
       // No service worker found. Probably a different app. Reload the page.
87
       navigator.serviceWorker.ready.then(function (registration) {
87
       navigator.serviceWorker.ready.then(function (registration) {
88
         registration.unregister().then(function () {
88
         registration.unregister().then(function () {
94
       registerValidSW(swUrl);
94
       registerValidSW(swUrl);
95
     }
95
     }
96
   }).catch(function () {
96
   }).catch(function () {
97
-    console.log('No internet connection found. App is running in offline mode.');
97
+    console.log("No internet connection found. App is running in offline mode.");
98
   });
98
   });
99
 }
99
 }
100
 
100
 
101
 function unregister() {
101
 function unregister() {
102
-  if ('serviceWorker' in navigator) {
102
+  if ("serviceWorker" in navigator) {
103
     navigator.serviceWorker.ready.then(function (registration) {
103
     navigator.serviceWorker.ready.then(function (registration) {
104
       registration.unregister();
104
       registration.unregister();
105
     });
105
     });

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


+ 3
- 13
src/App.js View File

1
 import React, { Component } from "react";
1
 import React, { Component } from "react";
2
 import PropTypes from "prop-types";
2
 import PropTypes from "prop-types";
3
-import { message, Tag } from "antd";
3
+import { message } from "antd";
4
 import axios from "axios";
4
 import axios from "axios";
5
 import { ERROR_DEFAULT, LIMIT } from "./constant";
5
 import { ERROR_DEFAULT, LIMIT } from "./constant";
6
 import { CommentContext } from "./Comment";
6
 import { CommentContext } from "./Comment";
335
    */
335
    */
336
   sOssSts() {
336
   sOssSts() {
337
     this.handleChangeLoading("sOssSts", true);
337
     this.handleChangeLoading("sOssSts", true);
338
+    const { API } = this.props;
338
     this.axios
339
     this.axios
339
-      .get(`http://api.links123.net/comment/v1/oss/sts`)
340
+      .get(`${API}/oss/sts`)
340
       .then(response => {
341
       .then(response => {
341
         this.setState({ oss: { ...response.data } });
342
         this.setState({ oss: { ...response.data } });
342
       })
343
       })
369
     return (
370
     return (
370
       <CommentContext.Provider value={value}>
371
       <CommentContext.Provider value={value}>
371
         <div className="comment">
372
         <div className="comment">
372
-          {this.props.showHeader && (
373
-            <div style={{ marginBottom: 15 }}>
374
-              <Tag className="comment-header-tag">留言</Tag>
375
-              <span className="comment-header-tip">口碑</span>
376
-              <span className="comment-header-text">
377
-                (全站挑出毛病或提出合理建议,奖励10到100元红包)
378
-              </span>
379
-            </div>
380
-          )}
381
           {this.props.showEditor && (
373
           {this.props.showEditor && (
382
             <CommentInput content={this.props.children} />
374
             <CommentInput content={this.props.children} />
383
           )}
375
           )}
398
   API: PropTypes.string, // 评论的 API 前缀
390
   API: PropTypes.string, // 评论的 API 前缀
399
   showList: PropTypes.bool, // 是否显示评论列表
391
   showList: PropTypes.bool, // 是否显示评论列表
400
   showEditor: PropTypes.bool, // 是否显示评论输入框
392
   showEditor: PropTypes.bool, // 是否显示评论输入框
401
-  showHeader: PropTypes.bool, // 是否显示评论顶部的提示
402
   showAlertComment: PropTypes.bool, // 评论成功之后,是否通过 Antd 的 Message 组件进行提示
393
   showAlertComment: PropTypes.bool, // 评论成功之后,是否通过 Antd 的 Message 组件进行提示
403
   showAlertReply: PropTypes.bool, // 回复成功之后,是否通过 Antd 的 Message 组件进行提示
394
   showAlertReply: PropTypes.bool, // 回复成功之后,是否通过 Antd 的 Message 组件进行提示
404
   showAlertFavor: PropTypes.bool // 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示
395
   showAlertFavor: PropTypes.bool // 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示
408
   API: "http://api.links123.net/comment/v1",
399
   API: "http://api.links123.net/comment/v1",
409
   showList: true,
400
   showList: true,
410
   showEditor: true,
401
   showEditor: true,
411
-  showHeader: true,
412
   showAlertComment: false,
402
   showAlertComment: false,
413
   showAlertReply: false,
403
   showAlertReply: false,
414
   showAlertFavor: false
404
   showAlertFavor: false

+ 3
- 3
src/components/ContentItem/index.js View File

77
         </div>
77
         </div>
78
         <div className="comment-item-right">
78
         <div className="comment-item-right">
79
           <div>
79
           <div>
80
-            <a href={`/${content.user_id}`}>
80
+            {/* <a href={`/${content.user_id}`}>
81
               {content.user_name || "暂无昵称"}
81
               {content.user_name || "暂无昵称"}
82
-            </a>
83
-
82
+            </a> */}
83
+            <strong>{content.user_name || "暂无昵称"}</strong>
84
             <span style={{ marginLeft: 10 }}>
84
             <span style={{ marginLeft: 10 }}>
85
               <Tooltip
85
               <Tooltip
86
                 placement="top"
86
                 placement="top"

+ 1
- 1
src/helper.js View File

35
  */
35
  */
36
 export function htmlEncode(str) {
36
 export function htmlEncode(str) {
37
   if (!str) return "";
37
   if (!str) return "";
38
-  return str.replace(/<\/?(?!a)\w*\b[^>]*>/gim, function(i) {
38
+  return str.replace(/<>/gim, function(i) {
39
     return "&#" + i.charCodeAt(0) + ";";
39
     return "&#" + i.charCodeAt(0) + ";";
40
   });
40
   });
41
 }
41
 }

+ 2
- 1
src/index.js View File

2
 import ReactDOM from "react-dom";
2
 import ReactDOM from "react-dom";
3
 // e.g.
3
 // e.g.
4
 // import { Button, Icon } from "antd";
4
 // import { Button, Icon } from "antd";
5
-import App, { Editor, RenderText } from "./App";
5
+// import App, { Editor, RenderText } from "./App";
6
+import App, { Editor } from "./App";
6
 import registerServiceWorker from "./registerServiceWorker";
7
 import registerServiceWorker from "./registerServiceWorker";
7
 
8
 
8
 class Index extends Component {
9
 class Index extends Component {