Ticket #45634: 45634-Block-Editor.patch
File 45634-Block-Editor.patch, 8.0 KB (added by , 6 years ago) |
---|
-
src/wp-admin/edit-form-blocks.php
26 26 $title = $post_type_object->labels->edit_item; 27 27 } 28 28 29 // Flag that we're loading the block editor.29 // Flag that we're loading the Block Editor. 30 30 $current_screen = get_current_screen(); 31 31 $current_screen->is_block_editor( true ); 32 32 … … 317 317 318 318 319 319 /** 320 * Filters the settings to pass to the block editor.320 * Filters the settings to pass to the Block Editor. 321 321 * 322 322 * @since 5.0.0 323 323 * … … 357 357 * Call `add_action` on any hook before 'admin_enqueue_scripts'. 358 358 * 359 359 * In the function call you supply, simply use `wp_enqueue_script` and 360 * `wp_enqueue_style` to add your functionality to the block editor.360 * `wp_enqueue_style` to add your functionality to the Block Editor. 361 361 * 362 362 * @since 5.0.0 363 363 */ -
src/wp-admin/includes/class-wp-screen.php
179 179 private $_screen_settings; 180 180 181 181 /** 182 * Whether the screen is using the block editor.182 * Whether the screen is using the Block Editor. 183 183 * 184 184 * @since 5.0.0 185 185 * @var bool … … 421 421 } 422 422 423 423 /** 424 * Sets or returns whether the block editor is loading on the current screen.424 * Sets or returns whether the Block Editor is loading on the current screen. 425 425 * 426 426 * @since 5.0.0 427 427 * 428 * @param bool $set Optional. Sets whether the block editor is loading on the current screen or not.429 * @return bool True if the block editor is being loaded, false otherwise.428 * @param bool $set Optional. Sets whether the Block Editor is loading on the current screen or not. 429 * @return bool True if the Block Editor is being loaded, false otherwise. 430 430 */ 431 431 public function is_block_editor( $set = null ) { 432 432 if ( $set !== null ) { -
src/wp-admin/includes/misc.php
1731 1731 * @since 5.0.0 Added the `$blocks` parameter. 1732 1732 * 1733 1733 * @param bool $description Whether to include the descriptions under the section headings. Default false. 1734 * @param bool $blocks Whether to format the content for the block editor. Default true.1734 * @param bool $blocks Whether to format the content for the Block Editor. Default true. 1735 1735 * @return string The default policy content. 1736 1736 */ 1737 1737 public static function get_default_content( $description = false, $blocks = true ) { … … 1971 1971 * @param $content string The default policy content. 1972 1972 * @param $strings array An array of privacy policy content strings. 1973 1973 * @param $description bool Whether policy descriptions should be included. 1974 * @param $blocks bool Whether the content should be formatted for the block editor.1974 * @param $blocks bool Whether the content should be formatted for the Block Editor. 1975 1975 */ 1976 1976 return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks ); 1977 1977 } -
src/wp-admin/includes/post.php
2025 2025 } 2026 2026 2027 2027 /** 2028 * Return whether the post can be edited in the block editor.2028 * Return whether the post can be edited in the Block Editor. 2029 2029 * 2030 2030 * @since 5.0.0 2031 2031 * 2032 2032 * @param int|WP_Post $post Post ID or WP_Post object. 2033 * @return bool Whether the post can be edited in the block editor.2033 * @return bool Whether the post can be edited in the Block Editor. 2034 2034 */ 2035 2035 function use_block_editor_for_post( $post ) { 2036 2036 $post = get_post( $post ); … … 2039 2039 return false; 2040 2040 } 2041 2041 2042 // We're in the meta box loader, so don't use the block editor.2042 // We're in the meta box loader, so don't use the Block Editor. 2043 2043 if ( isset( $_GET['meta-box-loader'] ) ) { 2044 2044 check_admin_referer( 'meta-box-loader' ); 2045 2045 return false; … … 2048 2048 $use_block_editor = use_block_editor_for_post_type( $post->post_type ); 2049 2049 2050 2050 /** 2051 * Filter whether a post is able to be edited in the block editor.2051 * Filter whether a post is able to be edited in the Block Editor. 2052 2052 * 2053 2053 * @since 5.0.0 2054 2054 * … … 2059 2059 } 2060 2060 2061 2061 /** 2062 * Return whether a post type is compatible with the block editor.2062 * Return whether a post type is compatible with the Block Editor. 2063 2063 * 2064 * The block editor depends on the REST API, and if the post type is not shown in the2065 * REST API, then it won't work with the block editor.2064 * The Block Editor depends on the REST API, and if the post type is not shown in the 2065 * REST API, then it won't work with the Block Editor. 2066 2066 * 2067 2067 * @since 5.0.0 2068 2068 * 2069 2069 * @param string $post_type The post type. 2070 * @return bool Whether the post type can be edited with the block editor.2070 * @return bool Whether the post type can be edited with the Block Editor. 2071 2071 */ 2072 2072 function use_block_editor_for_post_type( $post_type ) { 2073 2073 if ( ! post_type_exists( $post_type ) ) { … … 2084 2084 } 2085 2085 2086 2086 /** 2087 * Filter whether a post is able to be edited in the block editor.2087 * Filter whether a post is able to be edited in the Block Editor. 2088 2088 * 2089 2089 * @since 5.0.0 2090 2090 * … … 2095 2095 } 2096 2096 2097 2097 /** 2098 * Returns all the block categories that will be shown in the block editor.2098 * Returns all the block categories that will be shown in the Block Editor. 2099 2099 * 2100 2100 * @since 5.0.0 2101 2101 * … … 2148 2148 } 2149 2149 2150 2150 /** 2151 * Prepares server-registered blocks for the block editor.2151 * Prepares server-registered blocks for the Block Editor. 2152 2152 * 2153 2153 * Returns an associative array of registered block data keyed by block name. Data includes properties 2154 2154 * of a block relevant for client registration. -
src/wp-admin/includes/template.php
1139 1139 1140 1140 $block_compatible = true; 1141 1141 if ( is_array( $box['args'] ) ) { 1142 // If a meta box is just here for back compat, don't show it in the block editor.1142 // If a meta box is just here for back compat, don't show it in the Block Editor. 1143 1143 if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) { 1144 1144 continue; 1145 1145 } 1146 1146 1147 // If a meta box doesn't work in the block editor, don't show it in the block editor.1147 // If a meta box doesn't work in the Block Editor, don't show it in the Block Editor. 1148 1148 if ( $screen->is_block_editor() && isset( $box['args']['__block_editor_compatible_meta_box'] ) && ! $box['args']['__block_editor_compatible_meta_box'] ) { 1149 1149 continue; 1150 1150 } … … 1212 1212 <p> 1213 1213 <?php 1214 1214 /* translators: %s: the name of the plugin that generated this meta box. */ 1215 printf( __( "This meta box, from the %s plugin, isn't compatible with the block editor." ), "<strong>{$plugin['Name']}</strong>" );1215 printf( __( "This meta box, from the %s plugin, isn't compatible with the Block Editor." ), "<strong>{$plugin['Name']}</strong>" ); 1216 1216 ?> 1217 1217 </p> 1218 1218 </div> -
src/wp-content/themes/twentynineteen/functions.php
237 237 add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' ); 238 238 239 239 /** 240 * Enqueue supplemental block editor styles.240 * Enqueue supplemental Block Editor styles. 241 241 */ 242 242 function twentynineteen_editor_customizer_styles() { 243 243