Changeset 48340
- Timestamp:
- 07/06/2020 06:01:55 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/postbox.js
r48129 r48340 8 8 */ 9 9 10 /* global ajaxurl, post BoxL10n, postboxes */10 /* global ajaxurl, postboxes */ 11 11 12 12 (function($) { 13 var $document = $( document ); 13 var $document = $( document ), 14 __ = wp.i18n.__; 14 15 15 16 /** … … 236 237 }, 237 238 opacity: 0.65, 239 start: function() { 240 $( 'body' ).addClass( 'is-dragging-metaboxes' ); 241 }, 238 242 stop: function() { 239 243 var $el = $( this ); 244 245 $( 'body' ).removeClass( 'is-dragging-metaboxes' ); 240 246 241 247 if ( $el.find( '#dashboard_browser_nag' ).is( ':visible' ) && 'dashboard_browser_nag' != this.firstChild.id ) { … … 243 249 return; 244 250 } 245 246 251 postboxes.save_order(page); 247 252 }, … … 346 351 */ 347 352 _mark_area : function() { 348 var visible = $('div.postbox:visible').length, side = $('#post-body #side-sortables'); 349 350 $( '#dashboard-widgets .meta-box-sortables:visible' ).each( function() { 353 var visibleSortables = $( '#dashboard-widgets .meta-box-sortables:visible, #post-body .meta-box-sortables:visible' ), 354 areAllVisibleSortablesEmpty = true; 355 356 visibleSortables.each( function() { 351 357 var t = $(this); 352 358 353 if ( visible == 1 ||t.children('.postbox:visible').length ) {359 if ( t.children('.postbox:visible').length ) { 354 360 t.removeClass('empty-container'); 361 areAllVisibleSortablesEmpty = false; 355 362 } 356 363 else { 357 364 t.addClass('empty-container'); 358 t.attr('data-emptyString', postBoxL10n.postBoxEmptyString); 359 } 360 }); 361 362 if ( side.length ) { 363 if ( side.children('.postbox:visible').length ) 364 side.removeClass('empty-container'); 365 else if ( $('#postbox-container-1').css('width') == '280px' ) 366 side.addClass('empty-container'); 367 } 365 } 366 }); 367 368 postboxes.updateEmptySortablesText( visibleSortables, areAllVisibleSortablesEmpty ); 369 }, 370 371 /** 372 * Updates the text for the empty sortable areas on the Dashboard. 373 * 374 * @since 5.5.0 375 * 376 * @return {void} 377 */ 378 updateEmptySortablesText: function( visibleSortables, areAllVisibleSortablesEmpty ) { 379 var isDashboard = $( '#dashboard-widgets' ).length, 380 emptySortableText = areAllVisibleSortablesEmpty ? __( 'Add boxes from the Screen Options menu' ) : __( 'Drag boxes here' ); 381 382 if ( ! isDashboard ) { 383 return; 384 } 385 386 visibleSortables.each( function() { 387 if ( $( this ).hasClass( 'empty-container' ) ) { 388 $( this ).attr( 'data-emptyString', emptySortableText ); 389 } 390 } ); 368 391 }, 369 392 -
trunk/src/wp-admin/css/common.css
r48316 r48340 28 28 width: 100%; 29 29 overflow: visible; 30 }31 32 /* inner 2 column liquid layout */33 34 .inner-sidebar {35 float: right;36 clear: right;37 display: none;38 width: 281px;39 position: relative;40 }41 42 .columns-2 .inner-sidebar {43 margin-right: auto;44 width: 286px;45 display: block;46 }47 48 .inner-sidebar #side-sortables,49 .columns-2 .inner-sidebar #side-sortables {50 min-height: 300px;51 width: 280px;52 padding: 0;53 }54 55 .has-right-sidebar .inner-sidebar {56 display: block;57 }58 59 .has-right-sidebar #post-body {60 float: left;61 clear: left;62 width: 100%;63 margin-right: -2000px;64 }65 66 .has-right-sidebar #post-body-content {67 margin-right: 300px;68 float: none;69 width: auto;70 30 } 71 31 … … 1984 1944 1985 1945 .metabox-holder .postbox-container .empty-container { 1986 border: 3px dashed #b4b9be;1946 outline: 3px dashed #b4b9be; 1987 1947 height: 250px; 1988 1948 position: relative; 1989 }1990 1991 .metabox-holder .postbox-container .empty-container:after {1992 content: attr(data-emptystring);1993 margin: auto;1994 position: absolute;1995 top: 0;1996 left: 0;1997 bottom: 0;1998 right: 0;1999 height: 1em;2000 width: 200px;2001 text-align: center;2002 color: #ccc;2003 font-size: 18px;2004 display: none;2005 }2006 2007 .metabox-holder.columns-1 .postbox-container .empty-container,2008 .columns-2 #postbox-container-3 .empty-container,2009 .columns-2 #postbox-container-4 .empty-container,2010 .columns-3 #postbox-container-4 .empty-container {2011 border: 0 none;2012 height: 0;2013 min-height: 0;2014 1949 } 2015 1950 … … 2033 1968 @media only screen and (max-width: 799px) { 2034 1969 #wpbody-content .metabox-holder .postbox-container .empty-container { 2035 border: 0none;1970 outline: none; 2036 1971 height: 0; 2037 1972 min-height: 0; -
trunk/src/wp-admin/css/dashboard.css
r48146 r48340 49 49 50 50 #dashboard-widgets .meta-box-sortables { 51 margin: 0 8px;51 /* Required min-height to make the jQuery UI Sortable drop zone work. */ 52 52 min-height: 100px; 53 } 53 margin: 0 8px 20px; 54 } 55 56 /* Only highlight drop zones when dragging and only in the 2 columns layout. */ 57 .is-dragging-metaboxes #dashboard-widgets .meta-box-sortables { 58 outline: 3px dashed #606a73; 59 /* Prevent margin on the child from collapsing with margin on the parent. */ 60 display: flow-root; 61 } 62 63 #dashboard-widgets .postbox-container .empty-container:after { 64 content: attr(data-emptystring); 65 margin: auto; 66 position: absolute; 67 top: 50%; 68 left: 0; 69 right: 0; 70 transform: translateY( -50% ); 71 padding: 0 2em; 72 text-align: center; 73 color: #606a73; 74 font-size: 16px; 75 line-height: 1.5; 76 display: none; 77 } 78 54 79 55 80 /* @todo: this was originally in this section, but likely belongs elsewhere */ … … 1079 1104 width: 100%; 1080 1105 } 1106 1107 #dashboard-widgets .meta-box-sortables { 1108 min-height: 0; 1109 } 1110 1111 .is-dragging-metaboxes #dashboard-widgets .meta-box-sortables { 1112 min-height: 100px; 1113 } 1114 1115 #dashboard-widgets .meta-box-sortables.empty-container { 1116 margin-bottom: 0; 1117 } 1081 1118 } 1082 1119 … … 1096 1133 #dashboard-widgets #postbox-container-3 .empty-container, 1097 1134 #dashboard-widgets #postbox-container-4 .empty-container { 1098 border: 0none;1135 outline: none; 1099 1136 height: 0; 1100 1137 min-height: 0; 1138 margin-bottom: 0; 1101 1139 } 1102 1140 … … 1110 1148 } 1111 1149 1112 #wpbody # wpbody-content.metabox-holder.columns-1 .postbox-container .empty-container {1113 border: 0none;1150 #wpbody #dashboard-widgets .metabox-holder.columns-1 .postbox-container .empty-container { 1151 outline: none; 1114 1152 height: 0; 1115 1153 min-height: 0; 1154 margin-bottom: 0; 1116 1155 } 1117 1156 … … 1127 1166 } 1128 1167 1129 .metabox-holder.postbox-container .empty-container:after {1168 #dashboard-widgets .postbox-container .empty-container:after { 1130 1169 display: block; 1131 1170 } … … 1148 1187 1149 1188 #dashboard-widgets #postbox-container-4 .empty-container { 1150 border: 0none;1189 outline: none; 1151 1190 height: 0; 1152 1191 min-height: 0; 1192 margin-bottom: 0; 1153 1193 } 1154 1194 … … 1157 1197 } 1158 1198 1159 .metabox-holder .postbox-container .empty-container:after { 1199 #dashboard-widgets .postbox-container .empty-container:after { 1200 display: block; 1201 } 1202 } 1203 1204 /* Always show the "Drag boxes here" CSS generated content on large screens. */ 1205 @media only screen and (min-width: 1801px) { 1206 #dashboard-widgets .postbox-container .empty-container:after { 1160 1207 display: block; 1161 1208 } -
trunk/src/wp-admin/css/edit.css
r48234 r48340 148 148 149 149 /* Post Screen */ 150 #post-body #normal-sortables { 151 min-height: 50px; 150 151 /* Only target the sortables in the post screen excluding the ones in the Dashboard. */ 152 #post-body .meta-box-sortables { 153 /* Required min-height to make the jQuery UI Sortable drop zone work. */ 154 min-height: 1px; 155 } 156 157 /* Resets height and outline inherited from common.css. */ 158 #post-body.columns-1 #side-sortables.empty-container, 159 #post-body #normal-sortables.empty-container, 160 #post-body #advanced-sortables.empty-container { 161 /* Sortables need some initial height to work correctly. */ 162 height: 1px; 163 outline: none; 164 } 165 166 /* Only highlight drop zones when dragging and only in the 2 columns layout. */ 167 .is-dragging-metaboxes #post-body.columns-2 #side-sortables, 168 .is-dragging-metaboxes #post-body #normal-sortables, 169 .is-dragging-metaboxes #post-body #advanced-sortables { 170 outline: 3px dashed #606a73; 171 /* Prevent margin on the child from collapsing with margin on the parent. */ 172 display: flow-root; 173 /* 174 * This min-height is meant to limit jumpiness while dragging. It's equivalent 175 * to the minimum height of the sortable-placeholder which is given by the height 176 * of a collapsed post box (36px + 1px top and bottom borders) + the placeholder 177 * bottom margin (20px) + 2 additional pixels to compensate browsers rounding. 178 */ 179 min-height: 60px; 180 margin-bottom: 20px; 152 181 } 153 182 … … 1454 1483 } 1455 1484 1456 /* one column on the attachment editor screen */ 1485 /* 1486 * The edit attachment screen auto-switches to one column layout when the 1487 * viewport is smaller than 1200 pixels. 1488 */ 1457 1489 @media only screen and (max-width: 1200px) { 1458 1490 .post-type-attachment #poststuff { … … 1471 1503 .post-type-attachment #poststuff #postbox-container-1 .empty-container, 1472 1504 .post-type-attachment #poststuff #postbox-container-1 #side-sortables:empty { 1473 border: 0none;1505 outline: none; 1474 1506 height: 0; 1475 1507 min-height: 0; … … 1479 1511 min-height: 0; 1480 1512 width: auto; 1513 } 1514 1515 .is-dragging-metaboxes.post-type-attachment #post-body .meta-box-sortables { 1516 outline: none; 1517 min-height: 0; 1518 margin-bottom: 0; 1481 1519 } 1482 1520 … … 1505 1543 #poststuff #postbox-container-1 .empty-container, 1506 1544 #poststuff #postbox-container-1 #side-sortables:empty { 1507 border: 0none;1545 outline: none; 1508 1546 height: 0; 1509 1547 min-height: 0; -
trunk/src/wp-includes/script-loader.php
r48323 r48340 1241 1241 1242 1242 $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable' ), false, 1 ); 1243 did_action( 'init' ) && $scripts->localize( 1244 'postbox', 1245 'postBoxL10n', 1246 array( 1247 'postBoxEmptyString' => __( 'Drag boxes here' ), 1248 ) 1249 ); 1243 $scripts->set_translations( 'postbox' ); 1250 1244 1251 1245 $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.