Making WordPress.org

Changeset 11320


Ignore:
Timestamp:
11/10/2021 03:13:18 PM (3 months ago)
Author:
ryelle
Message:

Gutenberg: Use get_block_editor_settings function to set up editor settings.

This core function runs the expected hooks so any new settings are injected. This fixes an issue where defaultEditorStyles was expected but undefined, causing a fatal JS error.

Props stefanue, desrosj.
See https://wordpress.slack.com/archives/C02QB8GMM/p1636554866120800

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php

    r10914 r11320  
    314314    }
    315315
    316     /**
    317      * Filters the settings to pass to the block editor.
    318      *
    319      * @since 3.7.0
    320      *
    321      * @param array   $editor_settings Default editor settings.
    322      * @param WP_Post $post            Post being edited.
    323      */
    324     $editor_settings = apply_filters( 'block_editor_settings', $editor_settings, $post );
     316    $editor_context = new WP_Block_Editor_Context( array( 'post' => $post ) );
     317    $editor_settings = get_block_editor_settings( $editor_settings, $editor_context );
    325318
    326319    $init_script = <<<JS
Note: See TracChangeset for help on using the changeset viewer.