diff --git a/src/js/_enqueues/wp/dashboard.js b/src/js/_enqueues/wp/dashboard.js index bea3373ae5c97..9290d36c6bb34 100644 --- a/src/js/_enqueues/wp/dashboard.js +++ b/src/js/_enqueues/wp/dashboard.js @@ -3,7 +3,7 @@ */ /* global pagenow, ajaxurl, postboxes, wpActiveEditor:true, ajaxWidgets */ -/* global ajaxPopulateWidgets, quickPressLoad, */ +/* global ajaxPopulateWidgets, quickPressLoad */ window.wp = window.wp || {}; window.communityEventsData = window.communityEventsData || {}; @@ -137,31 +137,27 @@ jQuery( function($) { * @return {void} */ window.quickPressLoad = function() { - var act = $('#quickpost-action'), t; + var act = $( '#quickpost-action' ), t; - // Enable the submit buttons. - $( '#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]' ).prop( 'disabled' , false ); + // Enable the submit button. + $( '#quick-press .submit input[type="submit"]' ).prop( 'disabled', false ); - t = $('#quick-press').on( 'submit', function( e ) { + t = $( '#quick-press' ).on( 'submit', function( e ) { e.preventDefault(); - // Show a spinner. - $('#dashboard_quick_press #publishing-action .spinner').show(); - // Disable the submit button to prevent duplicate submissions. - $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', true); + $( '#quick-press .submit input[type="submit"]' ).prop( 'disabled', true ); // Post the entered data to save it. $.post( t.attr( 'action' ), t.serializeArray(), function( data ) { // Replace the form, and prepend the published post. - $('#dashboard_quick_press .inside').html( data ); - $('#quick-press').removeClass('initial-form'); + $( '#dashboard_quick_press .inside' ).html( data ); quickPressLoad(); highlightLatestPost(); // Focus the title to allow for quickly drafting another post. - $('#title').trigger( 'focus' ); - }); + $( '#title' ).focus(); + } ); /** * Highlights the latest post for one second. @@ -169,20 +165,20 @@ jQuery( function($) { * @return {void} */ function highlightLatestPost () { - var latestPost = $('.drafts ul li').first(); - latestPost.css('background', '#fffbe5'); - setTimeout(function () { - latestPost.css('background', 'none'); - }, 1000); + var latestPost = $( '.drafts ul li' ) .first(); + latestPost.css( 'background', '#fffbe5' ); + setTimeout( function () { + latestPost.css( 'background', 'none' ); + }, 1000 ); } } ); // Change the QuickPost action to the publish value. - $('#publish').on( 'click', function() { act.val( 'post-quickpress-publish' ); } ); + $( '#publish' ).on( 'click', function() { act.val( 'post-quickpress-publish' ); } ); - $('#quick-press').on( 'click focusin', function() { + $( '#quick-press' ).on( 'click focusin', function() { wpActiveEditor = 'content'; - }); + } ); autoResizeTextarea(); }; diff --git a/src/wp-admin/css/dashboard.css b/src/wp-admin/css/dashboard.css index ab73f828f7067..892d309de4da6 100644 --- a/src/wp-admin/css/dashboard.css +++ b/src/wp-admin/css/dashboard.css @@ -780,12 +780,6 @@ body #dashboard-widgets .postbox form .submit { padding: 0; } -#dashboard_quick_press div.updated { - margin-bottom: 10px; - border: 1px solid #f0f0f1; - border-width: 1px 1px 1px 0; -} - #dashboard_quick_press form { margin: 12px; } @@ -803,7 +797,6 @@ body #dashboard-widgets .postbox form .submit { #dashboard_quick_press input, #dashboard_quick_press textarea { - box-sizing: border-box; margin: 0; } @@ -850,11 +843,12 @@ body #dashboard-widgets .postbox form .submit { #dashboard_quick_press .drafts li { margin-bottom: 1em; } + #dashboard_quick_press .drafts li time { color: #646970; } -#dashboard_quick_press .drafts p { +#dashboard_quick_press .drafts .draft-content { margin: 0; word-wrap: break-word; } diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 778e3de40326b..5a0a524e201ab 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -541,12 +541,14 @@ function wp_network_dashboard_right_now() { * Displays the Quick Draft widget. * * @since 3.8.0 + * @since 7.1.0 Added $notice_type parameter. * * @global int $post_ID * - * @param string|false $error_msg Optional. Error message. Default false. + * @param string|false $message Optional. Error or success message. Default false. + * @param string $notice_type Optional. Admin notice type. Default 'notice-error'. */ -function wp_dashboard_quick_press( $error_msg = false ) { +function wp_dashboard_quick_press( $message = false, $notice_type = 'notice-error' ) { global $post_ID; if ( ! current_user_can( 'edit_posts' ) ) { @@ -578,14 +580,17 @@ function wp_dashboard_quick_press( $error_msg = false ) { $post_ID = (int) $post->ID; ?> -