Prevents users from typing more than 4000 characters into any 'textbox' (posts, comments, and post/comment edits). Also adds new error message for when users hit exactly 4000 characters so they know the limit.

Этот коммит содержится в:
Reed Garmsen
2015-08-24 20:47:27 -07:00
родитель b4ee263730
Коммит 5766bbfc65
5 изменённых файлов: 32 добавлений и 6 удалений

Просмотреть файл

@@ -106,13 +106,21 @@ module.exports = React.createClass({
}
},
handleUserInput: function(messageText) {
var newPostError = this.state.postError;
if (!this.state.postError && messageText.length >= Constants.MAX_POST_LEN) {
newPostError = 'Message length cannot exceed 4000 characters';
} else if (this.state.postError === 'Message length cannot exceed 4000 characters' && messageText.length < Constants.MAX_POST_LEN) {
newPostError = '';
}
var draft = PostStore.getCommentDraft(this.props.rootId);
draft.message = messageText;
PostStore.storeCommentDraft(this.props.rootId, draft);
$('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight);
$('.post-right__scroll').perfectScrollbar('update');
this.setState({messageText: messageText});
this.setState({messageText: messageText, postError: newPostError});
},
handleUploadStart: function(clientIds, channelId) {
var draft = PostStore.getCommentDraft(this.props.rootId);