Ticket #47131: 47131.3.diff
File 47131.3.diff, 3.0 KB (added by , 16 months ago) |
---|
-
src/js/_enqueues/admin/common.js
1274 1274 init: function() { 1275 1275 var self = this; 1276 1276 1277 this.maybeDisableSortables = this.maybeDisableSortables.bind( this ); 1278 1277 1279 // Modify functionality based on custom activate/deactivate event 1278 1280 $document.on( 'wp-responsive-activate.wp-responsive', function() { 1279 1281 self.activate(); … … 1313 1315 $document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) ); 1314 1316 1315 1317 // This needs to run later as UI Sortable may be initialized later on $(document).ready(). 1316 $window.on( 'load.wp-responsive', function() {1317 var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth;1318 $window.on( 'load.wp-responsive', this.maybeDisableSortables ); 1319 $document.on( 'postbox-toggled', this.maybeDisableSortables ); 1318 1320 1319 if ( width <= 782 ) { 1320 self.disableSortables(); 1321 } 1322 }); 1321 // When the screen columns are changed, potentially disable sortables. 1322 $( '#screen-options-wrap input' ).on( 'click', this.maybeDisableSortables ); 1323 1323 }, 1324 1324 1325 1325 /** 1326 * Disable sortables if there is only one metabox, or the screen is in one column mode. Otherwise, enable sortables. 1327 * 1328 * @since 5.3.0 1329 * 1330 * @returns {void} 1331 */ 1332 maybeDisableSortables: function() { 1333 var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth; 1334 1335 if ( 1336 ( width <= 782 ) || 1337 ( 1 >= $sortables.find( '.ui-sortable-handle:visible' ).length && jQuery( '.columns-prefs-1 input' ).prop( 'checked' ) ) 1338 ) { 1339 this.disableSortables(); 1340 } else { 1341 this.enableSortables(); 1342 } 1343 }, 1344 1345 /** 1326 1346 * Changes properties of body and admin menu. 1327 1347 * 1328 1348 * Pins and unpins the menu and adds the auto-fold class to the body. … … 1356 1376 deactivate: function() { 1357 1377 setPinMenu(); 1358 1378 $adminmenu.removeData('wp-responsive'); 1359 this.enableSortables(); 1379 1380 this.maybeDisableSortables(); 1360 1381 }, 1361 1382 1362 1383 /** … … 1391 1412 } else { 1392 1413 this.disableOverlay(); 1393 1414 } 1415 1416 this.maybeDisableSortables(); 1394 1417 }, 1395 1418 1396 1419 /** … … 1439 1462 if ( $sortables.length ) { 1440 1463 try { 1441 1464 $sortables.sortable( 'disable' ); 1465 $sortables.find( '.ui-sortable-handle' ).addClass( 'is-non-sortable' ); 1442 1466 } catch ( e ) {} 1443 1467 } 1444 1468 }, … … 1454 1478 if ( $sortables.length ) { 1455 1479 try { 1456 1480 $sortables.sortable( 'enable' ); 1481 $sortables.find( '.ui-sortable-handle' ).removeClass( 'is-non-sortable' ); 1457 1482 } catch ( e ) {} 1458 1483 } 1459 1484 } -
src/wp-admin/css/common.css
2051 2051 cursor: move; 2052 2052 } 2053 2053 2054 .js .widget .widget-top.is-non-sortable, 2055 .js .postbox .hndle.is-non-sortable { 2056 cursor: auto; 2057 } 2058 2054 2059 .hndle a { 2055 2060 font-size: 11px; 2056 2061 font-weight: 400;