Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block CSS: Move CSS from the stylesheet to the block definition #41689

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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