Make WordPress Core

Changeset 44165


Ignore:
Timestamp:
12/14/2018 05:11:14 AM (5 years ago)
Author:
pento
Message:

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, doomwaxer, 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, idpokute, 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, abhijitrakas, 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 #45037.

Location:
trunk
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-admin/edit-form-blocks.php

    r43815 r44165  
    8585 */
    8686$initial_edits = null;
    87 $is_new_post = false;
     87$is_new_post   = false;
    8888if ( 'auto-draft' === $post->post_status ) {
    8989    $is_new_post = true;
     
    102102}
    103103
    104 // Prepare Jed locale data.
    105 $locale_data = wp_get_jed_locale_data( 'default' );
    106 wp_add_inline_script(
    107     'wp-i18n',
    108     'wp.i18n.setLocaleData( ' . wp_json_encode( $locale_data ) . ' );'
    109 );
    110 
    111104// Preload server-registered block schemas.
    112105wp_add_inline_script(
     
    188181    foreach ( $editor_styles as $style ) {
    189182        if ( preg_match( '~^(https?:)?//~', $style ) ) {
    190             //$response = wp_remote_get( $style );
    191             var_dump( $response );
     183            $response = wp_remote_get( $style );
    192184            if ( ! is_wp_error( $response ) ) {
    193185                $styles[] = array(
  • trunk/src/wp-admin/post-new.php

    r43338 r44165  
    6969/** This filter is documented in wp-admin/post.php */
    7070if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
    71     wp_enqueue_script( 'autosave' );
    72     include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
     71    if ( use_block_editor_for_post( $post ) ) {
     72        include( ABSPATH . 'wp-admin/edit-form-blocks.php' );
     73    } else {
     74        wp_enqueue_script( 'autosave' );
     75        include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
     76    }
    7377}
    7478
  • trunk/src/wp-admin/post.php

    r44048 r44165  
    1717wp_reset_vars( array( 'action' ) );
    1818
    19 if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
    20     wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
    21 } elseif ( isset( $_GET['post'] ) ) {
     19if ( isset( $_GET['post'] ) ) {
    2220    $post_id = $post_ID = (int) $_GET['post'];
    2321} elseif ( isset( $_POST['post_ID'] ) ) {
     
    4341}
    4442
    45 if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
    46     wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
    47 }
    48 
    4943if ( isset( $_POST['deletepost'] ) ) {
    5044    $action = 'delete';
     
    5549$sendback = wp_get_referer();
    5650if ( ! $sendback ||
    57     strpos( $sendback, 'post.php' ) !== false ||
    58     strpos( $sendback, 'post-new.php' ) !== false ) {
     51     strpos( $sendback, 'post.php' ) !== false ||
     52     strpos( $sendback, 'post-new.php' ) !== false ) {
    5953    if ( 'attachment' == $post_type ) {
    6054        $sendback = admin_url( 'upload.php' );
     
    173167        }
    174168
     169        if ( use_block_editor_for_post( $post ) ) {
     170            include( ABSPATH . 'wp-admin/edit-form-blocks.php' );
     171            break;
     172        }
     173
    175174        if ( ! wp_check_post_lock( $post->ID ) ) {
    176175            $active_post_lock = wp_set_post_lock( $post->ID );
Note: See TracChangeset for help on using the changeset viewer.