From 345b61b3d48deaf8757ec3f098ddf26c77a8bf75 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Thu, 18 Aug 2022 16:43:53 -0400 Subject: [PATCH 1/2] Add the `entry-content` class on to the preview's wrapper div --- .../themes/pattern-directory/src/components/iframe/index.js | 4 +++- .../src/components/pattern-preview/canvas.js | 1 + .../src/components/pattern-thumbnail/canvas.js | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public_html/wp-content/themes/pattern-directory/src/components/iframe/index.js b/public_html/wp-content/themes/pattern-directory/src/components/iframe/index.js index e9062cc10..a89b20ac1 100644 --- a/public_html/wp-content/themes/pattern-directory/src/components/iframe/index.js +++ b/public_html/wp-content/themes/pattern-directory/src/components/iframe/index.js @@ -104,6 +104,9 @@ function Iframe( align-items: center; justify-content: center; background-color: white; + /* Override the Twenty Twenty-One sizes with our custom sizes. */ + --responsive--aligndefault-width: 800px; + --responsive--alignwide-width: 1000px; } .${ BODY_CLASS_NAME } { padding: 0; @@ -136,7 +139,6 @@ function Iframe( } setHead( contentDocument, headHTML ); - setBodyClassName( contentDocument ); bubbleEvents( contentDocument ); setBodyClassName( contentDocument ); setIframeDocument( contentDocument ); diff --git a/public_html/wp-content/themes/pattern-directory/src/components/pattern-preview/canvas.js b/public_html/wp-content/themes/pattern-directory/src/components/pattern-preview/canvas.js index f8867dfbd..9b1e98fa1 100644 --- a/public_html/wp-content/themes/pattern-directory/src/components/pattern-preview/canvas.js +++ b/public_html/wp-content/themes/pattern-directory/src/components/pattern-preview/canvas.js @@ -19,6 +19,7 @@ function Canvas( { html } ) { headHTML={ window.__editorStyles.html } >
Date: Thu, 18 Aug 2022 16:44:39 -0400 Subject: [PATCH 2/2] Remove the style overrides from the editorStyles settings This is not necessary now that the preview wrapper divs have the `entry-content` class, the default styles will apply. --- .../wp-content/themes/pattern-directory/functions.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/public_html/wp-content/themes/pattern-directory/functions.php b/public_html/wp-content/themes/pattern-directory/functions.php index 9e4833b6c..e40356134 100644 --- a/public_html/wp-content/themes/pattern-directory/functions.php +++ b/public_html/wp-content/themes/pattern-directory/functions.php @@ -150,13 +150,6 @@ function generate_block_editor_styles_html() { wp_styles()->do_items( $handles ); wp_styles()->done = $done; - // Build up the alignment styles to match the layout set in theme.json. - // See https://github.com/WordPress/gutenberg/blob/9d4b83cbbafcd6c6cbd20c86b572f458fc65ff16/lib/block-supports/layout.php#L38 - $block_gap = wp_get_global_styles( array( 'spacing', 'blockGap' ) ); - $layout = wp_get_global_settings( array( 'layout' ) ); - $style = gutenberg_get_layout_style( 'body > div', $layout, true, $block_gap ); - echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - wp_add_inline_script( 'wporg-pattern-script', sprintf(