Make WordPress Core

Changeset 44265


Ignore:
Timestamp:
12/17/2018 05:02:02 PM (6 years ago)
Author:
desrosj
Message:

TinyMCE: Run the filters for the Classic block.

The wp_editor_settings and disable_captions filters need to be run for the Classic Block.

This fixes possible regressions in plugins that use these filters, and plugins that use them to add filters for the buttons, external plugins, etc.

Props azaozz.

Merges [43914] into trunk.

Fixes #45348.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/script-loader.php

    r44262 r44265  
    517517 * Adds inline scripts required for the TinyMCE in the block editor.
    518518 *
     519 * These TinyMCE init settings are used to extend and override the default settings
     520 * from `_WP_Editors::default_settings()` for the Classic block.
     521 *
    519522 * @since 5.0.0
    520523 *
     
    523526function wp_tinymce_inline_scripts() {
    524527    global $wp_scripts;
     528
     529    /** This filter is documented in wp-includes/class-wp-editor.php */
     530    $editor_settings = apply_filters( 'wp_editor_settings', array( 'tinymce' => true ), 'classic-block' );
    525531
    526532    $tinymce_plugins = array(
     
    549555    $tinymce_plugins = array_unique( $tinymce_plugins );
    550556
     557    $disable_captions = false;
     558    // Runs after `tiny_mce_plugins` but before `mce_buttons`.
     559    /** This filter is documented in wp-admin/includes/media.php */
     560    if ( apply_filters( 'disable_captions', '' ) ) {
     561        $disable_captions = true;
     562    }
     563
    551564    $toolbar1 = array(
    552565        'formatselect',
     
    602615        'classic_block_editor' => true,
    603616    );
     617
     618    if ( $disable_captions ) {
     619        $tinymce_settings['wpeditimage_disable_captions'] = true;
     620    }
     621
     622    if ( ! empty( $editor_settings['tinymce'] ) && is_array( $editor_settings['tinymce'] ) ) {
     623        array_merge( $tinymce_settings, $editor_settings['tinymce'] );
     624    }
    604625
    605626    /* This filter is documented in wp-includes/class-wp-editor.php */
Note: See TracChangeset for help on using the changeset viewer.