Ticket #13220: sorting.improvements.progress.2.patch
File sorting.improvements.progress.2.patch, 1.4 KB (added by , 14 years ago) |
---|
-
wp-admin/js/nav-menu.dev.js
163 163 }, 164 164 165 165 initSortables : function() { 166 var currentDepth = 0, originalDepth, minDepth, maxDepth, 166 var currentDepth = 0, originalDepth, minDepth, maxDepth, prevBottom, 167 167 menuLeft = api.menuList.offset().left, 168 168 newItem, transport; 169 169 … … 232 232 updateDepthRange(ui); 233 233 }, 234 234 sort: function(e, ui) { 235 var depth = api.pxToDepth(ui.helper.offset().left - menuLeft); 235 var offset = ui.helper.offset(), 236 depth = api.pxToDepth( offset.left - menuLeft ); 236 237 // Check and correct if depth is not within range. 237 if ( depth < minDepth ) depth = minDepth; 238 else if ( depth > maxDepth ) depth = maxDepth; 238 // Also, if the dragged element is dragged upwards over 239 // an item, shift the placeholder to a child position. 240 if ( depth > maxDepth || offset.top < prevBottom ) depth = maxDepth; 241 else if ( depth < minDepth ) depth = minDepth; 239 242 240 243 if( depth != currentDepth ) 241 244 updateCurrentDepth(ui, depth); … … 250 253 if( prev[0] == ui.item[0] ) prev = prev.prev(); 251 254 if( next[0] == ui.item[0] ) next = next.next(); 252 255 256 prevBottom = (prev.length) ? prev.offset().top + prev.height() : 0; 253 257 minDepth = (next.length) ? next.menuItemDepth() : 0; 254 258 255 259 if( prev.length )