From 4a1d38ea9da68f271d6e8d57ccc9df0b7c0f78f2 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 14 Jul 2023 17:00:04 +0400 Subject: [PATCH 1/3] Try: Avoid copying global style presets via the styles compatibility hook --- packages/block-editor/src/components/block-list/layout.js | 4 ++-- packages/block-editor/src/components/editor-styles/index.js | 4 +++- .../src/components/iframe/use-compatibility-styles.js | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/block-list/layout.js b/packages/block-editor/src/components/block-list/layout.js index d7a9113ebfa0f..2c0073c1fb7a1 100644 --- a/packages/block-editor/src/components/block-list/layout.js +++ b/packages/block-editor/src/components/block-list/layout.js @@ -32,7 +32,7 @@ export function LayoutStyle( { layout = {}, css, ...props } ) { if ( layoutType ) { if ( css ) { - return ; + return ; } const layoutStyle = layoutType.getLayoutStyle?.( { hasBlockGapSupport, @@ -40,7 +40,7 @@ export function LayoutStyle( { layout = {}, css, ...props } ) { ...props, } ); if ( layoutStyle ) { - return ; + return ; } } return null; diff --git a/packages/block-editor/src/components/editor-styles/index.js b/packages/block-editor/src/components/editor-styles/index.js index 66f2a08f115a4..da972d6ec4338 100644 --- a/packages/block-editor/src/components/editor-styles/index.js +++ b/packages/block-editor/src/components/editor-styles/index.js @@ -96,7 +96,9 @@ export default function EditorStyles( { styles } ) { but this could be any element. */ } + ) ) } Date: Mon, 17 Jul 2023 12:39:00 +0400 Subject: [PATCH 2/3] Check for IDs --- .../src/components/iframe/use-compatibility-styles.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/iframe/use-compatibility-styles.js b/packages/block-editor/src/components/iframe/use-compatibility-styles.js index e9867a4f40787..eb738c7ebefdf 100644 --- a/packages/block-editor/src/components/iframe/use-compatibility-styles.js +++ b/packages/block-editor/src/components/iframe/use-compatibility-styles.js @@ -45,8 +45,8 @@ export function useCompatibilityStyles() { return accumulator; } - // Don't try to add global style presets; they're directly rendered in iframe. - if ( ownerNode.dataset.globalStyle === 'preset' ) { + // Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs. + if ( ! ownerNode.id ) { return accumulator; } From ac3765f82c4f82a807d2efc49762787084835090 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 17 Jul 2023 12:40:13 +0400 Subject: [PATCH 3/3] Remove markers --- packages/block-editor/src/components/block-list/layout.js | 4 ++-- packages/block-editor/src/components/editor-styles/index.js | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/components/block-list/layout.js b/packages/block-editor/src/components/block-list/layout.js index 2c0073c1fb7a1..d7a9113ebfa0f 100644 --- a/packages/block-editor/src/components/block-list/layout.js +++ b/packages/block-editor/src/components/block-list/layout.js @@ -32,7 +32,7 @@ export function LayoutStyle( { layout = {}, css, ...props } ) { if ( layoutType ) { if ( css ) { - return ; + return ; } const layoutStyle = layoutType.getLayoutStyle?.( { hasBlockGapSupport, @@ -40,7 +40,7 @@ export function LayoutStyle( { layout = {}, css, ...props } ) { ...props, } ); if ( layoutStyle ) { - return ; + return ; } } return null; diff --git a/packages/block-editor/src/components/editor-styles/index.js b/packages/block-editor/src/components/editor-styles/index.js index da972d6ec4338..66f2a08f115a4 100644 --- a/packages/block-editor/src/components/editor-styles/index.js +++ b/packages/block-editor/src/components/editor-styles/index.js @@ -96,9 +96,7 @@ export default function EditorStyles( { styles } ) { but this could be any element. */ } { transformedStyles.map( ( css, index ) => ( - + ) ) }