narro 6 年 前
コミット
538d8abdb2
共有1 個のファイルを変更した61 個の追加111 個の削除を含む
  1. 61
    111
      src/components/Editor/index.js

+ 61
- 111
src/components/Editor/index.js ファイルの表示

@@ -178,121 +178,71 @@ class Editor extends React.Component {
178 178
             )}
179 179
 
180 180
             {showUpload ? (
181
-              closeUploadWhenBlur ? (
182
-                <Popover
183
-                  trigger="click"
184
-                  overlayStyle={{ zIndex: 999 }}
185
-                  content={
186
-                    <div
187
-                      style={{
188
-                        width: 112 * maxUpload,
189
-                        minHeight: 100,
190
-                        margin: "0 auto"
191
-                      }}
192
-                    >
193
-                      <Upload
194
-                        onChangeFileList={this.handleChangeFileList}
195
-                        onUpload={this.handleUpload}
196
-                        maxUpload={maxUpload}
197
-                        fileList={this.state.fileList}
198
-                      />
199
-                    </div>
200
-                  }
201
-                  placement="bottomLeft"
202
-                  title={
203
-                    <div style={{ margin: "5px auto" }}>
204
-                      <span>
205
-                        上传图片
206
-                        {maxUpload >= 2 ? (
207
-                          <span style={{ color: "#666", fontWeight: 400 }}>
208
-                            (您还能上传{maxUpload - this.state.fileList.length}张图片)
209
-                          </span>
210
-                        ) : null}
211
-                      </span>
212
-                      <Icon
213
-                        type="close"
214
-                        onClick={() => this.handleShowUpload(false)}
215
-                        style={{
216
-                          float: "right",
217
-                          cursor: "pointer",
218
-                          marginTop: 4
219
-                        }}
220
-                      />
221
-                    </div>
222
-                  }
223
-                >
224
-                  {imageToolIcon ? (
225
-                    React.cloneElement(imageToolIcon, {
226
-                      onClick: () => this.handleShowUpload(true)
227
-                    })
228
-                  ) : (
229
-                    <Icon
230
-                      type="picture"
231
-                      className="comment-toolbar-icon"
232
-                      style={{ marginLeft: 10 }}
233
-                      onClick={() => this.handleShowUpload(true)}
181
+              <Popover
182
+                trigger="click"
183
+                visible={this.state.showUpload}
184
+                overlayStyle={{ zIndex: 999 }}
185
+                onVisibleChange={
186
+                  closeUploadWhenBlur
187
+                    ? visible => {
188
+                        this.handleShowUpload(visible);
189
+                      }
190
+                    : null
191
+                }
192
+                content={
193
+                  <div
194
+                    style={{
195
+                      width: 112 * maxUpload,
196
+                      minHeight: 100,
197
+                      margin: "0 auto"
198
+                    }}
199
+                  >
200
+                    <Upload
201
+                      onChangeFileList={this.handleChangeFileList}
202
+                      onUpload={this.handleUpload}
203
+                      maxUpload={maxUpload}
204
+                      fileList={this.state.fileList}
205
+                      showError={this.props.showError}
206
+                      onError={this.props.onError}
234 207
                     />
235
-                  )}
236
-                </Popover>
237
-              ) : (
238
-                <Popover
239
-                  visible={this.state.showUpload}
240
-                  overlayStyle={{ zIndex: 999 }}
241
-                  content={
242
-                    <div
208
+                  </div>
209
+                }
210
+                placement="bottomLeft"
211
+                title={
212
+                  <div style={{ margin: "5px auto" }}>
213
+                    <span>
214
+                      上传图片
215
+                      {maxUpload >= 2 ? (
216
+                        <span style={{ color: "#666", fontWeight: 400 }}>
217
+                          (您还能上传{maxUpload - this.state.fileList.length}张图片)
218
+                        </span>
219
+                      ) : null}
220
+                    </span>
221
+                    <Icon
222
+                      type="close"
223
+                      onClick={() => this.handleShowUpload(false)}
243 224
                       style={{
244
-                        width: 112 * maxUpload,
245
-                        minHeight: 100,
246
-                        margin: "0 auto"
225
+                        float: "right",
226
+                        cursor: "pointer",
227
+                        marginTop: 4
247 228
                       }}
248
-                    >
249
-                      <Upload
250
-                        onChangeFileList={this.handleChangeFileList}
251
-                        onUpload={this.handleUpload}
252
-                        maxUpload={maxUpload}
253
-                        fileList={this.state.fileList}
254
-                        showError={this.props.showError}
255
-                        onError={this.props.onError}
256
-                      />
257
-                    </div>
258
-                  }
259
-                  placement="bottomLeft"
260
-                  title={
261
-                    <div style={{ margin: "5px auto" }}>
262
-                      <span>
263
-                        上传图片
264
-                        {maxUpload >= 2 ? (
265
-                          <span style={{ color: "#666", fontWeight: 400 }}>
266
-                            (您还能上传{maxUpload - this.state.fileList.length}张图片)
267
-                          </span>
268
-                        ) : null}
269
-                      </span>
270
-                      <Icon
271
-                        type="close"
272
-                        onClick={() => this.handleShowUpload(false)}
273
-                        style={{
274
-                          float: "right",
275
-                          cursor: "pointer",
276
-                          marginTop: 4
277
-                        }}
278
-                      />
279
-                    </div>
280
-                  }
281
-                >
282
-                  {imageToolIcon ? (
283
-                    React.cloneElement(imageToolIcon, {
284
-                      onClick: () => this.handleShowUpload(true)
285
-                    })
286
-                  ) : (
287
-                    <Icon
288
-                      type="picture"
289
-                      className="comment-toolbar-icon"
290
-                      style={{ marginLeft: 10 }}
291
-                      onClick={() => this.handleShowUpload(true)}
292 229
                     />
293
-                  )}
294
-                </Popover>
295
-              )
230
+                  </div>
231
+                }
232
+              >
233
+                {imageToolIcon ? (
234
+                  React.cloneElement(imageToolIcon, {
235
+                    onClick: () => this.handleShowUpload(true)
236
+                  })
237
+                ) : (
238
+                  <Icon
239
+                    type="picture"
240
+                    className="comment-toolbar-icon"
241
+                    style={{ marginLeft: 10 }}
242
+                    onClick={() => this.handleShowUpload(true)}
243
+                  />
244
+                )}
245
+              </Popover>
296 246
             ) : null}
297 247
           </div>
298 248