Changeset 52364 for trunk/src/wp-admin/site-editor.php
- Timestamp:
- 12/14/2021 01:55:28 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/site-editor.php
r52336 r52364 24 24 } 25 25 26 // Used in the HTML title tag. 27 $title = __( 'Editor (beta)' ); 26 28 $parent_file = 'themes.php'; 27 29 … … 57 59 58 60 if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) { 59 60 61 $post_type = get_post_type_object( $_GET['postType'] ); 61 62 62 if ( ! $post_type ) { 63 63 wp_die( __( 'Invalid post type.' ) ); 64 64 } 65 } 65 66 66 // Used in the HTML title tag. 67 $title = $post_type->labels->name; 67 $active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id(); 68 $active_theme = wp_get_theme()->get_stylesheet(); 69 $preload_paths = array( 70 array( '/wp/v2/media', 'OPTIONS' ), 71 '/', 72 '/wp/v2/types?context=edit', 73 '/wp/v2/types/wp_template?context=edit', 74 '/wp/v2/types/wp_template-part?context=edit', 75 '/wp/v2/taxonomies?context=edit', 76 '/wp/v2/pages?context=edit', 77 '/wp/v2/categories?context=edit', 78 '/wp/v2/posts?context=edit', 79 '/wp/v2/tags?context=edit', 80 '/wp/v2/templates?context=edit&per_page=-1', 81 '/wp/v2/template-parts?context=edit&per_page=-1', 82 '/wp/v2/settings', 83 '/wp/v2/themes?context=edit&status=active', 84 '/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit', 85 '/wp/v2/global-styles/' . $active_global_styles_id, 86 '/wp/v2/global-styles/themes/' . $active_theme, 87 ); 68 88 69 $preload_paths = array( 70 '/', 71 '/wp/v2/types/' . $post_type->name . '?context=edit', 72 '/wp/v2/types?context=edit', 73 add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( $post_type->name ) ), 74 ); 89 block_editor_rest_api_preload( $preload_paths, $block_editor_context ); 75 90 76 block_editor_rest_api_preload( $preload_paths, $block_editor_context ); 77 78 wp_add_inline_script( 79 'wp-edit-site', 80 sprintf( 81 'wp.domReady( function() { 82 wp.editSite.initializeList( "site-editor", "%s", %s ); 83 } );', 84 $post_type->name, 85 wp_json_encode( $editor_settings ) 86 ) 87 ); 88 89 } else { 90 91 // Used in the HTML title tag. 92 $title = __( 'Editor (beta)' ); 93 94 $active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id(); 95 $active_theme = wp_get_theme()->get_stylesheet(); 96 $preload_paths = array( 97 array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ), 98 '/', 99 '/wp/v2/types?context=edit', 100 '/wp/v2/taxonomies?context=edit', 101 add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'page' ) ), 102 add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'post' ) ), 103 add_query_arg( 'context', 'edit', rest_get_route_for_taxonomy_items( 'category' ) ), 104 add_query_arg( 'context', 'edit', rest_get_route_for_taxonomy_items( 'post_tag' ) ), 105 add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'wp_template' ) ), 106 add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( 'wp_template_part' ) ), 107 '/wp/v2/settings', 108 '/wp/v2/themes?context=edit&status=active', 109 '/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit', 110 '/wp/v2/global-styles/' . $active_global_styles_id, 111 '/wp/v2/themes/' . $active_theme . '/global-styles', 112 ); 113 114 block_editor_rest_api_preload( $preload_paths, $block_editor_context ); 115 116 wp_add_inline_script( 117 'wp-edit-site', 118 sprintf( 119 'wp.domReady( function() { 120 wp.editSite.initializeEditor( "site-editor", %s ); 121 } );', 122 wp_json_encode( $editor_settings ) 123 ) 124 ); 125 126 } 91 wp_add_inline_script( 92 'wp-edit-site', 93 sprintf( 94 'wp.domReady( function() { 95 wp.editSite.initializeEditor( "site-editor", %s ); 96 } );', 97 wp_json_encode( $editor_settings ) 98 ) 99 ); 127 100 128 101 // Preload server-registered block schemas.
Note: See TracChangeset
for help on using the changeset viewer.