Ticket #22696: sortable-index-start.diff
| File sortable-index-start.diff, 1003 bytes (added by markjaquith, 6 months ago) |
|---|
-
wp-includes/js/media-views.js
3180 3180 }, 3181 3181 3182 3182 initSortable: function() { 3183 var collection = this.collection, 3184 from; 3183 var collection = this.collection; 3185 3184 3186 3185 if ( ! this.options.sortable || ! $.fn.sortable ) 3187 3186 return; … … 3200 3199 3201 3200 // Record the initial `index` of the dragged model. 3202 3201 start: function( event, ui ) { 3203 from = ui.item.index();3202 ui.item.data('sortableIndexStart', ui.item.index()); 3204 3203 }, 3205 3204 3206 3205 // Update the model's index in the collection. 3207 3206 // Do so silently, as the view is already accurate. 3208 3207 update: function( event, ui ) { 3209 var model = collection.at( from),3208 var model = collection.at( ui.item.data('sortableIndexStart') ), 3210 3209 comparator = collection.comparator; 3211 3210 3212 3211 // Temporarily disable the comparator to prevent `add`
