Editor: word count: exclude more characters
Also only exclude these characters for the `words` type. They should be counted for other types. Add the ASCIIOnly option to the uglify config to preserve escaped unicode characters. See #30966. Fixes #27391. Built from https://develop.svn.wordpress.org/trunk@33292 git-svn-id: http://core.svn.wordpress.org/trunk@33264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f7f834703f
commit
e098c0e9ee
|
@ -14,7 +14,42 @@
|
|||
WordCounter.prototype.settings = {
|
||||
HTMLRegExp: /<\/?[a-z][^>]*?>/gi,
|
||||
spaceRegExp: / | /gi,
|
||||
removeRegExp: /[0-9.(),;:!?%#$¿'"_+=\\\/-]+/g,
|
||||
connectorRegExp: /--|\u2014/gi,
|
||||
removeRegExp: new RegExp( [
|
||||
'[',
|
||||
// Basic Latin (extract)
|
||||
'\u0021-\u0040\u005B-\u0060\u007B-\u007E',
|
||||
// Latin-1 Supplement (extract)
|
||||
'\u0080-\u00BF\u00D7\u00F7',
|
||||
// General Punctuation
|
||||
// Superscripts and Subscripts
|
||||
// Currency Symbols
|
||||
// Combining Diacritical Marks for Symbols
|
||||
// Letterlike Symbols
|
||||
// Number Forms
|
||||
// Arrows
|
||||
// Mathematical Operators
|
||||
// Miscellaneous Technical
|
||||
// Control Pictures
|
||||
// Optical Character Recognition
|
||||
// Enclosed Alphanumerics
|
||||
// Box Drawing
|
||||
// Block Elements
|
||||
// Geometric Shapes
|
||||
// Miscellaneous Symbols
|
||||
// Dingbats
|
||||
// Miscellaneous Mathematical Symbols-A
|
||||
// Supplemental Arrows-A
|
||||
// Braille Patterns
|
||||
// Supplemental Arrows-B
|
||||
// Miscellaneous Mathematical Symbols-B
|
||||
// Supplemental Mathematical Operators
|
||||
// Miscellaneous Symbols and Arrows
|
||||
'\u2000-\u2BFF',
|
||||
// Supplemental Punctuation
|
||||
'\u2E00-\u2E7F',
|
||||
']'
|
||||
].join( '' ), 'g' ),
|
||||
wordsRegExp: /\S\s+/g,
|
||||
charactersRegExp: /\S/g,
|
||||
allRegExp: /[^\f\n\r\t\v\u00ad\u2028\u2029]/g,
|
||||
|
@ -31,7 +66,11 @@
|
|||
|
||||
text = text.replace( this.settings.HTMLRegExp, '\n' );
|
||||
text = text.replace( this.settings.spaceRegExp, ' ' );
|
||||
text = text.replace( this.settings.removeRegExp, '' );
|
||||
|
||||
if ( type === 'words' ) {
|
||||
text = text.replace( this.settings.connectorRegExp, ' ' );
|
||||
text = text.replace( this.settings.removeRegExp, '' );
|
||||
}
|
||||
|
||||
text = text.match( this.settings[ type + 'RegExp' ] );
|
||||
|
||||
|
|
|
@ -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,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}();
|
||||
!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,connectorRegExp:/--|\u2014/gi,removeRegExp:new RegExp(["[","!-@[-`{-~","\x80-\xbf\xd7\xf7","\u2000-\u2bff","\u2e00-\u2e7f","]"].join(""),"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," "),"words"===b&&(a=a.replace(this.settings.connectorRegExp," "),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}();
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
tinymce.PluginManager.add("wplink",function(a){var b;a.addCommand("WP_Link",function(){window.wpLink&&window.wpLink.open(a.id)}),a.addShortcut("Alt+Shift+A","","WP_Link"),a.addShortcut("Meta+K","","WP_Link"),a.addButton("link",{icon:"link",tooltip:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]"}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink"}),a.addMenuItem("link",{icon:"link",text:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]",context:"insert",prependToContext:!0}),a.on("pastepreprocess",function(b){var c=b.content,d=/^(?:https?:)?\/\/\S+$/i;a.selection.isCollapsed()||d.test(a.selection.getContent())||(c=c.replace(/<[^>]+>/g,""),c=tinymce.trim(c),d.test(c)&&(a.execCommand("mceInsertLink",!1,{href:a.dom.decode(c)}),b.preventDefault()))}),tinymce.ui.WPLinkPreview=tinymce.ui.Control.extend({url:"#",renderHtml:function(){return'<div id="'+this._id+'" class="wp-link-preview"><a href="'+this.url+'" target="_blank" tabindex="-1">'+this.url+"</a></div>"},setURL:function(a){var b,c;this.url!==a&&(this.url=a,a=window.decodeURIComponent(a),a=a.replace(/^(?:https?:)?\/\/(?:www\.)?/,""),-1!==(b=a.indexOf("?"))&&(a=a.slice(0,b)),-1!==(b=a.indexOf("#"))&&(a=a.slice(0,b)),a=a.replace(/(?:index)?\.html$/,""),"/"===a.charAt(a.length-1)&&(a=a.slice(0,-1)),a.length>40&&-1!==(b=a.indexOf("/"))&&-1!==(c=a.lastIndexOf("/"))&&c!==b&&(b+a.length-c<40&&(c=-(40-(b+1))),a=a.slice(0,b+1)+"…"+a.slice(c)),tinymce.$(this.getEl().firstChild).attr("href",this.url).text(a))},postRender:function(){var c=this;a.on("wptoolbar",function(d){var e,f=a.dom.getParent(d.element,"a"),g=a.$;f&&!g(f).find("img").length&&(e=g(f).attr("href"))&&(c.setURL(e),d.element=f,d.toolbar=b)})}}),a.addButton("wp_link_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",cmd:"WP_Link"}),a.addButton("wp_link_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",cmd:"unlink"}),a.on("preinit",function(){b=a.wp._createToolbar(["WPLinkPreview","wp_link_edit","wp_link_remove"],!0)})});
|
||||
tinymce.PluginManager.add("wplink",function(a){var b;a.addCommand("WP_Link",function(){window.wpLink&&window.wpLink.open(a.id)}),a.addShortcut("Alt+Shift+A","","WP_Link"),a.addShortcut("Meta+K","","WP_Link"),a.addButton("link",{icon:"link",tooltip:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]"}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink"}),a.addMenuItem("link",{icon:"link",text:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]",context:"insert",prependToContext:!0}),a.on("pastepreprocess",function(b){var c=b.content,d=/^(?:https?:)?\/\/\S+$/i;a.selection.isCollapsed()||d.test(a.selection.getContent())||(c=c.replace(/<[^>]+>/g,""),c=tinymce.trim(c),d.test(c)&&(a.execCommand("mceInsertLink",!1,{href:a.dom.decode(c)}),b.preventDefault()))}),tinymce.ui.WPLinkPreview=tinymce.ui.Control.extend({url:"#",renderHtml:function(){return'<div id="'+this._id+'" class="wp-link-preview"><a href="'+this.url+'" target="_blank" tabindex="-1">'+this.url+"</a></div>"},setURL:function(a){var b,c;this.url!==a&&(this.url=a,a=window.decodeURIComponent(a),a=a.replace(/^(?:https?:)?\/\/(?:www\.)?/,""),-1!==(b=a.indexOf("?"))&&(a=a.slice(0,b)),-1!==(b=a.indexOf("#"))&&(a=a.slice(0,b)),a=a.replace(/(?:index)?\.html$/,""),"/"===a.charAt(a.length-1)&&(a=a.slice(0,-1)),a.length>40&&-1!==(b=a.indexOf("/"))&&-1!==(c=a.lastIndexOf("/"))&&c!==b&&(b+a.length-c<40&&(c=-(40-(b+1))),a=a.slice(0,b+1)+"\u2026"+a.slice(c)),tinymce.$(this.getEl().firstChild).attr("href",this.url).text(a))},postRender:function(){var c=this;a.on("wptoolbar",function(d){var e,f=a.dom.getParent(d.element,"a"),g=a.$;f&&!g(f).find("img").length&&(e=g(f).attr("href"))&&(c.setURL(e),d.element=f,d.toolbar=b)})}}),a.addButton("wp_link_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",cmd:"WP_Link"}),a.addButton("wp_link_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",cmd:"unlink"}),a.on("preinit",function(){b=a.wp._createToolbar(["WPLinkPreview","wp_link_edit","wp_link_remove"],!0)})});
|
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-beta3-33291';
|
||||
$wp_version = '4.3-beta3-33292';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue