- Twenty Twenty-Four. Built with three distinct use cases in mind, the versatility of the new default theme makes it an ideal choice for almost any type of website. Dive into its collection of templates and patterns and unlock a world of creative possibilities with just a few tweaks.' ),
- __( 'https://make.wordpress.org/core/2023/08/24/introducing-twenty-twenty-four/' )
- );
- ?>
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
- a refreshed design and more commands to find what you\'re looking for, perform tasks efficiently, and save time as you create.' ),
- __( 'https://make.wordpress.org/core/2023/09/12/core-editor-improvement-commanding-the-command-palette/' )
- );
- ?>
-
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
+
+
-
+
+
+
-
-
-
- New enhancements ensure your content creation journey is smooth. Find new keyboard shortcuts in List View, refined list merging, and enhanced control over link settings. A revamped and cohesive toolbar experience for Navigation, List, and Quote blocks lets you efficiently work with the tooling options you need.' ),
- __( 'https://make.wordpress.org/core/2023/10/05/core-editor-improvement-ensuring-excellence-in-the-writing-experience/' )
- );
- ?>
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
+
+
+
-
-
-
-
+
-
+
+
+
-
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -277,7 +325,7 @@
Learn WordPress is a free resource for new and experienced WordPress users. Learn is stocked with how-to videos on using various features in WordPress, interactive workshops for exploring topics in-depth, and lesson plans for diving deep into specific areas of WordPress.' ),
+ __( 'Learn WordPress is a free resource for new and experienced WordPress users. Learn is stocked with how-to videos on using various features in WordPress, interactive events for exploring topics in-depth, and lesson plans for diving deep into specific areas of WordPress.' ),
'https://learn.wordpress.org/',
'https://learn.wordpress.org/online-workshops/'
);
@@ -290,17 +338,16 @@
WordPress %2$s Field Guide. Learn about the changes in this release with detailed developer notes to help you build with WordPress.' ),
- __( 'https://make.wordpress.org/core/2023/10/23/wordpress-6-4-field-guide/' ),
- '6.4'
+ /* translators: %s: WordPress Field Guide link. */
+ __( 'Check out the latest version of the WordPress Field Guide. It is overflowing with detailed developer notes to help you build with WordPress.' ),
+ __( 'https://make.wordpress.org/core/2023/07/18/wordpress-6-3-field-guide/' )
);
?>
@@ -308,22 +355,22 @@
Read the WordPress %2$s Release Notes for information on installation, enhancements, fixed issues, release contributors, learning resources, and the list of file changes.' ),
+ __( 'Read the WordPress %2$s Release Notes for more information on the included enhancements and issues fixed, installation information, developer notes and resources, release contributors, and the list of file changes in this release.' ),
sprintf(
/* translators: %s: WordPress version number. */
esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
- '6-4'
+ '6-3'
),
- '6.4'
+ '6.3'
);
?>
' . sprintf(
diff --git a/wp-admin/includes/menu.php b/wp-admin/includes/menu.php
index da1b2ebf5..ae8e06be6 100644
--- a/wp-admin/includes/menu.php
+++ b/wp-admin/includes/menu.php
@@ -228,7 +228,7 @@ function add_menu_classes( $menu ) {
$i = 0;
foreach ( $menu as $order => $top ) {
- ++$i;
+ $i++;
if ( 0 === $order ) { // Dashboard is always shown/single.
$menu[0][4] = add_cssclass( 'menu-top-first', $top[4] );
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index 522807607..7d0e1def8 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -311,24 +311,25 @@ function post_submit_meta_box( $post, $args = array() ) {
endif;
if ( 'draft' === $post->post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) :
- $message = sprintf(
- /* translators: %s: URL to the Customizer. */
- __( 'This draft comes from your unpublished customization changes. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ),
- esc_url(
- add_query_arg(
- 'changeset_uuid',
- rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
- admin_url( 'customize.php' )
- )
- )
- );
- wp_admin_notice(
- $message,
- array(
- 'type' => 'info',
- 'additional_classes' => array( 'notice-alt', 'inline' ),
- )
- );
+ ?>
+
+
+ unpublished customization changes. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ),
+ esc_url(
+ add_query_arg(
+ 'changeset_uuid',
+ rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
+ admin_url( 'customize.php' )
+ )
+ )
+ );
+ ?>
+
' . __( 'Note:' ) . ' ';
+ printf(
/* translators: %s: mod_rewrite */
__( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
'mod_rewrite'
- ) . '
';
+ printf(
/* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
__( 'If %1$s is disabled, ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up.' ),
'mod_rewrite',
'https://httpd.apache.org/docs/mod/mod_rewrite.html',
'https://www.google.com/search?q=apache+mod_rewrite'
- ) . '
';
}
if ( ! $tested_wp ) {
- wp_admin_notice(
- __( 'Warning: This plugin has not been tested with your current version of WordPress.' ),
- array(
- 'type' => 'warning',
- 'additional_classes' => array( 'notice-alt' ),
- )
- );
+ echo '
';
+ _e( 'Warning: This plugin has not been tested with your current version of WordPress.' );
+ echo '
';
} elseif ( ! $compatible_wp ) {
- $compatible_wp_notice_message = __( 'Error: This plugin requires a newer version of WordPress.' );
+ echo '
';
+ _e( 'Error: This plugin requires a newer version of WordPress.' );
if ( current_user_can( 'update_core' ) ) {
- $compatible_wp_notice_message .= sprintf(
+ printf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( 'Click here to update WordPress.' ),
esc_url( self_admin_url( 'update-core.php' ) )
);
}
-
- wp_admin_notice(
- $compatible_wp_notice_message,
- array(
- 'type' => 'error',
- 'additional_classes' => array( 'notice-alt' ),
- )
- );
+ echo '
';
}
foreach ( (array) $api->sections as $section_name => $content ) {
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index f55bbd80e..0e4881736 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -854,7 +854,7 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
* @param bool $network_wide Whether to enable the plugin for all sites in the network.
* Default false.
* @param bool $silent Prevent calling activation hooks. Default false.
- * @return true|WP_Error True when finished or WP_Error if there were errors during a plugin activation.
+ * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation.
*/
function activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false ) {
if ( ! is_array( $plugins ) ) {
@@ -2440,7 +2440,7 @@ function wp_get_plugin_error( $plugin ) {
*
* @param string $plugin Single plugin to resume.
* @param string $redirect Optional. URL to redirect to. Default empty string.
- * @return true|WP_Error True on success, false if `$plugin` was not paused,
+ * @return bool|WP_Error True on success, false if `$plugin` was not paused,
* `WP_Error` on failure.
*/
function resume_plugin( $plugin, $redirect = '' ) {
@@ -2497,17 +2497,13 @@ function paused_plugins_notice() {
return;
}
- $message = sprintf(
- '%s %s
';
- $local_storage_message .= __( 'The backup of this post in your browser is different from the version below.' );
- $local_storage_message .= '
';
- $local_storage_message .= '
';
- $local_storage_message .= __( 'This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.' );
- $local_storage_message .= '
+ query( "UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" );
$wpdb->query( "UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" );
}
+
}
/**
@@ -1296,7 +1294,7 @@ function upgrade_230() {
$num = 2;
do {
$alt_slug = $slug . "-$num";
- ++$num;
+ $num++;
$slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) );
} while ( $slug_check );
@@ -1548,6 +1546,7 @@ function upgrade_250() {
if ( $wp_current_db_version < 6689 ) {
populate_roles_250();
}
+
}
/**
@@ -1706,6 +1705,7 @@ function upgrade_300() {
)
);
}
+
}
/**
@@ -2326,29 +2326,6 @@ function upgrade_630() {
}
}
-/**
- * Executes changes made in WordPress 6.4.0.
- *
- * @ignore
- * @since 6.4.0
- *
- * @global int $wp_current_db_version The old (current) database version.
- */
-function upgrade_640() {
- global $wp_current_db_version;
-
- if ( $wp_current_db_version < 56657 ) {
- // Enable attachment pages.
- update_option( 'wp_attachment_pages_enabled', 1 );
-
- // Remove the wp_https_detection cron. Https status is checked directly in an async Site Health check.
- $scheduled = wp_get_scheduled_event( 'wp_https_detection' );
- if ( $scheduled ) {
- wp_clear_scheduled_hook( 'wp_https_detection' );
- }
- }
-}
-
/**
* Executes network-level upgrade routines.
*
@@ -2508,7 +2485,7 @@ function upgrade_network() {
/**
* Creates a table in the database, if it doesn't already exist.
*
- * This method checks for an existing database table and creates a new one if it's not
+ * This method checks for an existing database and creates a new one if it's not
* already present. It doesn't rely on MySQL's "IF NOT EXISTS" statement, but chooses
* to query all tables first and then run the SQL statement creating the table.
*
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index 423c13ad1..1903ec1c5 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -535,30 +535,28 @@ function default_password_nag() {
if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) {
return;
}
-
- $default_password_nag_message = sprintf(
- '
%1$s %2$s
',
- __( 'Notice:' ),
- __( 'You are using the auto-generated password for your account. Would you like to change it?' )
- );
- $default_password_nag_message .= sprintf(
- '
%2$s | ',
- esc_url( get_edit_profile_url() . '#password' ),
- __( 'Yes, take me to my profile page' )
- );
- $default_password_nag_message .= sprintf(
- '%2$s
"),wp.a11y.speak(t.data.msg)),o._view?o._view.save():l.close(i))})},open:function(e,t,i){this._view=i;var a=c("#image-editor-"+e),o=c("#media-head-"+e),r=c("#imgedit-open-btn-"+e),s=r.siblings(".spinner");if(!r.hasClass("button-activated"))return s.addClass("is-active"),c.ajax({url:ajaxurl,type:"post",data:{action:"image-editor",_ajax_nonce:t,postid:e,do:"open"},beforeSend:function(){r.addClass("button-activated")}}).done(function(t){var i;"-1"===t&&(i=n("Could not load the preview image."),a.html('
"),wp.a11y.speak(t.data.msg)),o._view?o._view.save():l.close(i))})},open:function(e,t,i){this._view=i;var a=c("#image-editor-"+e),o=c("#media-head-"+e),s=c("#imgedit-open-btn-"+e),r=s.siblings(".spinner");if(!s.hasClass("button-activated"))return r.addClass("is-active"),c.ajax({url:ajaxurl,type:"post",data:{action:"image-editor",_ajax_nonce:t,postid:e,do:"open"},beforeSend:function(){s.addClass("button-activated")}}).done(function(t){var i;"-1"===t&&(i=n("Could not load the preview image."),a.html('
"),u("#bulk-titles .ntdelbutton").click(function(){var t=u(this),e=t.attr("id").substr(1),i=t.parent().prev().children(".ntdelbutton"),t=t.parent().next().children(".ntdelbutton");u('table.widefat input[value="'+e+'"]').prop("checked",!1),u("#_"+e).parent().remove(),h.a11y.speak(h.i18n.__("Item removed."),"assertive"),t.length?t.focus():i.length?i.focus():(u("#bulk-titles-list").remove(),inlineEditPost.revert(),h.a11y.speak(h.i18n.__("All selected items have been removed. Select new items to use Bulk Actions.")))}),"post"===t&&u("tr.inline-editor textarea[data-wp-taxonomy]").each(function(t,e){u(e).autocomplete("instance")||u(e).wpTagsSuggest()}),u("#bulk-edit .inline-edit-wrapper").attr("tabindex","-1").focus(),u("html, body").animate({scrollTop:0},"fast")},edit:function(n){var t,a,e,i,s,r,l,o,d=this,p=!0;for(d.revert(),"object"==typeof n&&(n=d.getId(n)),t=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order","page_template"],"page"===d.type&&t.push("post_parent"),a=u("#inline-edit").clone(!0),u("td",a).attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("td",a).find("#quick-edit-legend").removeAttr("id"),u("td",a).find('p[id^="quick-edit-"]').removeAttr("id"),u(d.what+n).removeClass("is-expanded").hide().after(a).after('
"),u("#bulk-titles .ntdelbutton").click(function(){var t=u(this),e=t.attr("id").substr(1),i=t.parent().prev().children(".ntdelbutton"),t=t.parent().next().children(".ntdelbutton");u('table.widefat input[value="'+e+'"]').prop("checked",!1),u("#_"+e).parent().remove(),h.a11y.speak(h.i18n.__("Item removed."),"assertive"),t.length?t.focus():i.length?i.focus():(u("#bulk-titles-list").remove(),inlineEditPost.revert(),h.a11y.speak(h.i18n.__("All selected items have been removed. Select new items to use Bulk Actions.")))}),"post"===t&&u("tr.inline-editor textarea[data-wp-taxonomy]").each(function(t,e){u(e).autocomplete("instance")||u(e).wpTagsSuggest()}),u("#bulk-edit .inline-edit-wrapper").attr("tabindex","-1").focus(),u("html, body").animate({scrollTop:0},"fast")},edit:function(n){var t,a,e,i,s,r,l,o,d=this,p=!0;for(d.revert(),"object"==typeof n&&(n=d.getId(n)),t=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order","page_template"],"page"===d.type&&t.push("post_parent"),a=u("#inline-edit").clone(!0),u("td",a).attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("td",a).find("#quick-edit-legend").removeAttr("id"),u("td",a).find('p[id^="quick-edit-"]').removeAttr("id"),u(d.what+n).removeClass("is-expanded").hide().after(a).after('
]*?>/g,""),e.removeClass("hidden"),i.html(t),h.a11y.speak(i.text())):(e.removeClass("hidden"),i.text(h.i18n.__("Error while saving the changes.")),h.a11y.speak(h.i18n.__("Error while saving the changes.")))},"html"),!1},revert:function(){var t=u(".widefat"),e=u(".inline-editor",t).attr("id");return e&&(u(".spinner",t).removeClass("is-active"),("bulk-edit"===e?(u("#bulk-edit",t).removeClass("inline-editor").hide().siblings(".hidden").remove(),u("#bulk-titles").empty(),u("#inlineedit").append(u("#bulk-edit")),u("#"+inlineEditPost.whichBulkButtonId)):(u("#"+e).siblings("tr.hidden").addBack().remove(),e=e.substr(e.lastIndexOf("-")+1),u(this.what+e).show().find(".editinline").attr("aria-expanded","false"))).trigger("focus")),!1},getId:function(t){t=u(t).closest("tr").attr("id").split("-");return t[t.length-1]}},u(function(){inlineEditPost.init()}),u(function(){void 0!==h&&h.heartbeat&&h.heartbeat.interval(15)}).on("heartbeat-tick.wp-check-locked-posts",function(t,e){var n=e["wp-check-locked-posts"]||{};u("#the-list tr").each(function(t,e){var i=e.id,e=u(e);n.hasOwnProperty(i)?e.hasClass("wp-locked")||(i=n[i],e.find(".column-title .locked-text").text(i.text),e.find(".check-column checkbox").prop("checked",!1),i.avatar_src&&(i=u("",{class:"avatar avatar-18 photo",width:18,height:18,alt:"",src:i.avatar_src,srcset:i.avatar_src_2x?i.avatar_src_2x+" 2x":void 0}),e.find(".column-title .locked-avatar").empty().append(i)),e.addClass("wp-locked")):e.hasClass("wp-locked")&&e.removeClass("wp-locked").find(".locked-info span").empty()})}).on("heartbeat-send.wp-check-locked-posts",function(t,e){var i=[];u("#the-list tr").each(function(t,e){e.id&&i.push(e.id)}),i.length&&(e["wp-check-locked-posts"]=i)})}(jQuery,window.wp);
\ No newline at end of file
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
index a86ea4c84..6b96ad25f 100644
--- a/wp-admin/js/post.js
+++ b/wp-admin/js/post.js
@@ -511,7 +511,7 @@ jQuery( function($) {
// See https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event.
return __( 'The changes you made will be lost if you navigate away from this page.' );
}
- }).on( 'pagehide.edit-post', function( event ) {
+ }).on( 'unload.edit-post', function( event ) {
if ( ! releaseLock ) {
return;
}
diff --git a/wp-admin/js/post.min.js b/wp-admin/js/post.min.js
index 1bbdd27ca..af680ba87 100644
--- a/wp-admin/js/post.min.js
+++ b/wp-admin/js/post.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-window.makeSlugeditClickable=window.editPermalink=function(){},window.wp=window.wp||{},function(s){var t=!1,a=wp.i18n.__;window.commentsBox={st:0,get:function(t,e){var i=this.st;return this.st+=e=e||20,this.total=t,s("#commentsdiv .spinner").addClass("is-active"),t={action:"get-comments",mode:"single",_ajax_nonce:s("#add_comment_nonce").val(),p:s("#post_ID").val(),start:i,number:e},s.post(ajaxurl,t,function(t){t=wpAjax.parseAjaxResponse(t),s("#commentsdiv .widefat").show(),s("#commentsdiv .spinner").removeClass("is-active"),"object"==typeof t&&t.responses[0]?(s("#the-comment-list").append(t.responses[0].data),theList=theExtraList=null,s("a[className*=':']").off(),commentsBox.st>commentsBox.total?s("#show-comments").hide():s("#show-comments").show().children("a").text(a("Show more comments"))):1==t?s("#show-comments").text(a("No more comments found.")):s("#the-comment-list").append('
'+wpAjax.broken+"
")}),!1},load:function(t){this.st=jQuery("#the-comment-list tr.comment:visible").length,this.get(t)}},window.WPSetThumbnailHTML=function(t){s(".inside","#postimagediv").html(t)},window.WPSetThumbnailID=function(t){var e=s('input[value="_thumbnail_id"]',"#list-table");0",{class:"avatar avatar-64 photo",width:64,height:64,alt:"",src:e.lock_error.avatar_src,srcset:e.lock_error.avatar_src_2x?e.lock_error.avatar_src_2x+" 2x":void 0}),i.find("div.post-locked-avatar").empty().append(a)),i.show().find(".currently-editing").text(e.lock_error.text),i.find(".wp-tab-first").trigger("focus")):e.new_lock&&s("#active_post_lock").val(e.new_lock))}).on("before-autosave.update-post-slug",function(){t=document.activeElement&&"title"===document.activeElement.id}).on("after-autosave.update-post-slug",function(){s("#edit-slug-box > *").length||t||s.post(ajaxurl,{action:"sample-permalink",post_id:s("#post_ID").val(),new_title:s("#title").val(),samplepermalinknonce:s("#samplepermalinknonce").val()},function(t){"-1"!=t&&s("#edit-slug-box").html(t)})})}(jQuery),function(a){var n,t;function i(){n=!1,window.clearTimeout(t),t=window.setTimeout(function(){n=!0},3e5)}a(function(){i()}).on("heartbeat-send.wp-refresh-nonces",function(t,e){var i=a("#wp-auth-check-wrap");(n||i.length&&!i.hasClass("hidden"))&&(i=a("#post_ID").val())&&a("#_wpnonce").val()&&(e["wp-refresh-post-nonces"]={post_id:i})}).on("heartbeat-tick.wp-refresh-nonces",function(t,e){e=e["wp-refresh-post-nonces"];e&&(i(),e.replace&&a.each(e.replace,function(t,e){a("#"+t).val(e)}),e.heartbeatNonce)&&(window.heartbeatSettings.nonce=e.heartbeatNonce)})}(jQuery),jQuery(function(h){var p,e,i,a,n,s,o,l,r,t,c,d,u=h("#content"),f=h(document),v=h("#post_ID").val()||0,m=h("#submitpost"),g=!0,w=h("#post-visibility-select"),b=h("#timestampdiv"),k=h("#post-status-select"),_=!!window.navigator.platform&&-1!==window.navigator.platform.indexOf("Mac"),y=new ClipboardJS(".copy-attachment-url.edit-media"),x=wp.i18n.__,C=wp.i18n._x;function D(t){c.hasClass("wp-editor-expand")||(r?o.theme.resizeTo(null,l+t.pageY):u.height(Math.max(50,l+t.pageY)),t.preventDefault())}function j(){var t;c.hasClass("wp-editor-expand")||(t=r?(o.focus(),((t=parseInt(h("#wp-content-editor-container .mce-toolbar-grp").height(),10))<10||200 *").length&&(h("form#post").one("submit",function(){t=!0}),window.setTimeout(function(){!t&&wp.autosave&&wp.autosave.server.triggerSave()},200))}),f.on("autosave-disable-buttons.edit-post",function(){i.addClass("disabled")}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||i.removeClass("disabled")}).on("before-autosave.edit-post",function(){h(".autosave-message").text(x("Saving Draft\u2026"))}).on("after-autosave.edit-post",function(t,e){h(".autosave-message").text(e.message),h(document.body).hasClass("post-new-php")&&h(".submitbox .submitdelete").show()}),h(window).on("beforeunload.edit-post",function(t){var e=window.tinymce&&window.tinymce.get("content"),i=!1;if(wp.autosave?i=wp.autosave.server.postChanged():e&&(i=!e.isHidden()&&e.isDirty()),i)return t.preventDefault(),x("The changes you made will be lost if you navigate away from this page.")}).on("pagehide.edit-post",function(t){if(g&&(!t.target||"#document"==t.target.nodeName)){var t=h("#post_ID").val(),e=h("#active_post_lock").val();if(t&&e){t={action:"wp-remove-post-lock",_wpnonce:h("#_wpnonce").val(),post_ID:t,active_post_lock:e};if(window.FormData&&window.navigator.sendBeacon){var i=new window.FormData;if(h.each(t,function(t,e){i.append(t,e)}),window.navigator.sendBeacon(ajaxurl,i))return}h.post({async:!1,data:t,url:ajaxurl})}}}),h("#tagsdiv-post_tag").length?window.tagBox&&window.tagBox.init():h(".meta-box-sortables").children("div.postbox").each(function(){if(0===this.id.indexOf("tagsdiv-"))return window.tagBox&&window.tagBox.init(),!1}),h(".categorydiv").each(function(){var t,a,e,i=h(this).attr("id").split("-");i.shift(),a=i.join("-"),e="category"==a?"cats":a+"_tab",h("a","#"+a+"-tabs").on("click",function(t){t.preventDefault();t=h(this).attr("href");h(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),h("#"+a+"-tabs").siblings(".tabs-panel").hide(),h(t).show(),"#"+a+"-all"==t?deleteUserSetting(e):setUserSetting(e,"pop")}),getUserSetting(e)&&h('a[href="#'+a+'-pop"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).one("focus",function(){h(this).val("").removeClass("form-input-tip")}),h("#new"+a).on("keypress",function(t){13===t.keyCode&&(t.preventDefault(),h("#"+a+"-add-submit").trigger("click"))}),h("#"+a+"-add-submit").on("click",function(){h("#new"+a).trigger("focus")}),i=function(t){return!!h("#new"+a).val()&&(t.data+="&"+h(":checked","#"+a+"checklist").serialize(),h("#"+a+"-add-submit").prop("disabled",!0),t)},t=function(t,e){var i=h("#new"+a+"_parent");h("#"+a+"-add-submit").prop("disabled",!1),"undefined"!=e.parsed.responses[0]&&(e=e.parsed.responses[0].supplemental.newcat_parent)&&(i.before(e),i.remove())},h("#"+a+"checklist").wpList({alt:"",response:a+"-ajax-response",addBefore:i,addAfter:t}),h("#"+a+"-add-toggle").on("click",function(t){t.preventDefault(),h("#"+a+"-adder").toggleClass("wp-hidden-children"),h('a[href="#'+a+'-all"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).trigger("focus")}),h("#"+a+"checklist, #"+a+"checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var t=h(this),e=t.is(":checked"),i=t.val();i&&t.parents("#taxonomy-"+a).length&&h("#in-"+a+"-"+i+", #in-popular-"+a+"-"+i).prop("checked",e)})}),h("#postcustom").length&&h("#the-list").wpList({addBefore:function(t){return t.data+="&post_id="+h("#post_ID").val(),t},addAfter:function(){h("table#list-table").show()}}),h("#submitdiv").length&&(p=h("#timestamp").html(),e=h("#post-visibility-display").html(),a=function(){"public"!=w.find("input:radio:checked").val()?(h("#sticky").prop("checked",!1),h("#sticky-span").hide()):h("#sticky-span").show(),"password"!=w.find("input:radio:checked").val()?h("#password-span").hide():h("#password-span").show()},n=function(){if(b.length){var t,e=h("#post_status"),i=h('option[value="publish"]',e),a=h("#aa").val(),n=h("#mm").val(),s=h("#jj").val(),o=h("#hh").val(),l=h("#mn").val(),r=new Date(a,n-1,s,o,l),c=new Date(h("#hidden_aa").val(),h("#hidden_mm").val()-1,h("#hidden_jj").val(),h("#hidden_hh").val(),h("#hidden_mn").val()),d=new Date(h("#cur_aa").val(),h("#cur_mm").val()-1,h("#cur_jj").val(),h("#cur_hh").val(),h("#cur_mn").val());if(r.getFullYear()!=a||1+r.getMonth()!=n||r.getDate()!=s||r.getMinutes()!=l)return b.find(".timestamp-wrap").addClass("form-invalid"),!1;b.find(".timestamp-wrap").removeClass("form-invalid"),d"+x("%1$s %2$s, %3$s at %4$s:%5$s").replace("%1$s",h('option[value="'+n+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(s,10)).replace("%3$s",a).replace("%4$s",("00"+o).slice(-2)).replace("%5$s",("00"+l).slice(-2))+" "),"private"==w.find("input:radio:checked").val()?(h("#publish").val(x("Update")),0===i.length?e.append('"):i.html(x("Privately Published")),h('option[value="publish"]',e).prop("selected",!0),h("#misc-publishing-actions .edit-post-status").hide()):("future"==h("#original_post_status").val()||"draft"==h("#original_post_status").val()?i.length&&(i.remove(),e.val(h("#hidden_post_status").val())):i.html(x("Published")),e.is(":hidden")&&h("#misc-publishing-actions .edit-post-status").show()),h("#post-status-display").text(wp.sanitize.stripTagsAndEncodeText(h("option:selected",e).text())),"private"==h("option:selected",e).val()||"publish"==h("option:selected",e).val()?h("#save-post").hide():(h("#save-post").show(),"pending"==h("option:selected",e).val()?h("#save-post").show().val(x("Save as Pending")):h("#save-post").show().val(x("Save Draft")))}return!0},h("#visibility .edit-visibility").on("click",function(t){t.preventDefault(),w.is(":hidden")&&(a(),w.slideDown("fast",function(){w.find('input[type="radio"]').first().trigger("focus")}),h(this).hide())}),w.find(".cancel-post-visibility").on("click",function(t){w.slideUp("fast"),h("#visibility-radio-"+h("#hidden-post-visibility").val()).prop("checked",!0),h("#post_password").val(h("#hidden-post-password").val()),h("#sticky").prop("checked",h("#hidden-post-sticky").prop("checked")),h("#post-visibility-display").html(e),h("#visibility .edit-visibility").show().trigger("focus"),n(),t.preventDefault()}),w.find(".save-post-visibility").on("click",function(t){var e="",i=w.find("input:radio:checked").val();switch(w.slideUp("fast"),h("#visibility .edit-visibility").show().trigger("focus"),n(),"public"!==i&&h("#sticky").prop("checked",!1),i){case"public":e=h("#sticky").prop("checked")?x("Public, Sticky"):x("Public");break;case"private":e=x("Private");break;case"password":e=x("Password Protected")}h("#post-visibility-display").text(e),t.preventDefault()}),w.find("input:radio").on("change",function(){a()}),b.siblings("a.edit-timestamp").on("click",function(t){b.is(":hidden")&&(b.slideDown("fast",function(){h("input, select",b.find(".timestamp-wrap")).first().trigger("focus")}),h(this).hide()),t.preventDefault()}),b.find(".cancel-timestamp").on("click",function(t){b.slideUp("fast").siblings("a.edit-timestamp").show().trigger("focus"),h("#mm").val(h("#hidden_mm").val()),h("#jj").val(h("#hidden_jj").val()),h("#aa").val(h("#hidden_aa").val()),h("#hh").val(h("#hidden_hh").val()),h("#mn").val(h("#hidden_mn").val()),n(),t.preventDefault()}),b.find(".save-timestamp").on("click",function(t){n()&&(b.slideUp("fast"),b.siblings("a.edit-timestamp").show().trigger("focus")),t.preventDefault()}),h("#post").on("submit",function(t){n()||(t.preventDefault(),b.show(),wp.autosave&&wp.autosave.enableButtons(),h("#publishing-action .spinner").removeClass("is-active"))}),k.siblings("a.edit-post-status").on("click",function(t){k.is(":hidden")&&(k.slideDown("fast",function(){k.find("select").trigger("focus")}),h(this).hide()),t.preventDefault()}),k.find(".save-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),n(),t.preventDefault()}),k.find(".cancel-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),h("#post_status").val(h("#hidden_post_status").val()),n(),t.preventDefault()})),h("#titlediv").on("click",".edit-slug",function(){var t,e,a,i,n=0,s=h("#post_name"),o=s.val(),l=h("#sample-permalink"),r=l.html(),c=h("#sample-permalink a").html(),d=h("#edit-slug-buttons"),p=d.html(),u=h("#editable-post-name-full");for(u.find("img").replaceWith(function(){return this.alt}),u=u.html(),l.html(c),a=h("#editable-post-name"),i=a.html(),d.html(' "),d.children(".save").on("click",function(){var i=a.children("input").val();i==h("#editable-post-name-full").text()?d.children(".cancel").trigger("click"):h.post(ajaxurl,{action:"sample-permalink",post_id:v,new_slug:i,new_title:h("#title").val(),samplepermalinknonce:h("#samplepermalinknonce").val()},function(t){var e=h("#edit-slug-box");e.html(t),e.hasClass("hidden")&&e.fadeIn("fast",function(){e.removeClass("hidden")}),d.html(p),l.html(r),s.val(i),h(".edit-slug").trigger("focus"),wp.a11y.speak(x("Permalink saved"))})}),d.children(".cancel").on("click",function(){h("#view-post-btn").show(),a.html(i),d.html(p),l.html(r),s.val(o),h(".edit-slug").trigger("focus")}),t=0;tu.length/4?"":u,e=x("URL Slug"),a.html('').children("input").on("keydown",function(t){var e=t.which;13===e&&(t.preventDefault(),d.children(".save").trigger("click")),27===e&&d.children(".cancel").trigger("click")}).on("keyup",function(){s.val(this.value)}).trigger("focus")}),window.wptitlehint=function(t){var e=h("#"+(t=t||"title")),i=h("#"+t+"-prompt-text");""===e.val()&&i.removeClass("screen-reader-text"),e.on("input",function(){""===this.value?i.removeClass("screen-reader-text"):i.addClass("screen-reader-text")})},wptitlehint(),t=h("#post-status-info"),c=h("#postdivrich"),!u.length||"ontouchstart"in window?h("#content-resize-handle").hide():t.on("mousedown.wp-editor-resize",function(t){(o="undefined"!=typeof tinymce?tinymce.get("content"):o)&&!o.isHidden()?(r=!0,l=h("#content_ifr").height()-t.pageY):(r=!1,l=u.height()-t.pageY,u.trigger("blur")),f.on("mousemove.wp-editor-resize",D).on("mouseup.wp-editor-resize mouseleave.wp-editor-resize",j),t.preventDefault()}).on("mouseup.wp-editor-resize",j),"undefined"!=typeof tinymce&&(h("#post-formats-select input.post-format").on("change.set-editor-class",function(){var t,e,i=this.id;i&&h(this).prop("checked")&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpost-format-[^ ]+/,""),t.dom.addClass(e,"post-format-0"==i?"post-format-standard":i),h(document).trigger("editor-classchange"))}),h("#page_template").on("change.set-editor-class",function(){var t,e,i=h(this).val()||"";(i=i.substr(i.lastIndexOf("/")+1,i.length).replace(/\.php$/,"").replace(/\./g,"-"))&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpage-template-[^ ]+/,""),t.dom.addClass(e,"page-template-"+i),h(document).trigger("editor-classchange"))})),u.on("keydown.wp-autosave",function(t){83!==t.which||t.shiftKey||t.altKey||_&&(!t.metaKey||t.ctrlKey)||!_&&!t.ctrlKey||(wp.autosave&&wp.autosave.server.triggerSave(),t.preventDefault())}),"auto-draft"===h("#original_post_status").val()&&window.history.replaceState&&h("#publish").on("click",function(){d=(d=window.location.href)+(-1!==d.indexOf("?")?"&":"?")+"wp-post-new-reload=true",window.history.replaceState(null,null,d)}),y.on("success",function(t){var e=h(t.trigger),i=h(".success",e.closest(".copy-to-clipboard-container"));t.clearSelection(),e.trigger("focus"),clearTimeout(s),i.removeClass("hidden"),s=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(x("The file URL has been copied to your clipboard"))})}),function(t,o){t(function(){var i,e=t("#content"),a=t("#wp-word-count").find(".word-count"),n=0;function s(){var t=!i||i.isHidden()?e.val():i.getContent({format:"raw"}),t=o.count(t);t!==n&&a.text(t),n=t}t(document).on("tinymce-editor-init",function(t,e){"content"===e.id&&(i=e).on("nodechange keyup",_.debounce(s,1e3))}),e.on("input keyup",_.debounce(s,1e3)),s()})}(jQuery,new wp.utils.WordCounter);
\ No newline at end of file
+window.makeSlugeditClickable=window.editPermalink=function(){},window.wp=window.wp||{},function(s){var t=!1,a=wp.i18n.__;window.commentsBox={st:0,get:function(t,e){var i=this.st;return this.st+=e=e||20,this.total=t,s("#commentsdiv .spinner").addClass("is-active"),t={action:"get-comments",mode:"single",_ajax_nonce:s("#add_comment_nonce").val(),p:s("#post_ID").val(),start:i,number:e},s.post(ajaxurl,t,function(t){t=wpAjax.parseAjaxResponse(t),s("#commentsdiv .widefat").show(),s("#commentsdiv .spinner").removeClass("is-active"),"object"==typeof t&&t.responses[0]?(s("#the-comment-list").append(t.responses[0].data),theList=theExtraList=null,s("a[className*=':']").off(),commentsBox.st>commentsBox.total?s("#show-comments").hide():s("#show-comments").show().children("a").text(a("Show more comments"))):1==t?s("#show-comments").text(a("No more comments found.")):s("#the-comment-list").append('
'+wpAjax.broken+"
")}),!1},load:function(t){this.st=jQuery("#the-comment-list tr.comment:visible").length,this.get(t)}},window.WPSetThumbnailHTML=function(t){s(".inside","#postimagediv").html(t)},window.WPSetThumbnailID=function(t){var e=s('input[value="_thumbnail_id"]',"#list-table");0",{class:"avatar avatar-64 photo",width:64,height:64,alt:"",src:e.lock_error.avatar_src,srcset:e.lock_error.avatar_src_2x?e.lock_error.avatar_src_2x+" 2x":void 0}),i.find("div.post-locked-avatar").empty().append(a)),i.show().find(".currently-editing").text(e.lock_error.text),i.find(".wp-tab-first").trigger("focus")):e.new_lock&&s("#active_post_lock").val(e.new_lock))}).on("before-autosave.update-post-slug",function(){t=document.activeElement&&"title"===document.activeElement.id}).on("after-autosave.update-post-slug",function(){s("#edit-slug-box > *").length||t||s.post(ajaxurl,{action:"sample-permalink",post_id:s("#post_ID").val(),new_title:s("#title").val(),samplepermalinknonce:s("#samplepermalinknonce").val()},function(t){"-1"!=t&&s("#edit-slug-box").html(t)})})}(jQuery),function(a){var n,t;function i(){n=!1,window.clearTimeout(t),t=window.setTimeout(function(){n=!0},3e5)}a(function(){i()}).on("heartbeat-send.wp-refresh-nonces",function(t,e){var i=a("#wp-auth-check-wrap");(n||i.length&&!i.hasClass("hidden"))&&(i=a("#post_ID").val())&&a("#_wpnonce").val()&&(e["wp-refresh-post-nonces"]={post_id:i})}).on("heartbeat-tick.wp-refresh-nonces",function(t,e){e=e["wp-refresh-post-nonces"];e&&(i(),e.replace&&a.each(e.replace,function(t,e){a("#"+t).val(e)}),e.heartbeatNonce)&&(window.heartbeatSettings.nonce=e.heartbeatNonce)})}(jQuery),jQuery(function(h){var p,e,i,a,n,s,o,l,r,t,c,d,u=h("#content"),f=h(document),v=h("#post_ID").val()||0,m=h("#submitpost"),g=!0,w=h("#post-visibility-select"),b=h("#timestampdiv"),k=h("#post-status-select"),_=!!window.navigator.platform&&-1!==window.navigator.platform.indexOf("Mac"),y=new ClipboardJS(".copy-attachment-url.edit-media"),x=wp.i18n.__,C=wp.i18n._x;function D(t){c.hasClass("wp-editor-expand")||(r?o.theme.resizeTo(null,l+t.pageY):u.height(Math.max(50,l+t.pageY)),t.preventDefault())}function j(){var t;c.hasClass("wp-editor-expand")||(t=r?(o.focus(),((t=parseInt(h("#wp-content-editor-container .mce-toolbar-grp").height(),10))<10||200 *").length&&(h("form#post").one("submit",function(){t=!0}),window.setTimeout(function(){!t&&wp.autosave&&wp.autosave.server.triggerSave()},200))}),f.on("autosave-disable-buttons.edit-post",function(){i.addClass("disabled")}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||i.removeClass("disabled")}).on("before-autosave.edit-post",function(){h(".autosave-message").text(x("Saving Draft\u2026"))}).on("after-autosave.edit-post",function(t,e){h(".autosave-message").text(e.message),h(document.body).hasClass("post-new-php")&&h(".submitbox .submitdelete").show()}),h(window).on("beforeunload.edit-post",function(t){var e=window.tinymce&&window.tinymce.get("content"),i=!1;if(wp.autosave?i=wp.autosave.server.postChanged():e&&(i=!e.isHidden()&&e.isDirty()),i)return t.preventDefault(),x("The changes you made will be lost if you navigate away from this page.")}).on("unload.edit-post",function(t){if(g&&(!t.target||"#document"==t.target.nodeName)){var t=h("#post_ID").val(),e=h("#active_post_lock").val();if(t&&e){t={action:"wp-remove-post-lock",_wpnonce:h("#_wpnonce").val(),post_ID:t,active_post_lock:e};if(window.FormData&&window.navigator.sendBeacon){var i=new window.FormData;if(h.each(t,function(t,e){i.append(t,e)}),window.navigator.sendBeacon(ajaxurl,i))return}h.post({async:!1,data:t,url:ajaxurl})}}}),h("#tagsdiv-post_tag").length?window.tagBox&&window.tagBox.init():h(".meta-box-sortables").children("div.postbox").each(function(){if(0===this.id.indexOf("tagsdiv-"))return window.tagBox&&window.tagBox.init(),!1}),h(".categorydiv").each(function(){var t,a,e,i=h(this).attr("id").split("-");i.shift(),a=i.join("-"),e="category"==a?"cats":a+"_tab",h("a","#"+a+"-tabs").on("click",function(t){t.preventDefault();t=h(this).attr("href");h(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),h("#"+a+"-tabs").siblings(".tabs-panel").hide(),h(t).show(),"#"+a+"-all"==t?deleteUserSetting(e):setUserSetting(e,"pop")}),getUserSetting(e)&&h('a[href="#'+a+'-pop"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).one("focus",function(){h(this).val("").removeClass("form-input-tip")}),h("#new"+a).on("keypress",function(t){13===t.keyCode&&(t.preventDefault(),h("#"+a+"-add-submit").trigger("click"))}),h("#"+a+"-add-submit").on("click",function(){h("#new"+a).trigger("focus")}),i=function(t){return!!h("#new"+a).val()&&(t.data+="&"+h(":checked","#"+a+"checklist").serialize(),h("#"+a+"-add-submit").prop("disabled",!0),t)},t=function(t,e){var i=h("#new"+a+"_parent");h("#"+a+"-add-submit").prop("disabled",!1),"undefined"!=e.parsed.responses[0]&&(e=e.parsed.responses[0].supplemental.newcat_parent)&&(i.before(e),i.remove())},h("#"+a+"checklist").wpList({alt:"",response:a+"-ajax-response",addBefore:i,addAfter:t}),h("#"+a+"-add-toggle").on("click",function(t){t.preventDefault(),h("#"+a+"-adder").toggleClass("wp-hidden-children"),h('a[href="#'+a+'-all"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).trigger("focus")}),h("#"+a+"checklist, #"+a+"checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var t=h(this),e=t.is(":checked"),i=t.val();i&&t.parents("#taxonomy-"+a).length&&h("#in-"+a+"-"+i+", #in-popular-"+a+"-"+i).prop("checked",e)})}),h("#postcustom").length&&h("#the-list").wpList({addBefore:function(t){return t.data+="&post_id="+h("#post_ID").val(),t},addAfter:function(){h("table#list-table").show()}}),h("#submitdiv").length&&(p=h("#timestamp").html(),e=h("#post-visibility-display").html(),a=function(){"public"!=w.find("input:radio:checked").val()?(h("#sticky").prop("checked",!1),h("#sticky-span").hide()):h("#sticky-span").show(),"password"!=w.find("input:radio:checked").val()?h("#password-span").hide():h("#password-span").show()},n=function(){if(b.length){var t,e=h("#post_status"),i=h('option[value="publish"]',e),a=h("#aa").val(),n=h("#mm").val(),s=h("#jj").val(),o=h("#hh").val(),l=h("#mn").val(),r=new Date(a,n-1,s,o,l),c=new Date(h("#hidden_aa").val(),h("#hidden_mm").val()-1,h("#hidden_jj").val(),h("#hidden_hh").val(),h("#hidden_mn").val()),d=new Date(h("#cur_aa").val(),h("#cur_mm").val()-1,h("#cur_jj").val(),h("#cur_hh").val(),h("#cur_mn").val());if(r.getFullYear()!=a||1+r.getMonth()!=n||r.getDate()!=s||r.getMinutes()!=l)return b.find(".timestamp-wrap").addClass("form-invalid"),!1;b.find(".timestamp-wrap").removeClass("form-invalid"),d"+x("%1$s %2$s, %3$s at %4$s:%5$s").replace("%1$s",h('option[value="'+n+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(s,10)).replace("%3$s",a).replace("%4$s",("00"+o).slice(-2)).replace("%5$s",("00"+l).slice(-2))+" "),"private"==w.find("input:radio:checked").val()?(h("#publish").val(x("Update")),0===i.length?e.append('"):i.html(x("Privately Published")),h('option[value="publish"]',e).prop("selected",!0),h("#misc-publishing-actions .edit-post-status").hide()):("future"==h("#original_post_status").val()||"draft"==h("#original_post_status").val()?i.length&&(i.remove(),e.val(h("#hidden_post_status").val())):i.html(x("Published")),e.is(":hidden")&&h("#misc-publishing-actions .edit-post-status").show()),h("#post-status-display").text(wp.sanitize.stripTagsAndEncodeText(h("option:selected",e).text())),"private"==h("option:selected",e).val()||"publish"==h("option:selected",e).val()?h("#save-post").hide():(h("#save-post").show(),"pending"==h("option:selected",e).val()?h("#save-post").show().val(x("Save as Pending")):h("#save-post").show().val(x("Save Draft")))}return!0},h("#visibility .edit-visibility").on("click",function(t){t.preventDefault(),w.is(":hidden")&&(a(),w.slideDown("fast",function(){w.find('input[type="radio"]').first().trigger("focus")}),h(this).hide())}),w.find(".cancel-post-visibility").on("click",function(t){w.slideUp("fast"),h("#visibility-radio-"+h("#hidden-post-visibility").val()).prop("checked",!0),h("#post_password").val(h("#hidden-post-password").val()),h("#sticky").prop("checked",h("#hidden-post-sticky").prop("checked")),h("#post-visibility-display").html(e),h("#visibility .edit-visibility").show().trigger("focus"),n(),t.preventDefault()}),w.find(".save-post-visibility").on("click",function(t){var e="",i=w.find("input:radio:checked").val();switch(w.slideUp("fast"),h("#visibility .edit-visibility").show().trigger("focus"),n(),"public"!==i&&h("#sticky").prop("checked",!1),i){case"public":e=h("#sticky").prop("checked")?x("Public, Sticky"):x("Public");break;case"private":e=x("Private");break;case"password":e=x("Password Protected")}h("#post-visibility-display").text(e),t.preventDefault()}),w.find("input:radio").on("change",function(){a()}),b.siblings("a.edit-timestamp").on("click",function(t){b.is(":hidden")&&(b.slideDown("fast",function(){h("input, select",b.find(".timestamp-wrap")).first().trigger("focus")}),h(this).hide()),t.preventDefault()}),b.find(".cancel-timestamp").on("click",function(t){b.slideUp("fast").siblings("a.edit-timestamp").show().trigger("focus"),h("#mm").val(h("#hidden_mm").val()),h("#jj").val(h("#hidden_jj").val()),h("#aa").val(h("#hidden_aa").val()),h("#hh").val(h("#hidden_hh").val()),h("#mn").val(h("#hidden_mn").val()),n(),t.preventDefault()}),b.find(".save-timestamp").on("click",function(t){n()&&(b.slideUp("fast"),b.siblings("a.edit-timestamp").show().trigger("focus")),t.preventDefault()}),h("#post").on("submit",function(t){n()||(t.preventDefault(),b.show(),wp.autosave&&wp.autosave.enableButtons(),h("#publishing-action .spinner").removeClass("is-active"))}),k.siblings("a.edit-post-status").on("click",function(t){k.is(":hidden")&&(k.slideDown("fast",function(){k.find("select").trigger("focus")}),h(this).hide()),t.preventDefault()}),k.find(".save-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),n(),t.preventDefault()}),k.find(".cancel-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),h("#post_status").val(h("#hidden_post_status").val()),n(),t.preventDefault()})),h("#titlediv").on("click",".edit-slug",function(){var t,e,a,i,n=0,s=h("#post_name"),o=s.val(),l=h("#sample-permalink"),r=l.html(),c=h("#sample-permalink a").html(),d=h("#edit-slug-buttons"),p=d.html(),u=h("#editable-post-name-full");for(u.find("img").replaceWith(function(){return this.alt}),u=u.html(),l.html(c),a=h("#editable-post-name"),i=a.html(),d.html(' "),d.children(".save").on("click",function(){var i=a.children("input").val();i==h("#editable-post-name-full").text()?d.children(".cancel").trigger("click"):h.post(ajaxurl,{action:"sample-permalink",post_id:v,new_slug:i,new_title:h("#title").val(),samplepermalinknonce:h("#samplepermalinknonce").val()},function(t){var e=h("#edit-slug-box");e.html(t),e.hasClass("hidden")&&e.fadeIn("fast",function(){e.removeClass("hidden")}),d.html(p),l.html(r),s.val(i),h(".edit-slug").trigger("focus"),wp.a11y.speak(x("Permalink saved"))})}),d.children(".cancel").on("click",function(){h("#view-post-btn").show(),a.html(i),d.html(p),l.html(r),s.val(o),h(".edit-slug").trigger("focus")}),t=0;tu.length/4?"":u,e=x("URL Slug"),a.html('').children("input").on("keydown",function(t){var e=t.which;13===e&&(t.preventDefault(),d.children(".save").trigger("click")),27===e&&d.children(".cancel").trigger("click")}).on("keyup",function(){s.val(this.value)}).trigger("focus")}),window.wptitlehint=function(t){var e=h("#"+(t=t||"title")),i=h("#"+t+"-prompt-text");""===e.val()&&i.removeClass("screen-reader-text"),e.on("input",function(){""===this.value?i.removeClass("screen-reader-text"):i.addClass("screen-reader-text")})},wptitlehint(),t=h("#post-status-info"),c=h("#postdivrich"),!u.length||"ontouchstart"in window?h("#content-resize-handle").hide():t.on("mousedown.wp-editor-resize",function(t){(o="undefined"!=typeof tinymce?tinymce.get("content"):o)&&!o.isHidden()?(r=!0,l=h("#content_ifr").height()-t.pageY):(r=!1,l=u.height()-t.pageY,u.trigger("blur")),f.on("mousemove.wp-editor-resize",D).on("mouseup.wp-editor-resize mouseleave.wp-editor-resize",j),t.preventDefault()}).on("mouseup.wp-editor-resize",j),"undefined"!=typeof tinymce&&(h("#post-formats-select input.post-format").on("change.set-editor-class",function(){var t,e,i=this.id;i&&h(this).prop("checked")&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpost-format-[^ ]+/,""),t.dom.addClass(e,"post-format-0"==i?"post-format-standard":i),h(document).trigger("editor-classchange"))}),h("#page_template").on("change.set-editor-class",function(){var t,e,i=h(this).val()||"";(i=i.substr(i.lastIndexOf("/")+1,i.length).replace(/\.php$/,"").replace(/\./g,"-"))&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpage-template-[^ ]+/,""),t.dom.addClass(e,"page-template-"+i),h(document).trigger("editor-classchange"))})),u.on("keydown.wp-autosave",function(t){83!==t.which||t.shiftKey||t.altKey||_&&(!t.metaKey||t.ctrlKey)||!_&&!t.ctrlKey||(wp.autosave&&wp.autosave.server.triggerSave(),t.preventDefault())}),"auto-draft"===h("#original_post_status").val()&&window.history.replaceState&&h("#publish").on("click",function(){d=(d=window.location.href)+(-1!==d.indexOf("?")?"&":"?")+"wp-post-new-reload=true",window.history.replaceState(null,null,d)}),y.on("success",function(t){var e=h(t.trigger),i=h(".success",e.closest(".copy-to-clipboard-container"));t.clearSelection(),e.trigger("focus"),clearTimeout(s),i.removeClass("hidden"),s=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(x("The file URL has been copied to your clipboard"))})}),function(t,o){t(function(){var i,e=t("#content"),a=t("#wp-word-count").find(".word-count"),n=0;function s(){var t=!i||i.isHidden()?e.val():i.getContent({format:"raw"}),t=o.count(t);t!==n&&a.text(t),n=t}t(document).on("tinymce-editor-init",function(t,e){"content"===e.id&&(i=e).on("nodechange keyup",_.debounce(s,1e3))}),e.on("input keyup",_.debounce(s,1e3)),s()})}(jQuery,new wp.utils.WordCounter);
\ No newline at end of file
diff --git a/wp-admin/js/site-health.js b/wp-admin/js/site-health.js
index 5b5977183..893ca0c46 100644
--- a/wp-admin/js/site-health.js
+++ b/wp-admin/js/site-health.js
@@ -225,12 +225,12 @@ jQuery( function( $ ) {
$wrapper.addClass( 'green' ).removeClass( 'orange' );
$progressLabel.text( __( 'Good' ) );
- announceTestsProgression( 'good' );
+ wp.a11y.speak( __( 'All site health tests have finished running. Your site is looking good, and the results are now available on the page.' ) );
} else {
$wrapper.addClass( 'orange' ).removeClass( 'green' );
$progressLabel.text( __( 'Should be improved' ) );
- announceTestsProgression( 'improvable' );
+ wp.a11y.speak( __( 'All site health tests have finished running. There are items that should be addressed, and the results are now available on the page.' ) );
}
if ( isStatusTab ) {
@@ -379,7 +379,7 @@ jQuery( function( $ ) {
// After 3 seconds announce that we're still waiting for directory sizes.
var timeout = window.setTimeout( function() {
- announceTestsProgression( 'waiting-for-directory-sizes' );
+ wp.a11y.speak( __( 'Please wait...' ) );
}, 3000 );
wp.apiRequest( {
@@ -390,6 +390,7 @@ jQuery( function( $ ) {
var delay = ( new Date().getTime() ) - timestamp;
$( '.health-check-wp-paths-sizes.spinner' ).css( 'visibility', 'hidden' );
+ recalculateProgression();
if ( delay > 3000 ) {
/*
@@ -404,7 +405,7 @@ jQuery( function( $ ) {
}
window.setTimeout( function() {
- recalculateProgression();
+ wp.a11y.speak( __( 'All site health tests have finished running.' ) );
}, delay );
} else {
// Cancel the announcement.
@@ -451,34 +452,4 @@ jQuery( function( $ ) {
$( '.health-check-offscreen-nav-wrapper' ).on( 'click', function() {
$( this ).toggleClass( 'visible' );
} );
-
- /**
- * Announces to assistive technologies the tests progression status.
- *
- * @since 6.4.0
- *
- * @param {string} type The type of message to be announced.
- *
- * @return {void}
- */
- function announceTestsProgression( type ) {
- // Only announce the messages in the Site Health pages.
- if ( 'site-health' !== SiteHealth.screen ) {
- return;
- }
-
- switch ( type ) {
- case 'good':
- wp.a11y.speak( __( 'All site health tests have finished running. Your site is looking good.' ) );
- break;
- case 'improvable':
- wp.a11y.speak( __( 'All site health tests have finished running. There are items that should be addressed.' ) );
- break;
- case 'waiting-for-directory-sizes':
- wp.a11y.speak( __( 'Running additional tests... please wait.' ) );
- break;
- default:
- return;
- }
- }
} );
diff --git a/wp-admin/js/site-health.min.js b/wp-admin/js/site-health.min.js
index 53b14d749..f0404f36e 100644
--- a/wp-admin/js/site-health.min.js
+++ b/wp-admin/js/site-health.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-jQuery(function(o){var a,r=wp.i18n.__,n=wp.i18n._n,l=wp.i18n.sprintf,e=new ClipboardJS(".site-health-copy-buttons .copy-button"),c=o(".health-check-body.health-check-status-tab").length,t=o(".health-check-body.health-check-debug-tab").length,i=o("#health-check-accordion-block-wp-paths-sizes"),h=o("#adminmenu .site-health-counter"),u=o("#adminmenu .site-health-counter .count");function d(e){var t,s,a=wp.template("health-check-issue"),i=o("#health-check-issues-"+e.status);!function(e){var t,s,a,i,n={test:"string",label:"string",description:"string"},o=!0;if("object"==typeof e){for(t in n)if("object"==typeof(s=n[t]))for(a in s)i=s[a],void 0!==e[t]&&void 0!==e[t][a]&&i===typeof e[t][a]||(o=!1);else void 0!==e[t]&&s===typeof e[t]||(o=!1);return o}}(e)||(SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],void 0===e.test&&(e.test=e.status+s),"critical"===e.status?t=l(n("%s critical issue","%s critical issues",s),''+s+""):"recommended"===e.status?t=l(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=l(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&o(".site-health-issue-count-title",i).html(t),u.text(SiteHealth.site_status.issues.critical),0"+e+"
"+t+"
",actions:""};d(wp.hooks.applyFilters("site_status_test_result",e))}function s(){var t=(new Date).getTime(),s=window.setTimeout(function(){m("waiting-for-directory-sizes")},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),i.find("td[class]").each(function(e,t){var t=o(t),s=t.attr("class");a.hasOwnProperty(s)&&a[s].size&&t.text(a[s].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),3e3'+s+""):"recommended"===e.status?t=r(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=r(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&o(".site-health-issue-count-title",i).html(t),u.text(SiteHealth.site_status.issues.critical),0"+e+"
"+t+"
",actions:""};d(wp.hooks.applyFilters("site_status_test_result",e))}function s(){var t=(new Date).getTime(),s=window.setTimeout(function(){wp.a11y.speak(l("Please wait..."))},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),i.find("td[class]").each(function(e,t){var t=o(t),s=t.attr("class");a.hasOwnProperty(s)&&a[s].size&&t.text(a[s].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),p(),3e3 .widget-inside > .form, > .widget-inside > form"),s=o.find("> .id_base").val();-1===u.idBases.indexOf(s)||(s=o.find(".widget-id").val(),u.widgetControls[s])||o.find(".visual").val()&&(o=r(""),(d=t.find(".widget-content:first")).before(o),i=new u.TextWidgetControl({el:o,syncContainer:d}),u.widgetControls[s]=i,(n=function(){t.hasClass("open")?i.initializeEditor():setTimeout(n,50)})())},u.setupAccessibleMode=function(){var e,t=r(".editwidget > form");0!==t.length&&(e=t.find(".id_base").val(),-1!==u.idBases.indexOf(e))&&t.find(".visual").val()&&(e=r(""),(t=t.find("> .widget-inside")).before(e),new u.TextWidgetControl({el:e,syncContainer:t}).initializeEditor())},u.handleWidgetUpdated=function(e,t){var t=t.find("> .widget-inside > .form, > .widget-inside > form"),i=t.find("> .id_base").val();-1!==u.idBases.indexOf(i)&&(i=t.find("> .widget-id").val(),t=u.widgetControls[i])&&t.updateFields()},u.init=function(){var e=r(document);e.on("widget-added",u.handleWidgetAdded),e.on("widget-synced widget-updated",u.handleWidgetUpdated),r(function(){"widgets"===window.pagenow&&(r(".widgets-holder-wrap:not(#available-widgets)").find("div.widget").one("click.toggle-widget-expanded",function(){var e=r(this);u.handleWidgetAdded(new jQuery.Event("widget-added"),e)}),u.setupAccessibleMode())})},u}(jQuery);
\ No newline at end of file
+wp.textWidgets=function(r){"use strict";var u={dismissedPointers:[],idBases:["text"]};return u.TextWidgetControl=Backbone.View.extend({events:{},initialize:function(t){var n=this;if(!t.el)throw new Error("Missing options.el");if(!t.syncContainer)throw new Error("Missing options.syncContainer");Backbone.View.prototype.initialize.call(n,t),n.syncContainer=t.syncContainer,n.$el.addClass("text-widget-fields"),n.$el.html(wp.template("widget-text-control-fields")),n.customHtmlWidgetPointer=n.$el.find(".wp-pointer.custom-html-widget-pointer"),n.customHtmlWidgetPointer.length&&(n.customHtmlWidgetPointer.find(".close").on("click",function(t){t.preventDefault(),n.customHtmlWidgetPointer.hide(),r("#"+n.fields.text.attr("id")+"-html").trigger("focus"),n.dismissPointers(["text_widget_custom_html"])}),n.customHtmlWidgetPointer.find(".add-widget").on("click",function(t){t.preventDefault(),n.customHtmlWidgetPointer.hide(),n.openAvailableWidgetsPanel()})),n.pasteHtmlPointer=n.$el.find(".wp-pointer.paste-html-pointer"),n.pasteHtmlPointer.length&&n.pasteHtmlPointer.find(".close").on("click",function(t){t.preventDefault(),n.pasteHtmlPointer.hide(),n.editor.focus(),n.dismissPointers(["text_widget_custom_html","text_widget_paste_html"])}),n.fields={title:n.$el.find(".title"),text:n.$el.find(".text")},_.each(n.fields,function(e,i){e.on("input change",function(){var t=n.syncContainer.find(".sync-input."+i);t.val()!==e.val()&&(t.val(e.val()),t.trigger("change"))}),e.val(n.syncContainer.find(".sync-input."+i).val())})},dismissPointers:function(t){_.each(t,function(t){wp.ajax.post("dismiss-wp-pointer",{pointer:t}),u.dismissedPointers.push(t)})},openAvailableWidgetsPanel:function(){var e;wp.customize.section.each(function(t){t.extended(wp.customize.Widgets.SidebarSection)&&t.expanded()&&(e=wp.customize.control("sidebars_widgets["+t.params.sidebarId+"]"))}),e&&setTimeout(function(){wp.customize.Widgets.availableWidgetsPanel.open(e),wp.customize.Widgets.availableWidgetsPanel.$search.val("HTML").trigger("keyup")})},updateFields:function(){var t,e=this;e.fields.title.is(document.activeElement)||(t=e.syncContainer.find(".sync-input.title"),e.fields.title.val(t.val())),t=e.syncContainer.find(".sync-input.text"),e.fields.text.is(":visible")?e.fields.text.is(document.activeElement)||e.fields.text.val(t.val()):e.editor&&!e.editorFocused&&t.val()!==e.fields.text.val()&&e.editor.setContent(wp.oldEditor.autop(t.val()))},initializeEditor:function(){var d,t,o,e,s=this,a=1e3,l=!1,c=!1;t=s.fields.text,d=t.attr("id"),e=t.val(),o=function(){s.editor.isDirty()&&(wp.customize&&wp.customize.state&&(wp.customize.state("processing").set(wp.customize.state("processing").get()+1),_.delay(function(){wp.customize.state("processing").set(wp.customize.state("processing").get()-1)},300)),s.editor.isHidden()||s.editor.save()),c&&e!==t.val()&&(t.trigger("change"),c=!1,e=t.val())},s.syncContainer.closest(".widget").find("[name=savewidget]:first").on("click",function(){o()}),function t(){var e,i,n;if(document.getElementById(d))if(void 0===window.tinymce)wp.oldEditor.initialize(d,{quicktags:!0,mediaButtons:!0});else{if(tinymce.get(d)&&(l=tinymce.get(d).isHidden(),wp.oldEditor.remove(d)),r(document).one("wp-before-tinymce-init.text-widget-init",function(t,e){e.plugins&&!/\bwpview\b/.test(e.plugins)&&(e.plugins+=",wpview")}),wp.oldEditor.initialize(d,{tinymce:{wpautop:!0},quicktags:!0,mediaButtons:!0}),n=function(t){t.show(),t.find(".close").trigger("focus"),wp.a11y.speak(t.find("h3, p").map(function(){return r(this).text()}).get().join("\n\n"))},!(e=window.tinymce.get(d)))throw new Error("Failed to initialize editor");i=function(){r(e.getWin()).on("unload",function(){_.defer(t)}),l&&switchEditors.go(d,"html"),r("#"+d+"-html").on("click",function(){s.pasteHtmlPointer.hide(),-1===u.dismissedPointers.indexOf("text_widget_custom_html")&&n(s.customHtmlWidgetPointer)}),r("#"+d+"-tmce").on("click",function(){s.customHtmlWidgetPointer.hide()}),e.on("pastepreprocess",function(t){t=t.content,-1===u.dismissedPointers.indexOf("text_widget_paste_html")&&t&&/<\w+.*?>/.test(t)&&_.delay(function(){n(s.pasteHtmlPointer)},250)})},e.initialized?i():e.on("init",i),s.editorFocused=!1,e.on("focus",function(){s.editorFocused=!0}),e.on("paste",function(){e.setDirty(!0),o()}),e.on("NodeChange",function(){c=!0}),e.on("NodeChange",_.debounce(o,a)),e.on("blur hide",function(){s.editorFocused=!1,o()}),s.editor=e}}()}}),u.widgetControls={},u.handleWidgetAdded=function(t,e){var i,n,d,o=e.find("> .widget-inside > .form, > .widget-inside > form"),s=o.find("> .id_base").val();-1===u.idBases.indexOf(s)||(s=o.find(".widget-id").val(),u.widgetControls[s])||o.find(".visual").val()&&(o=r(""),(d=e.find(".widget-content:first")).before(o),i=new u.TextWidgetControl({el:o,syncContainer:d}),u.widgetControls[s]=i,(n=function(){e.hasClass("open")?i.initializeEditor():setTimeout(n,50)})())},u.setupAccessibleMode=function(){var t,e=r(".editwidget > form");0!==e.length&&(t=e.find(".id_base").val(),-1!==u.idBases.indexOf(t))&&e.find(".visual").val()&&(t=r(""),(e=e.find("> .widget-inside")).before(t),new u.TextWidgetControl({el:t,syncContainer:e}).initializeEditor())},u.handleWidgetUpdated=function(t,e){var e=e.find("> .widget-inside > .form, > .widget-inside > form"),i=e.find("> .id_base").val();-1!==u.idBases.indexOf(i)&&(i=e.find("> .widget-id").val(),e=u.widgetControls[i])&&e.updateFields()},u.init=function(){var t=r(document);t.on("widget-added",u.handleWidgetAdded),t.on("widget-synced widget-updated",u.handleWidgetUpdated),r(function(){"widgets"===window.pagenow&&(r(".widgets-holder-wrap:not(#available-widgets)").find("div.widget").one("click.toggle-widget-expanded",function(){var t=r(this);u.handleWidgetAdded(new jQuery.Event("widget-added"),t)}),u.setupAccessibleMode())})},u}(jQuery);
\ No newline at end of file
diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php
index 4ae6c4bcc..5f56ac798 100644
--- a/wp-admin/link-manager.php
+++ b/wp-admin/link-manager.php
@@ -101,7 +101,7 @@
?>
-
+
';
} elseif ( isset( $_GET['error'] ) && 'main' === $_GET['error'] ) {
- $message = __( 'You cannot delete a theme while it is active on the main site.' );
- $type = 'error';
+ echo '
' . __( 'You cannot delete a theme while it is active on the main site.' ) . '
- ' . __( 'Caution:' ) . ' ' . __( 'This plugin may be active on other sites in the network.' );
- wp_admin_notice(
- $maybe_active_plugin,
- array(
- 'additional_classes' => array( 'error' ),
- )
- );
- endif;
- ?>
+
+
+
- ' . __( 'Caution:' ) . ' ' . __( 'These plugins may be active on other sites in the network.' );
- wp_admin_notice(
- $maybe_active_plugins,
- array(
- 'additional_classes' => array( 'error' ),
- )
- );
- endif;
- ?>
+
+
+
@@ -511,7 +495,7 @@
// Return early if all selected plugins already have auto-updates enabled or disabled.
// Must use non-strict comparison, so that array order is not treated as significant.
- if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
+ if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
wp_redirect( $redirect );
exit;
}
@@ -563,7 +547,7 @@
'
' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' ' . __( 'The search results will be updated as you type.' ) . '
' .
'
' . sprintf(
/* translators: %s: WordPress Plugin Directory URL. */
- __( 'If you would like to see more plugins to choose from, click on the “Add New Plugin” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ),
+ __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ),
__( 'https://wordpress.org/plugins/' )
) . '
%s × %s', $width, $height )
);
} elseif ( $width ) {
printf(
/* translators: %s: Header width in pixels. */
- __( 'Click “Add New Image” to upload an image file from your computer. Your theme works best with an image with a header width of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ),
+ __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header width of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ),
sprintf( '%s', $width )
);
} else {
printf(
/* translators: %s: Header height in pixels. */
- __( 'Click “Add New Image” to upload an image file from your computer. Your theme works best with an image with a header height of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ),
+ __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header height of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ),
sprintf( '%s', $height )
);
}
@@ -246,7 +247,7 @@ public function render_content() {
-
+
diff --git a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
index 4c8ad5bec..028cd8da2 100644
--- a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
+++ b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
@@ -183,6 +183,7 @@ public function __construct( WP_Customize_Manager $manager, $id, array $args = a
throw new Exception( "Supplied nav_menu_item value missing property: $missing" );
}
}
+
}
/**
@@ -877,6 +878,7 @@ protected function update( $value ) {
}
}
}
+
}
/**
diff --git a/wp-includes/customize/class-wp-customize-selective-refresh.php b/wp-includes/customize/class-wp-customize-selective-refresh.php
index d20e8ab0a..f75baff3e 100644
--- a/wp-includes/customize/class-wp-customize-selective-refresh.php
+++ b/wp-includes/customize/class-wp-customize-selective-refresh.php
@@ -193,7 +193,7 @@ public function export_preview_data() {
);
// Export data to JS.
- wp_print_inline_script_tag( sprintf( 'var _customizePartialRefreshExports = %s;', wp_json_encode( $exports ) ) );
+ printf( '', wp_json_encode( $exports ) );
}
/**
diff --git a/wp-includes/customize/class-wp-customize-theme-control.php b/wp-includes/customize/class-wp-customize-theme-control.php
index 81c36dd42..0ebc9ef1e 100644
--- a/wp-includes/customize/class-wp-customize-theme-control.php
+++ b/wp-includes/customize/class-wp-customize-theme-control.php
@@ -240,15 +240,7 @@ public function content_template() {
.
* }
- * @return bool Whether a tag was matched.
+ * @return boolean Whether a tag was matched.
*/
public function next_tag( $query = null ) {
$this->parse_query( $query );
@@ -626,94 +626,6 @@ public function next_tag( $query = null ) {
}
- /**
- * Generator for a foreach loop to step through each class name for the matched tag.
- *
- * This generator function is designed to be used inside a "foreach" loop.
- *
- * Example:
- *
- * $p = new WP_HTML_Tag_Processor( "
" );
- * $p->next_tag();
- * foreach ( $p->class_list() as $class_name ) {
- * echo "{$class_name} ";
- * }
- * // Outputs: "free lang-en "
- *
- * @since 6.4.0
- */
- public function class_list() {
- /** @var string $class contains the string value of the class attribute, with character references decoded. */
- $class = $this->get_attribute( 'class' );
-
- if ( ! is_string( $class ) ) {
- return;
- }
-
- $seen = array();
-
- $at = 0;
- while ( $at < strlen( $class ) ) {
- // Skip past any initial boundary characters.
- $at += strspn( $class, " \t\f\r\n", $at );
- if ( $at >= strlen( $class ) ) {
- return;
- }
-
- // Find the byte length until the next boundary.
- $length = strcspn( $class, " \t\f\r\n", $at );
- if ( 0 === $length ) {
- return;
- }
-
- /*
- * CSS class names are case-insensitive in the ASCII range.
- *
- * @see https://www.w3.org/TR/CSS2/syndata.html#x1
- */
- $name = strtolower( substr( $class, $at, $length ) );
- $at += $length;
-
- /*
- * It's expected that the number of class names for a given tag is relatively small.
- * Given this, it is probably faster overall to scan an array for a value rather
- * than to use the class name as a key and check if it's a key of $seen.
- */
- if ( in_array( $name, $seen, true ) ) {
- continue;
- }
-
- $seen[] = $name;
- yield $name;
- }
- }
-
-
- /**
- * Returns if a matched tag contains the given ASCII case-insensitive class name.
- *
- * @since 6.4.0
- *
- * @param string $wanted_class Look for this CSS class name, ASCII case-insensitive.
- * @return bool|null Whether the matched tag contains the given class name, or null if not matched.
- */
- public function has_class( $wanted_class ) {
- if ( ! $this->tag_name_starts_at ) {
- return null;
- }
-
- $wanted_class = strtolower( $wanted_class );
-
- foreach ( $this->class_list() as $class_name ) {
- if ( $class_name === $wanted_class ) {
- return true;
- }
- }
-
- return false;
- }
-
-
/**
* Sets a bookmark in the HTML document.
*
@@ -799,7 +711,7 @@ public function set_bookmark( $name ) {
return false;
}
- if ( ! array_key_exists( $name, $this->bookmarks ) && count( $this->bookmarks ) >= static::MAX_BOOKMARKS ) {
+ if ( ! array_key_exists( $name, $this->bookmarks ) && count( $this->bookmarks ) >= self::MAX_BOOKMARKS ) {
_doing_it_wrong(
__METHOD__,
__( 'Too many bookmarks: cannot create any more.' ),
@@ -1095,7 +1007,7 @@ private function parse_next_tag() {
if ( '/' === $this->html[ $at + 1 ] ) {
$this->is_closing_tag = true;
- ++$at;
+ $at++;
} else {
$this->is_closing_tag = false;
}
@@ -1164,7 +1076,7 @@ private function parse_next_tag() {
*
* See https://html.spec.whatwg.org/#parse-error-incorrectly-closed-comment
*/
- --$closer_at; // Pre-increment inside condition below reduces risk of accidental infinite looping.
+ $closer_at--; // Pre-increment inside condition below reduces risk of accidental infinite looping.
while ( ++$closer_at < strlen( $html ) ) {
$closer_at = strpos( $html, '--', $closer_at );
if ( false === $closer_at ) {
@@ -1245,7 +1157,7 @@ private function parse_next_tag() {
* See https://html.spec.whatwg.org/#parse-error-missing-end-tag-name
*/
if ( '>' === $html[ $at + 1 ] ) {
- ++$at;
+ $at++;
continue;
}
@@ -1702,7 +1614,7 @@ public function seek( $bookmark_name ) {
return false;
}
- if ( ++$this->seek_count > static::MAX_SEEK_OPS ) {
+ if ( ++$this->seek_count > self::MAX_SEEK_OPS ) {
_doing_it_wrong(
__METHOD__,
__( 'Too many calls to seek() - this can lead to performance issues.' ),
@@ -1907,7 +1819,7 @@ public function get_attribute( $name ) {
* @param string $prefix Prefix of requested attribute names.
* @return array|null List of attribute names, or `null` when no tag opener is matched.
*/
- public function get_attribute_names_with_prefix( $prefix ) {
+ function get_attribute_names_with_prefix( $prefix ) {
if ( $this->is_closing_tag || null === $this->tag_name_starts_at ) {
return null;
}
@@ -2270,7 +2182,6 @@ public function __toString() {
*
* @since 6.2.0
* @since 6.2.1 Shifts the internal cursor corresponding to the applied updates.
- * @since 6.4.0 No longer calls subclass method `next_tag()` after updating HTML.
*
* @return string The processed HTML.
*/
@@ -2304,29 +2215,24 @@ public function get_updated_html() {
* Rewind before the tag name starts so that it's as if the cursor didn't
* move; a call to `next_tag()` will reparse the recently-updated attributes
* and additional calls to modify the attributes will apply at this same
- * location, but in order to avoid issues with subclasses that might add
- * behaviors to `next_tag()`, the internal methods should be called here
- * instead.
- *
- * It's important to note that in this specific place there will be no change
- * because the processor was already at a tag when this was called and it's
- * rewinding only to the beginning of this very tag before reprocessing it
- * and its attributes.
+ * location.
*
*
Previous HTMLMore HTML
- * ↑ │ back up by the length of the tag name plus the opening <
- * └←─┘ back up by strlen("em") + 1 ==> 3
+ * ^ | back up by the length of the tag name plus the opening <
+ * \<-/ back up by strlen("em") + 1 ==> 3
*/
+
+ // Store existing state so it can be restored after reparsing.
+ $previous_parsed_byte_count = $this->bytes_already_parsed;
+ $previous_query = $this->last_query;
+
+ // Reparse attributes.
$this->bytes_already_parsed = $before_current_tag;
- $this->parse_next_tag();
- // Reparse the attributes.
- while ( $this->parse_next_attribute() ) {
- continue;
- }
+ $this->next_tag();
- $tag_ends_at = strpos( $this->html, '>', $this->bytes_already_parsed );
- $this->tag_ends_at = $tag_ends_at;
- $this->bytes_already_parsed = $tag_ends_at;
+ // Restore previous state.
+ $this->bytes_already_parsed = $previous_parsed_byte_count;
+ $this->parse_query( $previous_query );
return $this->html;
}
@@ -2402,7 +2308,7 @@ private function parse_query( $query ) {
*
* @since 6.2.0
*
- * @return bool Whether the given tag and its attribute match the search criteria.
+ * @return boolean Whether the given tag and its attribute match the search criteria.
*/
private function matches() {
if ( $this->is_closing_tag && ! $this->stop_on_tag_closers ) {
@@ -2441,7 +2347,64 @@ private function matches() {
}
}
- if ( null !== $this->sought_class_name && ! $this->has_class( $this->sought_class_name ) ) {
+ $needs_class_name = null !== $this->sought_class_name;
+
+ if ( $needs_class_name && ! isset( $this->attributes['class'] ) ) {
+ return false;
+ }
+
+ /*
+ * Match byte-for-byte (case-sensitive and encoding-form-sensitive) on the class name.
+ *
+ * This will overlook certain classes that exist in other lexical variations
+ * than was supplied to the search query, but requires more complicated searching.
+ */
+ if ( $needs_class_name ) {
+ $class_start = $this->attributes['class']->value_starts_at;
+ $class_end = $class_start + $this->attributes['class']->value_length;
+ $class_at = $class_start;
+
+ /*
+ * Ensure that boundaries surround the class name to avoid matching on
+ * substrings of a longer name. For example, the sequence "not-odd"
+ * should not match for the class "odd" even though "odd" is found
+ * within the class attribute text.
+ *
+ * See https://html.spec.whatwg.org/#attributes-3
+ * See https://html.spec.whatwg.org/#space-separated-tokens
+ */
+ while (
+ // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
+ false !== ( $class_at = strpos( $this->html, $this->sought_class_name, $class_at ) ) &&
+ $class_at < $class_end
+ ) {
+ /*
+ * Verify this class starts at a boundary.
+ */
+ if ( $class_at > $class_start ) {
+ $character = $this->html[ $class_at - 1 ];
+
+ if ( ' ' !== $character && "\t" !== $character && "\f" !== $character && "\r" !== $character && "\n" !== $character ) {
+ $class_at += strlen( $this->sought_class_name );
+ continue;
+ }
+ }
+
+ /*
+ * Verify this class ends at a boundary as well.
+ */
+ if ( $class_at + strlen( $this->sought_class_name ) < $class_end ) {
+ $character = $this->html[ $class_at + strlen( $this->sought_class_name ) ];
+
+ if ( ' ' !== $character && "\t" !== $character && "\f" !== $character && "\r" !== $character && "\n" !== $character ) {
+ $class_at += strlen( $this->sought_class_name );
+ continue;
+ }
+ }
+
+ return true;
+ }
+
return false;
}
diff --git a/wp-includes/html-api/class-wp-html-token.php b/wp-includes/html-api/class-wp-html-token.php
deleted file mode 100644
index 86dd7658c..000000000
--- a/wp-includes/html-api/class-wp-html-token.php
+++ /dev/null
@@ -1,106 +0,0 @@
-bookmark_name = $bookmark_name;
- $this->node_name = $node_name;
- $this->has_self_closing_flag = $has_self_closing_flag;
- $this->on_destroy = $on_destroy;
- }
-
- /**
- * Destructor.
- *
- * @since 6.4.0
- */
- public function __destruct() {
- if ( is_callable( $this->on_destroy ) ) {
- call_user_func( $this->on_destroy, $this->bookmark_name );
- }
- }
-
- /**
- * Wakeup magic method.
- *
- * @since 6.4.2
- */
- public function __wakeup() {
- throw new \LogicException( __CLASS__ . ' should never be unserialized' );
- }
-}
diff --git a/wp-includes/html-api/class-wp-html-unsupported-exception.php b/wp-includes/html-api/class-wp-html-unsupported-exception.php
deleted file mode 100644
index 6e7228670..000000000
--- a/wp-includes/html-api/class-wp-html-unsupported-exception.php
+++ /dev/null
@@ -1,31 +0,0 @@
-errors;
+ update_option( 'https_detection_errors', $support_errors->errors );
+ return;
}
$support_errors = new WP_Error();
@@ -153,7 +153,41 @@ function wp_get_https_detection_errors() {
}
}
- return $support_errors->errors;
+ update_option( 'https_detection_errors', $support_errors->errors );
+}
+
+/**
+ * Schedules the Cron hook for detecting HTTPS support.
+ *
+ * @since 5.7.0
+ * @access private
+ */
+function wp_schedule_https_detection() {
+ if ( wp_installing() ) {
+ return;
+ }
+
+ if ( ! wp_next_scheduled( 'wp_https_detection' ) ) {
+ wp_schedule_event( time(), 'twicedaily', 'wp_https_detection' );
+ }
+}
+
+/**
+ * Disables SSL verification if the 'cron_request' arguments include an HTTPS URL.
+ *
+ * This prevents an issue if HTTPS breaks, where there would be a failed attempt to verify HTTPS.
+ *
+ * @since 5.7.0
+ * @access private
+ *
+ * @param array $request The cron request arguments.
+ * @return array The filtered cron request arguments.
+ */
+function wp_cron_conditionally_prevent_sslverify( $request ) {
+ if ( 'https' === wp_parse_url( $request['url'], PHP_URL_SCHEME ) ) {
+ $request['args']['sslverify'] = false;
+ }
+ return $request;
}
/**
diff --git a/wp-includes/js/backbone.js b/wp-includes/js/backbone.js
index 2f8db3721..fd64012a3 100644
--- a/wp-includes/js/backbone.js
+++ b/wp-includes/js/backbone.js
@@ -1,4 +1,4 @@
-// Backbone.js 1.5.0
+// Backbone.js 1.4.1
// (c) 2010-2022 Jeremy Ashkenas and DocumentCloud
// Backbone may be freely distributed under the MIT license.
@@ -44,7 +44,7 @@
var slice = Array.prototype.slice;
// Current version of the library. Keep in sync with `package.json`.
- Backbone.VERSION = '1.5.0';
+ Backbone.VERSION = '1.4.1';
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
// the `$` variable.
@@ -404,11 +404,7 @@
if (options.collection) this.collection = options.collection;
if (options.parse) attrs = this.parse(attrs, options) || {};
var defaults = _.result(this, 'defaults');
-
- // Just _.defaults would work fine, but the additional _.extends
- // is in there for historical reasons. See #3843.
attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
-
this.set(attrs, options);
this.changed = {};
this.initialize.apply(this, arguments);
@@ -1084,23 +1080,9 @@
var collection = this;
var success = options.success;
options.success = function(m, resp, callbackOpts) {
- if (wait) {
- m.off('error', this._forwardPristineError, this);
- collection.add(m, callbackOpts);
- }
+ if (wait) collection.add(m, callbackOpts);
if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
};
- // In case of wait:true, our collection is not listening to any
- // of the model's events yet, so it will not forward the error
- // event. In this special case, we need to listen for it
- // separately and handle the event just once.
- // (The reason we don't need to do this for the sync event is
- // in the success handler above: we add the model first, which
- // causes the collection to listen, and then invoke the callback
- // that triggers the event.)
- if (wait) {
- model.once('error', this._forwardPristineError, this);
- }
model.save(null, options);
return model;
},
@@ -1195,7 +1177,6 @@
removed.push(model);
this._removeReference(model, options);
}
- if (models.length > 0 && !options.silent) delete options.index;
return removed;
},
@@ -1238,19 +1219,8 @@
}
}
this.trigger.apply(this, arguments);
- },
-
- // Internal callback method used in `create`. It serves as a
- // stand-in for the `_onModelEvent` method, which is not yet bound
- // during the `wait` period of the `create` call. We still want to
- // forward any `'error'` event at the end of the `wait` period,
- // hence a customized callback.
- _forwardPristineError: function(model, collection, options) {
- // Prevent double forward if the model was already in the
- // collection before the call to `create`.
- if (this.has(model)) return;
- this._onModelEvent('error', model, collection, options);
}
+
});
// Defining an @@iterator method implements JavaScript's Iterable protocol.
@@ -1876,7 +1846,6 @@
// Is pushState desired ... is it available?
this.options = _.extend({root: '/'}, this.options, options);
this.root = this.options.root;
- this._trailingSlash = this.options.trailingSlash;
this._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
this._useHashChange = this._wantsHashChange && this._hasHashChange;
@@ -2019,9 +1988,9 @@
// Normalize the fragment.
fragment = this.getFragment(fragment || '');
- // Strip trailing slash on the root unless _trailingSlash is true
+ // Don't include a trailing slash on the root.
var rootPath = this.root;
- if (!this._trailingSlash && (fragment === '' || fragment.charAt(0) === '?')) {
+ if (fragment === '' || fragment.charAt(0) === '?') {
rootPath = rootPath.slice(0, -1) || '/';
}
var url = rootPath + fragment;
diff --git a/wp-includes/js/backbone.min.js b/wp-includes/js/backbone.min.js
index b674cc22b..60ac51658 100644
--- a/wp-includes/js/backbone.min.js
+++ b/wp-includes/js/backbone.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(n){var s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(t,e,i){s.Backbone=n(s,i,t,e)});else if("undefined"!=typeof exports){var t,e=require("underscore");try{t=require("jquery")}catch(t){}n(s,exports,e,t)}else s.Backbone=n(s,{},s._,s.jQuery||s.Zepto||s.ender||s.$)}(function(t,h,b,e){function a(t,e,i,n,s){var r,o=0;if(i&&"object"==typeof i){void 0!==n&&"context"in s&&void 0===s.context&&(s.context=n);for(r=b.keys(i);othis.length?this.length:n)<0&&(n+=this.length+1),[]),r=[],o=[],h=[],a={},l=e.add,c=e.merge,u=e.remove,d=!1,f=this.comparator&&null==n&&!1!==e.sort,p=b.isString(this.comparator)?this.comparator:null,g=0;gthis.length?this.length:n)<0&&(n+=this.length+1),[]),r=[],o=[],h=[],a={},u=e.add,c=e.merge,l=e.remove,d=!1,f=this.comparator&&null==n&&!1!==e.sort,p=b.isString(this.comparator)?this.comparator:null,g=0;g]+>/g, ' ');
-
/*
* Safari + VoiceOver don't announce repeated, identical strings. We use
* a `no-break space` to force them to think identical strings are different.
*/
+
if (previousMessage === message) {
message += '\u00A0';
}
+
previousMessage = message;
return message;
}
@@ -168,7 +174,6 @@ function filterMessage(message) {
* WordPress dependencies
*/
-
/**
* Internal dependencies
*/
@@ -180,26 +185,29 @@ function filterMessage(message) {
/**
* Create the live regions.
*/
+
function setup() {
const introText = document.getElementById('a11y-speak-intro-text');
const containerAssertive = document.getElementById('a11y-speak-assertive');
const containerPolite = document.getElementById('a11y-speak-polite');
+
if (introText === null) {
addIntroText();
}
+
if (containerAssertive === null) {
addContainer('assertive');
}
+
if (containerPolite === null) {
addContainer('polite');
}
}
-
/**
* Run setup on domReady.
*/
-external_wp_domReady_default()(setup);
+external_wp_domReady_default()(setup);
/**
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions.
* This module is inspired by the `speak` function in `wp-a11y.js`.
@@ -218,6 +226,7 @@ external_wp_domReady_default()(setup);
* speak( 'The message you want to send to the ARIA live region', 'assertive' );
* ```
*/
+
function speak(message, ariaLive) {
/*
* Clear previous messages to allow repeated strings being read out and hide
@@ -228,16 +237,18 @@ function speak(message, ariaLive) {
const introText = document.getElementById('a11y-speak-intro-text');
const containerAssertive = document.getElementById('a11y-speak-assertive');
const containerPolite = document.getElementById('a11y-speak-polite');
+
if (containerAssertive && ariaLive === 'assertive') {
containerAssertive.textContent = message;
} else if (containerPolite) {
containerPolite.textContent = message;
}
-
/*
* Make the explanatory text available to assistive technologies by removing
* the 'hidden' HTML attribute.
*/
+
+
if (introText) {
introText.removeAttribute('hidden');
}
diff --git a/wp-includes/js/dist/annotations.js b/wp-includes/js/dist/annotations.js
index 955dbf047..0ec439aac 100644
--- a/wp-includes/js/dist/annotations.js
+++ b/wp-includes/js/dist/annotations.js
@@ -39,27 +39,27 @@ __webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
- store: function() { return /* reexport */ store; }
+ "store": function() { return /* reexport */ store; }
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
- __experimentalGetAllAnnotationsForBlock: function() { return __experimentalGetAllAnnotationsForBlock; },
- __experimentalGetAnnotations: function() { return __experimentalGetAnnotations; },
- __experimentalGetAnnotationsForBlock: function() { return __experimentalGetAnnotationsForBlock; },
- __experimentalGetAnnotationsForRichText: function() { return __experimentalGetAnnotationsForRichText; }
+ "__experimentalGetAllAnnotationsForBlock": function() { return __experimentalGetAllAnnotationsForBlock; },
+ "__experimentalGetAnnotations": function() { return __experimentalGetAnnotations; },
+ "__experimentalGetAnnotationsForBlock": function() { return __experimentalGetAnnotationsForBlock; },
+ "__experimentalGetAnnotationsForRichText": function() { return __experimentalGetAnnotationsForRichText; }
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
- __experimentalAddAnnotation: function() { return __experimentalAddAnnotation; },
- __experimentalRemoveAnnotation: function() { return __experimentalRemoveAnnotation; },
- __experimentalRemoveAnnotationsBySource: function() { return __experimentalRemoveAnnotationsBySource; },
- __experimentalUpdateAnnotationRange: function() { return __experimentalUpdateAnnotationRange; }
+ "__experimentalAddAnnotation": function() { return __experimentalAddAnnotation; },
+ "__experimentalRemoveAnnotation": function() { return __experimentalRemoveAnnotation; },
+ "__experimentalRemoveAnnotationsBySource": function() { return __experimentalRemoveAnnotationsBySource; },
+ "__experimentalUpdateAnnotationRange": function() { return __experimentalUpdateAnnotationRange; }
});
;// CONCATENATED MODULE: external ["wp","richText"]
@@ -94,18 +94,22 @@ const ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-';
* @param {Array} annotations The annotation to apply.
* @return {Object} A record with the annotations applied.
*/
+
function applyAnnotations(record, annotations = []) {
annotations.forEach(annotation => {
let {
start,
end
} = annotation;
+
if (start > record.text.length) {
start = record.text.length;
}
+
if (end > record.text.length) {
end = record.text.length;
}
+
const className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source;
const id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id;
record = (0,external_wp_richText_namespaceObject.applyFormat)(record, {
@@ -118,23 +122,23 @@ function applyAnnotations(record, annotations = []) {
});
return record;
}
-
/**
* Removes annotations from the given record.
*
* @param {Object} record Record to remove annotations from.
* @return {Object} The cleaned record.
*/
+
function removeAnnotations(record) {
return removeFormat(record, 'core/annotation', 0, record.text.length);
}
-
/**
* Retrieves the positions of annotations inside an array of formats.
*
* @param {Array} formats Formats with annotations in there.
* @return {Object} ID keyed positions of annotations.
*/
+
function retrieveAnnotationPositions(formats) {
const positions = {};
formats.forEach((characterFormats, i) => {
@@ -145,21 +149,21 @@ function retrieveAnnotationPositions(formats) {
id
} = format.attributes;
id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, '');
+
if (!positions.hasOwnProperty(id)) {
positions[id] = {
start: i
};
- }
-
- // Annotations refer to positions between characters.
+ } // Annotations refer to positions between characters.
// Formats refer to the character themselves.
// So we need to adjust for that here.
+
+
positions[id].end = i + 1;
});
});
return positions;
}
-
/**
* Updates annotations in the state based on positions retrieved from RichText.
*
@@ -169,28 +173,33 @@ function retrieveAnnotationPositions(formats) {
* @param {Function} actions.removeAnnotation Function to remove an annotation from the state.
* @param {Function} actions.updateAnnotationRange Function to update an annotation range in the state.
*/
+
+
function updateAnnotationsWithPositions(annotations, positions, {
removeAnnotation,
updateAnnotationRange
}) {
annotations.forEach(currentAnnotation => {
- const position = positions[currentAnnotation.id];
- // If we cannot find an annotation, delete it.
+ const position = positions[currentAnnotation.id]; // If we cannot find an annotation, delete it.
+
if (!position) {
// Apparently the annotation has been removed, so remove it from the state:
// Remove...
removeAnnotation(currentAnnotation.id);
return;
}
+
const {
start,
end
} = currentAnnotation;
+
if (start !== position.start || end !== position.end) {
updateAnnotationRange(currentAnnotation.id, position.start, position.end);
}
});
}
+
const annotation = {
name: FORMAT_NAME,
title: (0,external_wp_i18n_namespaceObject.__)('Annotation'),
@@ -200,9 +209,11 @@ const annotation = {
className: 'class',
id: 'id'
},
+
edit() {
return null;
},
+
__experimentalGetPropsForEditableTreePreparation(select, {
richTextIdentifier,
blockClientId
@@ -211,6 +222,7 @@ const annotation = {
annotations: select(STORE_NAME).__experimentalGetAnnotationsForRichText(blockClientId, richTextIdentifier)
};
},
+
__experimentalCreatePrepareEditableTree({
annotations
}) {
@@ -218,6 +230,7 @@ const annotation = {
if (annotations.length === 0) {
return formats;
}
+
let record = {
formats,
text
@@ -226,12 +239,14 @@ const annotation = {
return record.formats;
};
},
+
__experimentalGetPropsForEditableTreeChangeHandler(dispatch) {
return {
removeAnnotation: dispatch(STORE_NAME).__experimentalRemoveAnnotation,
updateAnnotationRange: dispatch(STORE_NAME).__experimentalUpdateAnnotationRange
};
},
+
__experimentalCreateOnChangeEditableValue(props) {
return formats => {
const positions = retrieveAnnotationPositions(formats);
@@ -246,6 +261,7 @@ const annotation = {
});
};
}
+
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/index.js
@@ -253,11 +269,11 @@ const annotation = {
* WordPress dependencies
*/
-
/**
* Internal dependencies
*/
+
const {
name: format_name,
...settings
@@ -274,23 +290,25 @@ var external_wp_data_namespaceObject = window["wp"]["data"];
*/
-
/**
* Internal dependencies
*/
+
/**
* Adds annotation className to the block-list-block component.
*
* @param {Object} OriginalComponent The original BlockListBlock component.
* @return {Object} The enhanced component.
*/
+
const addAnnotationClassName = OriginalComponent => {
return (0,external_wp_data_namespaceObject.withSelect)((select, {
clientId,
className
}) => {
const annotations = select(STORE_NAME).__experimentalGetAnnotationsForBlock(clientId);
+
return {
className: annotations.map(annotation => {
return 'is-annotated-by-' + annotation.source;
@@ -298,6 +316,7 @@ const addAnnotationClassName = OriginalComponent => {
};
})(OriginalComponent);
};
+
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/annotations', addAnnotationClassName);
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/reducer.js
@@ -314,7 +333,6 @@ function filterWithReference(collection, predicate) {
const filteredCollection = collection.filter(predicate);
return collection.length === filteredCollection.length ? collection : filteredCollection;
}
-
/**
* Creates a new object with the same keys, but with `callback()` called as
* a transformer function on each of the values.
@@ -323,21 +341,22 @@ function filterWithReference(collection, predicate) {
* @param {Function} callback The function to transform each object value.
* @return {Array} Transformed object.
*/
-const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({
- ...acc,
+
+
+const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({ ...acc,
[key]: callback(value)
}), {});
-
/**
* Verifies whether the given annotations is a valid annotation.
*
* @param {Object} annotation The annotation to verify.
* @return {boolean} Whether the given annotation is valid.
*/
+
+
function isValidAnnotationRange(annotation) {
return typeof annotation.start === 'number' && typeof annotation.end === 'number' && annotation.start <= annotation.end;
}
-
/**
* Reducer managing annotations.
*
@@ -346,8 +365,11 @@ function isValidAnnotationRange(annotation) {
*
* @return {Array} Updated state.
*/
+
+
function annotations(state = {}, action) {
var _state$blockClientId;
+
switch (action.type) {
case 'ANNOTATION_ADD':
const blockClientId = action.blockClientId;
@@ -359,38 +381,42 @@ function annotations(state = {}, action) {
selector: action.selector,
range: action.range
};
+
if (newAnnotation.selector === 'range' && !isValidAnnotationRange(newAnnotation.range)) {
return state;
}
+
const previousAnnotationsForBlock = (_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : [];
- return {
- ...state,
+ return { ...state,
[blockClientId]: [...previousAnnotationsForBlock, newAnnotation]
};
+
case 'ANNOTATION_REMOVE':
return mapValues(state, annotationsForBlock => {
return filterWithReference(annotationsForBlock, annotation => {
return annotation.id !== action.annotationId;
});
});
+
case 'ANNOTATION_UPDATE_RANGE':
return mapValues(state, annotationsForBlock => {
let hasChangedRange = false;
const newAnnotations = annotationsForBlock.map(annotation => {
if (annotation.id === action.annotationId) {
hasChangedRange = true;
- return {
- ...annotation,
+ return { ...annotation,
range: {
start: action.start,
end: action.end
}
};
}
+
return annotation;
});
return hasChangedRange ? newAnnotations : annotationsForBlock;
});
+
case 'ANNOTATION_REMOVE_SOURCE':
return mapValues(state, annotationsForBlock => {
return filterWithReference(annotationsForBlock, annotation => {
@@ -398,6 +424,7 @@ function annotations(state = {}, action) {
});
});
}
+
return state;
}
/* harmony default export */ var reducer = (annotations);
@@ -705,7 +732,6 @@ function isShallowEqual(a, b, fromIndex) {
* External dependencies
*/
-
/**
* Shared reference to an empty array for cases where it is important to avoid
* returning a new array reference on every invocation, as in a connected or
@@ -715,8 +741,8 @@ function isShallowEqual(a, b, fromIndex) {
*
* @type {Array}
*/
-const EMPTY_ARRAY = [];
+const EMPTY_ARRAY = [];
/**
* Returns the annotations for a specific client ID.
*
@@ -725,20 +751,23 @@ const EMPTY_ARRAY = [];
*
* @return {Array} The annotations applicable to this block.
*/
+
const __experimentalGetAnnotationsForBlock = rememo((state, blockClientId) => {
var _state$blockClientId;
+
return ((_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => {
return annotation.selector === 'block';
});
}, (state, blockClientId) => {
var _state$blockClientId2;
+
return [(_state$blockClientId2 = state?.[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY];
});
function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
var _state$blockClientId3;
+
return (_state$blockClientId3 = state?.[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY;
}
-
/**
* Returns the annotations that apply to the given RichText instance.
*
@@ -751,8 +780,10 @@ function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
* @param {string} richTextIdentifier Unique identifier that identifies the given RichText.
* @return {Array} All the annotations relevant for the `RichText`.
*/
+
const __experimentalGetAnnotationsForRichText = rememo((state, blockClientId, richTextIdentifier) => {
var _state$blockClientId4;
+
return ((_state$blockClientId4 = state?.[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => {
return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier;
}).map(annotation => {
@@ -760,42 +791,38 @@ const __experimentalGetAnnotationsForRichText = rememo((state, blockClientId, ri
range,
...other
} = annotation;
- return {
- ...range,
+ return { ...range,
...other
};
});
}, (state, blockClientId) => {
var _state$blockClientId5;
+
return [(_state$blockClientId5 = state?.[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY];
});
-
/**
* Returns all annotations in the editor state.
*
* @param {Object} state Editor state.
* @return {Array} All annotations currently applied.
*/
+
function __experimentalGetAnnotations(state) {
return Object.values(state).flat();
}
-;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
-const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
-/* harmony default export */ var esm_browser_native = ({
- randomUUID
-});
-;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/rng.js
// Unique ID creation requires a high quality random # generator. In the browser we therefore
// require the crypto API and do not support built-in fallback to lower quality random number
// generators (like Math.random()).
-let getRandomValues;
-const rnds8 = new Uint8Array(16);
+var getRandomValues;
+var rnds8 = new Uint8Array(16);
function rng() {
// lazy load so that environments that need to polyfill have a chance to do so
if (!getRandomValues) {
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
+ // find the complete implementation of crypto (msCrypto) on IE11.
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
if (!getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
@@ -804,52 +831,54 @@ function rng() {
return getRandomValues(rnds8);
}
-;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/regex.js
+/* harmony default export */ var regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/validate.js
+
+
+function validate(uuid) {
+ return typeof uuid === 'string' && regex.test(uuid);
+}
+
+/* harmony default export */ var esm_browser_validate = (validate);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/stringify.js
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
-const byteToHex = [];
+var byteToHex = [];
-for (let i = 0; i < 256; ++i) {
- byteToHex.push((i + 0x100).toString(16).slice(1));
+for (var i = 0; i < 256; ++i) {
+ byteToHex.push((i + 0x100).toString(16).substr(1));
}
-function unsafeStringify(arr, offset = 0) {
+function stringify(arr) {
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
-}
-
-function stringify(arr, offset = 0) {
- const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
+ var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
- if (!validate(uuid)) {
+ if (!esm_browser_validate(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
-/* harmony default export */ var esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
-;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
-
+/* harmony default export */ var esm_browser_stringify = (stringify);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/v4.js
function v4(options, buf, offset) {
- if (esm_browser_native.randomUUID && !buf && !options) {
- return esm_browser_native.randomUUID();
- }
-
options = options || {};
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
@@ -857,14 +886,14 @@ function v4(options, buf, offset) {
if (buf) {
offset = offset || 0;
- for (let i = 0; i < 16; ++i) {
+ for (var i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
- return unsafeStringify(rnds);
+ return esm_browser_stringify(rnds);
}
/* harmony default export */ var esm_browser_v4 = (v4);
@@ -873,7 +902,6 @@ function v4(options, buf, offset) {
* External dependencies
*/
-
/**
* @typedef WPAnnotationRange
*
@@ -901,6 +929,7 @@ function v4(options, buf, offset) {
*
* @return {Object} Action object.
*/
+
function __experimentalAddAnnotation({
blockClientId,
richTextIdentifier = null,
@@ -917,12 +946,13 @@ function __experimentalAddAnnotation({
source,
selector
};
+
if (selector === 'range') {
action.range = range;
}
+
return action;
}
-
/**
* Removes an annotation with a specific ID.
*
@@ -930,13 +960,13 @@ function __experimentalAddAnnotation({
*
* @return {Object} Action object.
*/
+
function __experimentalRemoveAnnotation(annotationId) {
return {
type: 'ANNOTATION_REMOVE',
annotationId
};
}
-
/**
* Updates the range of an annotation.
*
@@ -946,6 +976,7 @@ function __experimentalRemoveAnnotation(annotationId) {
*
* @return {Object} Action object.
*/
+
function __experimentalUpdateAnnotationRange(annotationId, start, end) {
return {
type: 'ANNOTATION_UPDATE_RANGE',
@@ -954,7 +985,6 @@ function __experimentalUpdateAnnotationRange(annotationId, start, end) {
end
};
}
-
/**
* Removes all annotations of a specific source.
*
@@ -962,6 +992,7 @@ function __experimentalUpdateAnnotationRange(annotationId, start, end) {
*
* @return {Object} Action object.
*/
+
function __experimentalRemoveAnnotationsBySource(source) {
return {
type: 'ANNOTATION_REMOVE_SOURCE',
@@ -974,7 +1005,6 @@ function __experimentalRemoveAnnotationsBySource(source) {
* WordPress dependencies
*/
-
/**
* Internal dependencies
*/
@@ -994,6 +1024,7 @@ function __experimentalRemoveAnnotationsBySource(source) {
*
* @type {Object}
*/
+
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
reducer: reducer,
selectors: selectors_namespaceObject,
diff --git a/wp-includes/js/dist/annotations.min.js b/wp-includes/js/dist/annotations.min.js
index eb7088988..cad5180ac 100644
--- a/wp-includes/js/dist/annotations.min.js
+++ b/wp-includes/js/dist/annotations.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:function(){return G}});var n={};e.r(n),e.d(n,{__experimentalGetAllAnnotationsForBlock:function(){return N},__experimentalGetAnnotations:function(){return O},__experimentalGetAnnotationsForBlock:function(){return T},__experimentalGetAnnotationsForRichText:function(){return b}});var r={};e.r(r),e.d(r,{__experimentalAddAnnotation:function(){return S},__experimentalRemoveAnnotation:function(){return C},__experimentalRemoveAnnotationsBySource:function(){return F},__experimentalUpdateAnnotationRange:function(){return P}});var o=window.wp.richText,a=window.wp.i18n;const i="core/annotations",u="core/annotation",c="annotation-text-";const l={name:u,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit(){return null},__experimentalGetPropsForEditableTreePreparation(e,{richTextIdentifier:t,blockClientId:n}){return{annotations:e(i).__experimentalGetAnnotationsForRichText(n,t)}},__experimentalCreatePrepareEditableTree({annotations:e}){return(t,n)=>{if(0===e.length)return t;let r={formats:t,text:n};return r=function(e,t=[]){return t.forEach((t=>{let{start:n,end:r}=t;n>e.text.length&&(n=e.text.length),r>e.text.length&&(r=e.text.length);const a=c+t.source,i=c+t.id;e=(0,o.applyFormat)(e,{type:u,attributes:{className:a,id:i}},n,r)})),e}(r,e),r.formats}},__experimentalGetPropsForEditableTreeChangeHandler(e){return{removeAnnotation:e(i).__experimentalRemoveAnnotation,updateAnnotationRange:e(i).__experimentalUpdateAnnotationRange}},__experimentalCreateOnChangeEditableValue(e){return t=>{const n=function(e){const t={};return e.forEach(((e,n)=>{(e=(e=e||[]).filter((e=>e.type===u))).forEach((e=>{let{id:r}=e.attributes;r=r.replace(c,""),t.hasOwnProperty(r)||(t[r]={start:n}),t[r].end=n+1}))})),t}(t),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=e;!function(e,t,{removeAnnotation:n,updateAnnotationRange:r}){e.forEach((e=>{const o=t[e.id];if(!o)return void n(e.id);const{start:a,end:i}=e;a===o.start&&i===o.end||r(e.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}}},{name:s,...d}=l;(0,o.registerFormatType)(s,d);var p=window.wp.hooks,f=window.wp.data;function m(e,t){const n=e.filter(t);return e.length===n.length?e:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(e=>(0,f.withSelect)(((e,{clientId:t,className:n})=>({className:e(i).__experimentalGetAnnotationsForBlock(t).map((e=>"is-annotated-by-"+e.source)).concat(n).filter(Boolean).join(" ")})))(e)));const g=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:t(r)})),{});var h=function(e={},t){var n;switch(t.type){case"ANNOTATION_ADD":const r=t.blockClientId,o={id:t.id,blockClientId:r,richTextIdentifier:t.richTextIdentifier,source:t.source,selector:t.selector,range:t.range};if("range"===o.selector&&!function(e){return"number"==typeof e.start&&"number"==typeof e.end&&e.start<=e.end}(o.range))return e;const a=null!==(n=e?.[r])&&void 0!==n?n:[];return{...e,[r]:[...a,o]};case"ANNOTATION_REMOVE":return g(e,(e=>m(e,(e=>e.id!==t.annotationId))));case"ANNOTATION_UPDATE_RANGE":return g(e,(e=>{let n=!1;const r=e.map((e=>e.id===t.annotationId?(n=!0,{...e,range:{start:t.start,end:t.end}}):e));return n?r:e}));case"ANNOTATION_REMOVE_SOURCE":return g(e,(e=>m(e,(e=>e.source!==t.source))))}return e},_={};function v(e){return[e]}function A(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r{var n;return(null!==(n=e?.[t])&&void 0!==n?n:[]).filter((e=>"block"===e.selector))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function N(e,t){var n;return null!==(n=e?.[t])&&void 0!==n?n:x}const b=y(((e,t,n)=>{var r;return(null!==(r=e?.[t])&&void 0!==r?r:[]).filter((e=>"range"===e.selector&&n===e.richTextIdentifier)).map((e=>{const{range:t,...n}=e;return{...t,...n}}))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function O(e){return Object.values(e).flat()}var I={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let w;const E=new Uint8Array(16);function R(){if(!w&&(w="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!w))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w(E)}const U=[];for(let e=0;e<256;++e)U.push((e+256).toString(16).slice(1));function D(e,t=0){return U[e[t+0]]+U[e[t+1]]+U[e[t+2]]+U[e[t+3]]+"-"+U[e[t+4]]+U[e[t+5]]+"-"+U[e[t+6]]+U[e[t+7]]+"-"+U[e[t+8]]+U[e[t+9]]+"-"+U[e[t+10]]+U[e[t+11]]+U[e[t+12]]+U[e[t+13]]+U[e[t+14]]+U[e[t+15]]}var k=function(e,t,n){if(I.randomUUID&&!t&&!e)return I.randomUUID();const r=(e=e||{}).random||(e.rng||R)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return D(r)};function S({blockClientId:e,richTextIdentifier:t=null,range:n=null,selector:r="range",source:o="default",id:a=k()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:e,richTextIdentifier:t,source:o,selector:r};return"range"===r&&(i.range=n),i}function C(e){return{type:"ANNOTATION_REMOVE",annotationId:e}}function P(e,t,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:e,start:t,end:n}}function F(e){return{type:"ANNOTATION_REMOVE_SOURCE",source:e}}const G=(0,f.createReduxStore)(i,{reducer:h,selectors:n,actions:r});(0,f.register)(G),(window.wp=window.wp||{}).annotations=t}();
\ No newline at end of file
+!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:function(){return j}});var n={};e.r(n),e.d(n,{__experimentalGetAllAnnotationsForBlock:function(){return b},__experimentalGetAnnotations:function(){return O},__experimentalGetAnnotationsForBlock:function(){return T},__experimentalGetAnnotationsForRichText:function(){return N}});var r={};e.r(r),e.d(r,{__experimentalAddAnnotation:function(){return U},__experimentalRemoveAnnotation:function(){return F},__experimentalRemoveAnnotationsBySource:function(){return V},__experimentalUpdateAnnotationRange:function(){return G}});var o=window.wp.richText,a=window.wp.i18n;const i="core/annotations",u="core/annotation",l="annotation-text-";const c={name:u,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit(){return null},__experimentalGetPropsForEditableTreePreparation(e,{richTextIdentifier:t,blockClientId:n}){return{annotations:e(i).__experimentalGetAnnotationsForRichText(n,t)}},__experimentalCreatePrepareEditableTree({annotations:e}){return(t,n)=>{if(0===e.length)return t;let r={formats:t,text:n};return r=function(e,t=[]){return t.forEach((t=>{let{start:n,end:r}=t;n>e.text.length&&(n=e.text.length),r>e.text.length&&(r=e.text.length);const a=l+t.source,i=l+t.id;e=(0,o.applyFormat)(e,{type:u,attributes:{className:a,id:i}},n,r)})),e}(r,e),r.formats}},__experimentalGetPropsForEditableTreeChangeHandler(e){return{removeAnnotation:e(i).__experimentalRemoveAnnotation,updateAnnotationRange:e(i).__experimentalUpdateAnnotationRange}},__experimentalCreateOnChangeEditableValue(e){return t=>{const n=function(e){const t={};return e.forEach(((e,n)=>{(e=(e=e||[]).filter((e=>e.type===u))).forEach((e=>{let{id:r}=e.attributes;r=r.replace(l,""),t.hasOwnProperty(r)||(t[r]={start:n}),t[r].end=n+1}))})),t}(t),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=e;!function(e,t,{removeAnnotation:n,updateAnnotationRange:r}){e.forEach((e=>{const o=t[e.id];if(!o)return void n(e.id);const{start:a,end:i}=e;a===o.start&&i===o.end||r(e.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}}},{name:s,...d}=c;(0,o.registerFormatType)(s,d);var p=window.wp.hooks,f=window.wp.data;function m(e,t){const n=e.filter(t);return e.length===n.length?e:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(e=>(0,f.withSelect)(((e,{clientId:t,className:n})=>({className:e(i).__experimentalGetAnnotationsForBlock(t).map((e=>"is-annotated-by-"+e.source)).concat(n).filter(Boolean).join(" ")})))(e)));const g=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:t(r)})),{});var v=function(e={},t){var n;switch(t.type){case"ANNOTATION_ADD":const r=t.blockClientId,o={id:t.id,blockClientId:r,richTextIdentifier:t.richTextIdentifier,source:t.source,selector:t.selector,range:t.range};if("range"===o.selector&&!function(e){return"number"==typeof e.start&&"number"==typeof e.end&&e.start<=e.end}(o.range))return e;const a=null!==(n=e?.[r])&&void 0!==n?n:[];return{...e,[r]:[...a,o]};case"ANNOTATION_REMOVE":return g(e,(e=>m(e,(e=>e.id!==t.annotationId))));case"ANNOTATION_UPDATE_RANGE":return g(e,(e=>{let n=!1;const r=e.map((e=>e.id===t.annotationId?(n=!0,{...e,range:{start:t.start,end:t.end}}):e));return n?r:e}));case"ANNOTATION_REMOVE_SOURCE":return g(e,(e=>m(e,(e=>e.source!==t.source))))}return e},h={};function _(e){return[e]}function A(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r{var n;return(null!==(n=e?.[t])&&void 0!==n?n:[]).filter((e=>"block"===e.selector))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function b(e,t){var n;return null!==(n=e?.[t])&&void 0!==n?n:x}const N=y(((e,t,n)=>{var r;return(null!==(r=e?.[t])&&void 0!==r?r:[]).filter((e=>"range"===e.selector&&n===e.richTextIdentifier)).map((e=>{const{range:t,...n}=e;return{...t,...n}}))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function O(e){return Object.values(e).flat()}var w,I=new Uint8Array(16);function R(){if(!w&&!(w="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w(I)}var E=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var k=function(e){return"string"==typeof e&&E.test(e)},C=[],D=0;D<256;++D)C.push((D+256).toString(16).substr(1));var S=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(C[e[t+0]]+C[e[t+1]]+C[e[t+2]]+C[e[t+3]]+"-"+C[e[t+4]]+C[e[t+5]]+"-"+C[e[t+6]]+C[e[t+7]]+"-"+C[e[t+8]]+C[e[t+9]]+"-"+C[e[t+10]]+C[e[t+11]]+C[e[t+12]]+C[e[t+13]]+C[e[t+14]]+C[e[t+15]]).toLowerCase();if(!k(n))throw TypeError("Stringified UUID is invalid");return n};var P=function(e,t,n){var r=(e=e||{}).random||(e.rng||R)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return S(r)};function U({blockClientId:e,richTextIdentifier:t=null,range:n=null,selector:r="range",source:o="default",id:a=P()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:e,richTextIdentifier:t,source:o,selector:r};return"range"===r&&(i.range=n),i}function F(e){return{type:"ANNOTATION_REMOVE",annotationId:e}}function G(e,t,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:e,start:t,end:n}}function V(e){return{type:"ANNOTATION_REMOVE_SOURCE",source:e}}const j=(0,f.createReduxStore)(i,{reducer:v,selectors:n,actions:r});(0,f.register)(j),(window.wp=window.wp||{}).annotations=t}();
\ No newline at end of file
diff --git a/wp-includes/js/dist/api-fetch.js b/wp-includes/js/dist/api-fetch.js
index 9eb3e325a..e6848545f 100644
--- a/wp-includes/js/dist/api-fetch.js
+++ b/wp-includes/js/dist/api-fetch.js
@@ -43,26 +43,26 @@ function createNonceMiddleware(nonce) {
const middleware = (options, next) => {
const {
headers = {}
- } = options;
-
- // If an 'X-WP-Nonce' header (or any case-insensitive variation
+ } = options; // If an 'X-WP-Nonce' header (or any case-insensitive variation
// thereof) was specified, no need to add a nonce header.
+
for (const headerName in headers) {
if (headerName.toLowerCase() === 'x-wp-nonce' && headers[headerName] === middleware.nonce) {
return next(options);
}
}
- return next({
- ...options,
- headers: {
- ...headers,
+
+ return next({ ...options,
+ headers: { ...headers,
'X-WP-Nonce': middleware.nonce
}
});
};
+
middleware.nonce = nonce;
return middleware;
}
+
/* harmony default export */ var nonce = (createNonceMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js
@@ -72,22 +72,25 @@ function createNonceMiddleware(nonce) {
const namespaceAndEndpointMiddleware = (options, next) => {
let path = options.path;
let namespaceTrimmed, endpointTrimmed;
+
if (typeof options.namespace === 'string' && typeof options.endpoint === 'string') {
namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, '');
endpointTrimmed = options.endpoint.replace(/^\//, '');
+
if (endpointTrimmed) {
path = namespaceTrimmed + '/' + endpointTrimmed;
} else {
path = namespaceTrimmed;
}
}
+
delete options.namespace;
delete options.endpoint;
- return next({
- ...options,
+ return next({ ...options,
path
});
};
+
/* harmony default export */ var namespace_endpoint = (namespaceAndEndpointMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js
@@ -95,36 +98,40 @@ const namespaceAndEndpointMiddleware = (options, next) => {
* Internal dependencies
*/
-
/**
* @param {string} rootURL
* @return {import('../types').APIFetchMiddleware} Root URL middleware.
*/
+
const createRootURLMiddleware = rootURL => (options, next) => {
return namespace_endpoint(options, optionsWithPath => {
let url = optionsWithPath.url;
let path = optionsWithPath.path;
let apiRoot;
+
if (typeof path === 'string') {
apiRoot = rootURL;
+
if (-1 !== rootURL.indexOf('?')) {
path = path.replace('?', '&');
}
- path = path.replace(/^\//, '');
- // API root may already include query parameter prefix if site is
+ path = path.replace(/^\//, ''); // API root may already include query parameter prefix if site is
// configured to use plain permalinks.
+
if ('string' === typeof apiRoot && -1 !== apiRoot.indexOf('?')) {
path = path.replace('?', '&');
}
+
url = apiRoot + path;
}
- return next({
- ...optionsWithPath,
+
+ return next({ ...optionsWithPath,
url
});
});
};
+
/* harmony default export */ var root_url = (createRootURLMiddleware);
;// CONCATENATED MODULE: external ["wp","url"]
@@ -134,11 +141,11 @@ var external_wp_url_namespaceObject = window["wp"]["url"];
* WordPress dependencies
*/
-
/**
* @param {Record} preloadedData
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
*/
+
function createPreloadingMiddleware(preloadedData) {
const cache = Object.fromEntries(Object.entries(preloadedData).map(([path, data]) => [(0,external_wp_url_namespaceObject.normalizePath)(path), data]));
return (options, next) => {
@@ -146,38 +153,42 @@ function createPreloadingMiddleware(preloadedData) {
parse = true
} = options;
/** @type {string | void} */
+
let rawPath = options.path;
+
if (!rawPath && options.url) {
const {
rest_route: pathFromQuery,
...queryArgs
} = (0,external_wp_url_namespaceObject.getQueryArgs)(options.url);
+
if (typeof pathFromQuery === 'string') {
rawPath = (0,external_wp_url_namespaceObject.addQueryArgs)(pathFromQuery, queryArgs);
}
}
+
if (typeof rawPath !== 'string') {
return next(options);
}
+
const method = options.method || 'GET';
const path = (0,external_wp_url_namespaceObject.normalizePath)(rawPath);
+
if ('GET' === method && cache[path]) {
- const cacheData = cache[path];
+ const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time.
- // Unsetting the cache key ensures that the data is only used a single time.
delete cache[path];
return prepareResponse(cacheData, !!parse);
} else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
- const cacheData = cache[method][path];
+ const cacheData = cache[method][path]; // Unsetting the cache key ensures that the data is only used a single time.
- // Unsetting the cache key ensures that the data is only used a single time.
delete cache[method][path];
return prepareResponse(cacheData, !!parse);
}
+
return next(options);
};
}
-
/**
* This is a helper function that sends a success response.
*
@@ -185,6 +196,8 @@ function createPreloadingMiddleware(preloadedData) {
* @param {boolean} parse
* @return {Promise} Promise with the response.
*/
+
+
function prepareResponse(responseData, parse) {
return Promise.resolve(parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), {
status: 200,
@@ -192,6 +205,7 @@ function prepareResponse(responseData, parse) {
headers: responseData.headers
}));
}
+
/* harmony default export */ var preloading = (createPreloadingMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/fetch-all-middleware.js
@@ -199,7 +213,6 @@ function prepareResponse(responseData, parse) {
* WordPress dependencies
*/
-
/**
* Internal dependencies
*/
@@ -212,59 +225,63 @@ function prepareResponse(responseData, parse) {
* @param {Record} queryArgs
* @return {import('../types').APIFetchOptions} The request with the modified query args
*/
+
const modifyQuery = ({
path,
url,
...options
-}, queryArgs) => ({
- ...options,
+}, queryArgs) => ({ ...options,
url: url && (0,external_wp_url_namespaceObject.addQueryArgs)(url, queryArgs),
path: path && (0,external_wp_url_namespaceObject.addQueryArgs)(path, queryArgs)
});
-
/**
* Duplicates parsing functionality from apiFetch.
*
* @param {Response} response
* @return {Promise} Parsed response json.
*/
-const parseResponse = response => response.json ? response.json() : Promise.reject(response);
+
+const parseResponse = response => response.json ? response.json() : Promise.reject(response);
/**
* @param {string | null} linkHeader
* @return {{ next?: string }} The parsed link header.
*/
+
+
const parseLinkHeader = linkHeader => {
if (!linkHeader) {
return {};
}
+
const match = linkHeader.match(/<([^>]+)>; rel="next"/);
return match ? {
next: match[1]
} : {};
};
-
/**
* @param {Response} response
* @return {string | undefined} The next page URL.
*/
+
+
const getNextPageUrl = response => {
const {
next
} = parseLinkHeader(response.headers.get('link'));
return next;
};
-
/**
* @param {import('../types').APIFetchOptions} options
* @return {boolean} True if the request contains an unbounded query.
*/
+
+
const requestContainsUnboundedQuery = options => {
const pathIsUnbounded = !!options.path && options.path.indexOf('per_page=-1') !== -1;
const urlIsUnbounded = !!options.url && options.url.indexOf('per_page=-1') !== -1;
return pathIsUnbounded || urlIsUnbounded;
};
-
/**
* The REST API enforces an upper limit on the per_page option. To handle large
* collections, apiFetch consumers can pass `per_page=-1`; this middleware will
@@ -272,40 +289,47 @@ const requestContainsUnboundedQuery = options => {
*
* @type {import('../types').APIFetchMiddleware}
*/
+
+
const fetchAllMiddleware = async (options, next) => {
if (options.parse === false) {
// If a consumer has opted out of parsing, do not apply middleware.
return next(options);
}
+
if (!requestContainsUnboundedQuery(options)) {
// If neither url nor path is requesting all items, do not apply middleware.
return next(options);
- }
+ } // Retrieve requested page of results.
+
- // Retrieve requested page of results.
- const response = await build_module({
- ...modifyQuery(options, {
+ const response = await build_module({ ...modifyQuery(options, {
per_page: 100
}),
// Ensure headers are returned for page 1.
parse: false
});
const results = await parseResponse(response);
+
if (!Array.isArray(results)) {
// We have no reliable way of merging non-array results.
return results;
}
+
let nextPage = getNextPageUrl(response);
+
if (!nextPage) {
// There are no further pages to request.
return results;
- }
+ } // Iteratively fetch all remaining pages until no "next" header is found.
+
+
+ let mergedResults =
+ /** @type {any[]} */
+ [].concat(results);
- // Iteratively fetch all remaining pages until no "next" header is found.
- let mergedResults = /** @type {any[]} */[].concat(results);
while (nextPage) {
- const nextResponse = await build_module({
- ...options,
+ const nextResponse = await build_module({ ...options,
// Ensure the URL for the next page is used instead of any provided path.
path: undefined,
url: nextPage,
@@ -316,8 +340,10 @@ const fetchAllMiddleware = async (options, next) => {
mergedResults = mergedResults.concat(nextResults);
nextPage = getNextPageUrl(nextResponse);
}
+
return mergedResults;
};
+
/* harmony default export */ var fetch_all_middleware = (fetchAllMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js
@@ -327,7 +353,6 @@ const fetchAllMiddleware = async (options, next) => {
* @type {Set}
*/
const OVERRIDE_METHODS = new Set(['PATCH', 'PUT', 'DELETE']);
-
/**
* Default request method.
*
@@ -338,31 +363,33 @@ const OVERRIDE_METHODS = new Set(['PATCH', 'PUT', 'DELETE']);
*
* @type {string}
*/
-const DEFAULT_METHOD = 'GET';
+const DEFAULT_METHOD = 'GET';
/**
* API Fetch middleware which overrides the request method for HTTP v1
* compatibility leveraging the REST API X-HTTP-Method-Override header.
*
* @type {import('../types').APIFetchMiddleware}
*/
+
const httpV1Middleware = (options, next) => {
const {
method = DEFAULT_METHOD
} = options;
+
if (OVERRIDE_METHODS.has(method.toUpperCase())) {
- options = {
- ...options,
- headers: {
- ...options.headers,
+ options = { ...options,
+ headers: { ...options.headers,
'X-HTTP-Method-Override': method,
'Content-Type': 'application/json'
},
method: 'POST'
};
}
+
return next(options);
};
+
/* harmony default export */ var http_v1 = (httpV1Middleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/user-locale.js
@@ -370,23 +397,26 @@ const httpV1Middleware = (options, next) => {
* WordPress dependencies
*/
-
/**
* @type {import('../types').APIFetchMiddleware}
*/
+
const userLocaleMiddleware = (options, next) => {
if (typeof options.url === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.url, '_locale')) {
options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, {
_locale: 'user'
});
}
+
if (typeof options.path === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.path, '_locale')) {
options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, {
_locale: 'user'
});
}
+
return next(options);
};
+
/* harmony default export */ var user_locale = (userLocaleMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/utils/response.js
@@ -394,7 +424,6 @@ const userLocaleMiddleware = (options, next) => {
* WordPress dependencies
*/
-
/**
* Parses the apiFetch response.
*
@@ -403,16 +432,18 @@ const userLocaleMiddleware = (options, next) => {
*
* @return {Promise | null | Response} Parsed response.
*/
+
const response_parseResponse = (response, shouldParseResponse = true) => {
if (shouldParseResponse) {
if (response.status === 204) {
return null;
}
+
return response.json ? response.json() : Promise.reject(response);
}
+
return response;
};
-
/**
* Calls the `json` function on the Response, throwing an error if the response
* doesn't have a json function or if parsing the json itself fails.
@@ -420,19 +451,22 @@ const response_parseResponse = (response, shouldParseResponse = true) => {
* @param {Response} response
* @return {Promise} Parsed response.
*/
+
+
const parseJsonAndNormalizeError = response => {
const invalidJsonError = {
code: 'invalid_json',
message: (0,external_wp_i18n_namespaceObject.__)('The response is not a valid JSON response.')
};
+
if (!response || !response.json) {
throw invalidJsonError;
}
+
return response.json().catch(() => {
throw invalidJsonError;
});
};
-
/**
* Parses the apiFetch response properly and normalize response errors.
*
@@ -441,10 +475,11 @@ const parseJsonAndNormalizeError = response => {
*
* @return {Promise} Parsed response.
*/
+
+
const parseResponseAndNormalizeError = (response, shouldParseResponse = true) => {
return Promise.resolve(response_parseResponse(response, shouldParseResponse)).catch(res => parseAndThrowError(res, shouldParseResponse));
};
-
/**
* Parses a response, throwing an error if parsing the response fails.
*
@@ -452,10 +487,12 @@ const parseResponseAndNormalizeError = (response, shouldParseResponse = true) =>
* @param {boolean} shouldParseResponse
* @return {Promise} Parsed response.
*/
+
function parseAndThrowError(response, shouldParseResponse = true) {
if (!shouldParseResponse) {
throw response;
}
+
return parseJsonAndNormalizeError(response).then(error => {
const unknownError = {
code: 'unknown_error',
@@ -470,7 +507,6 @@ function parseAndThrowError(response, shouldParseResponse = true) {
* WordPress dependencies
*/
-
/**
* Internal dependencies
*/
@@ -480,28 +516,31 @@ function parseAndThrowError(response, shouldParseResponse = true) {
* @param {import('../types').APIFetchOptions} options
* @return {boolean} True if the request is for media upload.
*/
+
function isMediaUploadRequest(options) {
const isCreateMethod = !!options.method && options.method === 'POST';
const isMediaEndpoint = !!options.path && options.path.indexOf('/wp/v2/media') !== -1 || !!options.url && options.url.indexOf('/wp/v2/media') !== -1;
return isMediaEndpoint && isCreateMethod;
}
-
/**
* Middleware handling media upload failures and retries.
*
* @type {import('../types').APIFetchMiddleware}
*/
+
+
const mediaUploadMiddleware = (options, next) => {
if (!isMediaUploadRequest(options)) {
return next(options);
}
+
let retries = 0;
const maxRetries = 5;
-
/**
* @param {string} attachmentId
* @return {Promise} Processed post response.
*/
+
const postProcess = attachmentId => {
retries++;
return next({
@@ -515,6 +554,7 @@ const mediaUploadMiddleware = (options, next) => {
if (retries < maxRetries) {
return postProcess(attachmentId);
}
+
next({
path: `/wp/v2/media/${attachmentId}?force=true`,
method: 'DELETE'
@@ -522,11 +562,12 @@ const mediaUploadMiddleware = (options, next) => {
return Promise.reject();
});
};
- return next({
- ...options,
+
+ return next({ ...options,
parse: false
}).catch(response => {
const attachmentId = response.headers.get('x-wp-upload-attachment-id');
+
if (response.status >= 500 && response.status < 600 && attachmentId) {
return postProcess(attachmentId).catch(() => {
if (options.parse !== false) {
@@ -535,12 +576,15 @@ const mediaUploadMiddleware = (options, next) => {
message: (0,external_wp_i18n_namespaceObject.__)('Media upload failed. If this is a photo or a large image, please scale it down and try again.')
});
}
+
return Promise.reject(response);
});
}
+
return parseAndThrowError(response, options.parse);
}).then(response => parseResponseAndNormalizeError(response, options.parse));
};
+
/* harmony default export */ var media_upload = (mediaUploadMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/theme-preview.js
@@ -548,7 +592,6 @@ const mediaUploadMiddleware = (options, next) => {
* WordPress dependencies
*/
-
/**
* This appends a `wp_theme_preview` parameter to the REST API request URL if
* the admin URL contains a `theme` GET parameter.
@@ -556,19 +599,23 @@ const mediaUploadMiddleware = (options, next) => {
* @param {Record} themePath
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
*/
+
const createThemePreviewMiddleware = themePath => (options, next) => {
if (typeof options.url === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.url, 'wp_theme_preview')) {
options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, {
wp_theme_preview: themePath
});
}
+
if (typeof options.path === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.path, 'wp_theme_preview')) {
options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, {
wp_theme_preview: themePath
});
}
+
return next(options);
};
+
/* harmony default export */ var theme_preview = (createThemePreviewMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/index.js
@@ -576,7 +623,6 @@ const createThemePreviewMiddleware = themePath => (options, next) => {
* WordPress dependencies
*/
-
/**
* Internal dependencies
*/
@@ -597,6 +643,7 @@ const createThemePreviewMiddleware = themePath => (options, next) => {
*
* @type {Record}
*/
+
const DEFAULT_HEADERS = {
// The backend uses the Accept header as a condition for considering an
// incoming request as a REST request.
@@ -604,34 +651,34 @@ const DEFAULT_HEADERS = {
// See: https://core.trac.wordpress.org/ticket/44534
Accept: 'application/json, */*;q=0.1'
};
-
/**
* Default set of fetch option values which should be sent with every request
* unless explicitly provided through apiFetch options.
*
* @type {Object}
*/
+
const DEFAULT_OPTIONS = {
credentials: 'include'
};
-
/** @typedef {import('./types').APIFetchMiddleware} APIFetchMiddleware */
+
/** @typedef {import('./types').APIFetchOptions} APIFetchOptions */
/**
* @type {import('./types').APIFetchMiddleware[]}
*/
-const middlewares = [user_locale, namespace_endpoint, http_v1, fetch_all_middleware];
+const middlewares = [user_locale, namespace_endpoint, http_v1, fetch_all_middleware];
/**
* Register a middleware
*
* @param {import('./types').APIFetchMiddleware} middleware
*/
+
function registerMiddleware(middleware) {
middlewares.unshift(middleware);
}
-
/**
* Checks the status of a response, throwing the Response as an error if
* it is outside the 200 range.
@@ -639,18 +686,22 @@ function registerMiddleware(middleware) {
* @param {Response} response
* @return {Response} The response if the status is in the 200 range.
*/
+
+
const checkStatus = response => {
if (response.status >= 200 && response.status < 300) {
return response;
}
+
throw response;
};
-
/** @typedef {(options: import('./types').APIFetchOptions) => Promise} FetchHandler*/
/**
* @type {FetchHandler}
*/
+
+
const defaultFetchHandler = nextOptions => {
const {
url,
@@ -662,23 +713,19 @@ const defaultFetchHandler = nextOptions => {
let {
body,
headers
- } = nextOptions;
+ } = nextOptions; // Merge explicitly-provided headers with default values.
- // Merge explicitly-provided headers with default values.
- headers = {
- ...DEFAULT_HEADERS,
+ headers = { ...DEFAULT_HEADERS,
...headers
- };
+ }; // The `data` property is a shorthand for sending a JSON body.
- // The `data` property is a shorthand for sending a JSON body.
if (data) {
body = JSON.stringify(data);
headers['Content-Type'] = 'application/json';
}
- const responsePromise = window.fetch(
- // Fall back to explicitly passing `window.location` which is the behavior if `undefined` is passed.
- url || path || window.location.href, {
- ...DEFAULT_OPTIONS,
+
+ const responsePromise = window.fetch( // Fall back to explicitly passing `window.location` which is the behavior if `undefined` is passed.
+ url || path || window.location.href, { ...DEFAULT_OPTIONS,
...remainingOptions,
body,
headers
@@ -687,52 +734,55 @@ const defaultFetchHandler = nextOptions => {
// Re-throw AbortError for the users to handle it themselves.
if (err && err.name === 'AbortError') {
throw err;
- }
-
- // Otherwise, there is most likely no network connection.
+ } // Otherwise, there is most likely no network connection.
// Unfortunately the message might depend on the browser.
+
+
throw {
code: 'fetch_error',
message: (0,external_wp_i18n_namespaceObject.__)('You are probably offline.')
};
});
};
-
/** @type {FetchHandler} */
-let fetchHandler = defaultFetchHandler;
+
+let fetchHandler = defaultFetchHandler;
/**
* Defines a custom fetch handler for making the requests that will override
* the default one using window.fetch
*
* @param {FetchHandler} newFetchHandler The new fetch handler
*/
+
function setFetchHandler(newFetchHandler) {
fetchHandler = newFetchHandler;
}
-
/**
* @template T
* @param {import('./types').APIFetchOptions} options
* @return {Promise} A promise representing the request processed via the registered middlewares.
*/
+
+
function apiFetch(options) {
// creates a nested function chain that calls all middlewares and finally the `fetchHandler`,
// converting `middlewares = [ m1, m2, m3 ]` into:
// ```
// opts1 => m1( opts1, opts2 => m2( opts2, opts3 => m3( opts3, fetchHandler ) ) );
// ```
- const enhancedHandler = middlewares.reduceRight(( /** @type {FetchHandler} */next, middleware) => {
+ const enhancedHandler = middlewares.reduceRight((
+ /** @type {FetchHandler} */
+ next, middleware) => {
return workingOptions => middleware(workingOptions, next);
}, fetchHandler);
return enhancedHandler(options).catch(error => {
if (error.code !== 'rest_cookie_invalid_nonce') {
return Promise.reject(error);
- }
+ } // If the nonce is invalid, refresh it and try again.
- // If the nonce is invalid, refresh it and try again.
- return window
- // @ts-ignore
+
+ return window // @ts-ignore
.fetch(apiFetch.nonceEndpoint).then(checkStatus).then(data => data.text()).then(text => {
// @ts-ignore
apiFetch.nonceMiddleware.nonce = text;
@@ -740,6 +790,7 @@ function apiFetch(options) {
});
});
}
+
apiFetch.use = registerMiddleware;
apiFetch.setFetchHandler = setFetchHandler;
apiFetch.createNonceMiddleware = nonce;
diff --git a/wp-includes/js/dist/autop.js b/wp-includes/js/dist/autop.js
index e855bce61..26c0cc517 100644
--- a/wp-includes/js/dist/autop.js
+++ b/wp-includes/js/dist/autop.js
@@ -36,8 +36,8 @@
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ autop: function() { return /* binding */ autop; },
-/* harmony export */ removep: function() { return /* binding */ removep; }
+/* harmony export */ "autop": function() { return /* binding */ autop; },
+/* harmony export */ "removep": function() { return /* binding */ removep; }
/* harmony export */ });
/**
* The regular expression for an HTML element.
@@ -46,54 +46,34 @@ __webpack_require__.r(__webpack_exports__);
*/
const htmlSplitRegex = (() => {
/* eslint-disable no-multi-spaces */
- const comments = '!' +
- // Start of comment, after the <.
- '(?:' +
- // Unroll the loop: Consume everything until --> is found.
- '-(?!->)' +
- // Dash not followed by end of comment.
- '[^\\-]*' +
- // Consume non-dashes.
- ')*' +
- // Loop possessively.
+ const comments = '!' + // Start of comment, after the <.
+ '(?:' + // Unroll the loop: Consume everything until --> is found.
+ '-(?!->)' + // Dash not followed by end of comment.
+ '[^\\-]*' + // Consume non-dashes.
+ ')*' + // Loop possessively.
'(?:-->)?'; // End of comment. If not found, match all input.
- const cdata = '!\\[CDATA\\[' +
- // Start of comment, after the <.
- '[^\\]]*' +
- // Consume non-].
- '(?:' +
- // Unroll the loop: Consume everything until ]]> is found.
- '](?!]>)' +
- // One ] not followed by end of comment.
- '[^\\]]*' +
- // Consume non-].
- ')*?' +
- // Loop possessively.
+ const cdata = '!\\[CDATA\\[' + // Start of comment, after the <.
+ '[^\\]]*' + // Consume non-].
+ '(?:' + // Unroll the loop: Consume everything until ]]> is found.
+ '](?!]>)' + // One ] not followed by end of comment.
+ '[^\\]]*' + // Consume non-].
+ ')*?' + // Loop possessively.
'(?:]]>)?'; // End of comment. If not found, match all input.
- const escaped = '(?=' +
- // Is the element escaped?
- '!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' +
- // If yes, which type?
+ const escaped = '(?=' + // Is the element escaped?
+ '!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' + // If yes, which type?
comments + '|' + cdata + ')';
- const regex = '(' +
- // Capture the entire match.
- '<' +
- // Find start of element.
- '(' +
- // Conditional expression follows.
- escaped +
- // Find end of escaped element.
- '|' +
- // ... else ...
- '[^>]*>?' +
- // Find end of normal element.
+ const regex = '(' + // Capture the entire match.
+ '<' + // Find start of element.
+ '(' + // Conditional expression follows.
+ escaped + // Find end of escaped element.
+ '|' + // ... else ...
+ '[^>]*>?' + // Find end of normal element.
')' + ')';
return new RegExp(regex);
/* eslint-enable no-multi-spaces */
})();
-
/**
* Separate HTML elements and comments from the text.
*
@@ -101,26 +81,32 @@ const htmlSplitRegex = (() => {
*
* @return {string[]} The formatted text.
*/
+
+
function htmlSplit(input) {
const parts = [];
let workingInput = input;
let match;
+
while (match = workingInput.match(htmlSplitRegex)) {
// The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`.
// If the `g` flag is omitted, `index` is included.
// `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number.
// Assert `match.index` is a number.
- const index = /** @type {number} */match.index;
+ const index =
+ /** @type {number} */
+ match.index;
parts.push(workingInput.slice(0, index));
parts.push(match[0]);
workingInput = workingInput.slice(index + match[0].length);
}
+
if (workingInput.length) {
parts.push(workingInput);
}
+
return parts;
}
-
/**
* Replace characters or phrases within HTML elements only.
*
@@ -129,32 +115,34 @@ function htmlSplit(input) {
*
* @return {string} The formatted text.
*/
+
+
function replaceInHtmlTags(haystack, replacePairs) {
// Find all elements.
const textArr = htmlSplit(haystack);
- let changed = false;
+ let changed = false; // Extract all needles.
- // Extract all needles.
- const needles = Object.keys(replacePairs);
+ const needles = Object.keys(replacePairs); // Loop through delimiters (elements) only.
- // Loop through delimiters (elements) only.
for (let i = 1; i < textArr.length; i += 2) {
for (let j = 0; j < needles.length; j++) {
const needle = needles[j];
+
if (-1 !== textArr[i].indexOf(needle)) {
textArr[i] = textArr[i].replace(new RegExp(needle, 'g'), replacePairs[needle]);
- changed = true;
- // After one strtr() break out of the foreach loop and look at next element.
+ changed = true; // After one strtr() break out of the foreach loop and look at next element.
+
break;
}
}
}
+
if (changed) {
haystack = textArr.join('');
}
+
return haystack;
}
-
/**
* Replaces double line-breaks with paragraph elements.
*
@@ -174,159 +162,145 @@ function replaceInHtmlTags(haystack, replacePairs) {
*
* @return {string} Text which has been converted into paragraph tags.
*/
+
+
function autop(text, br = true) {
const preTags = [];
+
if (text.trim() === '') {
return '';
- }
+ } // Just to make things a little easier, pad the end.
- // Just to make things a little easier, pad the end.
- text = text + '\n';
+ text = text + '\n';
/*
* Pre tags shouldn't be touched by autop.
* Replace pre tags with placeholders and bring them back after autop.
*/
+
if (text.indexOf('
');
const lastText = textParts.pop();
text = '';
+
for (let i = 0; i < textParts.length; i++) {
const textPart = textParts[i];
- const start = textPart.indexOf('';
preTags.push([name, textPart.substr(start) + '
']);
text += textPart.substr(0, start) + name;
}
+
text += lastText;
- }
- // Change multiple s into two line breaks, which will turn into paragraphs.
+ } // Change multiple s into two line breaks, which will turn into paragraphs.
+
+
text = text.replace(/ \s* /g, '\n\n');
- const allBlocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
+ const allBlocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; // Add a double line break above block-level opening tags.
- // Add a double line break above block-level opening tags.
- text = text.replace(new RegExp('(<' + allBlocks + '[\\s/>])', 'g'), '\n\n$1');
+ text = text.replace(new RegExp('(<' + allBlocks + '[\\s/>])', 'g'), '\n\n$1'); // Add a double line break below block-level closing tags.
- // Add a double line break below block-level closing tags.
- text = text.replace(new RegExp('(' + allBlocks + '>)', 'g'), '$1\n\n');
+ text = text.replace(new RegExp('(' + allBlocks + '>)', 'g'), '$1\n\n'); // Standardize newline characters to "\n".
- // Standardize newline characters to "\n".
- text = text.replace(/\r\n|\r/g, '\n');
+ text = text.replace(/\r\n|\r/g, '\n'); // Find newlines in all elements and add placeholders.
- // Find newlines in all elements and add placeholders.
text = replaceInHtmlTags(text, {
'\n': ' '
- });
+ }); // Collapse line breaks before and after ');
}
-
/*
* Collapse line breaks inside ') !== -1) {
text = text.replace(/(');
text = text.replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g, '$1');
}
-
/*
* Collapse line breaks inside