Make WordPress Core


Ignore:
Timestamp:
11/15/2018 11:52:47 PM (6 years ago)
Author:
pento
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.

See #45338.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/script-loader.php

    r43894 r43901  
    485485        'after'
    486486    );
    487 
    488     // TinyMCE init.
     487}
     488
     489/**
     490 * Adds inline scripts required for the TinyMCE in the block editor.
     491 *
     492 * @since 5.0.0
     493 *
     494 * @global WP_Scripts $wp_scripts
     495 */
     496function wp_tinymce_inline_scripts() {
     497    global $wp_scripts;
     498
    489499    $tinymce_plugins = array(
    490500        'charmap',
     
    597607    }';
    598608
    599     $scripts->add_inline_script( 'wp-block-library', $script, 'before' );
     609    $wp_scripts->add_inline_script( 'wp-block-library', $script, 'before' );
    600610}
    601611
Note: See TracChangeset for help on using the changeset viewer.