Changeset 46250
- Timestamp:
- 09/23/2019 05:29:46 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/common.js
r44722 r46250 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() { … … 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 1319 if ( width <= 782 ) { 1320 self.disableSortables(); 1321 } 1322 }); 1318 $window.on( 'load.wp-responsive', this.maybeDisableSortables ); 1319 $document.on( 'postbox-toggled', this.maybeDisableSortables ); 1320 1321 // When the screen columns are changed, potentially disable sortables. 1322 $( '#screen-options-wrap input' ).on( 'click', this.maybeDisableSortables ); 1323 }, 1324 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 } 1323 1343 }, 1324 1344 … … 1357 1377 setPinMenu(); 1358 1378 $adminmenu.removeData('wp-responsive'); 1359 this.enableSortables(); 1379 1380 this.maybeDisableSortables(); 1360 1381 }, 1361 1382 … … 1392 1413 this.disableOverlay(); 1393 1414 } 1415 1416 this.maybeDisableSortables(); 1394 1417 }, 1395 1418 … … 1440 1463 try { 1441 1464 $sortables.sortable( 'disable' ); 1465 $sortables.find( '.ui-sortable-handle' ).addClass( 'is-non-sortable' ); 1442 1466 } catch ( e ) {} 1443 1467 } … … 1455 1479 try { 1456 1480 $sortables.sortable( 'enable' ); 1481 $sortables.find( '.ui-sortable-handle' ).removeClass( 'is-non-sortable' ); 1457 1482 } catch ( e ) {} 1458 1483 } -
trunk/src/wp-admin/css/common.css
r46247 r46250 2042 2042 } 2043 2043 2044 .js .widget .widget-top.is-non-sortable, 2045 .js .postbox .hndle.is-non-sortable { 2046 cursor: auto; 2047 } 2048 2044 2049 .hndle a { 2045 2050 font-size: 11px;
Note: See TracChangeset
for help on using the changeset viewer.