Skip to content

Commit fa276d0

Browse files
committed
Remove extra spaces
1 parent 4a47267 commit fa276d0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/lib/text-utils/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ function countWords( content ) {
33
// https://github.com/tinymce/tinymce/blob/4.2.6/js/tinymce/plugins/wordcount/plugin.js
44

55
if ( content && typeof content === 'string' ) {
6-
content = content.replace( /\.\.\./g, ' ' ); // convert ellipses to spaces
7-
content = content.replace( /<.[^<>]*?>/g, ' ' ); // remove HTML tags
8-
content = content.replace( /&nbsp;|&#160;/gi, ' ' ); // remove space chars
6+
// convert ellipses to spaces, remove HTML tags, and remove space chars
7+
content = content.replace( /\.\.\./g, ' ' );
8+
content = content.replace( /<.[^<>]*?>/g, ' ' );
9+
content = content.replace( /&nbsp;|&#160;/gi, ' ' );
910

1011
// deal with HTML entities
1112
content = content.replace( /(\w+)(&#?[a-z0-9]+;)+(\w+)/i, '$1$3' ); // strip entities inside words

0 commit comments

Comments
 (0)