<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[44165] trunk/src/wp-admin: Editor: Merge some minor bug fixes.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/44165">44165</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/44165","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>pento</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-12-14 05:11:14 +0000 (Fri, 14 Dec 2018)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: Merge some minor bug fixes.

There were some tweaks made to the post editor in WordPress 5.0 that hadn't been merged to `trunk`, this commit rectifies that.

Merges [43815,43816] from the 5.0 branch to trunk.

Props birgire, jorbin, abdullahramzan, adamsilverstein, mrahmadawais, airathalitov, ajitbohra, schlessera, albertomedina, aldavigdis, alexsanford1, xyfi, nitrajka, afercia, andreiglingeanu, euthelup, aduth, sumobi, anevins, azaozz, androb, andrewserong, kallehauge, nosolosw, apeatling, atimmer, arnaudban, asvinballoo, b-07, benlk, blowery, caxco93, benjamin_zekavica, kau-boy, bernhard-reiter, bcolumbia, bph, boblinthorst, bradyvercher, bpayton, brentswisher, bronsonquick, burhandodhy, icaleb, chouby, ehg, chrisvanpatten, butimnoexpert, christophherr, chriskmnds, claudiosanches, danielbachhuber, mrmadhat, danielhw, danieltj, goldsounds, dfangstrom, daniloercoli, dannycooper, nerrad, dsawardekar, davemoran118, davidherrera, dryanpress, davidsword, davisshaver, dmsnell, dlocc, diegoreymendez, dd32, dency, ocean90, donnapep, chopinbach, electricfeet, eliorivero, sewmyheadon, ericnmurphy, foobar4u, circlecube, fabs_pim, flixos90, floriansimeth, gma992, garrett-eclipse, garyj, pento, doomw
 axer, revgeorge, gziolo, bordoni, hardeepasrani, helen, luehrsen, herbmiller, toro_unit, ianbelanger, iandunn, igorsch, ipstenu, ireneyoast, israelshmueli, sisanu, jd55, copons, jnylen0, jamestryon, ephoxjames, jamiehalvorson, jsnajdr, jagnew, dciso, octalmage, vengisss, jhoffm34, shenkj, audrasjb, jblz, jeremyfelt, motleydev, jipmoors, sephsekla, joemaller, joemcgill, joen, johndyer, johnjamesjacoby, joshuawold, johnny5, desrosj, jonsurrell, belcherj, sirjonathan, koke, jorgefilipecosta, shelob9, jvisick77, julienmelissas, kopepasah, kadamwhite, codebykat, ryelle, gwwar, kevinwhoffman, coderkevin, ixkaito, kjellr, obenland, lancewillett, postphotos, loicblascos, lucasstark, luigipulcini, lucaskowalski, lukepettway, mahdiyazdani, mahmoudsaeed, mkaz, tyxla, markjaquith, mapk, vindl, m-e-h, mboynes, mattheu, lonelyvegan, mtias, napy84, maurobringolf, maximebj, mayukojpn, woodent, michaelhull, mmtr86, stubgo, simison, mihai2u, mike-haydon-swo, mnelson4, mpheasant, mikeschroder, idpokut
 e, mikeyarce, dimadin, gonzomir, milesdelliott, warmarks, munirkamal, nfmohit, nateconley, greatislander, njpanderson, notnownikki, nielslange, nikschavan, potbot, nshki, webmandesign, oskosk, pglewis, pareshradadiya-1, swissspidy, pbearne, pauldechov, psealock, paulstonier, paulwilde, pedromendonca, ptasker, peterwilsoncc, tyrannous, strategio, piersb, delawski, prtksxna, presskopp, rachelbaker, rachelmcr, rakshans1, rahmon, lamosty, youknowriad, riddhiehta02, noisysocks, deviodigital, sanchothefat, robertsky, _dorsvenabili, rohittm, magicroundabout, rmccue, welcher, ryo511, sagarprajapati, samikeijonen, scottmweaver, kluny, sharaz, giventofly76, designsimply, sstoqnov, hypest, netweb, stevehenty, stuartfeldt, sergioestevao, soean, tammie_l, karmatosed, thrijith, timgardner, timmydcrawford, tjnowell, mirucon, travislopes, truongwp, tjfunke001, vishalkakadiya, vtrpldn, walterebert, westonruter, skorasaurus, somtijds, earnjam, williampatton, willybahuaud, yoavf, zebulan, ziyaddin, ab
 hijitrakas, andreamiddleton, csabotta, dixitadusara, etoledom, faishal, hideokamoto, imath, iseulde, j-falk, jaswrks, johnwatkins0, jomurgel, notlaura, leahkoerper, mcsf, meetjey, 0mirka00, mitogh, ephoxmogran, tacrapo, mzorz, nagayama, omarreiss, ramonopoly, rileybrook, tinkerbelly, shaileesheth, sikander, ssousa, tfrommen, yahil.

Fixes <a href="https://core.trac.wordpress.org/ticket/45037">#45037</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminpostnewphp">trunk/src/wp-admin/post-new.php</a></li>
<li><a href="#trunksrcwpadminpostphp">trunk/src/wp-admin/post.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpadmineditformblocksphp">trunk/src/wp-admin/edit-form-blocks.php</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunk">trunk/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk        2018-12-14 04:52:27 UTC (rev 44164)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk 2018-12-14 05:11:14 UTC (rev 44165)
</ins><a id="trunk"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:43557,43622
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43814,43817-43818,43821,43842,43860,43869-43876,43892,43904,43909,43926-43929,43954,43956,43961-43963
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43818,43821,43842,43860,43869-43876,43892,43904,43909,43926-43929,43954,43956,43961-43963
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpadmineditformblocksphpfromrev43815branches50srcwpadmineditformblocksphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/wp-admin/edit-form-blocks.php (from rev 43815, branches/5.0/src/wp-admin/edit-form-blocks.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/edit-form-blocks.php                           (rev 0)
+++ trunk/src/wp-admin/edit-form-blocks.php     2018-12-14 05:11:14 UTC (rev 44165)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,360 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * The Block Editor page.
+ *
+ * @since 5.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// don't load directly
+if ( ! defined( 'ABSPATH' ) ) {
+       die( '-1' );
+}
+
+/**
+ * @global string       $post_type
+ * @global WP_Post_Type $post_type_object
+ * @global WP_Post      $post
+ * @global string       $title
+ * @global array        $editor_styles
+ */
+global $post_type, $post_type_object, $post, $title, $editor_styles;
+
+if ( ! empty( $post_type_object ) ) {
+       $title = $post_type_object->labels->edit_item;
+}
+
+// Flag that we're loading the block editor.
+$current_screen = get_current_screen();
+$current_screen->is_block_editor( true );
+
+/*
+ * Emoji replacement is disabled for now, until it plays nicely with React.
+ */
+remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
+
+wp_enqueue_script( 'heartbeat' );
+wp_enqueue_script( 'wp-edit-post' );
+
+$rest_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name;
+
+// Preload common data.
+$preload_paths = array(
+       '/',
+       '/wp/v2/types?context=edit',
+       '/wp/v2/taxonomies?per_page=-1&context=edit',
+       '/wp/v2/themes?status=active',
+       sprintf( '/wp/v2/%s/%s?context=edit', $rest_base, $post->ID ),
+       sprintf( '/wp/v2/types/%s?context=edit', $post_type ),
+       sprintf( '/wp/v2/users/me?post_type=%s&context=edit', $post_type ),
+);
+
+/*
+ * Ensure the global $post remains the same after API data is preloaded.
+ * Because API preloading can call the_content and other filters, plugins
+ * can unexpectedly modify $post.
+ */
+$backup_global_post = $post;
+
+$preload_data = array_reduce(
+       $preload_paths,
+       'rest_preload_api_request',
+       array()
+);
+
+// Restore the global $post as it was before API preloading.
+$post = $backup_global_post;
+
+wp_add_inline_script(
+       'wp-api-fetch',
+       sprintf( 'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );', wp_json_encode( $preload_data ) ),
+       'after'
+);
+
+wp_add_inline_script(
+       'wp-blocks',
+       sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $post ) ) ),
+       'after'
+);
+
+/*
+ * Assign initial edits, if applicable. These are not initially assigned to the persisted post,
+ * but should be included in its save payload.
+ */
+$initial_edits = null;
+$is_new_post   = false;
+if ( 'auto-draft' === $post->post_status ) {
+       $is_new_post = true;
+       // Override "(Auto Draft)" new post default title with empty string, or filtered value.
+       $initial_edits = array(
+               'title'   => array(
+                       'raw' => $post->post_title,
+               ),
+               'content' => array(
+                       'raw' => $post->post_content,
+               ),
+               'excerpt' => array(
+                       'raw' => $post->post_excerpt,
+               ),
+       );
+}
+
+// Preload server-registered block schemas.
+wp_add_inline_script(
+       'wp-blocks',
+       'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
+);
+
+// Get admin url for handling meta boxes.
+$meta_box_url = admin_url( 'post.php' );
+$meta_box_url = add_query_arg(
+       array(
+               'post'            => $post->ID,
+               'action'          => 'edit',
+               'meta-box-loader' => true,
+               '_wpnonce'        => wp_create_nonce( 'meta-box-loader' ),
+       ),
+       $meta_box_url
+);
+wp_localize_script( 'wp-editor', '_wpMetaBoxUrl', $meta_box_url );
+
+
+// Populate default code editor settings by short-circuiting wp_enqueue_code_editor.
+wp_add_inline_script(
+       'wp-editor',
+       sprintf(
+               'window._wpGutenbergCodeEditorSettings = %s;',
+               wp_json_encode( wp_get_code_editor_settings( array( 'type' => 'text/html' ) ) )
+       )
+);
+
+/*
+ * Initialize the editor.
+ */
+
+$align_wide    = get_theme_support( 'align-wide' );
+$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
+$font_sizes    = current( (array) get_theme_support( 'editor-font-sizes' ) );
+
+/**
+ * Filters the allowed block types for the editor, defaulting to true (all
+ * block types supported).
+ *
+ * @since 5.0.0
+ *
+ * @param bool|array $allowed_block_types Array of block type slugs, or
+ *                                        boolean to enable/disable all.
+ * @param object $post                    The post resource data.
+ */
+$allowed_block_types = apply_filters( 'allowed_block_types', true, $post );
+
+// Get all available templates for the post/page attributes meta-box.
+// The "Default template" array element should only be added if the array is
+// not empty so we do not trigger the template select element without any options
+// besides the default value.
+$available_templates = wp_get_theme()->get_page_templates( get_post( $post->ID ) );
+$available_templates = ! empty( $available_templates ) ? array_merge(
+       array(
+               /** This filter is documented in wp-admin/includes/meta-boxes.php */
+               '' => apply_filters( 'default_page_template_title', __( 'Default template' ), 'rest-api' ),
+       ),
+       $available_templates
+) : $available_templates;
+
+// Media settings.
+$max_upload_size = wp_max_upload_size();
+if ( ! $max_upload_size ) {
+       $max_upload_size = 0;
+}
+
+// Editor Styles.
+$styles = array(
+       array(
+               'css' => file_get_contents(
+                       ABSPATH . WPINC . '/css/dist/editor/editor-styles.css'
+               ),
+       ),
+);
+if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
+       foreach ( $editor_styles as $style ) {
+               if ( preg_match( '~^(https?:)?//~', $style ) ) {
+                       $response = wp_remote_get( $style );
+                       if ( ! is_wp_error( $response ) ) {
+                               $styles[] = array(
+                                       'css' => wp_remote_retrieve_body( $response ),
+                               );
+                       }
+               } else {
+                       $file     = get_theme_file_path( $style );
+                       $styles[] = array(
+                               'css'     => file_get_contents( get_theme_file_path( $style ) ),
+                               'baseURL' => get_theme_file_uri( $style ),
+                       );
+               }
+       }
+}
+
+// Lock settings.
+$user_id = wp_check_post_lock( $post->ID );
+if ( $user_id ) {
+       /** This filter is documented in wp-admin/includes/post.php */
+       if ( apply_filters( 'show_post_locked_dialog', true, $post, $user_id ) ) {
+               $locked = true;
+       }
+
+       $user_details = null;
+       if ( $locked ) {
+               $user         = get_userdata( $user_id );
+               $user_details = array(
+                       'name' => $user->display_name,
+               );
+               $avatar       = get_avatar_url( $user_id, array( 'size' => 64 ) );
+       }
+
+       $lock_details = array(
+               'isLocked' => $locked,
+               'user'     => $user_details,
+       );
+} else {
+       // Lock the post.
+       $active_post_lock = wp_set_post_lock( $post->ID );
+       $lock_details     = array(
+               'isLocked'       => false,
+               'activePostLock' => esc_attr( implode( ':', $active_post_lock ) ),
+       );
+}
+
+/**
+ * Filters the body placeholder text.
+ *
+ * @since 5.0.0
+ *
+ * @param string  $text Placeholder text. Default 'Write your story'.
+ * @param WP_Post $post Post object.
+ */
+$body_placeholder = apply_filters( 'write_your_story', __( 'Write your story' ), $post );
+
+$editor_settings = array(
+       'alignWide'              => $align_wide,
+       'availableTemplates'     => $available_templates,
+       'allowedBlockTypes'      => $allowed_block_types,
+       'disableCustomColors'    => get_theme_support( 'disable-custom-colors' ),
+       'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
+       'disablePostFormats'     => ! current_theme_supports( 'post-formats' ),
+       /** This filter is documented in wp-admin/edit-form-advanced.php */
+       'titlePlaceholder'       => apply_filters( 'enter_title_here', __( 'Add title' ), $post ),
+       'bodyPlaceholder'        => $body_placeholder,
+       'isRTL'                  => is_rtl(),
+       'autosaveInterval'       => 10,
+       'maxUploadFileSize'      => $max_upload_size,
+       'allowedMimeTypes'       => get_allowed_mime_types(),
+       'styles'                 => $styles,
+       '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' ),
+       ),
+);
+
+$autosave = wp_get_post_autosave( $post_ID );
+if ( $autosave ) {
+       if ( mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
+               $editor_settings['autosave'] = array(
+                       'editLink' => get_edit_post_link( $autosave->ID ),
+               );
+       } else {
+               wp_delete_post_revision( $autosave->ID );
+       }
+}
+
+if ( false !== $color_palette ) {
+       $editor_settings['colors'] = $color_palette;
+}
+
+if ( ! empty( $font_sizes ) ) {
+       $editor_settings['fontSizes'] = $font_sizes;
+}
+
+if ( ! empty( $post_type_object->template ) ) {
+       $editor_settings['template']     = $post_type_object->template;
+       $editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;
+}
+
+// If there's no template set on a new post, use the post format, instead.
+if ( $is_new_post && ! isset( $editor_settings['template'] ) && 'post' === $post->post_type ) {
+       $post_format = get_post_format( $post );
+       if ( in_array( $post_format, array( 'audio', 'gallery', 'image', 'quote', 'video' ), true ) ) {
+               $editor_settings['template'] = array( array( "core/$post_format" ) );
+       }
+}
+
+$init_script = <<<JS
+( function() {
+       window._wpLoadBlockEditor = new Promise( function( resolve ) {
+               wp.domReady( function() {
+                       resolve( wp.editPost.initializeEditor( 'editor', "%s", %d, %s, %s ) );
+               } );
+       } );
+} )();
+JS;
+
+
+/**
+ * Filters the settings to pass to the block editor.
+ *
+ * @since 5.0.0
+ *
+ * @param array   $editor_settings Default editor settings.
+ * @param WP_Post $post            Post being edited.
+ */
+$editor_settings = apply_filters( 'block_editor_settings', $editor_settings, $post );
+
+$script = sprintf(
+       $init_script,
+       $post->post_type,
+       $post->ID,
+       wp_json_encode( $editor_settings ),
+       wp_json_encode( $initial_edits )
+);
+wp_add_inline_script( 'wp-edit-post', $script );
+
+/**
+ * Scripts
+ */
+wp_enqueue_media(
+       array(
+               'post' => $post->ID,
+       )
+);
+wp_enqueue_editor();
+
+/**
+ * Styles
+ */
+wp_enqueue_style( 'wp-edit-post' );
+
+/**
+ * Fires after block assets have been enqueued for the editing interface.
+ *
+ * Call `add_action` on any hook before 'admin_enqueue_scripts'.
+ *
+ * In the function call you supply, simply use `wp_enqueue_script` and
+ * `wp_enqueue_style` to add your functionality to the block editor.
+ *
+ * @since 5.0.0
+ */
+do_action( 'enqueue_block_editor_assets' );
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="block-editor">
+       <h1 class="screen-reader-text"><?php echo esc_html( $post_type_object->labels->edit_item ); ?></h1>
+       <div id="editor" class="block-editor__container"></div>
+       <div id="metaboxes" class="hidden">
+               <?php the_block_editor_meta_boxes(); ?>
+       </div>
+</div>
</ins></span></pre></div>
<a id="trunksrcwpadminpostnewphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/post-new.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/post-new.php   2018-12-14 04:52:27 UTC (rev 44164)
+++ trunk/src/wp-admin/post-new.php     2018-12-14 05:11:14 UTC (rev 44165)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -68,8 +68,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /** This filter is documented in wp-admin/post.php */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        wp_enqueue_script( 'autosave' );
-       include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( use_block_editor_for_post( $post ) ) {
+               include( ABSPATH . 'wp-admin/edit-form-blocks.php' );
+       } else {
+               wp_enqueue_script( 'autosave' );
+               include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> include( ABSPATH . 'wp-admin/admin-footer.php' );
</span></span></pre></div>
<a id="trunksrcwpadminpostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/post.php       2018-12-14 04:52:27 UTC (rev 44164)
+++ trunk/src/wp-admin/post.php 2018-12-14 05:11:14 UTC (rev 44165)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,9 +16,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> wp_reset_vars( array( 'action' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
-       wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
-} elseif ( isset( $_GET['post'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( isset( $_GET['post'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">         $post_id = $post_ID = (int) $_GET['post'];
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( isset( $_POST['post_ID'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $post_id = $post_ID = (int) $_POST['post_ID'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,10 +40,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $post_type_object = get_post_type_object( $post_type );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
-       wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_POST['deletepost'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $action = 'delete';
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' == $_POST['wp-preview'] ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,8 +48,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> $sendback = wp_get_referer();
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $sendback ||
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        strpos( $sendback, 'post.php' ) !== false ||
-       strpos( $sendback, 'post-new.php' ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  strpos( $sendback, 'post.php' ) !== false ||
+        strpos( $sendback, 'post-new.php' ) !== false ) {
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( 'attachment' == $post_type ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $sendback = admin_url( 'upload.php' );
</span><span class="cx" style="display: block; padding: 0 10px">        } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -172,6 +166,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        break;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( use_block_editor_for_post( $post ) ) {
+                       include( ABSPATH . 'wp-admin/edit-form-blocks.php' );
+                       break;
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( ! wp_check_post_lock( $post->ID ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $active_post_lock = wp_set_post_lock( $post->ID );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>