Ticket #13525: nav-menu-rtl-js.13525.2.diff
File nav-menu-rtl-js.13525.2.diff, 1.9 KB (added by , 15 years ago) |
---|
-
wp-admin/js/nav-menu.dev.js
22 22 menuList : undefined, // Set in init. 23 23 targetList : undefined, // Set in init. 24 24 menusChanged : false, 25 isRTL: !! ( 'undefined' != typeof isRtl && isRtl ), 25 26 26 27 // Functions that run on init. 27 28 init : function() { … … 52 53 // jQuery extensions 53 54 $.fn.extend({ 54 55 menuItemDepth : function() { 55 var margin = this.eq(0).css('margin-left');56 var margin = api.isRTL ? this.eq(0).css('margin-right') : this.eq(0).css('margin-left'); 56 57 return api.pxToDepth( margin && -1 != margin.indexOf('px') ? margin.slice(0, -2) : 0 ); 57 58 }, 58 59 updateDepthClass : function(current, prev) { … … 244 245 placeholder: 'sortable-placeholder', 245 246 start: function(e, ui) { 246 247 var height, width, parent, children, maxChildDepth, tempHolder; 248 249 // handle placement for rtl orientation 250 if ( api.isRTL ) 251 ui.item[0].style.right = 'auto'; 247 252 248 253 transport = ui.item.children('.menu-item-transport'); 249 254 … … 306 311 // address sortable's incorrectly-calculated top in opera 307 312 ui.item[0].style.top = 0; 308 313 314 // handle drop placement for rtl orientation 315 if ( api.isRTL ) { 316 ui.item[0].style.left = 'auto'; 317 ui.item[0].style.right = 0; 318 } 319 309 320 }, 310 321 change: function(e, ui) { 311 322 // Make sure the placeholder is inside the menu. … … 317 328 }, 318 329 sort: function(e, ui) { 319 330 var offset = ui.helper.offset(), 320 depth = api.pxToDepth( offset.left - menuLeft);331 depth = Math.abs( api.pxToDepth( offset.left - menuLeft ) ); 321 332 // Check and correct if depth is not within range. 322 333 // Also, if the dragged element is dragged upwards over 323 334 // an item, shift the placeholder to a child position.