narro 6 years ago
parent
commit
6f99498da9

+ 3
- 0
CHANGELOG.md View File

1
 # CHANGELOG
1
 # CHANGELOG
2
 
2
 
3
+## 0.5.8
4
+- [x] Editor增加autoFocus属性
5
+
3
 ## 0.5.7
6
 ## 0.5.7
4
 - [x] fix: 修复评论内容不换行超出区域的问题
7
 - [x] fix: 修复评论内容不换行超出区域的问题
5
 
8
 

+ 1
- 1
README.md View File

54
 | showError           | boolean                         | true          | false    | 是否使用Antd的Message组件提示错误信息, 主要是上传图片出错的情况                                   |
54
 | showError           | boolean                         | true          | false    | 是否使用Antd的Message组件提示错误信息, 主要是上传图片出错的情况                                   |
55
 | onError             | function(msg,{response})        |               | false    | 错误回调, 出错了会被调用, 主要是上传图片出错的情况                                                |
55
 | onError             | function(msg,{response})        |               | false    | 错误回调, 出错了会被调用, 主要是上传图片出错的情况                                                |
56
 | maxLength           | number                          | 140           | false    | 限制最大输入字数                                                                                  |
56
 | maxLength           | number                          | 140           | false    | 限制最大输入字数                                                                                  |
57
-
57
+| autoFocus           | boolean                         | false         | false    | 编辑器自动聚焦                                                                                    |
58
 
58
 
59
 
59
 
60
 ### 什么时候不要使用 value/onChange/onSubmit
60
 ### 什么时候不要使用 value/onChange/onSubmit

+ 1
- 2
lib/components/ContentItem/index.js View File

183
               __html: (0, _helper.renderContent)(this.renderTextWithReply(newContent, content))
183
               __html: (0, _helper.renderContent)(this.renderTextWithReply(newContent, content))
184
             }
184
             }
185
           }),
185
           }),
186
-
187
           // image为空时不渲染comment-item-image
186
           // image为空时不渲染comment-item-image
188
-          imageList.length > 0 && imageList[0] !== '' && _react2.default.createElement(
187
+          imageList.length > 0 && imageList[0] !== "" && _react2.default.createElement(
189
             "div",
188
             "div",
190
             { className: "comment-item-image" },
189
             { className: "comment-item-image" },
191
             imageList.map(function (item, index) {
190
             imageList.map(function (item, index) {

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


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

265
           button = _props.button,
265
           button = _props.button,
266
           emojiToolIcon = _props.emojiToolIcon,
266
           emojiToolIcon = _props.emojiToolIcon,
267
           imageToolIcon = _props.imageToolIcon,
267
           imageToolIcon = _props.imageToolIcon,
268
-          maxLength = _props.maxLength;
268
+          maxLength = _props.maxLength,
269
+          autoFocus = _props.autoFocus;
269
 
270
 
270
       var handleSubmit = this.handleSubmit;
271
       var handleSubmit = this.handleSubmit;
271
       var disabledSubmit = btnDisabled || !this.props.value && !this.state.value && !this.state.fileList.length;
272
       var disabledSubmit = btnDisabled || !this.props.value && !this.state.value && !this.state.fileList.length;
296
               return _this3.handleChange(e.target.value);
297
               return _this3.handleChange(e.target.value);
297
             },
298
             },
298
             rows: rows,
299
             rows: rows,
299
-            placeholder: placeholder
300
+            placeholder: placeholder,
301
+            autoFocus: autoFocus
300
           }),
302
           }),
301
           _react2.default.createElement(
303
           _react2.default.createElement(
302
             "div",
304
             "div",

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


+ 1
- 0
lib/index.js View File

93
         },
93
         },
94
         _react2.default.createElement(_App.Editor, {
94
         _react2.default.createElement(_App.Editor, {
95
           maxUpload: 4,
95
           maxUpload: 4,
96
+          autoFocus: true,
96
           beforeSubmit: function beforeSubmit() {
97
           beforeSubmit: function beforeSubmit() {
97
             return new Promise(function (resolve) {
98
             return new Promise(function (resolve) {
98
               resolve(true);
99
               resolve(true);

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


+ 1
- 1
package.json View File

1
 {
1
 {
2
   "name": "comment",
2
   "name": "comment",
3
-  "version": "0.5.7",
3
+  "version": "0.5.8",
4
   "main": "lib/App.js",
4
   "main": "lib/App.js",
5
   "description": "通用评论",
5
   "description": "通用评论",
6
   "keywords": [
6
   "keywords": [

+ 3
- 1
src/components/Editor/index.js View File

165
       button,
165
       button,
166
       emojiToolIcon,
166
       emojiToolIcon,
167
       imageToolIcon,
167
       imageToolIcon,
168
-      maxLength
168
+      maxLength,
169
+      autoFocus
169
     } = this.props;
170
     } = this.props;
170
     const handleSubmit = this.handleSubmit;
171
     const handleSubmit = this.handleSubmit;
171
     const disabledSubmit =
172
     const disabledSubmit =
188
             onChange={e => this.handleChange(e.target.value)}
189
             onChange={e => this.handleChange(e.target.value)}
189
             rows={rows}
190
             rows={rows}
190
             placeholder={placeholder}
191
             placeholder={placeholder}
192
+            autoFocus={autoFocus}
191
           />
193
           />
192
 
194
 
193
           <div className="comment-toolbar">
195
           <div className="comment-toolbar">

+ 1
- 0
src/index.js View File

51
       >
51
       >
52
         <Editor
52
         <Editor
53
           maxUpload={4}
53
           maxUpload={4}
54
+          autoFocus
54
           beforeSubmit={() => {
55
           beforeSubmit={() => {
55
             return new Promise(resolve => {
56
             return new Promise(resolve => {
56
               resolve(true);
57
               resolve(true);