WordPress.org

Make WordPress Core

Changeset 44251


Ignore:
Timestamp:
12/17/2018 12:28:36 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Block Editor: Load TinyMCE inline scripts later.

Previously, the TinyMCE inline scripts were added on the init action in the block editor. In the classic editor, however, these scripts are loaded when the TinyMCE window is printed, and some plugins rely on them being loaded later, so they can attach to the appropriate filters.

Props pento.
Merges [43901] to trunk.
Fixes #45338.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r44244 r44251  
    306306    )
    307307);
     308wp_tinymce_inline_scripts();
    308309wp_enqueue_editor();
    309310
  • trunk/src/wp-includes/script-loader.php

    r44249 r44251  
    476476        'after'
    477477    );
    478 
    479     // TinyMCE init.
     478}
     479
     480/**
     481 * Adds inline scripts required for the TinyMCE in the block editor.
     482 *
     483 * @since 5.0.0
     484 *
     485 * @global WP_Scripts $wp_scripts
     486 */
     487function wp_tinymce_inline_scripts() {
     488    global $wp_scripts;
     489
    480490    $tinymce_plugins = array(
    481491        'charmap',
     
    588598    }';
    589599
    590     $scripts->add_inline_script( 'wp-block-library', $script, 'before' );
     600    $wp_scripts->add_inline_script( 'wp-block-library', $script, 'before' );
    591601}
    592602
Note: See TracChangeset for help on using the changeset viewer.