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