From 541e8459be00b55b41aa387acb3de6c3288d9dc9 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 19 Mar 2021 18:05:15 +0100 Subject: [PATCH 1/2] Fix paragraph margin specificity inside layout containers --- .../block-editor/src/components/block-list/layout.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-list/layout.js b/packages/block-editor/src/components/block-list/layout.js index 88d35a59a0ebb5..f1940e0f41592a 100644 --- a/packages/block-editor/src/components/block-list/layout.js +++ b/packages/block-editor/src/components/block-list/layout.js @@ -8,9 +8,18 @@ export const defaultLayout = { type: 'default' }; const Layout = createContext( defaultLayout ); function appendSelectors( selectors, append ) { + // Ideally we shouldn't need the `.editor-styles-wrapper` increased specificity here + // The problem though is that we have a `.editor-styles-wrapper p { margin: reset; }` style + // it's used to reset the default margin added by wp-admin to paragraphs + // so we need this to be higher speficity otherwise, it won't be applied to paragraphs inside containers + // When the post editor is fully iframed, this extra classname could be removed. + return selectors .split( ',' ) - .map( ( subselector ) => subselector + ' ' + append ) + .map( + ( subselector ) => + '.editor-styles-wrapper ' + subselector + ' ' + append + ) .join( ',' ); } From cd41b0c244737d5c7079b43011e77606a9a84dd5 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 22 Mar 2021 10:40:09 +0100 Subject: [PATCH 2/2] Code style improvement --- packages/block-editor/src/components/block-list/layout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-list/layout.js b/packages/block-editor/src/components/block-list/layout.js index f1940e0f41592a..3f898ae12c02fe 100644 --- a/packages/block-editor/src/components/block-list/layout.js +++ b/packages/block-editor/src/components/block-list/layout.js @@ -18,7 +18,7 @@ function appendSelectors( selectors, append ) { .split( ',' ) .map( ( subselector ) => - '.editor-styles-wrapper ' + subselector + ' ' + append + `.editor-styles-wrapper ${ subselector } ${ append }` ) .join( ',' ); }