From a01f00b5049e42c3418165078905582ef35ab9c4 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Mon, 30 Jan 2023 19:41:36 +0100 Subject: [PATCH] fix tinymce body margin --- inc/editor.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/inc/editor.php b/inc/editor.php index b180b51f..1302144d 100644 --- a/inc/editor.php +++ b/inc/editor.php @@ -82,6 +82,18 @@ if ( ! function_exists( 'understrap_tiny_mce_before_init' ) ) { } $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; } }