Accessibility: Administration: Improve the sortable postboxes areas on the Dashboard and Classic Editor pages.

- makes the postboxes areas in the Dashboard visible also on large screens 
- uses a more meaningful text when all postboxes areas are empty instead of "Drag boxes here"
- restores the ability to drag boxes to the "advanced" area in the Classic Editor page
- makes the postboxes areas in the Classic Editor page visible while dragging so that users have a clue what the available areas are
- improves the color contrast of the postboxes areas while dragging
- uses `wp.i18n` for translatable strings in `wp-admin/js/postbox.js`

Props xkon, karmatosed, audrasjb, ocean90, joedolson, afercia, azaozz.
See #20491.
Fixes #49288, #47541.

Built from https://develop.svn.wordpress.org/trunk@48340


git-svn-id: http://core.svn.wordpress.org/trunk@48109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2020-07-06 18:03:02 +00:00
parent 5ad2cf365e
commit 454dab13c1
16 changed files with 242 additions and 185 deletions

View File

@ -30,46 +30,6 @@
overflow: visible;
}
/* inner 2 column liquid layout */
.inner-sidebar {
float: left;
clear: left;
display: none;
width: 281px;
position: relative;
}
.columns-2 .inner-sidebar {
margin-left: auto;
width: 286px;
display: block;
}
.inner-sidebar #side-sortables,
.columns-2 .inner-sidebar #side-sortables {
min-height: 300px;
width: 280px;
padding: 0;
}
.has-right-sidebar .inner-sidebar {
display: block;
}
.has-right-sidebar #post-body {
float: right;
clear: right;
width: 100%;
margin-left: -2000px;
}
.has-right-sidebar #post-body-content {
margin-left: 300px;
float: none;
width: auto;
}
/* 2 columns main area */
#col-left {
@ -1984,36 +1944,11 @@ html.wp-toolbar {
}
.metabox-holder .postbox-container .empty-container {
border: 3px dashed #b4b9be;
outline: 3px dashed #b4b9be;
height: 250px;
position: relative;
}
.metabox-holder .postbox-container .empty-container:after {
content: attr(data-emptystring);
margin: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 1em;
width: 200px;
text-align: center;
color: #ccc;
font-size: 18px;
display: none;
}
.metabox-holder.columns-1 .postbox-container .empty-container,
.columns-2 #postbox-container-3 .empty-container,
.columns-2 #postbox-container-4 .empty-container,
.columns-3 #postbox-container-4 .empty-container {
border: 0 none;
height: 0;
min-height: 0;
}
#post-body-content {
width: 100%;
min-width: 463px;
@ -2033,7 +1968,7 @@ html.wp-toolbar {
/* one column on the dash */
@media only screen and (max-width: 799px) {
#wpbody-content .metabox-holder .postbox-container .empty-container {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -29,46 +29,6 @@
overflow: visible;
}
/* inner 2 column liquid layout */
.inner-sidebar {
float: right;
clear: right;
display: none;
width: 281px;
position: relative;
}
.columns-2 .inner-sidebar {
margin-right: auto;
width: 286px;
display: block;
}
.inner-sidebar #side-sortables,
.columns-2 .inner-sidebar #side-sortables {
min-height: 300px;
width: 280px;
padding: 0;
}
.has-right-sidebar .inner-sidebar {
display: block;
}
.has-right-sidebar #post-body {
float: left;
clear: left;
width: 100%;
margin-right: -2000px;
}
.has-right-sidebar #post-body-content {
margin-right: 300px;
float: none;
width: auto;
}
/* 2 columns main area */
#col-left {
@ -1983,36 +1943,11 @@ html.wp-toolbar {
}
.metabox-holder .postbox-container .empty-container {
border: 3px dashed #b4b9be;
outline: 3px dashed #b4b9be;
height: 250px;
position: relative;
}
.metabox-holder .postbox-container .empty-container:after {
content: attr(data-emptystring);
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 1em;
width: 200px;
text-align: center;
color: #ccc;
font-size: 18px;
display: none;
}
.metabox-holder.columns-1 .postbox-container .empty-container,
.columns-2 #postbox-container-3 .empty-container,
.columns-2 #postbox-container-4 .empty-container,
.columns-3 #postbox-container-4 .empty-container {
border: 0 none;
height: 0;
min-height: 0;
}
#post-body-content {
width: 100%;
min-width: 463px;
@ -2032,7 +1967,7 @@ html.wp-toolbar {
/* one column on the dash */
@media only screen and (max-width: 799px) {
#wpbody-content .metabox-holder .postbox-container .empty-container {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -49,10 +49,35 @@
}
#dashboard-widgets .meta-box-sortables {
margin: 0 8px;
/* Required min-height to make the jQuery UI Sortable drop zone work. */
min-height: 100px;
margin: 0 8px 20px;
}
/* Only highlight drop zones when dragging and only in the 2 columns layout. */
.is-dragging-metaboxes #dashboard-widgets .meta-box-sortables {
outline: 3px dashed #606a73;
/* Prevent margin on the child from collapsing with margin on the parent. */
display: flow-root;
}
#dashboard-widgets .postbox-container .empty-container:after {
content: attr(data-emptystring);
margin: auto;
position: absolute;
top: 50%;
right: 0;
left: 0;
transform: translateY( -50% );
padding: 0 2em;
text-align: center;
color: #606a73;
font-size: 16px;
line-height: 1.5;
display: none;
}
/* @todo: this was originally in this section, but likely belongs elsewhere */
#the-comment-list td.comment p.comment-author {
margin-top: 0;
@ -1079,6 +1104,18 @@ a.rsswidget {
#wpbody-content #dashboard-widgets .postbox-container {
width: 100%;
}
#dashboard-widgets .meta-box-sortables {
min-height: 0;
}
.is-dragging-metaboxes #dashboard-widgets .meta-box-sortables {
min-height: 100px;
}
#dashboard-widgets .meta-box-sortables.empty-container {
margin-bottom: 0;
}
}
/* two columns on the dash, but keep the setting if one is selected */
@ -1096,9 +1133,10 @@ a.rsswidget {
#dashboard-widgets #postbox-container-3 .empty-container,
#dashboard-widgets #postbox-container-4 .empty-container {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
margin-bottom: 0;
}
#dashboard-widgets #postbox-container-3 .empty-container:after,
@ -1110,10 +1148,11 @@ a.rsswidget {
width: 100%;
}
#wpbody #wpbody-content .metabox-holder.columns-1 .postbox-container .empty-container {
border: 0 none;
#wpbody #dashboard-widgets .metabox-holder.columns-1 .postbox-container .empty-container {
outline: none;
height: 0;
min-height: 0;
margin-bottom: 0;
}
/* show the radio buttons for column prefs only for one or two columns */
@ -1127,7 +1166,7 @@ a.rsswidget {
display: none;
}
.metabox-holder .postbox-container .empty-container:after {
#dashboard-widgets .postbox-container .empty-container:after {
display: block;
}
}
@ -1148,16 +1187,24 @@ a.rsswidget {
}
#dashboard-widgets #postbox-container-4 .empty-container {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
margin-bottom: 0;
}
#dashboard-widgets #postbox-container-4 .empty-container:after {
display: none;
}
.metabox-holder .postbox-container .empty-container:after {
#dashboard-widgets .postbox-container .empty-container:after {
display: block;
}
}
/* Always show the "Drag boxes here" CSS generated content on large screens. */
@media only screen and (min-width: 1801px) {
#dashboard-widgets .postbox-container .empty-container:after {
display: block;
}
}

File diff suppressed because one or more lines are too long

View File

@ -48,10 +48,35 @@
}
#dashboard-widgets .meta-box-sortables {
margin: 0 8px;
/* Required min-height to make the jQuery UI Sortable drop zone work. */
min-height: 100px;
margin: 0 8px 20px;
}
/* Only highlight drop zones when dragging and only in the 2 columns layout. */
.is-dragging-metaboxes #dashboard-widgets .meta-box-sortables {
outline: 3px dashed #606a73;
/* Prevent margin on the child from collapsing with margin on the parent. */
display: flow-root;
}
#dashboard-widgets .postbox-container .empty-container:after {
content: attr(data-emptystring);
margin: auto;
position: absolute;
top: 50%;
left: 0;
right: 0;
transform: translateY( -50% );
padding: 0 2em;
text-align: center;
color: #606a73;
font-size: 16px;
line-height: 1.5;
display: none;
}
/* @todo: this was originally in this section, but likely belongs elsewhere */
#the-comment-list td.comment p.comment-author {
margin-top: 0;
@ -1078,6 +1103,18 @@ a.rsswidget {
#wpbody-content #dashboard-widgets .postbox-container {
width: 100%;
}
#dashboard-widgets .meta-box-sortables {
min-height: 0;
}
.is-dragging-metaboxes #dashboard-widgets .meta-box-sortables {
min-height: 100px;
}
#dashboard-widgets .meta-box-sortables.empty-container {
margin-bottom: 0;
}
}
/* two columns on the dash, but keep the setting if one is selected */
@ -1095,9 +1132,10 @@ a.rsswidget {
#dashboard-widgets #postbox-container-3 .empty-container,
#dashboard-widgets #postbox-container-4 .empty-container {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
margin-bottom: 0;
}
#dashboard-widgets #postbox-container-3 .empty-container:after,
@ -1109,10 +1147,11 @@ a.rsswidget {
width: 100%;
}
#wpbody #wpbody-content .metabox-holder.columns-1 .postbox-container .empty-container {
border: 0 none;
#wpbody #dashboard-widgets .metabox-holder.columns-1 .postbox-container .empty-container {
outline: none;
height: 0;
min-height: 0;
margin-bottom: 0;
}
/* show the radio buttons for column prefs only for one or two columns */
@ -1126,7 +1165,7 @@ a.rsswidget {
display: none;
}
.metabox-holder .postbox-container .empty-container:after {
#dashboard-widgets .postbox-container .empty-container:after {
display: block;
}
}
@ -1147,16 +1186,24 @@ a.rsswidget {
}
#dashboard-widgets #postbox-container-4 .empty-container {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
margin-bottom: 0;
}
#dashboard-widgets #postbox-container-4 .empty-container:after {
display: none;
}
.metabox-holder .postbox-container .empty-container:after {
#dashboard-widgets .postbox-container .empty-container:after {
display: block;
}
}
/* Always show the "Drag boxes here" CSS generated content on large screens. */
@media only screen and (min-width: 1801px) {
#dashboard-widgets .postbox-container .empty-container:after {
display: block;
}
}

File diff suppressed because one or more lines are too long

View File

@ -148,8 +148,37 @@ body.post-new-php .submitbox .submitdelete {
}
/* Post Screen */
#post-body #normal-sortables {
min-height: 50px;
/* Only target the sortables in the post screen excluding the ones in the Dashboard. */
#post-body .meta-box-sortables {
/* Required min-height to make the jQuery UI Sortable drop zone work. */
min-height: 1px;
}
/* Resets height and outline inherited from common.css. */
#post-body.columns-1 #side-sortables.empty-container,
#post-body #normal-sortables.empty-container,
#post-body #advanced-sortables.empty-container {
/* Sortables need some initial height to work correctly. */
height: 1px;
outline: none;
}
/* Only highlight drop zones when dragging and only in the 2 columns layout. */
.is-dragging-metaboxes #post-body.columns-2 #side-sortables,
.is-dragging-metaboxes #post-body #normal-sortables,
.is-dragging-metaboxes #post-body #advanced-sortables {
outline: 3px dashed #606a73;
/* Prevent margin on the child from collapsing with margin on the parent. */
display: flow-root;
/*
* This min-height is meant to limit jumpiness while dragging. It's equivalent
* to the minimum height of the sortable-placeholder which is given by the height
* of a collapsed post box (36px + 1px top and bottom borders) + the placeholder
* bottom margin (20px) + 2 additional pixels to compensate browsers rounding.
*/
min-height: 60px;
margin-bottom: 20px;
}
.postbox {
@ -1454,7 +1483,10 @@ table.links-table {
}
}
/* one column on the attachment editor screen */
/*
* The edit attachment screen auto-switches to one column layout when the
* viewport is smaller than 1200 pixels.
*/
@media only screen and (max-width: 1200px) {
.post-type-attachment #poststuff {
min-width: 0;
@ -1471,7 +1503,7 @@ table.links-table {
.post-type-attachment #poststuff #postbox-container-1 .empty-container,
.post-type-attachment #poststuff #postbox-container-1 #side-sortables:empty {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
}
@ -1481,6 +1513,12 @@ table.links-table {
width: auto;
}
.is-dragging-metaboxes.post-type-attachment #post-body .meta-box-sortables {
outline: none;
min-height: 0;
margin-bottom: 0;
}
/* hide the radio buttons for column prefs */
.post-type-attachment .screen-layout,
.post-type-attachment .columns-prefs {
@ -1505,7 +1543,7 @@ table.links-table {
#poststuff #postbox-container-1 .empty-container,
#poststuff #postbox-container-1 #side-sortables:empty {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -147,8 +147,37 @@ body.post-new-php .submitbox .submitdelete {
}
/* Post Screen */
#post-body #normal-sortables {
min-height: 50px;
/* Only target the sortables in the post screen excluding the ones in the Dashboard. */
#post-body .meta-box-sortables {
/* Required min-height to make the jQuery UI Sortable drop zone work. */
min-height: 1px;
}
/* Resets height and outline inherited from common.css. */
#post-body.columns-1 #side-sortables.empty-container,
#post-body #normal-sortables.empty-container,
#post-body #advanced-sortables.empty-container {
/* Sortables need some initial height to work correctly. */
height: 1px;
outline: none;
}
/* Only highlight drop zones when dragging and only in the 2 columns layout. */
.is-dragging-metaboxes #post-body.columns-2 #side-sortables,
.is-dragging-metaboxes #post-body #normal-sortables,
.is-dragging-metaboxes #post-body #advanced-sortables {
outline: 3px dashed #606a73;
/* Prevent margin on the child from collapsing with margin on the parent. */
display: flow-root;
/*
* This min-height is meant to limit jumpiness while dragging. It's equivalent
* to the minimum height of the sortable-placeholder which is given by the height
* of a collapsed post box (36px + 1px top and bottom borders) + the placeholder
* bottom margin (20px) + 2 additional pixels to compensate browsers rounding.
*/
min-height: 60px;
margin-bottom: 20px;
}
.postbox {
@ -1453,7 +1482,10 @@ table.links-table {
}
}
/* one column on the attachment editor screen */
/*
* The edit attachment screen auto-switches to one column layout when the
* viewport is smaller than 1200 pixels.
*/
@media only screen and (max-width: 1200px) {
.post-type-attachment #poststuff {
min-width: 0;
@ -1470,7 +1502,7 @@ table.links-table {
.post-type-attachment #poststuff #postbox-container-1 .empty-container,
.post-type-attachment #poststuff #postbox-container-1 #side-sortables:empty {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
}
@ -1480,6 +1512,12 @@ table.links-table {
width: auto;
}
.is-dragging-metaboxes.post-type-attachment #post-body .meta-box-sortables {
outline: none;
min-height: 0;
margin-bottom: 0;
}
/* hide the radio buttons for column prefs */
.post-type-attachment .screen-layout,
.post-type-attachment .columns-prefs {
@ -1504,7 +1542,7 @@ table.links-table {
#poststuff #postbox-container-1 .empty-container,
#poststuff #postbox-container-1 #side-sortables:empty {
border: 0 none;
outline: none;
height: 0;
min-height: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -7,10 +7,11 @@
* @output wp-admin/js/postbox.js
*/
/* global ajaxurl, postBoxL10n, postboxes */
/* global ajaxurl, postboxes */
(function($) {
var $document = $( document );
var $document = $( document ),
__ = wp.i18n.__;
/**
* This object contains all function to handle the behaviour of the post boxes. The post boxes are the boxes you see
@ -235,14 +236,18 @@
.end();
},
opacity: 0.65,
start: function() {
$( 'body' ).addClass( 'is-dragging-metaboxes' );
},
stop: function() {
var $el = $( this );
$( 'body' ).removeClass( 'is-dragging-metaboxes' );
if ( $el.find( '#dashboard_browser_nag' ).is( ':visible' ) && 'dashboard_browser_nag' != this.firstChild.id ) {
$el.sortable('cancel');
return;
}
postboxes.save_order(page);
},
receive: function(e,ui) {
@ -345,26 +350,44 @@
* @return {void}
*/
_mark_area : function() {
var visible = $('div.postbox:visible').length, side = $('#post-body #side-sortables');
var visibleSortables = $( '#dashboard-widgets .meta-box-sortables:visible, #post-body .meta-box-sortables:visible' ),
areAllVisibleSortablesEmpty = true;
$( '#dashboard-widgets .meta-box-sortables:visible' ).each( function() {
visibleSortables.each( function() {
var t = $(this);
if ( visible == 1 || t.children('.postbox:visible').length ) {
if ( t.children('.postbox:visible').length ) {
t.removeClass('empty-container');
areAllVisibleSortablesEmpty = false;
}
else {
t.addClass('empty-container');
t.attr('data-emptyString', postBoxL10n.postBoxEmptyString);
}
});
if ( side.length ) {
if ( side.children('.postbox:visible').length )
side.removeClass('empty-container');
else if ( $('#postbox-container-1').css('width') == '280px' )
side.addClass('empty-container');
postboxes.updateEmptySortablesText( visibleSortables, areAllVisibleSortablesEmpty );
},
/**
* Updates the text for the empty sortable areas on the Dashboard.
*
* @since 5.5.0
*
* @return {void}
*/
updateEmptySortablesText: function( visibleSortables, areAllVisibleSortablesEmpty ) {
var isDashboard = $( '#dashboard-widgets' ).length,
emptySortableText = areAllVisibleSortablesEmpty ? __( 'Add boxes from the Screen Options menu' ) : __( 'Drag boxes here' );
if ( ! isDashboard ) {
return;
}
visibleSortables.each( function() {
if ( $( this ).hasClass( 'empty-container' ) ) {
$( this ).attr( 'data-emptyString', emptySortableText );
}
} );
},
/**

View File

@ -1,2 +1,2 @@
/*! This file is auto-generated */
!function(a){var n=a(document);window.postboxes={handle_click:function(){var e,o=a(this),s=o.parent(".postbox"),t=s.attr("id");"dashboard_browser_nag"!==t&&(s.toggleClass("closed"),e=!s.hasClass("closed"),o.hasClass("handlediv")?o.attr("aria-expanded",e):o.closest(".postbox").find("button.handlediv").attr("aria-expanded",e),"press-this"!==postboxes.page&&postboxes.save_state(postboxes.page),t&&(!s.hasClass("closed")&&a.isFunction(postboxes.pbshow)?postboxes.pbshow(t):s.hasClass("closed")&&a.isFunction(postboxes.pbhide)&&postboxes.pbhide(t)),n.trigger("postbox-toggled",s))},add_postbox_toggles:function(t,e){var o=a(".postbox .hndle, .postbox .handlediv");this.page=t,this.init(t,e),o.on("click.postboxes",this.handle_click),a(".postbox .hndle a").click(function(e){e.stopPropagation()}),a(".postbox a.dismiss").on("click.postboxes",function(e){var o=a(this).parents(".postbox").attr("id")+"-hide";e.preventDefault(),a("#"+o).prop("checked",!1).triggerHandler("click")}),a(".hide-postbox-tog").bind("click.postboxes",function(){var e=a(this),o=e.val(),s=a("#"+o);e.prop("checked")?(s.show(),a.isFunction(postboxes.pbshow)&&postboxes.pbshow(o)):(s.hide(),a.isFunction(postboxes.pbhide)&&postboxes.pbhide(o)),postboxes.save_state(t),postboxes._mark_area(),n.trigger("postbox-toggled",s)}),a('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var e=parseInt(a(this).val(),10);e&&(postboxes._pb_edit(e),postboxes.save_order(t))})},init:function(o,e){var s=a(document.body).hasClass("mobile"),t=a(".postbox .handlediv");a.extend(this,e||{}),a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",delay:s?200:0,distance:2,tolerance:"pointer",forcePlaceholderSize:!0,helper:function(e,o){return o.clone().find(":input").attr("name",function(e,o){return"sort_"+parseInt(1e5*Math.random(),10).toString()+"_"+o}).end()},opacity:.65,stop:function(){var e=a(this);e.find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id?e.sortable("cancel"):postboxes.save_order(o)},receive:function(e,o){"dashboard_browser_nag"==o.item[0].id&&a(o.sender).sortable("cancel"),postboxes._mark_area(),n.trigger("postbox-moved",o.item)}}),s&&(a(document.body).bind("orientationchange.postboxes",function(){postboxes._pb_change()}),this._pb_change()),this._mark_area(),t.each(function(){var e=a(this);e.attr("aria-expanded",!e.parent(".postbox").hasClass("closed"))})},save_state:function(e){var o,s;"nav-menus"!==e&&(o=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),s=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(","),a.post(ajaxurl,{action:"closed-postboxes",closed:o,hidden:s,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:e}))},save_order:function(e){var o,s=a(".columns-prefs input:checked").val()||0;o={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:s,page:e},a(".meta-box-sortables").each(function(){o["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")}),a.post(ajaxurl,o)},_mark_area:function(){var o=a("div.postbox:visible").length,e=a("#post-body #side-sortables");a("#dashboard-widgets .meta-box-sortables:visible").each(function(){var e=a(this);1==o||e.children(".postbox:visible").length?e.removeClass("empty-container"):(e.addClass("empty-container"),e.attr("data-emptyString",postBoxL10n.postBoxEmptyString))}),e.length&&(e.children(".postbox:visible").length?e.removeClass("empty-container"):"280px"==a("#postbox-container-1").css("width")&&e.addClass("empty-container"))},_pb_edit:function(e){var o=a(".metabox-holder").get(0);o&&(o.className=o.className.replace(/columns-\d+/,"columns-"+e)),a(document).trigger("postboxes-columnchange")},_pb_change:function(){var e=a('label.columns-prefs-1 input[type="radio"]');switch(window.orientation){case 90:case-90:e.length&&e.is(":checked")||this._pb_edit(2);break;case 0:case 180:a("#poststuff").length?this._pb_edit(1):e.length&&e.is(":checked")||this._pb_edit(2)}},pbshow:!1,pbhide:!1}}(jQuery);
!function(a){var n=a(document),i=wp.i18n.__;window.postboxes={handle_click:function(){var e,o=a(this),s=o.parent(".postbox"),t=s.attr("id");"dashboard_browser_nag"!==t&&(s.toggleClass("closed"),e=!s.hasClass("closed"),o.hasClass("handlediv")?o.attr("aria-expanded",e):o.closest(".postbox").find("button.handlediv").attr("aria-expanded",e),"press-this"!==postboxes.page&&postboxes.save_state(postboxes.page),t&&(!s.hasClass("closed")&&a.isFunction(postboxes.pbshow)?postboxes.pbshow(t):s.hasClass("closed")&&a.isFunction(postboxes.pbhide)&&postboxes.pbhide(t)),n.trigger("postbox-toggled",s))},add_postbox_toggles:function(t,e){var o=a(".postbox .hndle, .postbox .handlediv");this.page=t,this.init(t,e),o.on("click.postboxes",this.handle_click),a(".postbox .hndle a").click(function(e){e.stopPropagation()}),a(".postbox a.dismiss").on("click.postboxes",function(e){var o=a(this).parents(".postbox").attr("id")+"-hide";e.preventDefault(),a("#"+o).prop("checked",!1).triggerHandler("click")}),a(".hide-postbox-tog").bind("click.postboxes",function(){var e=a(this),o=e.val(),s=a("#"+o);e.prop("checked")?(s.show(),a.isFunction(postboxes.pbshow)&&postboxes.pbshow(o)):(s.hide(),a.isFunction(postboxes.pbhide)&&postboxes.pbhide(o)),postboxes.save_state(t),postboxes._mark_area(),n.trigger("postbox-toggled",s)}),a('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var e=parseInt(a(this).val(),10);e&&(postboxes._pb_edit(e),postboxes.save_order(t))})},init:function(o,e){var s=a(document.body).hasClass("mobile"),t=a(".postbox .handlediv");a.extend(this,e||{}),a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",delay:s?200:0,distance:2,tolerance:"pointer",forcePlaceholderSize:!0,helper:function(e,o){return o.clone().find(":input").attr("name",function(e,o){return"sort_"+parseInt(1e5*Math.random(),10).toString()+"_"+o}).end()},opacity:.65,start:function(){a("body").addClass("is-dragging-metaboxes")},stop:function(){var e=a(this);a("body").removeClass("is-dragging-metaboxes"),e.find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id?e.sortable("cancel"):postboxes.save_order(o)},receive:function(e,o){"dashboard_browser_nag"==o.item[0].id&&a(o.sender).sortable("cancel"),postboxes._mark_area(),n.trigger("postbox-moved",o.item)}}),s&&(a(document.body).bind("orientationchange.postboxes",function(){postboxes._pb_change()}),this._pb_change()),this._mark_area(),t.each(function(){var e=a(this);e.attr("aria-expanded",!e.parent(".postbox").hasClass("closed"))})},save_state:function(e){var o,s;"nav-menus"!==e&&(o=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),s=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(","),a.post(ajaxurl,{action:"closed-postboxes",closed:o,hidden:s,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:e}))},save_order:function(e){var o,s=a(".columns-prefs input:checked").val()||0;o={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:s,page:e},a(".meta-box-sortables").each(function(){o["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")}),a.post(ajaxurl,o)},_mark_area:function(){var e=a("#dashboard-widgets .meta-box-sortables:visible, #post-body .meta-box-sortables:visible"),o=!0;e.each(function(){var e=a(this);e.children(".postbox:visible").length?(e.removeClass("empty-container"),o=!1):e.addClass("empty-container")}),postboxes.updateEmptySortablesText(e,o)},updateEmptySortablesText:function(e,o){var s=a("#dashboard-widgets").length,t=i(o?"Add boxes from the Screen Options menu":"Drag boxes here");s&&e.each(function(){a(this).hasClass("empty-container")&&a(this).attr("data-emptyString",t)})},_pb_edit:function(e){var o=a(".metabox-holder").get(0);o&&(o.className=o.className.replace(/columns-\d+/,"columns-"+e)),a(document).trigger("postboxes-columnchange")},_pb_change:function(){var e=a('label.columns-prefs-1 input[type="radio"]');switch(window.orientation){case 90:case-90:e.length&&e.is(":checked")||this._pb_edit(2);break;case 0:case 180:a("#poststuff").length?this._pb_edit(1):e.length&&e.is(":checked")||this._pb_edit(2)}},pbshow:!1,pbhide:!1}}(jQuery);

View File

@ -1240,13 +1240,7 @@ function wp_default_scripts( $scripts ) {
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'postbox',
'postBoxL10n',
array(
'postBoxEmptyString' => __( 'Drag boxes here' ),
)
);
$scripts->set_translations( 'postbox' );
$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48339';
$wp_version = '5.5-alpha-48340';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.