| 1 | Index: wp-admin/js/nav-menu.dev.js |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/js/nav-menu.dev.js (revision 15030) |
|---|
| 4 | +++ wp-admin/js/nav-menu.dev.js (working copy) |
|---|
| 5 | @@ -22,6 +22,7 @@ |
|---|
| 6 | menuList : undefined, // Set in init. |
|---|
| 7 | targetList : undefined, // Set in init. |
|---|
| 8 | menusChanged : false, |
|---|
| 9 | + isRTL: !! ( 'undefined' != typeof isRtl && isRtl ), |
|---|
| 10 | |
|---|
| 11 | // Functions that run on init. |
|---|
| 12 | init : function() { |
|---|
| 13 | @@ -52,7 +53,7 @@ |
|---|
| 14 | // jQuery extensions |
|---|
| 15 | $.fn.extend({ |
|---|
| 16 | menuItemDepth : function() { |
|---|
| 17 | - var margin = this.eq(0).css('margin-left'); |
|---|
| 18 | + var margin = api.isRTL ? this.eq(0).css('margin-right') : this.eq(0).css('margin-left'); |
|---|
| 19 | return api.pxToDepth( margin && -1 != margin.indexOf('px') ? margin.slice(0, -2) : 0 ); |
|---|
| 20 | }, |
|---|
| 21 | updateDepthClass : function(current, prev) { |
|---|
| 22 | @@ -244,6 +245,10 @@ |
|---|
| 23 | placeholder: 'sortable-placeholder', |
|---|
| 24 | start: function(e, ui) { |
|---|
| 25 | var height, width, parent, children, maxChildDepth, tempHolder; |
|---|
| 26 | + |
|---|
| 27 | + // handle placement for rtl orientation |
|---|
| 28 | + if ( api.isRTL ) |
|---|
| 29 | + ui.item[0].style.right = 'auto'; |
|---|
| 30 | |
|---|
| 31 | transport = ui.item.children('.menu-item-transport'); |
|---|
| 32 | |
|---|
| 33 | @@ -306,6 +311,12 @@ |
|---|
| 34 | // address sortable's incorrectly-calculated top in opera |
|---|
| 35 | ui.item[0].style.top = 0; |
|---|
| 36 | |
|---|
| 37 | + // handle drop placement for rtl orientation |
|---|
| 38 | + if ( api.isRTL ) { |
|---|
| 39 | + ui.item[0].style.left = 'auto'; |
|---|
| 40 | + ui.item[0].style.right = 0; |
|---|
| 41 | + } |
|---|
| 42 | + |
|---|
| 43 | }, |
|---|
| 44 | change: function(e, ui) { |
|---|
| 45 | // Make sure the placeholder is inside the menu. |
|---|
| 46 | @@ -317,7 +328,7 @@ |
|---|
| 47 | }, |
|---|
| 48 | sort: function(e, ui) { |
|---|
| 49 | var offset = ui.helper.offset(), |
|---|
| 50 | - depth = api.pxToDepth( offset.left - menuLeft ); |
|---|
| 51 | + depth = Math.abs( api.pxToDepth( offset.left - menuLeft ) ); |
|---|
| 52 | // Check and correct if depth is not within range. |
|---|
| 53 | // Also, if the dragged element is dragged upwards over |
|---|
| 54 | // an item, shift the placeholder to a child position. |
|---|