From 8ab31d70093bca77739b57cba7e89b859efbf3f1 Mon Sep 17 00:00:00 2001 From: kamos1 Date: Fri, 6 Oct 2017 13:19:37 -0600 Subject: [PATCH] add trim to prevent empty spaces, tabs and other whitespace characters --- client/talk-plugin-commentbox/CommentForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/talk-plugin-commentbox/CommentForm.js b/client/talk-plugin-commentbox/CommentForm.js index 347051a42..5093e3f1c 100644 --- a/client/talk-plugin-commentbox/CommentForm.js +++ b/client/talk-plugin-commentbox/CommentForm.js @@ -90,7 +90,7 @@ export class CommentForm extends React.Component { const {maxCharCount, submitEnabled, cancelButtonClassName, submitButtonClassName, charCountEnable, body, loadingState} = this.props; const cleanedBody = this.removeNewLine(body); - const length = cleanedBody.length; + const length = cleanedBody.trim().length; const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount; const disableSubmitButton = !length || isRespectingMaxCount(length) || !submitEnabled({body}) || loadingState === 'loading'; const disableCancelButton = loadingState === 'loading';