mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Block Editor: Fix loading the script handling the "Manage Reusable Blocks" page.
This ensures the "import from JSON" and "export JSON" buttons are shown properly. The script is loaded in the footer because it relies on the DOM being already there. Props noisysocks, mukesh27. Merges [43936] into trunk. Fixes #45396. Built from https://develop.svn.wordpress.org/trunk@44274 git-svn-id: http://core.svn.wordpress.org/trunk@44104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
36158d7909
commit
54ab431046
@ -201,8 +201,10 @@ wp_enqueue_script( 'inline-edit-post' );
|
||||
wp_enqueue_script( 'heartbeat' );
|
||||
|
||||
if ( 'wp_block' === $post_type ) {
|
||||
wp_enqueue_script( 'wp-list-reusable-blocks' );
|
||||
wp_enqueue_style( 'wp-list-reusable-blocks' );
|
||||
|
||||
// wp-list-reusable-blocks enhances the page's DOM and so needs to be loaded in the footer.
|
||||
wp_enqueue_script( 'wp-list-reusable-blocks', '', array(), false, true );
|
||||
}
|
||||
|
||||
$title = $post_type_object->labels->name;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'wp_latest_comments_draft_or_post_title' ) ) {
|
||||
if ( ! function_exists( 'gutenberg_draft_or_post_title' ) ) {
|
||||
/**
|
||||
* Get the post title.
|
||||
*
|
||||
@ -26,7 +26,7 @@ if ( ! function_exists( 'wp_latest_comments_draft_or_post_title' ) ) {
|
||||
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
|
||||
* @return string The post title if set; "(no title)" if no title is set.
|
||||
*/
|
||||
function wp_latest_comments_draft_or_post_title( $post = 0 ) {
|
||||
function gutenberg_draft_or_post_title( $post = 0 ) {
|
||||
$title = get_the_title( $post );
|
||||
if ( empty( $title ) ) {
|
||||
$title = __( '(no title)' );
|
||||
@ -42,7 +42,7 @@ if ( ! function_exists( 'wp_latest_comments_draft_or_post_title' ) ) {
|
||||
*
|
||||
* @return string Returns the post content with latest comments added.
|
||||
*/
|
||||
function render_block_core_latest_comments( $attributes = array() ) {
|
||||
function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
|
||||
// This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php.
|
||||
$comments = get_comments(
|
||||
apply_filters(
|
||||
@ -94,7 +94,7 @@ function render_block_core_latest_comments( $attributes = array() ) {
|
||||
|
||||
// `_draft_or_post_title` calls `esc_html()` so we don't need to wrap that call in
|
||||
// `esc_html`.
|
||||
$post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . wp_latest_comments_draft_or_post_title( $comment->comment_post_ID ) . '</a>';
|
||||
$post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . gutenberg_draft_or_post_title( $comment->comment_post_ID ) . '</a>';
|
||||
|
||||
$list_items_markup .= sprintf(
|
||||
/* translators: 1: author name (inside <a> or <span> tag, based on if they have a URL), 2: post title related to this comment */
|
||||
@ -179,6 +179,6 @@ register_block_type(
|
||||
'enum' => array( 'center', 'left', 'right', 'wide', 'full', '' ),
|
||||
),
|
||||
),
|
||||
'render_callback' => 'render_block_core_latest_comments',
|
||||
'render_callback' => 'gutenberg_render_block_core_latest_comments',
|
||||
)
|
||||
);
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.1-alpha-44273';
|
||||
$wp_version = '5.1-alpha-44274';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user