From 656a88efdd2606ce8449097e740535f41aee9d64 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Tue, 25 Aug 2015 12:47:18 -0700
Subject: Fixed issue with carriage returns being counted improperly in non-ie
 browsers and updated error messages to be appropriate to what is being typed
 (message vs. post vs. edit)

---
 web/react/components/edit_post_modal.jsx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'web/react/components/edit_post_modal.jsx')

diff --git a/web/react/components/edit_post_modal.jsx b/web/react/components/edit_post_modal.jsx
index 2dce889f8..39d058f30 100644
--- a/web/react/components/edit_post_modal.jsx
+++ b/web/react/components/edit_post_modal.jsx
@@ -4,6 +4,7 @@
 var Client = require('../utils/client.jsx');
 var AsyncClient = require('../utils/async_client.jsx');
 var Constants = require('../utils/constants.jsx');
+var utils = require('../utils/utils.jsx');
 var Textbox = require('./textbox.jsx');
 var BrowserStore = require('../stores/browser_store.jsx');
 
@@ -40,9 +41,11 @@ module.exports = React.createClass({
     handleEditInput: function(editText) {
         var newError = this.state.error;
 
-        if (!this.state.error && editText.length >= Constants.MAX_POST_LEN) {
-            newError = 'Message length cannot exceed 4000 characters';
-        } else if (this.state.error === 'Message length cannot exceed 4000 characters' && editText.length < Constants.MAX_POST_LEN) {
+        var len = utils.getLengthOfTextInTextarea(editText);
+
+        if (!this.state.error && len >= Constants.MAX_POST_LEN) {
+            newError = 'New message length cannot exceed 4000 characters';
+        } else if (this.state.error === 'New message length cannot exceed 4000 characters' && len < Constants.MAX_POST_LEN) {
             newError = '';
         }
 
-- 
cgit v1.2.3-1-g7c22

