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:
parent
25a9a1873c
commit
bbccb9ca6b
|
@ -17,6 +17,7 @@
|
||||||
removeRegExp: /[0-9.(),;:!?%#$¿'"_+=\\\/-]+/g,
|
removeRegExp: /[0-9.(),;:!?%#$¿'"_+=\\\/-]+/g,
|
||||||
wordsRegExp: /\S\s+/g,
|
wordsRegExp: /\S\s+/g,
|
||||||
charactersRegExp: /\S/g,
|
charactersRegExp: /\S/g,
|
||||||
|
allRegExp: /[^\f\n\r\t\v\u00ad\u2028\u2029]/g,
|
||||||
l10n: window.wordCountL10n || {}
|
l10n: window.wordCountL10n || {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,9 +27,9 @@
|
||||||
type = type || this.settings.l10n.type || 'words';
|
type = type || this.settings.l10n.type || 'words';
|
||||||
|
|
||||||
if ( text ) {
|
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.spaceRegExp, ' ' );
|
||||||
text = text.replace( this.settings.removeRegExp, '' );
|
text = text.replace( this.settings.removeRegExp, '' );
|
||||||
|
|
||||||
|
|
|
@ -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:/ | /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:/ | /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}();
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue