From 325cb107d1493688c6e14dcfcd33e237c8672d93 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Sat, 3 Nov 2018 07:57:54 +0000 Subject: [PATCH] Build Tools: Update the `@wordpress` packages. This brings support for the custom fields meta box to the block editor. The `webpack` and `copy-webpack-plugin` packages have also been updated. See #45145. Fixes #45257. Built from https://develop.svn.wordpress.org/branches/5.0@43861 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43690 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-blocks.php | 28 ++++++++++++++++++ wp-admin/includes/meta-boxes.php | 5 +++- wp-admin/includes/post.php | 29 ++++++++++++++++++- wp-admin/post.php | 12 ++++++++ .../css/dist/block-library/editor-rtl.css | 2 +- wp-includes/css/dist/block-library/editor.css | 2 +- .../css/dist/block-library/style-rtl.css | 2 +- wp-includes/css/dist/block-library/style.css | 2 +- wp-includes/css/dist/components/style-rtl.css | 2 +- wp-includes/css/dist/components/style.css | 2 +- wp-includes/css/dist/edit-post/style-rtl.css | 2 +- wp-includes/css/dist/edit-post/style.css | 2 +- wp-includes/css/dist/editor/style-rtl.css | 2 +- wp-includes/css/dist/editor/style.css | 2 +- wp-includes/js/dist/api-fetch.min.js | 2 +- wp-includes/js/dist/block-library.min.js | 6 ++-- wp-includes/js/dist/blocks.min.js | 2 +- wp-includes/js/dist/components.min.js | 6 ++-- wp-includes/js/dist/compose.min.js | 2 +- wp-includes/js/dist/core-data.min.js | 2 +- wp-includes/js/dist/data.min.js | 2 +- wp-includes/js/dist/date.min.js | 4 +-- wp-includes/js/dist/dom.min.js | 2 +- wp-includes/js/dist/edit-post.min.js | 4 +-- wp-includes/js/dist/editor.min.js | 8 ++--- wp-includes/js/dist/element.min.js | 2 +- wp-includes/js/dist/format-library.min.js | 2 +- wp-includes/js/dist/i18n.min.js | 2 +- wp-includes/js/dist/keycodes.min.js | 2 +- .../js/dist/list-reusable-blocks.min.js | 2 +- wp-includes/js/dist/notices.min.js | 2 +- wp-includes/js/dist/nux.min.js | 2 +- wp-includes/js/dist/plugins.min.js | 2 +- wp-includes/js/dist/redux-routine.min.js | 2 +- wp-includes/js/dist/rich-text.min.js | 2 +- wp-includes/js/dist/shortcode.min.js | 2 +- wp-includes/js/dist/viewport.min.js | 2 +- wp-includes/script-loader.php | 2 ++ wp-includes/version.php | 2 +- 39 files changed, 117 insertions(+), 45 deletions(-) diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php index 3dfa4f2f6a..00fd098ec6 100644 --- a/wp-admin/edit-form-blocks.php +++ b/wp-admin/edit-form-blocks.php @@ -208,6 +208,29 @@ if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) { } } +// Image sizes. +$image_sizes = get_intermediate_image_sizes(); +$image_sizes[] = 'full'; + +/** This filter is documented in wp-admin/includes/media.php */ +$image_size_names = apply_filters( + 'image_size_names_choose', + array( + 'thumbnail' => __( 'Thumbnail' ), + 'medium' => __( 'Medium' ), + 'large' => __( 'Large' ), + 'full' => __( 'Full Size' ), + ) +); + +$available_image_sizes = array(); +foreach ( $image_sizes as $image_size_slug ) { + $available_image_sizes[] = array( + 'slug' => $image_size_slug, + 'name' => isset( $image_size_names[ $image_size_slug ] ) ? $image_size_names[ $image_size_slug ] : $image_size_slug, + ); +} + // Lock settings. $user_id = wp_check_post_lock( $post->ID ); if ( $user_id ) { @@ -263,12 +286,17 @@ $editor_settings = array( 'maxUploadFileSize' => $max_upload_size, 'allowedMimeTypes' => get_allowed_mime_types(), 'styles' => $styles, + 'availableImageSizes' => $available_image_sizes, 'postLock' => $lock_details, 'postLockUtils' => array( 'nonce' => wp_create_nonce( 'lock-post_' . $post->ID ), 'unlockNonce' => wp_create_nonce( 'update-post_' . $post->ID ), 'ajaxUrl' => admin_url( 'admin-ajax.php' ), ), + + // Whether or not to load the 'postcustom' meta box is stored as a user meta + // field so that we're not always loading its assets. + 'enableCustomFields' => (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ), ); $autosave = wp_get_post_autosave( $post_ID ); diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 15593684c6..d075199a2d 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -1361,7 +1361,10 @@ function register_and_do_post_meta_boxes( $post ) { add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); if ( post_type_supports($post_type, 'custom-fields') ) - add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); + $screen = get_current_screen(); + if ( ! $screen || ! $screen->is_block_editor() || (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ) ) { + add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => false, '__block_editor_compatible_meta_box' => true ) ); + } /** * Fires in the middle of built-in meta box registration. diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 5e814f416b..462bde55c3 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1958,7 +1958,7 @@ function get_block_categories( $post ) { array( 'slug' => 'common', 'title' => __( 'Common Blocks' ), - 'icon' => 'screenoptions', + 'icon' => null, ), array( 'slug' => 'formatting', @@ -2060,6 +2060,10 @@ function the_block_editor_meta_boxes() {
+
+ + +