Editor: word count: add `all` type

This type will count all characters including spaces.

See #30966.

Built from https://develop.svn.wordpress.org/trunk@33290


git-svn-id: http://core.svn.wordpress.org/trunk@33262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ella Iseulde Van Dorpe 2015-07-15 23:48:24 +00:00
parent 25a9a1873c
commit bbccb9ca6b
3 changed files with 5 additions and 4 deletions

View File

@ -17,6 +17,7 @@
removeRegExp: /[0-9.(),;:!?%#$¿'"_+=\\\/-]+/g,
wordsRegExp: /\S\s+/g,
charactersRegExp: /\S/g,
allRegExp: /[^\f\n\r\t\v\u00ad\u2028\u2029]/g,
l10n: window.wordCountL10n || {}
};
@ -26,9 +27,9 @@
type = type || this.settings.l10n.type || 'words';
if ( text ) {
text = ' ' + text + ' ';
text = text + '\n';
text = text.replace( this.settings.HTMLRegExp, ' ' );
text = text.replace( this.settings.HTMLRegExp, '\n' );
text = text.replace( this.settings.spaceRegExp, ' ' );
text = text.replace( this.settings.removeRegExp, '' );

View File

@ -1 +1 @@
!function(){function a(a){var b;if(a)for(b in a)a.hasOwnProperty(b)&&(this.settings[b]=a[b])}a.prototype.settings={HTMLRegExp:/<\/?[a-z][^>]*?>/gi,spaceRegExp:/&nbsp;|&#160;/gi,removeRegExp:/[0-9.(),;:!?%#$¿'"_+=\\\/-]+/g,wordsRegExp:/\S\s+/g,charactersRegExp:/\S/g,l10n:window.wordCountL10n||{}},a.prototype.count=function(a,b){var c=0;return b=b||this.settings.l10n.type||"words",a&&(a=" "+a+" ",a=a.replace(this.settings.HTMLRegExp," "),a=a.replace(this.settings.spaceRegExp," "),a=a.replace(this.settings.removeRegExp,""),a=a.match(this.settings[b+"RegExp"]),a&&(c=a.length)),c},window.wp=window.wp||{},window.wp.utils=window.wp.utils||{},window.wp.utils.WordCounter=a}();
!function(){function a(a){var b;if(a)for(b in a)a.hasOwnProperty(b)&&(this.settings[b]=a[b])}a.prototype.settings={HTMLRegExp:/<\/?[a-z][^>]*?>/gi,spaceRegExp:/&nbsp;|&#160;/gi,removeRegExp:/[0-9.(),;:!?%#$¿'"_+=\\\/-]+/g,wordsRegExp:/\S\s+/g,charactersRegExp:/\S/g,allRegExp:/[^\f\n\r\t\v\u00ad\u2028\u2029]/g,l10n:window.wordCountL10n||{}},a.prototype.count=function(a,b){var c=0;return b=b||this.settings.l10n.type||"words",a&&(a+="\n",a=a.replace(this.settings.HTMLRegExp,"\n"),a=a.replace(this.settings.spaceRegExp," "),a=a.replace(this.settings.removeRegExp,""),a=a.match(this.settings[b+"RegExp"]),a&&(c=a.length)),c},window.wp=window.wp||{},window.wp.utils=window.wp.utils||{},window.wp.utils.WordCounter=a}();

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-beta3-33289';
$wp_version = '4.3-beta3-33290';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.