From bbccb9ca6b910890e8884e0ea344d8e418182a62 Mon Sep 17 00:00:00 2001 From: Ella Iseulde Van Dorpe <*@iseulde.com> Date: Wed, 15 Jul 2015 23:48:24 +0000 Subject: [PATCH] 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 --- wp-admin/js/word-count.js | 5 +++-- wp-admin/js/word-count.min.js | 2 +- wp-includes/version.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/word-count.js b/wp-admin/js/word-count.js index c1902c39bc..40c2934b9e 100644 --- a/wp-admin/js/word-count.js +++ b/wp-admin/js/word-count.js @@ -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, '' ); diff --git a/wp-admin/js/word-count.min.js b/wp-admin/js/word-count.min.js index 0fd30ecca3..2bb6265369 100644 --- a/wp-admin/js/word-count.min.js +++ b/wp-admin/js/word-count.min.js @@ -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}(); \ No newline at end of file +!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}(); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index 4a00a70b03..650b227828 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.