Changeset 33299
- Timestamp:
- 07/16/2015 09:08:05 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/word-count.js
r33292 r33299 1 1 ( function() { 2 2 function WordCounter( settings ) { 3 var key; 3 var key, 4 shortcodes; 4 5 5 6 if ( settings ) { … … 9 10 } 10 11 } 12 } 13 14 shortcodes = this.settings.l10n.shortcodes; 15 16 if ( shortcodes && shortcodes.length ) { 17 this.settings.shortcodesRegExp = new RegExp( '\\[\\/?(?:' + shortcodes.join( '|' ) + ')[^\\]]*?\\]', 'gi' ); 11 18 } 12 19 } … … 66 73 67 74 text = text.replace( this.settings.HTMLRegExp, '\n' ); 75 76 if ( this.settings.shortcodesRegExp ) { 77 text = text.replace( this.settings.shortcodesRegExp, '\n' ); 78 } 79 68 80 text = text.replace( this.settings.spaceRegExp, ' ' ); 69 81 -
trunk/src/wp-includes/script-loader.php
r33291 r33299 401 401 enter 'characters', or 'all' to include spaces. Otherwise, enter 'words'. 402 402 Do not translate into your own language. */ 403 'type' => _x( 'words', 'word count: words, characters or all?' ) 403 'type' => _x( 'words', 'word count: words, characters or all?' ), 404 'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array() 404 405 ) ); 405 406 -
trunk/tests/qunit/wp-admin/js/word-count.js
r33292 r33299 45 45 characters: 14, 46 46 all: 14 47 }, 48 { 49 message: 'Shortcodes.', 50 string: 'one [shortcode attribute="value"]two[/shortcode]three', 51 words: 3, 52 characters: 11, 53 all: 12 47 54 } 48 55 ], function( test ) { … … 52 59 } ); 53 60 } ); 54 } )( window.QUnit, new window.wp.utils.WordCounter() ); 61 } )( window.QUnit, new window.wp.utils.WordCounter( { 62 l10n: { 63 shortcodes: [ 'shortcode' ] 64 } 65 } ) );
Note: See TracChangeset
for help on using the changeset viewer.