diff --git a/core/client/utils/word-count.js b/core/client/utils/word-count.js index 67542c44a0..52de247015 100644 --- a/core/client/utils/word-count.js +++ b/core/client/utils/word-count.js @@ -1,6 +1,7 @@ export default function (s) { s = s.replace(/(^\s*)|(\s*$)/gi, ''); // exclude start and end white-space s = s.replace(/[ ]{2,}/gi, ' '); // 2 or more space to 1 - s = s.replace(/\n /, '\n'); // exclude newline with a start spacing - return s.split(' ').length; + s = s.replace(/\n /gi, '\n'); // exclude newline with a start spacing + s = s.replace(/\n+/gi, '\n'); + return s.split(/ |\n/).length; } \ No newline at end of file