Преглед изворни кода

add: 图片上传框位置参数可传

zhengyingya пре 5 година
родитељ
комит
7a06eef4b7
2 измењених фајлова са 11 додато и 2 уклоњено
  1. 9
    1
      src/components/Editor/index.js
  2. 2
    1
      src/index.js

+ 9
- 1
src/components/Editor/index.js Прегледај датотеку

@@ -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,
@@ -249,6 +251,9 @@ class Editor extends React.Component {
249 251
                   trigger="click"
250 252
                   // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
251 253
                   // visible={this.state.showUpload}
254
+                  placement={uploadPopoverPlacement}
255
+                  overlayClassName={uploadOverlayClassName}
256
+                  autoAdjustOverflow={false}
252 257
                   overlayStyle={{ zIndex: 999 }}
253 258
                   onVisibleChange={
254 259
                     closeUploadWhenBlur
@@ -277,7 +282,6 @@ class Editor extends React.Component {
277 282
                       <div className="clearfix" />
278 283
                     </div>
279 284
                   }
280
-                  placement="bottomLeft"
281 285
                   title={
282 286
                     <div style={{ margin: "5px auto" }}>
283 287
                       <span>
@@ -348,6 +352,8 @@ Editor.propTypes = {
348 352
   showEmoji: PropTypes.bool,
349 353
   emojiPopoverPlacement: PropTypes.string,
350 354
   showUpload: PropTypes.bool,
355
+  uploadPopoverPlacement: PropTypes.string,
356
+  uploadOverlayClassName: PropTypes.string,
351 357
   multiple: PropTypes.bool,
352 358
   closeUploadWhenBlur: PropTypes.bool,
353 359
   maxUpload: PropTypes.number,
@@ -374,6 +380,8 @@ Editor.defaultProps = {
374 380
   multiple: true,
375 381
   emojiPopoverPlacement: "bottomLeft",
376 382
   closeUploadWhenBlur: false,
383
+  uploadPopoverPlacement: "bottomLeft",
384
+  uploadOverlayClassName: "",
377 385
   maxUpload: 1,
378 386
   // btnSubmitText: "发表",
379 387
   btnLoading: false,

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

@@ -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
 }