File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ function countWords( content ) {
3
3
// https://github.com/tinymce/tinymce/blob/4.2.6/js/tinymce/plugins/wordcount/plugin.js
4
4
5
5
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 ( / & n b s p ; | & # 1 6 0 ; / 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 ( / & n b s p ; | & # 1 6 0 ; / gi, ' ' ) ;
9
10
10
11
// deal with HTML entities
11
12
content = content . replace ( / ( \w + ) ( & # ? [ a - z 0 - 9 ] + ; ) + ( \w + ) / i, '$1$3' ) ; // strip entities inside words
You can’t perform that action at this time.
0 commit comments