Changeset 38797
- Timestamp:
- 10/14/2016 10:39:49 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-posts-list-table.php
r38672 r38797 1551 1551 1552 1552 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?> 1553 <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?> 1553 <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : 1554 $taxonomy_name = esc_attr( $taxonomy->name ); 1555 1556 ?> 1554 1557 <label class="inline-edit-tags"> 1555 1558 <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span> 1556 <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>1559 <textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea> 1557 1560 </label> 1558 1561 <?php endif; ?> -
trunk/src/wp-admin/includes/meta-boxes.php
r38700 r38797 432 432 <div class="ajaxtag hide-if-no-js"> 433 433 <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> 434 <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" />434 <p><input data-wp-taxonomy="<?php echo $tax_name; ?>" type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" /> 435 435 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p> 436 436 </div> -
trunk/src/wp-admin/js/inline-edit-post.js
r36375 r38797 84 84 85 85 setBulk : function(){ 86 var te = '', type = this.type, tax,c = true;86 var te = '', type = this.type, c = true; 87 87 this.revert(); 88 88 … … 115 115 // enable autocomplete for tags 116 116 if ( 'post' === type ) { 117 // support multi taxonomies?118 tax = 'post_tag';119 $('tr.inline-editor textarea[name="tax_input['+tax+']"]').suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma} );117 $( 'tr.inline-editor textarea[data-wp-taxonomy]' ).each( function ( i, element ) { 118 $( element ).wpTagsSuggest(); 119 } ); 120 120 } 121 121 $('html, body').animate( { scrollTop: 0 }, 'fast' ); … … 197 197 } 198 198 199 textarea. suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma });199 textarea.wpTagsSuggest(); 200 200 }); 201 201 -
trunk/src/wp-admin/js/tags-box.js
r35292 r38797 5 5 6 6 ( function( $ ) { 7 var tagDelimiter = ( window.tagsSuggestL10n && window.tagsSuggestL10n.tagDelimiter ) || ','; 8 7 9 // Return an array with any duplicate, whitespace or empty values removed 8 10 array_unique_noempty = function( array ) { … … 21 23 22 24 tagBox = { 23 clean : function(tags) { 24 var comma = window.tagsBoxL10n.tagDelimiter; 25 if ( ',' !== comma ) 26 tags = tags.replace(new RegExp(comma, 'g'), ','); 25 clean : function( tags ) { 26 if ( ',' !== tagDelimiter ) { 27 tags = tags.replace( new RegExp( tagDelimiter, 'g' ), ',' ); 28 } 29 27 30 tags = tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, ''); 28 if ( ',' !== comma ) 29 tags = tags.replace(/,/g, comma); 31 32 if ( ',' !== tagDelimiter ) { 33 tags = tags.replace( /,/g, tagDelimiter ); 34 } 35 30 36 return tags; 31 37 }, … … 36 42 taxbox = $(el).closest('.tagsdiv'), 37 43 thetags = taxbox.find('.the-tags'), 38 comma = window.tagsBoxL10n.tagDelimiter, 39 current_tags = thetags.val().split( comma ), 44 current_tags = thetags.val().split( tagDelimiter ), 40 45 new_tags = []; 41 46 … … 49 54 }); 50 55 51 thetags.val( this.clean( new_tags.join( comma) ) );56 thetags.val( this.clean( new_tags.join( tagDelimiter ) ) ); 52 57 53 58 this.quickClicks( taxbox ); … … 66 71 disabled = thetags.prop('disabled'); 67 72 68 current_tags = thetags.val().split( window.tagsBoxL10n.tagDelimiter );73 current_tags = thetags.val().split( tagDelimiter ); 69 74 tagchecklist.empty(); 70 75 … … 107 112 var tagsval, newtags, text, 108 113 tags = $( '.the-tags', el ), 109 newtag = $( 'input.newtag', el ), 110 comma = window.tagsBoxL10n.tagDelimiter; 114 newtag = $( 'input.newtag', el ); 111 115 112 116 a = a || false; … … 119 123 120 124 tagsval = tags.val(); 121 newtags = tagsval ? tagsval + comma+ text : text;125 newtags = tagsval ? tagsval + tagDelimiter + text : text; 122 126 123 127 newtags = this.clean( newtags ); 124 newtags = array_unique_noempty( newtags.split( comma ) ).join( comma);128 newtags = array_unique_noempty( newtags.split( tagDelimiter ) ).join( tagDelimiter ); 125 129 tags.val( newtags ); 126 130 this.quickClicks( el ); … … 154 158 155 159 init : function() { 156 var t = this,ajaxtag = $('div.ajaxtag');160 var ajaxtag = $('div.ajaxtag'); 157 161 158 162 $('.tagsdiv').each( function() { 159 tagBox.quickClicks(this); 160 }); 161 162 $('.tagadd', ajaxtag).click(function(){ 163 t.flushTags( $(this).closest('.tagsdiv') ); 164 }); 165 166 $('input.newtag', ajaxtag).keyup(function(e){ 167 if ( 13 == e.which ) { 168 tagBox.flushTags( $(this).closest('.tagsdiv') ); 169 return false; 170 } 171 }).keypress(function(e){ 172 if ( 13 == e.which ) { 173 e.preventDefault(); 174 return false; 175 } 176 }).each( function() { 177 var tax = $(this).closest('div.tagsdiv').attr('id'); 178 $(this).suggest( 179 ajaxurl + '?action=ajax-tag-search&tax=' + tax, 180 { delay: 500, minchars: 2, multiple: true, multipleSep: window.tagsBoxL10n.tagDelimiter } 181 ); 163 tagBox.quickClicks( this ); 164 }); 165 166 $( '.tagadd', ajaxtag ).click( function() { 167 tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); 168 }); 169 170 $( 'input.newtag', ajaxtag ).keyup( function( event ) { 171 if ( 13 == event.which ) { 172 tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); 173 event.preventDefault(); 174 event.stopPropagation(); 175 } 176 }).keypress( function( event ) { 177 if ( 13 == event.which ) { 178 event.preventDefault(); 179 event.stopPropagation(); 180 } 181 }).each( function( i, element ) { 182 $( element ).wpTagsSuggest(); 182 183 }); 183 184 -
trunk/src/wp-includes/script-loader.php
r38628 r38797 235 235 /* translators: %d: Number of results found when using jQuery UI Autocomplete */ 236 236 'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ), 237 'itemSelected' => __( 'Item selected.' ), 237 238 ) ); 238 239 … … 242 243 // jQuery plugins 243 244 $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 ); 244 $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );245 245 $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 ); 246 246 $scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 ); … … 249 249 $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 ); 250 250 $scripts->add( 'jquery-touch-punch', "/wp-includes/js/jquery/jquery.ui.touch-punch.js", array('jquery-ui-widget', 'jquery-ui-mouse'), '0.2.2', 1 ); 251 252 // Not used any more, registered for backwards compatibility. 253 $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 ); 251 254 252 255 // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv. … … 524 527 ) ); 525 528 526 $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'suggest' ), false, 1 ); 527 did_action( 'init' ) && $scripts->localize( 'tags-box', 'tagsBoxL10n', array( 529 $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 ); 530 531 $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 ); 532 did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array( 528 533 'tagDelimiter' => _x( ',', 'tag delimiter' ), 529 534 ) ); … … 585 590 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 ); 586 591 587 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', ' suggest', 'wp-a11y' ), false, 1 );592 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 ); 588 593 did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 589 594 'error' => __( 'Error while saving the changes.' ),
Note: See TracChangeset
for help on using the changeset viewer.