diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php index 6e353943b0..2e651d3f28 100644 --- a/wp-admin/edit-form-blocks.php +++ b/wp-admin/edit-form-blocks.php @@ -48,6 +48,7 @@ $preload_paths = array( sprintf( '/wp/v2/types/%s?context=edit', $post_type ), sprintf( '/wp/v2/users/me?post_type=%s&context=edit', $post_type ), array( '/wp/v2/media', 'OPTIONS' ), + array( '/wp/v2/blocks', 'OPTIONS' ), ); /** diff --git a/wp-includes/blocks/latest-comments.php b/wp-includes/blocks/latest-comments.php index fcc17c3cd6..26a8f4d636 100644 --- a/wp-includes/blocks/latest-comments.php +++ b/wp-includes/blocks/latest-comments.php @@ -117,6 +117,9 @@ function render_block_core_latest_comments( $attributes = array() ) { } $class = 'wp-block-latest-comments'; + if ( ! empty( $attributes['className'] ) ) { + $class .= ' ' . $attributes['className']; + } if ( isset( $attributes['align'] ) ) { $class .= " align{$attributes['align']}"; } diff --git a/wp-includes/blocks/latest-posts.php b/wp-includes/blocks/latest-posts.php index 18a43e5182..888f99c887 100644 --- a/wp-includes/blocks/latest-posts.php +++ b/wp-includes/blocks/latest-posts.php @@ -14,38 +14,37 @@ */ function render_block_core_latest_posts( $attributes ) { $args = array( - 'numberposts' => $attributes['postsToShow'], - 'post_status' => 'publish', - 'order' => $attributes['order'], - 'orderby' => $attributes['orderBy'], + 'posts_per_page' => $attributes['postsToShow'], + 'post_status' => 'publish', + 'order' => $attributes['order'], + 'orderby' => $attributes['orderBy'], + 'suppress_filters' => false, ); if ( isset( $attributes['categories'] ) ) { $args['category'] = $attributes['categories']; } - $recent_posts = wp_get_recent_posts( $args ); + $recent_posts = get_posts( $args ); $list_items_markup = ''; foreach ( $recent_posts as $post ) { - $post_id = $post['ID']; - - $title = get_the_title( $post_id ); + $title = get_the_title( $post ); if ( ! $title ) { $title = __( '(Untitled)' ); } $list_items_markup .= sprintf( '
([^<]+)<\/(div|address|form)>/g, '
$1
$2>'); // If an opening or closing block element tag is wrapped in a, unwrap it. - text = text.replace(new RegExp('
\s*(<\/?' + allBlocks + '[^>]*>)\s*<\/p>', 'g'), '$1'); // In some cases
, fix them. + text = text.replace(new RegExp('
\\s*(<\/?' + allBlocks + '[^>]*>)\\s*<\/p>', 'g'), '$1'); // In some cases
, fix them. text = text.replace(/
(
is wrapped with a, move it inside the
. text = text.replace(/]*)>/gi, ''); // If an opening or closing block element tag is preceded by an opening'); text = text.replace(/<\/blockquote><\/p>/g, '
tag, remove it. - text = text.replace(new RegExp('
\s*(<\/?' + allBlocks + '[^>]*>)', 'g'), '$1'); // If an opening or closing block element tag is followed by a closing
tag, remove it. + text = text.replace(new RegExp('
\\s*(<\/?' + allBlocks + '[^>]*>)', 'g'), '$1'); // If an opening or closing block element tag is followed by a closing
tag, remove it. - text = text.replace(new RegExp('(<\/?' + allBlocks + '[^>]*>)\s*<\/p>', 'g'), '$1'); // Optionally insert line breaks. + text = text.replace(new RegExp('(<\/?' + allBlocks + '[^>]*>)\\s*<\/p>', 'g'), '$1'); // Optionally insert line breaks. if (br) { // Replace newlines that shouldn't be touched with a placeholder. @@ -332,7 +332,7 @@ function autop(text) { } // If a
'); // Replace placeholder
tag is after an opening or closing block tag, remove it. - text = text.replace(new RegExp('(<\/?' + allBlocks + '[^>]*>)\s*
', 'g'), '$1'); // If a
tag is before a subset of opening or closing block tags, remove it. + text = text.replace(new RegExp('(<\/?' + allBlocks + '[^>]*>)\\s*
', 'g'), '$1'); // If a
tag is before a subset of opening or closing block tags, remove it. text = text.replace(/
(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g, '$1'); text = text.replace(/\n<\/p>$/g, 'tags with their original content. @@ -352,10 +352,10 @@ function autop(text) { return text; } /** - * Replacestags with two line breaks. "Opposite" of autop(). + * Replaces `
` tags with two line breaks. "Opposite" of autop(). * - * Replaces
tags with two line breaks except where the
has attributes. - * Unifies whitespace. Indents
, and for better readability. + * Replaces ` ` tags with two line breaks except where the `
` has attributes. + * Unifies whitespace. Indents `
`, ` ` and ` ` for better readability. * * @param {string} html The content from the editor. * @return {string} The content with stripped paragraph tags. @@ -483,7 +483,7 @@ function removep(html) { "use strict"; // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js -var arrayWithHoles = __webpack_require__(35); +var arrayWithHoles = __webpack_require__(34); // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js function _iterableToArrayLimit(arr, i) { @@ -512,7 +512,7 @@ function _iterableToArrayLimit(arr, i) { return _arr; } // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js -var nonIterableRest = __webpack_require__(36); +var nonIterableRest = __webpack_require__(35); // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; }); @@ -525,7 +525,7 @@ function _slicedToArray(arr, i) { /***/ }), -/***/ 35: +/***/ 34: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -536,7 +536,7 @@ function _arrayWithHoles(arr) { /***/ }), -/***/ 36: +/***/ 35: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; diff --git a/wp-includes/js/dist/autop.min.js b/wp-includes/js/dist/autop.min.js index feac0deff6..14e2a2df9f 100644 --- a/wp-includes/js/dist/autop.min.js +++ b/wp-includes/js/dist/autop.min.js @@ -1 +1 @@ -this.wp=this.wp||{},this.wp.autop=function(e){var r={};function n(t){if(r[t])return r[t].exports;var p=r[t]={i:t,l:!1,exports:{}};return e[t].call(p.exports,p,p.exports,n),p.l=!0,p.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var p in e)n.d(t,p,function(r){return e[r]}.bind(null,p));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=195)}({195:function(e,r,n){"use strict";n.r(r),n.d(r,"autop",function(){return a}),n.d(r,"removep",function(){return i});var t=n(25),p=new RegExp("(<((?=!--|!\\[CDATA\\[)((?=!-)!(?:-(?!->)[^\\-]*)*(?:--\x3e)?|!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?)|[^>]*>?))");function c(e,r){for(var n=function(e){for(var r,n=[],t=e;r=t.match(p);)n.push(t.slice(0,r.index)),n.push(r[0]),t=t.slice(r.index+r[0].length);return t.length&&n.push(t),n}(e),t=!1,c=Object.keys(r),a=1;a 1&&void 0!==arguments[1])||arguments[1],n=[];if(""===e.trim())return"";if(-1!==(e+="\n").indexOf(" "),a=p.pop();e="";for(var i=0;i";n.push([s,o.substr(l)+""]),e+=o.substr(0,l)+s}else e+=o}e+=a}var u="(?: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)";-1!==(e=c(e=(e=(e=(e=e.replace(/
\s*
/g,"\n\n")).replace(new RegExp("(<"+u+"[s/>])","g"),"\n\n$1")).replace(new RegExp("("+u+">)","g"),"$1\n\n")).replace(/\r\n|\r/g,"\n"),{"\n":" \x3c!-- wpnl --\x3e "})).indexOf("")),-1!==e.indexOf("")&&(e=(e=(e=e.replace(/(")).replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g,"$1")),-1===e.indexOf("