From 79027152ee281ee08449309a1dbd9dc890292ef4 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Mon, 13 Jun 2022 12:48:10 +0100 Subject: [PATCH] Block CSS: Move CSS from the stylesheet to the block definition --- packages/block-library/src/audio/block.json | 7 ++++++- packages/block-library/src/audio/style.scss | 2 -- packages/block-library/src/embed/block.json | 7 ++++++- packages/block-library/src/embed/style.scss | 1 - packages/block-library/src/image/block.json | 5 +++++ packages/block-library/src/image/style.scss | 2 -- packages/block-library/src/table/block.json | 7 ++++++- packages/block-library/src/table/style.scss | 1 - packages/block-library/src/video/block.json | 7 ++++++- packages/block-library/src/video/style.scss | 2 -- 10 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/block-library/src/audio/block.json b/packages/block-library/src/audio/block.json index 0dfe83855844a..62d79826b4a45 100644 --- a/packages/block-library/src/audio/block.json +++ b/packages/block-library/src/audio/block.json @@ -43,7 +43,12 @@ }, "supports": { "anchor": true, - "align": true + "align": true, + "__experimentalStyle": { + "spacing": { + "margin": "0 0 1em 0" + } + } }, "editorStyle": "wp-block-audio-editor", "style": "wp-block-audio" diff --git a/packages/block-library/src/audio/style.scss b/packages/block-library/src/audio/style.scss index 5ae37a0b2b7ad..64d79cafd85dc 100644 --- a/packages/block-library/src/audio/style.scss +++ b/packages/block-library/src/audio/style.scss @@ -1,6 +1,4 @@ .wp-block-audio { - margin: 0 0 1em 0; - // Supply caption styles to audio blocks, even if the theme hasn't opted in. // Reason being: the new markup, , are not likely to be styled in the majority of existing themes, // so we supply the styles so as to not appear broken or unstyled in those themes. diff --git a/packages/block-library/src/embed/block.json b/packages/block-library/src/embed/block.json index 7257b54cf20fa..f8d8c3206d017 100644 --- a/packages/block-library/src/embed/block.json +++ b/packages/block-library/src/embed/block.json @@ -35,7 +35,12 @@ } }, "supports": { - "align": true + "align": true, + "__experimentalStyle": { + "spacing": { + "margin": "0 0 1em 0" + } + } }, "editorStyle": "wp-block-embed-editor", "style": "wp-block-embed" diff --git a/packages/block-library/src/embed/style.scss b/packages/block-library/src/embed/style.scss index 30ab048529ef2..31e248ec006dc 100644 --- a/packages/block-library/src/embed/style.scss +++ b/packages/block-library/src/embed/style.scss @@ -20,7 +20,6 @@ } .wp-block-embed { - margin: 0 0 1em 0; overflow-wrap: break-word; // Break long strings of text without spaces so they don't overflow the block. // Supply caption styles to embeds, even if the theme hasn't opted in. diff --git a/packages/block-library/src/image/block.json b/packages/block-library/src/image/block.json index 0cc46aaf311d5..2549206104821 100644 --- a/packages/block-library/src/image/block.json +++ b/packages/block-library/src/image/block.json @@ -88,6 +88,11 @@ "__experimentalDefaultControls": { "radius": true } + }, + "__experimentalStyle": { + "spacing": { + "margin": "0 0 1em 0" + } } }, "styles": [ diff --git a/packages/block-library/src/image/style.scss b/packages/block-library/src/image/style.scss index cbbe939c2425b..65072b0050ff0 100644 --- a/packages/block-library/src/image/style.scss +++ b/packages/block-library/src/image/style.scss @@ -1,6 +1,4 @@ .wp-block-image { - margin: 0 0 1em 0; - img { height: auto; max-width: 100%; diff --git a/packages/block-library/src/table/block.json b/packages/block-library/src/table/block.json index d19d260249e02..8591813d67629 100644 --- a/packages/block-library/src/table/block.json +++ b/packages/block-library/src/table/block.json @@ -156,7 +156,12 @@ "width": true } }, - "__experimentalSelector": ".wp-block-table > table" + "__experimentalSelector": ".wp-block-table > table", + "__experimentalStyle": { + "spacing": { + "margin": "0 0 1em 0" + } + } }, "styles": [ { diff --git a/packages/block-library/src/table/style.scss b/packages/block-library/src/table/style.scss index 52ff4f640aac8..ffc7ad266c6f7 100644 --- a/packages/block-library/src/table/style.scss +++ b/packages/block-library/src/table/style.scss @@ -1,5 +1,4 @@ .wp-block-table { - margin: 0 0 1em 0; $subtle-light-gray: #f3f4f5; $subtle-pale-green: #e9fbe5; $subtle-pale-blue: #e7f5fe; diff --git a/packages/block-library/src/video/block.json b/packages/block-library/src/video/block.json index f5274ed833d20..f609996d85852 100644 --- a/packages/block-library/src/video/block.json +++ b/packages/block-library/src/video/block.json @@ -76,7 +76,12 @@ }, "supports": { "anchor": true, - "align": true + "align": true, + "__experimentalStyle": { + "spacing": { + "margin": "0 0 1em 0" + } + } }, "editorStyle": "wp-block-video-editor", "style": "wp-block-video" diff --git a/packages/block-library/src/video/style.scss b/packages/block-library/src/video/style.scss index 4a91c07fee90f..9e98626441808 100644 --- a/packages/block-library/src/video/style.scss +++ b/packages/block-library/src/video/style.scss @@ -1,6 +1,4 @@ .wp-block-video { - margin: 0 0 1em 0; - video { width: 100%; }