Moved duplicate code into functions and added better handling of large paste text dumps
Этот коммит содержится в:
@@ -105,16 +105,9 @@ module.exports = React.createClass({
|
||||
this.lastTime = t;
|
||||
}
|
||||
},
|
||||
handleUserInput: function(messageText) {
|
||||
var newPostError = this.state.postError;
|
||||
|
||||
var len = utils.getLengthOfTextInTextarea(messageText);
|
||||
|
||||
if (!this.state.postError && len >= Constants.MAX_POST_LEN) {
|
||||
newPostError = 'Comment length cannot exceed 4000 characters';
|
||||
} else if (this.state.postError === 'Comment length cannot exceed 4000 characters' && len < Constants.MAX_POST_LEN) {
|
||||
newPostError = '';
|
||||
}
|
||||
handleUserInput: function(message) {
|
||||
var messageText = utils.truncateText(message);
|
||||
var newPostError = utils.checkMessageLengthError(messageText, this.state.postError, 'Comment length cannot exceed ' + Constants.MAX_POST_LEN + ' characters');
|
||||
|
||||
var draft = PostStore.getCommentDraft(this.props.rootId);
|
||||
draft.message = messageText;
|
||||
|
||||
Ссылка в новой задаче
Block a user