Skip to content

Commit

Permalink
Merge pull request #2073 from IanDelMar/classic-editor-body-margin
Browse files Browse the repository at this point in the history
Fix TinyMCE body margin
  • Loading branch information
bacoords committed Oct 9, 2023
2 parents 1a29899 + a01f00b commit 1747a15
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inc/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ function understrap_tiny_mce_before_init( $settings ) {
}

$settings['style_formats'] = wp_json_encode( $style_formats );

/*
* Fix TinyMCE editor body margin that is set to 0 by Bootstrap's
* _reboot.scss (v4 & v5). `margin: 9px 10px` is the value used by WP's
* TinyMCE skin (/wp-includes/js/tinymce/skins/wordpress/wp-content.css).
*/
if ( isset( $settings['content_style'] ) ) {
$settings['content_style'] .= ' body#tinymce { margin: 9px 10px; }';
} else {
$settings['content_style'] = 'body#tinymce { margin: 9px 10px; }';
}

return $settings;
}
}
Expand Down

0 comments on commit 1747a15

Please sign in to comment.