mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 12:58:25 +01:00
TinyMCE: Run the "wp_editor_settings" and "disable_captions" filters for the Classic block. Fixes possible regressions in plugins that use these filters, also plugins that use them to add filters for the buttons, external plugins, etc.
Fixes #45348. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43914 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b436ee19f3
commit
b9ac168134
@ -486,6 +486,9 @@ function wp_default_packages_inline_scripts( &$scripts ) {
|
|||||||
/**
|
/**
|
||||||
* Adds inline scripts required for the TinyMCE in the block editor.
|
* Adds inline scripts required for the TinyMCE in the block editor.
|
||||||
*
|
*
|
||||||
|
* These TinyMCE init settings are used to extend and override the default settings
|
||||||
|
* from `_WP_Editors::default_settings()` for the Classic block.
|
||||||
|
*
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*
|
*
|
||||||
* @global WP_Scripts $wp_scripts
|
* @global WP_Scripts $wp_scripts
|
||||||
@ -493,6 +496,9 @@ function wp_default_packages_inline_scripts( &$scripts ) {
|
|||||||
function wp_tinymce_inline_scripts() {
|
function wp_tinymce_inline_scripts() {
|
||||||
global $wp_scripts;
|
global $wp_scripts;
|
||||||
|
|
||||||
|
/** This filter is documented in wp-includes/class-wp-editor.php */
|
||||||
|
$editor_settings = apply_filters( 'wp_editor_settings', array( 'tinymce' => true ), 'classic-block' );
|
||||||
|
|
||||||
$tinymce_plugins = array(
|
$tinymce_plugins = array(
|
||||||
'charmap',
|
'charmap',
|
||||||
'colorpicker',
|
'colorpicker',
|
||||||
@ -518,6 +524,13 @@ function wp_tinymce_inline_scripts() {
|
|||||||
$tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' );
|
$tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' );
|
||||||
$tinymce_plugins = array_unique( $tinymce_plugins );
|
$tinymce_plugins = array_unique( $tinymce_plugins );
|
||||||
|
|
||||||
|
$disable_captions = false;
|
||||||
|
// Runs after `tiny_mce_plugins` but before `mce_buttons`.
|
||||||
|
/** This filter is documented in wp-admin/includes/media.php */
|
||||||
|
if ( apply_filters( 'disable_captions', '' ) ) {
|
||||||
|
$disable_captions = true;
|
||||||
|
}
|
||||||
|
|
||||||
$toolbar1 = array(
|
$toolbar1 = array(
|
||||||
'formatselect',
|
'formatselect',
|
||||||
'bold',
|
'bold',
|
||||||
@ -572,6 +585,14 @@ function wp_tinymce_inline_scripts() {
|
|||||||
'classic_block_editor' => true,
|
'classic_block_editor' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( $disable_captions ) {
|
||||||
|
$tinymce_settings['wpeditimage_disable_captions'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $editor_settings['tinymce'] ) && is_array( $editor_settings['tinymce'] ) ) {
|
||||||
|
array_merge( $tinymce_settings, $editor_settings['tinymce'] );
|
||||||
|
}
|
||||||
|
|
||||||
/* This filter is documented in wp-includes/class-wp-editor.php */
|
/* This filter is documented in wp-includes/class-wp-editor.php */
|
||||||
$tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' );
|
$tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user