Skip to content

Commit

Permalink
Block CSS: Move CSS from the stylesheet to the block definition (#41689)
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Jun 13, 2022
1 parent 6402921 commit 0bf2650
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 12 deletions.
7 changes: 6 additions & 1 deletion packages/block-library/src/audio/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions packages/block-library/src/audio/style.scss
Original file line number Diff line number Diff line change
@@ -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, <figcaptions>, 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.
Expand Down
7 changes: 6 additions & 1 deletion packages/block-library/src/embed/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/embed/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions packages/block-library/src/image/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
"__experimentalDefaultControls": {
"radius": true
}
},
"__experimentalStyle": {
"spacing": {
"margin": "0 0 1em 0"
}
}
},
"styles": [
Expand Down
2 changes: 0 additions & 2 deletions packages/block-library/src/image/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.wp-block-image {
margin: 0 0 1em 0;

img {
height: auto;
max-width: 100%;
Expand Down
7 changes: 6 additions & 1 deletion packages/block-library/src/table/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@
"width": true
}
},
"__experimentalSelector": ".wp-block-table > table"
"__experimentalSelector": ".wp-block-table > table",
"__experimentalStyle": {
"spacing": {
"margin": "0 0 1em 0"
}
}
},
"styles": [
{
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/table/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.wp-block-table {
margin: 0 0 1em 0;
$subtle-light-gray: #f3f4f5;
$subtle-pale-green: #e9fbe5;
$subtle-pale-blue: #e7f5fe;
Expand Down
7 changes: 6 additions & 1 deletion packages/block-library/src/video/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions packages/block-library/src/video/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.wp-block-video {
margin: 0 0 1em 0;

video {
width: 100%;
}
Expand Down

0 comments on commit 0bf2650

Please sign in to comment.