Ticket #38342: 38342.20.diff
File 38342.20.diff, 23.7 KB (added by , 8 years ago) |
---|
-
src/wp-admin/css/dashboard.css
diff --git src/wp-admin/css/dashboard.css src/wp-admin/css/dashboard.css index 72b0230..3c7b618 100644
form.initial-form.quickpress-open input#title { 518 518 resize: none; 519 519 } 520 520 521 #quick-press.is-saving .spinner { 522 visibility: inherit; 523 } 524 521 525 /* Dashboard Quick Draft - Drafts list */ 522 526 523 527 .js #dashboard_quick_press .drafts { … … form.initial-form.quickpress-open input#title { 541 545 margin: 0 12px; 542 546 } 543 547 548 #dashboard_quick_press .drafts ul.is-placeholder li { 549 padding: 3px 0; 550 color: transparent; 551 } 552 553 @-webkit-keyframes loading-fade { 554 555 0% { 556 opacity: 0.5; 557 } 558 559 50% { 560 opacity: 1; 561 } 562 563 100% { 564 opacity: 0.5; 565 } 566 } 567 568 @keyframes loading-fade { 569 570 0% { 571 opacity: 0.5; 572 } 573 574 50% { 575 opacity: 1; 576 } 577 578 100% { 579 opacity: 0.5; 580 } 581 } 582 583 #dashboard_quick_press .drafts ul.is-placeholder li:before, 584 #dashboard_quick_press .drafts ul.is-placeholder li:after { 585 content: ""; 586 display: block; 587 height: 13px; 588 background: #eee; 589 -webkit-animation: loading-fade 1.6s ease-in-out infinite; 590 animation: loading-fade 1.6s ease-in-out infinite; 591 } 592 593 #dashboard_quick_press .drafts ul.is-placeholder li:before { 594 margin-bottom: 5px; 595 width: 40%; 596 } 597 598 #dashboard_quick_press .drafts ul.is-placeholder li:after { 599 width: 80%; 600 } 601 544 602 #dashboard_quick_press .drafts li { 545 603 margin-bottom: 1em; 546 604 } 605 606 #dashboard_quick_press .drafts li.is-new { 607 background-color: #fffbe5; 608 } 609 547 610 #dashboard_quick_press .drafts li time { 548 611 color: #72777c; 549 612 } -
src/wp-admin/includes/dashboard.php
diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php index 0ecf0a2..299546b 100644
function wp_dashboard_setup() { 50 50 if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { 51 51 $quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Drafts' ) ); 52 52 wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' ); 53 add_action( 'admin_footer', 'wp_dashboard_print_recent_drafts_template' ); 53 54 } 54 55 55 56 // WordPress News … … function wp_dashboard_quick_press( $error_msg = false ) { 494 495 $post_ID = (int) $post->ID; 495 496 ?> 496 497 497 <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js"> 498 499 <?php if ( $error_msg ) : ?> 500 <div class="error"><?php echo $error_msg; ?></div> 501 <?php endif; ?> 502 498 <form name="post" method="post" id="quick-press" class="initial-form hide-if-no-js"> 499 <div class="notice notice-error notice-alt inline hidden"><p></p></div> 503 500 <div class="input-text-wrap" id="title-wrap"> 504 <label class=" screen-reader-textprompt" for="title" id="title-prompt-text">501 <label class="prompt" for="title" id="title-prompt-text"> 505 502 506 503 <?php 507 504 /** This filter is documented in wp-admin/edit-form-advanced.php */ 508 505 echo apply_filters( 'enter_title_here', __( 'Title' ), $post ); 509 506 ?> 510 507 </label> 511 <input type="text" name=" post_title" id="title" autocomplete="off" />508 <input type="text" name="title" id="title" autocomplete="off" /> 512 509 </div> 513 510 514 511 <div class="textarea-wrap" id="description-wrap"> 515 <label class=" screen-reader-textprompt" for="content" id="content-prompt-text"><?php _e( 'What’s on your mind?' ); ?></label>512 <label class="prompt" for="content" id="content-prompt-text"><?php _e( 'What’s on your mind?' ); ?></label> 516 513 <textarea name="content" id="content" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea> 517 514 </div> 518 519 515 <p class="submit"> 520 <input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" /> 521 <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" /> 522 <input type="hidden" name="post_type" value="post" /> 523 <?php wp_nonce_field( 'add-post' ); ?> 516 <div class="spinner no-float"></div> 524 517 <?php submit_button( __( 'Save Draft' ), 'primary', 'save', false, array( 'id' => 'save-post' ) ); ?> 525 518 <br class="clear" /> 526 519 </p> 527 520 528 521 </form> 522 <div id="quick-press-drafts" class="drafts"> 523 <p class="view-all" style="display: none;"> 524 <a href="<?php echo esc_url( admin_url( 'edit.php?post_status=draft' ) ) ?>" aria-label="<?php esc_attr_e( 'View all drafts' ) ?>"><?php _ex( 'View all', 'drafts' ) ?></a> 525 </p> 526 <h2 class="hide-if-no-js"><?php _e( 'Drafts' ) ?></h2> 527 <ul class="drafts-list is-placeholder"> 528 <li><span class="screen-reader-text"><?php _e( 'Loading…' ) ?></span></li> 529 </ul> 530 </div> 529 531 <?php 530 wp_dashboard_recent_drafts();531 532 } 532 533 533 534 /** 534 535 * Show recent drafts of the user on the dashboard. 535 536 * 536 537 * @since 2.7.0 538 * @deprecated 4.7 537 539 * 538 540 * @param array $drafts 539 541 */ … … function wp_dashboard_recent_drafts( $drafts = false ) { 548 550 'order' => 'DESC' 549 551 ); 550 552 551 /** 552 * Filters the post query arguments for the 'Recent Drafts' dashboard widget. 553 * 554 * @since 4.4.0 555 * 556 * @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget. 557 */ 553 /** This filter is documented in wp-includes/rest-api.php */ 558 554 $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); 559 555 560 556 $drafts = get_posts( $query_args ); … … function wp_dashboard_recent_drafts( $drafts = false ) { 586 582 } 587 583 588 584 /** 585 * Get the HTML template for the Quick Draft recent posts. 586 * 587 * @since 4.7.0 588 * 589 * @return string The template HTML. 590 */ 591 function wp_dashboard_print_recent_drafts_template() { 592 ?> 593 <script id="tmpl-item-quick-press-draft" type="text/template"> 594 <div class="draft-title"> 595 <a href="post.php?post={{ data.id }}&action=edit" aria-label="<?php esc_attr_e( 'Edit Post' ) ?>">{{ data.formattedTitle }}</a> 596 <time datetime="{{ data.date }}">{{ data.formattedDate }}</time> 597 </div> 598 {{{ data.formattedContent }}} 599 </script> 600 <?php 601 } 602 603 /** 589 604 * Outputs a row for the Recent Comments widget. 590 605 * 591 606 * @access private -
src/wp-admin/js/dashboard.js
diff --git src/wp-admin/js/dashboard.js src/wp-admin/js/dashboard.js index fa100dd..67246fa 100644
1 /* global pagenow, ajaxurl, postboxes, wpActiveEditor:true */2 var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;1 /* global _, wp, quickDraft, pagenow, ajaxurl, postboxes, wpActiveEditor:true */ 2 var ajaxWidgets, ajaxPopulateWidgets, QuickDraft = {}; 3 3 4 4 jQuery(document).ready( function($) { 5 5 var welcomePanel = $( '#welcome-panel' ), … … jQuery(document).ready( function($) { 59 59 }; 60 60 ajaxPopulateWidgets(); 61 61 62 postboxes.add_postbox_toggles(pagenow, { pbshow: ajaxPopulateWidgets } ); 63 64 /* QuickPress */ 65 quickPressLoad = function() { 66 var act = $('#quickpost-action'), t; 67 68 $( '#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]' ).prop( 'disabled' , false ); 69 70 t = $('#quick-press').submit( function( e ) { 71 e.preventDefault(); 72 $('#dashboard_quick_press #publishing-action .spinner').show(); 73 $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', true); 74 75 $.post( t.attr( 'action' ), t.serializeArray(), function( data ) { 76 // Replace the form, and prepend the published post. 77 $('#dashboard_quick_press .inside').html( data ); 78 $('#quick-press').removeClass('initial-form'); 79 quickPressLoad(); 80 highlightLatestPost(); 81 $('#title').focus(); 82 }); 83 84 function highlightLatestPost () { 85 var latestPost = $('.drafts ul li').first(); 86 latestPost.css('background', '#fffbe5'); 87 setTimeout(function () { 88 latestPost.css('background', 'none'); 89 }, 1000); 90 } 91 } ); 92 93 $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); 94 95 $('#title, #tags-input, #content').each( function() { 96 var input = $(this), prompt = $('#' + this.id + '-prompt-text'); 97 98 if ( '' === this.value ) { 99 prompt.removeClass('screen-reader-text'); 100 } 101 102 prompt.click( function() { 103 $(this).addClass('screen-reader-text'); 104 input.focus(); 105 }); 106 107 input.blur( function() { 108 if ( '' === this.value ) { 109 prompt.removeClass('screen-reader-text'); 110 } 111 }); 112 113 input.focus( function() { 114 prompt.addClass('screen-reader-text'); 115 }); 116 }); 62 postboxes.add_postbox_toggles(pagenow, { pbshow: function( id ) { 63 ajaxPopulateWidgets(); 117 64 118 $('#quick-press').on( 'click focusin', function() { 119 wpActiveEditor = 'content'; 120 }); 121 122 autoResizeTextarea(); 123 }; 124 quickPressLoad(); 65 if ( 'dashboard_quick_press' === id ) { 66 QuickDraft.init(); 67 } 68 } } ); 125 69 126 70 $( '.meta-box-sortables' ).sortable( 'option', 'containment', '#wpwrap' ); 127 71 … … jQuery(document).ready( function($) { 186 130 }); 187 131 } 188 132 133 autoResizeTextarea(); 134 135 if ( jQuery( '#dashboard_quick_press' ).is( ':visible' ) ) { 136 QuickDraft.init(); 137 } 138 }); 139 140 // Set up the QuickDraft views. 141 QuickDraft.Views = {}; 142 143 /** 144 * Set up a view object for the quick draft form. 145 * 146 * @since 4.7.0 147 * 148 * @augments wp.Backbone.View 149 */ 150 QuickDraft.Views.Form = wp.Backbone.View.extend( { 151 152 // Set up our default action handlers. 153 events: { 154 155 // Hide the prompt whena field receives focus. 156 'focus :input': 'hidePrompt', 157 158 // Possibly re-display the prompt when a field looses focus. 159 'blur :input': 'showPrompt', 160 161 // Listen for a reset event, showing all prompts. 162 'reset': 'showAllPrompts', 163 164 // Listed for and handle form submissions. 165 'submit': 'handleFormSubmission' 166 }, 167 168 // Initialize the QuickDraft Form view. 169 initialize: function() { 170 171 // Show all prompts in the form to begin. 172 this.showAllPrompts(); 173 174 // Rerender if the error state changes. 175 quickDraft.state.on( 'change:errorState', _.bind( this.render, this ) ); 176 }, 177 178 /** 179 * Handle toggling of the helper prompts shown inside each field. 180 * 181 * Will only show the prompt if the field is empty. 182 * 183 * @param {object} element Field element containing the helper prompt. 184 * @param {boolean} visible Should the prompt be visible? 185 */ 186 togglePrompt: function( element, visible ) { 187 var $input = jQuery( element ), 188 hasContent = $input.val().length > 0; 189 190 jQuery( element ).siblings( '.prompt' ).toggleClass( 'screen-reader-text', ! visible || hasContent ); 191 }, 192 193 // Show all of the field promts. 194 showAllPrompts: function() { 195 this.$el.find( ':input' ).each( _.bind( function( i, input ) { 196 197 // Prompt toggling must be deferred because the reset event is 198 // fired before the input values have been cleared 199 _.defer( _.bind( this.togglePrompt, this, input, true ) ); 200 }, this ) ); 201 }, 202 203 /** 204 * Show the prompt inside a field. 205 * 206 * @param {object} event The event triggering this show request. 207 */ 208 showPrompt: function( event ) { 209 this.togglePrompt( event.target, true ); 210 }, 211 212 /** 213 * Hide the prompt inside a field. 214 * 215 * @param {object} event The event triggering this hide request. 216 */ 217 hidePrompt: function( event ) { 218 this.togglePrompt( event.target, false ); 219 }, 220 221 /** 222 * Handle error conditions. 223 * 224 * {string} error The error condition, or false to reset. 225 */ 226 setErrorState: function( error ) { 227 228 // Set or reset the app state error condition. 229 quickDraft.state.set( 'errorState', error ); 230 231 if ( false !== error ) { 232 233 // Alert screen readers that an error occurred. 234 wp.a11y.speak( error, 'assertive' ); 235 } 236 237 }, 238 239 /** 240 * Handle the form submission event. 241 * 242 * @param {object} event The form submission event. 243 */ 244 handleFormSubmission: function( event ) { 245 var values, 246 hasValuesToSave = false; 247 248 // Prevent the browser's default form submission handling. 249 event.preventDefault(); 250 251 if ( quickDraft.state.get( 'submitting' ) ) { 252 return false; 253 } 254 255 quickDraft.state.set( 'submitting', true ); 256 257 // Reset the error state. 258 this.setErrorState( false ); 259 260 // Extract the form field values. 261 values = _.reduce( this.$el.serializeArray(), function( memo, field ) { 262 memo[ field.name ] = field.value; 263 return memo; 264 }, {} ); 265 266 // Check to see if there are any values to save. 267 _.each( values, function( value ) { 268 if ( '' !== value ) { 269 hasValuesToSave = true; 270 } 271 }); 272 273 // If the values are all blank, show an error. 274 if ( ! hasValuesToSave ) { 275 276 // Set the error. 277 this.setErrorState( quickDraft.l10n.errorEmptyFields ); 278 return; 279 } 280 281 // Save the new values to the model and confirm they are valid. 282 this.model.set( values ); 283 if ( ! this.model.isValid() ) { 284 return; 285 } 286 287 // Show a spinner during the callback. 288 this.$el.addClass( 'is-saving' ); 289 290 // Trigger the model save. 291 this.model.save() 292 293 // Always remove the spinner. 294 .always( 295 _.bind( function() { 296 this.$el.removeClass( 'is-saving' ); 297 298 // Refocus in the title field, hiding its prompt. 299 _.delay( function() { jQuery( '#quick-press input#title' ).focus(); }, 250 ); 300 301 // Submission complete 302 quickDraft.state.set( 'submitting', false ); 303 304 }, this ) 305 ) 306 307 // Handle save success. 308 .success( 309 _.bind( function() { 310 // Success! Clear any previous error state. 311 this.render(); 312 313 // Add the post model to the head of our collection. 314 this.collection.add( this.model, { at: 0 } ); 315 316 // Create a new post model to contain the form data and reset the form. 317 this.model = new wp.api.models.Post(); 318 this.model.on( 'change:errorState', _.bind( this.render, this ) ); 319 320 this.el.reset(); 321 }, this ) 322 ) 323 324 // Handle save failure. 325 .error( 326 _.bind( function( model, error ) { 327 var message = ''; 328 329 // Try to parse and use the response message. 330 try { 331 message = JSON.parse( error.responseText ).message; 332 } catch( e ) { 333 334 // Fall back to a default error string if we parse fails. 335 message = quickDraft.l10n.error; 336 } 337 338 // Set the app error condition. 339 this.setErrorState( message ); 340 }, this ) 341 ) 342 ; 343 }, 344 345 // Render the form view. 346 render: function() { 347 var $error = this.$el.find( '.notice-alt' ), 348 errorText = quickDraft.state.get( 'errorState' ); 349 350 // Error notice is only visible if error text is set. 351 $error.toggleClass( 'hidden', ! errorText ); 352 if ( errorText ) { 353 354 // Note: The inner text transform prevents XSS via html(). 355 $error.html( jQuery( '<p />', { text: errorText } ) ); 356 } 357 } 358 } ); 359 360 /** 361 * Set up a view object for the Quick Draft list of drafts. 362 * 363 * @since 4.7.0 364 * 365 * @augments wp.Backbone.View 366 */ 367 QuickDraft.Views.DraftList = wp.Backbone.View.extend( { 368 369 // Initialize the draft list view. 370 initialize: function() { 371 372 // Render the view once the drafts have loaded. 373 this.listenTo( this.collection, 'sync', this.onDraftsLoaded ); 374 }, 375 376 // Once the drafts have loaded, complete the setup. 377 onDraftsLoaded: function() { 378 379 // Add a listener for new items added to the underlying (draft) post collection. 380 this.listenTo( this.collection, 'add', this.renderNew ); 381 382 // Render the view! 383 this.render(); 384 }, 385 386 // Handle a new item being added to the collection. 387 renderNew: function() { 388 389 // Display highlight effect to first (added) item for one second. 390 var $newEl = this.render().$el.find( 'li:first' ).addClass( 'is-new' ); 391 setTimeout( function() { 392 $newEl.removeClass( 'is-new' ); 393 }, 1000 ); 394 395 // Alert screen readers that a new draft has been added. 396 wp.a11y.speak( quickDraft.l10n.newDraftCreated, 'assertive' ); 397 }, 398 399 // Render the draft post list view. 400 render: function() { 401 402 // Hide drafts list entirely if no drafts exist. 403 this.$el.toggle( this.collection.length > 0 ); 404 405 // Display a 'View All' link if there are more drafts available. 406 this.$el.find( '.view-all' ).toggle( this.collection.hasMore() ); 407 408 // Remove the placeholder class and render the models. 409 this.$el.find( '.drafts-list' ) 410 .removeClass( 'is-placeholder' ) 411 .html( 412 _.map( this.collection.models, function( draft ) { 413 return new QuickDraft.Views.DraftListItem( { 414 model: draft 415 } ).render().el; 416 } ) 417 ); 418 419 return this; 420 } 189 421 } ); 422 423 /** 424 * Set up a view object an individual draft in the draft list. 425 * 426 * @since 4.7.0 427 * 428 * @augments wp.Backbone.View 429 */ 430 QuickDraft.Views.DraftListItem = wp.Backbone.View.extend( { 431 tagName: 'li', 432 433 // Render beased on the passed template. 434 template: wp.template( 'item-quick-press-draft' ), 435 436 // Render a single draft list item. 437 render: function() { 438 439 // Clone the original model attributes, so we can leave the model untouched. 440 var attributes = _.clone( this.model.attributes ); 441 442 // Trim the content to 10 words. 443 attributes.formattedContent = wp.formatting.trimWords( attributes.content.rendered, 10 ); 444 445 // If the title is missing entirely, add a no title placeholder. 446 attributes.formattedTitle = attributes.title.rendered.length > 0 ? attributes.title.rendered : quickDraft.l10n.noTitle; 447 448 // Format the data using Intl.DateTimeFormat with a fallback to date.toLocaleDateString. 449 var date = new Date( wp.api.utils.parseISO8601( attributes.date + quickDraft.timezoneOffset ) ); 450 if ( 'undefined' !== typeof Intl && Intl.DateTimeFormat ) { 451 attributes.formattedDate = new Intl.DateTimeFormat( undefined, { 452 month: 'long', 453 day: 'numeric', 454 year: 'numeric' 455 } ).format( date ); 456 } else { 457 attributes.formattedDate = date.toLocaleDateString(); 458 } 459 460 // Output the rendered template. 461 this.$el.html( this.template( attributes ) ); 462 463 // Continue the rendering chain. 464 return this; 465 } 466 } ); 467 468 469 /** 470 * Initialize the Quick Draft feature. 471 * 472 * @since 4.7.0 473 * 474 */ 475 QuickDraft.init = function() { 476 477 // Set up a state model to track the application state. 478 quickDraft.state = new Backbone.Model({ 479 'errorState': false 480 }); 481 482 // Wait for the wp-api client to initialize. 483 wp.api.loadPromise.done( function() { 484 485 // Fetch up to 4 of the current user's recent drafts by extending wp.api.collections.Posts. 486 var draftsCollection = new wp.api.collections.Posts(); 487 draftsCollection.fetch( { 488 data: { 489 status: 'draft', 490 author: quickDraft.currentUserId, 491 per_page: 4, 492 order_by: 'date', 493 'quick-draft-post-list': true /* flag passed for back end filters */ 494 } 495 } ); 496 497 // Drafts list is initialized but not rendered until drafts load. 498 new QuickDraft.Views.DraftList( { 499 el: '#quick-press-drafts', 500 collection: draftsCollection 501 } ); 502 503 new QuickDraft.Views.Form( { 504 el: '#quick-press', 505 model: new wp.api.models.Post(), 506 collection: draftsCollection 507 } ).render(); 508 }); 509 }; -
src/wp-includes/js/wp-util.js
diff --git src/wp-includes/js/wp-util.js src/wp-includes/js/wp-util.js index 527441d..bdc7531 100644
window.wp = window.wp || {}; 121 121 } 122 122 }; 123 123 124 // wp.formatting 125 // ------ 126 // 127 // Tools for formatting strings 128 wp.formatting = { 129 settings: settings.formatting || {}, 130 131 /** 132 * Trims text to a certain number of words. 133 * 134 * @see wp_trim_words 135 * 136 * @param {string} text Text to trim. 137 * @param {number} numWords Number of words. Optional, default is 55. 138 * @param {string} more What to append if text needs to be trimmed. Optional, default is '…'. 139 * @return {string} Trimmed text. 140 */ 141 trimWords: function( text, numWords, more ) { 142 var words, separator; 143 144 if ( 'undefined' === typeof numWords ) { 145 numWords = 55; 146 } 147 148 if ( 'undefined' === typeof more ) { 149 more = wp.formatting.settings.trimWordsMore; 150 } 151 152 text = text.replace( /[\n\r\t ]+/g, ' ' ).replace( /^ | $/g, '' ); 153 154 if ( wp.formatting.settings.trimWordsByCharacter ) { 155 separator = ''; 156 } else { 157 separator = ' '; 158 } 159 160 words = text.split( separator ); 161 162 if ( words.length <= numWords ) { 163 return words.join( separator ); 164 } 165 166 return words.slice( 0, numWords ).join( separator ) + more; 167 } 168 }; 169 124 170 }(jQuery)); -
src/wp-includes/rest-api.php
diff --git src/wp-includes/rest-api.php src/wp-includes/rest-api.php index 3d0b7ee..3711e32 100644
function rest_api_default_filters() { 164 164 add_filter( 'rest_post_dispatch', 'rest_send_allow_header', 10, 3 ); 165 165 166 166 add_filter( 'rest_pre_dispatch', 'rest_handle_options_request', 10, 3 ); 167 168 // Legacy filter for Quick Draft recent posts. 169 add_filter( 'rest_post_query', 'rest_filter_quick_draft_query', 10, 2 ); 170 } 171 172 /** 173 * Filter query args used by he Quick Draft recent posts list. 174 * 175 * @param array $args Key value array of query var to query value. 176 * @param WP_REST_Request $request The request used. 177 */ 178 function rest_filter_quick_draft_query( $query_args, $request ) { 179 180 // Only modify Quick Draft queries. 181 $params = $request->get_query_params(); 182 183 if ( ! isset( $params['quick-draft-post-list'] ) ) { 184 return $query_args; 185 } 186 187 /** 188 * Filters the post query arguments for the 'Recent Drafts' dashboard widget. 189 * 190 * @since 4.4.0 191 * 192 * @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget. 193 */ 194 $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); 195 196 return $query_args; 197 167 198 } 168 199 169 200 /** -
src/wp-includes/script-loader.php
diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php index be32073..c10fa11 100644
function wp_default_scripts( &$scripts ) { 336 336 'ajax' => array( 337 337 'url' => admin_url( 'admin-ajax.php', 'relative' ), 338 338 ), 339 'formatting' => array( 340 'trimWordsMore' => __( '…' ), 341 /* 342 * translators: If your word count is based on single characters (e.g. East Asian characters), 343 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 344 * Do not translate into your own language. 345 */ 346 'trimWordsByCharacter' => strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ), 347 ), 339 348 ) ); 340 349 341 350 $scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 ); … … function wp_default_scripts( &$scripts ) { 721 730 'current' => __( 'Current Color' ), 722 731 ) ); 723 732 724 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), false, 1 ); 733 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-api', 'wp-backbone', 'wp-a11y', 'wp-util' ), false, 1 ); 734 did_action( 'init' ) && $scripts->localize( 'dashboard', 'quickDraft', array( 735 'currentUserId' => get_current_user_id(), 736 'l10n' => array( 737 'error' => __( 'An error has occurred. Please reload the page and try again.' ), 738 'newDraftCreated' => __( 'Success. A new draft was created.' ), 739 'errorEmptyFields' => __( 'Error. All fields were empty.' ), 740 'noTitle' => __( '(no title)' ), 741 ), 742 'timezoneOffset' => ( get_option( 'gmt_offset' ) >= 0 ? '+' : '-' ) . date( 'H:i', abs( get_option( 'gmt_offset' ) * 3600 ) ), 743 ) ); 725 744 726 745 $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" ); 727 746 -
tests/qunit/index.html
diff --git tests/qunit/index.html tests/qunit/index.html index 9a17ec2..baf0f46 100644
61 61 <script src="wp-admin/js/customize-base.js"></script> 62 62 <script src="wp-admin/js/customize-header.js"></script> 63 63 <script src="wp-includes/js/shortcode.js"></script> 64 <script src="wp-includes/js/wp-util.js"></script> 64 65 <script src="wp-admin/js/customize-controls.js"></script> 65 66 <script src="wp-admin/js/customize-controls-utils.js"></script> 66 67 <script src="wp-admin/js/customize-nav-menus.js"></script>