|
@@ -174,9 +174,10 @@ class Editor extends React.Component {
|
174
|
174
|
* -- evo 20200223
|
175
|
175
|
*/
|
176
|
176
|
invokeFileListChange(fileList) {
|
177
|
|
- this.props.handleChangeFileList(fileList);
|
|
177
|
+ const { limitOne, handleChangeFileList } = this.props;
|
|
178
|
+ handleChangeFileList(fileList);
|
178
|
179
|
this.setState({ fileList });
|
179
|
|
- if (isMobile) {
|
|
180
|
+ if (limitOne && isMobile) {
|
180
|
181
|
const file = fileList[0];
|
181
|
182
|
if (
|
182
|
183
|
file &&
|
|
@@ -542,7 +543,9 @@ Editor.propTypes = {
|
542
|
543
|
onError: PropTypes.func,
|
543
|
544
|
maxLength: PropTypes.number,
|
544
|
545
|
// Enter事件相关
|
545
|
|
- allowEnterSubmit: PropTypes.bool
|
|
546
|
+ allowEnterSubmit: PropTypes.bool,
|
|
547
|
+ // 私信仅允许选中一个,此处可以优化为通用的limit
|
|
548
|
+ limitOne: PropTypes.bool
|
546
|
549
|
};
|
547
|
550
|
|
548
|
551
|
Editor.defaultProps = {
|
|
@@ -564,7 +567,8 @@ Editor.defaultProps = {
|
564
|
567
|
app: {},
|
565
|
568
|
handleChangeFileList: () => {},
|
566
|
569
|
// Enter事件相关
|
567
|
|
- allowEnterSubmit: false
|
|
570
|
+ allowEnterSubmit: false,
|
|
571
|
+ limitOne: false
|
568
|
572
|
};
|
569
|
573
|
|
570
|
574
|
export default Comment(Editor);
|