Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only disable wpautop on the main TinyMCE instance for the page #8229

Merged
merged 6 commits into from
Jul 30, 2018
11 changes: 6 additions & 5 deletions lib/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,19 @@ function _gutenberg_utf8_split( $str ) {
* Disables wpautop behavior in classic editor when post contains blocks, to
* prevent removep from invalidating paragraph blocks.
*
* @param array $settings Original editor settings.
* @return array Filtered settings.
* @param array $settings Original editor settings.
* @param string $editor_id ID for the editor instance.
* @return array Filtered settings.
*/
function gutenberg_disable_editor_settings_wpautop( $settings ) {
function gutenberg_disable_editor_settings_wpautop( $settings, $editor_id ) {
$post = get_post();
if ( is_object( $post ) && gutenberg_post_has_blocks( $post ) ) {
if ( 'content' === $editor_id && is_object( $post ) && gutenberg_post_has_blocks( $post ) ) {
$settings['wpautop'] = false;
}

return $settings;
}
add_filter( 'wp_editor_settings', 'gutenberg_disable_editor_settings_wpautop' );
add_filter( 'wp_editor_settings', 'gutenberg_disable_editor_settings_wpautop', 10, 2 );

/**
* Add TinyMCE fixes for the Classic Editor.
Expand Down