Skip to content

Commit

Permalink
Only disable wpautop on the main TinyMCE instance for the page (#8229)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored and pento committed Jul 30, 2018
1 parent cbae73c commit 2d54b09
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit 2d54b09

Please sign in to comment.