Roxas 3 years ago
parent
commit
b429321569

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


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


+ 13
- 2
lib/components/Editor/index.js View File

@@ -129,7 +129,7 @@ var Editor = function (_React$Component) {
129 129
       value: props.value || "", // 编辑器里面的值
130 130
       fileList: props.fileList || [], // 图片列表
131 131
       fileMap: {}, // 已经上传的图片路径和 uid 的映射 { uid: path }
132
-      uploadVisible: false
132
+      uploadVisible: false // 上传图片弹窗是否可视
133 133
     };
134 134
     _this.handleChange = _this.handleChange.bind(_this);
135 135
     _this.handleClickEmoji = _this.handleClickEmoji.bind(_this);
@@ -150,7 +150,8 @@ var Editor = function (_React$Component) {
150 150
     value: function componentDidMount() {
151 151
       var _props = this.props,
152 152
           app = _props.app,
153
-          onRef = _props.onRef;
153
+          onRef = _props.onRef,
154
+          uploadDefaultShow = _props.uploadDefaultShow;
154 155
 
155 156
       if (app.currentUser && (app.currentUser.user_id > 0 || app.currentUser.id > 0)) {
156 157
         app.sOssSts();
@@ -158,6 +159,14 @@ var Editor = function (_React$Component) {
158 159
       if ((0, _helper.isFunction)(onRef)) {
159 160
         onRef(this);
160 161
       }
162
+      if (uploadDefaultShow) {
163
+        var uploadFileList = this.props.fileList || this.state.fileList;
164
+        if (uploadFileList.length > 0) {
165
+          this.setState({
166
+            uploadVisible: true
167
+          });
168
+        }
169
+      }
161 170
     }
162 171
   }, {
163 172
     key: "handleEmojiScroll",
@@ -666,6 +675,7 @@ Editor.propTypes = {
666 675
   button: _propTypes2.default.node,
667 676
   emojiToolIcon: _propTypes2.default.node,
668 677
   imageToolIcon: _propTypes2.default.node,
678
+  uploadDefaultShow: _propTypes2.default.bool,
669 679
   showError: _propTypes2.default.bool,
670 680
   onError: _propTypes2.default.func,
671 681
   maxLength: _propTypes2.default.number,
@@ -680,6 +690,7 @@ Editor.defaultProps = {
680 690
   // placeholder: "说点什么吧",
681 691
   showEmoji: true,
682 692
   showUpload: true,
693
+  uploadDefaultShow: true,
683 694
   multiple: true,
684 695
   emojiPopoverPlacement: "bottomLeft",
685 696
   closeUploadWhenBlur: false,

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


+ 2
- 1
package.json View File

@@ -16,6 +16,7 @@
16 16
   "dependencies": {
17 17
     "antd": "^3.19.3",
18 18
     "axios": "^0.18.0",
19
+    "babel-plugin-transform-class-properties": "^6.24.1",
19 20
     "dayjs": "^1.8.25",
20 21
     "js-cookie": "^2.2.0",
21 22
     "prop-types": "^15.6.2",
@@ -42,13 +43,13 @@
42 43
     "lib": "babel ./src --out-dir ./lib --source-maps --copy-files"
43 44
   },
44 45
   "devDependencies": {
45
-    "cross-env": "^5.2.0",
46 46
     "babel-cli": "^6.26.0",
47 47
     "babel-plugin-import": "^1.8.0",
48 48
     "babel-plugin-transform-object-rest-spread": "^6.26.0",
49 49
     "babel-preset-env": "^1.7.0",
50 50
     "babel-preset-es2015": "^6.24.1",
51 51
     "babel-preset-react": "^6.24.1",
52
+    "cross-env": "^5.2.0",
52 53
     "husky": "^0.14.3",
53 54
     "lint-staged": "^7.2.0",
54 55
     "node-sass": "^4.9.4",