mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 04:45:23 +08:00
fix issue 1037
This commit is contained in:
@@ -82,11 +82,16 @@ export class CommentForm extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
removeNewLine = (string) => {
|
||||
return string.replace(/\n/g, '');
|
||||
}
|
||||
|
||||
render() {
|
||||
const {maxCharCount, submitEnabled, cancelButtonClassName, submitButtonClassName, charCountEnable, body, loadingState} = this.props;
|
||||
|
||||
const length = body.length;
|
||||
const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount;
|
||||
const cleanedBody = this.removeNewLine(body);
|
||||
const length = cleanedBody.length;
|
||||
const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount;
|
||||
const disableSubmitButton = !length || isRespectingMaxCount(length) || !submitEnabled({body}) || loadingState === 'loading';
|
||||
const disableCancelButton = loadingState === 'loading';
|
||||
const disableTextArea = loadingState === 'loading';
|
||||
|
||||
Reference in New Issue
Block a user