Ticket #32633: 32633.diff
File 32633.diff, 2.3 KB (added by , 9 years ago) |
---|
-
src/wp-admin/js/nav-menu.js
20 20 21 21 options : { 22 22 menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead. 23 globalMaxDepth : 11 23 globalMaxDepth : 11, 24 sortableItems: '> *' 24 25 }, 25 26 26 27 menuList : undefined, // Set in init. … … 87 88 childMenuItems : function() { 88 89 var result = $(); 89 90 this.each(function(){ 90 var t = $(this), depth = t.menuItemDepth(), next = t.next( );91 var t = $(this), depth = t.menuItemDepth(), next = t.next( '.menu-item' ); 91 92 while( next.length && next.menuItemDepth() > depth ) { 92 93 result = result.add( next ); 93 next = next.next( );94 next = next.next( '.menu-item' ); 94 95 } 95 96 }); 96 97 return result; … … 620 621 api.menuList.sortable({ 621 622 handle: '.menu-item-handle', 622 623 placeholder: 'sortable-placeholder', 624 items: api.options.sortableItems, 623 625 start: function(e, ui) { 624 626 var height, width, parent, children, tempHolder; 625 627 … … 660 662 ui.placeholder.width(width); 661 663 662 664 // Update the list of menu items. 663 tempHolder = ui.placeholder.next( );665 tempHolder = ui.placeholder.next( '.menu-item' ); 664 666 tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder 665 667 ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item 666 668 $(this).sortable( 'refresh' ); // The children aren't sortable. We should let jQ UI know. … … 738 740 }); 739 741 740 742 function updateSharedVars(ui) { 743 741 744 var depth; 742 745 743 prev = ui.placeholder.prev( );744 next = ui.placeholder.next( );746 prev = ui.placeholder.prev( '.menu-item' ); 747 next = ui.placeholder.next( '.menu-item' ); 745 748 746 749 // Make sure we don't select the moving item. 747 if( prev[0] == ui.item[0] ) prev = prev.prev( );748 if( next[0] == ui.item[0] ) next = next.next( );750 if( prev[0] == ui.item[0] ) prev = prev.prev( '.menu-item' ); 751 if( next[0] == ui.item[0] ) next = next.next( '.menu-item' ); 749 752 750 753 prevBottom = (prev.length) ? prev.offset().top + prev.height() : 0; 751 754 nextThreshold = (next.length) ? next.offset().top + next.height() / 3 : 0;