Browse Source

Merge branch 'master' of Hepper/comment into master

AdamFu 5 years ago
parent
commit
f910fb548b

+ 12
- 3
lib/components/Editor/index.js View File

277
           showUpload = _props.showUpload,
277
           showUpload = _props.showUpload,
278
           multiple = _props.multiple,
278
           multiple = _props.multiple,
279
           emojiPopoverPlacement = _props.emojiPopoverPlacement,
279
           emojiPopoverPlacement = _props.emojiPopoverPlacement,
280
+          uploadPopoverPlacement = _props.uploadPopoverPlacement,
281
+          uploadOverlayClassName = _props.uploadOverlayClassName,
280
           closeUploadWhenBlur = _props.closeUploadWhenBlur,
282
           closeUploadWhenBlur = _props.closeUploadWhenBlur,
281
           maxUpload = _props.maxUpload,
283
           maxUpload = _props.maxUpload,
282
           btnLoading = _props.btnLoading,
284
           btnLoading = _props.btnLoading,
325
                   trigger: "click",
327
                   trigger: "click",
326
                   placement: emojiPopoverPlacement,
328
                   placement: emojiPopoverPlacement,
327
                   autoAdjustOverflow: false,
329
                   autoAdjustOverflow: false,
330
+                  overlayStyle: { zIndex: 999 },
328
                   content: _react2.default.createElement(
331
                   content: _react2.default.createElement(
329
                     "div",
332
                     "div",
330
                     {
333
                     {
331
-                      style: { width: 240 },
334
+                      style: { width: 240, height: 205 },
332
                       onWheel: this.handleEmojiScroll
335
                       onWheel: this.handleEmojiScroll
333
                     },
336
                     },
334
                     _react2.default.createElement(_Emoji2.default, {
337
                     _react2.default.createElement(_Emoji2.default, {
348
                   trigger: "click"
351
                   trigger: "click"
349
                   // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
352
                   // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
350
                   // visible={this.state.showUpload}
353
                   // visible={this.state.showUpload}
351
-                  , overlayStyle: { zIndex: 999 },
354
+                  , placement: uploadPopoverPlacement,
355
+                  overlayClassName: uploadOverlayClassName,
356
+                  autoAdjustOverflow: false,
357
+                  overlayStyle: { zIndex: 999 },
352
                   onVisibleChange: closeUploadWhenBlur ? function (visible) {
358
                   onVisibleChange: closeUploadWhenBlur ? function (visible) {
353
                     _this3.handleShowUpload(visible);
359
                     _this3.handleShowUpload(visible);
354
                   } : null,
360
                   } : null,
372
                     }),
378
                     }),
373
                     _react2.default.createElement("div", { className: "clearfix" })
379
                     _react2.default.createElement("div", { className: "clearfix" })
374
                   ),
380
                   ),
375
-                  placement: "bottomLeft",
376
                   title: _react2.default.createElement(
381
                   title: _react2.default.createElement(
377
                     "div",
382
                     "div",
378
                     { style: { margin: "5px auto" } },
383
                     { style: { margin: "5px auto" } },
437
   showEmoji: _propTypes2.default.bool,
442
   showEmoji: _propTypes2.default.bool,
438
   emojiPopoverPlacement: _propTypes2.default.string,
443
   emojiPopoverPlacement: _propTypes2.default.string,
439
   showUpload: _propTypes2.default.bool,
444
   showUpload: _propTypes2.default.bool,
445
+  uploadPopoverPlacement: _propTypes2.default.string,
446
+  uploadOverlayClassName: _propTypes2.default.string,
440
   multiple: _propTypes2.default.bool,
447
   multiple: _propTypes2.default.bool,
441
   closeUploadWhenBlur: _propTypes2.default.bool,
448
   closeUploadWhenBlur: _propTypes2.default.bool,
442
   maxUpload: _propTypes2.default.number,
449
   maxUpload: _propTypes2.default.number,
463
   multiple: true,
470
   multiple: true,
464
   emojiPopoverPlacement: "bottomLeft",
471
   emojiPopoverPlacement: "bottomLeft",
465
   closeUploadWhenBlur: false,
472
   closeUploadWhenBlur: false,
473
+  uploadPopoverPlacement: "bottomLeft",
474
+  uploadOverlayClassName: "",
466
   maxUpload: 1,
475
   maxUpload: 1,
467
   // btnSubmitText: "发表",
476
   // btnSubmitText: "发表",
468
   btnLoading: false,
477
   btnLoading: false,

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


+ 2
- 1
lib/index.js View File

69
       console.log(c);
69
       console.log(c);
70
     },
70
     },
71
     editorProps: {
71
     editorProps: {
72
-      // emojiPopoverPlacement: "bottom"
72
+      // emojiPopoverPlacement: "bottom",
73
+      uploadPopoverPlacement: "top"
73
     }
74
     }
74
   });
75
   });
75
 }
76
 }

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

1
-{"version":3,"sources":["../src/index.js"],"names":["Index","props","editorProps","renderComment","config","id","Error","type","businessId","console","warn","API","ReactDOM","render","document","getElementById","window","process","env","NODE_ENV","businessUserId","userId","onCountChange","log","c"],"mappings":";;;;AAAA;;;;AACA;;;;AACA;;;;;;AACA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ;AAAA,SACZ;AAAC,iBAAD;AAAA,eAAK,sBAAL,EAAsB,oBAAtB,EAAqC,oBAArC,EAAoD,eAApD,IAAkEC,KAAlE;AACE,kCAAC,WAAD,aAAQ,WAAW,CAAnB,EAAsB,eAAtB,IAAoCA,MAAMC,WAA1C;AADF,GADY;AAAA,CAAd;;AAMA;;;;;;;;AAQA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOG,IAAZ,EAAkB;AAChB,UAAM,IAAID,KAAJ,CAAU,kBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOI,UAAZ,EAAwB;AACtB;AACAJ,WAAOI,UAAP,GAAoB,MAApB;AACAC,YAAQC,IAAR,CAAa,+BAAb;AACD;AACD,MAAI,CAACN,OAAOO,GAAZ,EAAiB;AACf;AACAP,WAAOO,GAAP,GAAa,oCAAb;AACAF,YAAQC,IAAR,CACE,sDADF;AAGD;;AAEDE,qBAASC,MAAT,CAAgB,8BAAC,KAAD,EAAWT,MAAX,CAAhB,EAAuCU,SAASC,cAAT,CAAwBX,OAAOC,EAA/B,CAAvC;AACA;AACD;;AAEDW,OAAOb,aAAP,GAAuBA,aAAvB;;AAEA,IAAIc,QAAQC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzChB,gBAAc;AACZE,QAAI,cADQ;AAEZE,UAAM,CAFM;AAGZC,gBAAY,MAHA;AAIZY,oBAAgB,CAJJ;AAKZC,YAAQ,KALI;AAMZC,mBAAe,0BAAK;AAClBb,cAAQc,GAAR,CAAYC,CAAZ;AACD,KARW;AASZtB,iBAAa;AACX;AADW;AATD,GAAd;AAaD;;AAED;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App, { Editor } from \"./App\";\n// import registerServiceWorker from \"./registerServiceWorker\";\n\nconst Index = props => (\n  <App showAlertComment showAlertReply showAlertFavor showError {...props}>\n    <Editor maxUpload={9} autoFocus {...props.editorProps} />\n  </App>\n);\n\n/**\n * 渲染评论组件\n * @param {object} config 编辑器配置\n *  - {string} id 渲染评论的DOM的 ID\n *  - {number} type 评论的 type\n *  - {string} businessId 评论的 businessId\n *  - {string} API, API 前缀, 默认 http://api.links123.net/comment/v1\n */\nfunction renderComment(config) {\n  if (!config.id) {\n    throw new Error(\"id is required\");\n  }\n  if (!config.type) {\n    throw new Error(\"type is required\");\n  }\n  if (!config.businessId) {\n    // throw new Error(\"businessId is required\");\n    config.businessId = \"test\";\n    console.warn(\"没有传入 businessId 参数,默认使用: test\");\n  }\n  if (!config.API) {\n    // throw new Error(\"API is required\");\n    config.API = \"http://api.links123.net/comment/v1\";\n    console.warn(\n      \"没有传入 API 参数,默认使用: http://api.links123.net/comment/v1\"\n    );\n  }\n\n  ReactDOM.render(<Index {...config} />, document.getElementById(config.id));\n  // registerServiceWorker();\n}\n\nwindow.renderComment = renderComment;\n\nif (process.env.NODE_ENV !== \"production\") {\n  renderComment({\n    id: \"root-comment\",\n    type: 1,\n    businessId: \"test\",\n    businessUserId: 4,\n    userId: 71299,\n    onCountChange: c => {\n      console.log(c);\n    },\n    editorProps: {\n      // emojiPopoverPlacement: \"bottom\"\n    }\n  });\n}\n\n// renderComment({\n//   id: \"root-comment\",\n//   type: 1,\n//   businessId: \"test\",\n//   API: 'http://api.links123.net/comment/v1',\n// });\n"]}
1
+{"version":3,"sources":["../src/index.js"],"names":["Index","props","editorProps","renderComment","config","id","Error","type","businessId","console","warn","API","ReactDOM","render","document","getElementById","window","process","env","NODE_ENV","businessUserId","userId","onCountChange","log","c","uploadPopoverPlacement"],"mappings":";;;;AAAA;;;;AACA;;;;AACA;;;;;;AACA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ;AAAA,SACZ;AAAC,iBAAD;AAAA,eAAK,sBAAL,EAAsB,oBAAtB,EAAqC,oBAArC,EAAoD,eAApD,IAAkEC,KAAlE;AACE,kCAAC,WAAD,aAAQ,WAAW,CAAnB,EAAsB,eAAtB,IAAoCA,MAAMC,WAA1C;AADF,GADY;AAAA,CAAd;;AAMA;;;;;;;;AAQA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOG,IAAZ,EAAkB;AAChB,UAAM,IAAID,KAAJ,CAAU,kBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOI,UAAZ,EAAwB;AACtB;AACAJ,WAAOI,UAAP,GAAoB,MAApB;AACAC,YAAQC,IAAR,CAAa,+BAAb;AACD;AACD,MAAI,CAACN,OAAOO,GAAZ,EAAiB;AACf;AACAP,WAAOO,GAAP,GAAa,oCAAb;AACAF,YAAQC,IAAR,CACE,sDADF;AAGD;;AAEDE,qBAASC,MAAT,CAAgB,8BAAC,KAAD,EAAWT,MAAX,CAAhB,EAAuCU,SAASC,cAAT,CAAwBX,OAAOC,EAA/B,CAAvC;AACA;AACD;;AAEDW,OAAOb,aAAP,GAAuBA,aAAvB;;AAEA,IAAIc,QAAQC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzChB,gBAAc;AACZE,QAAI,cADQ;AAEZE,UAAM,CAFM;AAGZC,gBAAY,MAHA;AAIZY,oBAAgB,CAJJ;AAKZC,YAAQ,KALI;AAMZC,mBAAe,0BAAK;AAClBb,cAAQc,GAAR,CAAYC,CAAZ;AACD,KARW;AASZtB,iBAAa;AACX;AACAuB,8BAAwB;AAFb;AATD,GAAd;AAcD;;AAED;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App, { Editor } from \"./App\";\n// import registerServiceWorker from \"./registerServiceWorker\";\n\nconst Index = props => (\n  <App showAlertComment showAlertReply showAlertFavor showError {...props}>\n    <Editor maxUpload={9} autoFocus {...props.editorProps} />\n  </App>\n);\n\n/**\n * 渲染评论组件\n * @param {object} config 编辑器配置\n *  - {string} id 渲染评论的DOM的 ID\n *  - {number} type 评论的 type\n *  - {string} businessId 评论的 businessId\n *  - {string} API, API 前缀, 默认 http://api.links123.net/comment/v1\n */\nfunction renderComment(config) {\n  if (!config.id) {\n    throw new Error(\"id is required\");\n  }\n  if (!config.type) {\n    throw new Error(\"type is required\");\n  }\n  if (!config.businessId) {\n    // throw new Error(\"businessId is required\");\n    config.businessId = \"test\";\n    console.warn(\"没有传入 businessId 参数,默认使用: test\");\n  }\n  if (!config.API) {\n    // throw new Error(\"API is required\");\n    config.API = \"http://api.links123.net/comment/v1\";\n    console.warn(\n      \"没有传入 API 参数,默认使用: http://api.links123.net/comment/v1\"\n    );\n  }\n\n  ReactDOM.render(<Index {...config} />, document.getElementById(config.id));\n  // registerServiceWorker();\n}\n\nwindow.renderComment = renderComment;\n\nif (process.env.NODE_ENV !== \"production\") {\n  renderComment({\n    id: \"root-comment\",\n    type: 1,\n    businessId: \"test\",\n    businessUserId: 4,\n    userId: 71299,\n    onCountChange: c => {\n      console.log(c);\n    },\n    editorProps: {\n      // emojiPopoverPlacement: \"bottom\",\n      uploadPopoverPlacement: \"top\"\n    }\n  });\n}\n\n// renderComment({\n//   id: \"root-comment\",\n//   type: 1,\n//   businessId: \"test\",\n//   API: 'http://api.links123.net/comment/v1',\n// });\n"]}

+ 4
- 4
lib/version.json View File

1
 {
1
 {
2
     "name":       "comment",
2
     "name":       "comment",
3
-    "buildDate":  1559795177962,
3
+    "buildDate":  1560392257361,
4
     "version":    "1.0.4",
4
     "version":    "1.0.4",
5
-    "numCommits": 137,
6
-    "hash":       "c861eb3",
7
-    "dirty":      true
5
+    "numCommits": 143,
6
+    "hash":       "7a06eef",
7
+    "dirty":      false
8
 }
8
 }

+ 1
- 1
package.json View File

14
   },
14
   },
15
   "private": true,
15
   "private": true,
16
   "dependencies": {
16
   "dependencies": {
17
-    "antd": "^3.6.6",
17
+    "antd": "^3.19.3",
18
     "axios": "^0.18.0",
18
     "axios": "^0.18.0",
19
     "dayjs": "^1.7.2",
19
     "dayjs": "^1.7.2",
20
     "js-cookie": "^2.2.0",
20
     "js-cookie": "^2.2.0",

+ 11
- 2
src/components/Editor/index.js View File

174
       showUpload,
174
       showUpload,
175
       multiple,
175
       multiple,
176
       emojiPopoverPlacement,
176
       emojiPopoverPlacement,
177
+      uploadPopoverPlacement,
178
+      uploadOverlayClassName,
177
       closeUploadWhenBlur,
179
       closeUploadWhenBlur,
178
       maxUpload,
180
       maxUpload,
179
       // btnSubmitText,
181
       // btnSubmitText,
222
                   trigger="click"
224
                   trigger="click"
223
                   placement={emojiPopoverPlacement}
225
                   placement={emojiPopoverPlacement}
224
                   autoAdjustOverflow={false}
226
                   autoAdjustOverflow={false}
227
+                  overlayStyle={{ zIndex: 999 }}
225
                   content={
228
                   content={
226
                     <div
229
                     <div
227
-                      style={{ width: 240 }}
230
+                      style={{ width: 240, height: 205 }}
228
                       onWheel={this.handleEmojiScroll}
231
                       onWheel={this.handleEmojiScroll}
229
                     >
232
                     >
230
                       <Emoji
233
                       <Emoji
248
                   trigger="click"
251
                   trigger="click"
249
                   // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
252
                   // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
250
                   // visible={this.state.showUpload}
253
                   // visible={this.state.showUpload}
254
+                  placement={uploadPopoverPlacement}
255
+                  overlayClassName={uploadOverlayClassName}
256
+                  autoAdjustOverflow={false}
251
                   overlayStyle={{ zIndex: 999 }}
257
                   overlayStyle={{ zIndex: 999 }}
252
                   onVisibleChange={
258
                   onVisibleChange={
253
                     closeUploadWhenBlur
259
                     closeUploadWhenBlur
276
                       <div className="clearfix" />
282
                       <div className="clearfix" />
277
                     </div>
283
                     </div>
278
                   }
284
                   }
279
-                  placement="bottomLeft"
280
                   title={
285
                   title={
281
                     <div style={{ margin: "5px auto" }}>
286
                     <div style={{ margin: "5px auto" }}>
282
                       <span>
287
                       <span>
347
   showEmoji: PropTypes.bool,
352
   showEmoji: PropTypes.bool,
348
   emojiPopoverPlacement: PropTypes.string,
353
   emojiPopoverPlacement: PropTypes.string,
349
   showUpload: PropTypes.bool,
354
   showUpload: PropTypes.bool,
355
+  uploadPopoverPlacement: PropTypes.string,
356
+  uploadOverlayClassName: PropTypes.string,
350
   multiple: PropTypes.bool,
357
   multiple: PropTypes.bool,
351
   closeUploadWhenBlur: PropTypes.bool,
358
   closeUploadWhenBlur: PropTypes.bool,
352
   maxUpload: PropTypes.number,
359
   maxUpload: PropTypes.number,
373
   multiple: true,
380
   multiple: true,
374
   emojiPopoverPlacement: "bottomLeft",
381
   emojiPopoverPlacement: "bottomLeft",
375
   closeUploadWhenBlur: false,
382
   closeUploadWhenBlur: false,
383
+  uploadPopoverPlacement: "bottomLeft",
384
+  uploadOverlayClassName: "",
376
   maxUpload: 1,
385
   maxUpload: 1,
377
   // btnSubmitText: "发表",
386
   // btnSubmitText: "发表",
378
   btnLoading: false,
387
   btnLoading: false,

+ 2
- 1
src/index.js View File

54
       console.log(c);
54
       console.log(c);
55
     },
55
     },
56
     editorProps: {
56
     editorProps: {
57
-      // emojiPopoverPlacement: "bottom"
57
+      // emojiPopoverPlacement: "bottom",
58
+      uploadPopoverPlacement: "top"
58
     }
59
     }
59
   });
60
   });
60
 }
61
 }