Kaynağa Gözat

Merge branch 'master' of Hepper/comment into master

AdamFu 5 yıl önce
ebeveyn
işleme
f910fb548b

+ 12
- 3
lib/components/Editor/index.js Dosyayı Görüntüle

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

+ 1
- 1
lib/components/Editor/index.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 2
- 1
lib/index.js Dosyayı Görüntüle

@@ -69,7 +69,8 @@ if (process.env.NODE_ENV !== "production") {
69 69
       console.log(c);
70 70
     },
71 71
     editorProps: {
72
-      // emojiPopoverPlacement: "bottom"
72
+      // emojiPopoverPlacement: "bottom",
73
+      uploadPopoverPlacement: "top"
73 74
     }
74 75
   });
75 76
 }

+ 1
- 1
lib/index.js.map Dosyayı Görüntüle

@@ -1 +1 @@
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 Dosyayı Görüntüle

@@ -1,8 +1,8 @@
1 1
 {
2 2
     "name":       "comment",
3
-    "buildDate":  1559795177962,
3
+    "buildDate":  1560392257361,
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 Dosyayı Görüntüle

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

+ 11
- 2
src/components/Editor/index.js Dosyayı Görüntüle

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

+ 2
- 1
src/index.js Dosyayı Görüntüle

@@ -54,7 +54,8 @@ if (process.env.NODE_ENV !== "production") {
54 54
       console.log(c);
55 55
     },
56 56
     editorProps: {
57
-      // emojiPopoverPlacement: "bottom"
57
+      // emojiPopoverPlacement: "bottom",
58
+      uploadPopoverPlacement: "top"
58 59
     }
59 60
   });
60 61
 }