Ticket #34613: 34613.2.patch
| File 34613.2.patch, 4.3 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/includes/class-wp-terms-list-table.php
588 588 ?> 589 589 590 590 <p class="inline-edit-save submit"> 591 < a href="#inline-edit" class="cancel button-secondary alignleft"><?php _e( 'Cancel' ); ?></a>592 < a href="#inline-edit" class="save button-primary alignright"><?php echo $tax->labels->update_item; ?></a>591 <button type="button" class="cancel button-secondary alignleft"><?php _e( 'Cancel' ); ?></button> 592 <button type="button" class="save button-primary alignright"><?php echo $tax->labels->update_item; ?></button> 593 593 <span class="spinner"></span> 594 594 <span class="error" style="display:none;"></span> 595 595 <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?> -
src/wp-admin/js/inline-edit-tax.js
1 1 /* global inlineEditL10n, ajaxurl */ 2 window.wp = window.wp || {}; 2 3 3 4 var inlineEditTax; 4 ( function($) {5 ( function( $, wp ) { 5 6 inlineEditTax = { 6 7 7 8 init : function() { … … 22 23 } 23 24 }); 24 25 25 $( ' a.cancel', row ).click( function() {26 $( '.cancel', row ).click( function() { 26 27 return inlineEditTax.revert(); 27 28 }); 28 $( ' a.save', row ).click( function() {29 $( '.save', row ).click( function() { 29 30 return inlineEditTax.save(this); 30 31 }); 31 32 $( 'input, select', row ).keydown( function( e ) { … … 96 97 // make ajax request 97 98 $.post( ajaxurl, params, 98 99 function(r) { 99 var row, new_id, option_value; 100 var row, new_id, option_value, 101 $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' ); 102 100 103 $( 'table.widefat .spinner' ).removeClass( 'is-active' ); 101 104 102 105 if (r) { … … 117 120 // Update the value in the Parent dropdown. 118 121 $( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() ); 119 122 120 row.hide().fadeIn(); 123 row.hide().fadeIn( 400, function() { 124 // Move focus back to the taxonomy title. 125 row.find( '.row-title' ).focus(); 126 wp.a11y.speak( inlineEditL10n.saved ); 127 }); 128 121 129 } else { 122 $('#edit-'+id+' .inline-edit-save .error').html(r).show(); 130 $errorSpan.html( r ).show(); 131 // Some error strings may contain HTML entities (e.g. `“`), let's use the HTML element's text. 132 wp.a11y.speak( $errorSpan.text() ); 123 133 } 124 134 } else { 125 $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show(); 135 $errorSpan.html( inlineEditL10n.error ).show(); 136 wp.a11y.speak( inlineEditL10n.error ); 126 137 } 127 138 } 128 139 ); 129 return false;130 140 }, 131 141 132 142 revert : function() { … … 136 146 $( 'table.widefat .spinner' ).removeClass( 'is-active' ); 137 147 $('#'+id).siblings('tr.hidden').addBack().remove(); 138 148 id = id.substr( id.lastIndexOf('-') + 1 ); 139 $(this.what+id).show(); 149 // Show the taxonomy listing and move focus back to the taxonomy title. 150 $( this.what + id ).show().find( '.row-title' ).focus(); 140 151 } 141 142 return false;143 152 }, 144 153 145 154 getId : function(o) { … … 149 158 }; 150 159 151 160 $(document).ready(function(){inlineEditTax.init();}); 152 })( jQuery);161 })( jQuery, window.wp ); -
src/wp-includes/script-loader.php
562 562 'comma' => trim( _x( ',', 'tag delimiter' ) ), 563 563 ) ); 564 564 565 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 );565 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); 566 566 did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 567 'error' => __('Error while saving the changes.') 567 'error' => __( 'Error while saving the changes.' ), 568 'saved' => __( 'Changes saved.' ), 568 569 ) ); 569 570 570 571 $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), false, 1 );