From 017af056a2bfc412e7a325a006367b9407669cc7 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Wed, 19 Oct 2022 12:58:28 +0200 Subject: [PATCH 1/4] File block: Add spacing support --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/file/block.json | 13 ++++++++++++- packages/block-library/src/file/style.scss | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 75b4850e678c43..efe55c5b56adc4 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -248,7 +248,7 @@ Add a link to a downloadable file. ([Source](https://github.com/WordPress/gutenb - **Name:** core/file - **Category:** media -- **Supports:** align, anchor +- **Supports:** align, anchor, spacing (margin, padding) - **Attributes:** displayPreview, downloadButtonText, fileId, fileName, href, id, previewHeight, showDownloadButton, textLinkHref, textLinkTarget ## Classic diff --git a/packages/block-library/src/file/block.json b/packages/block-library/src/file/block.json index 8e90825a64dfd4..ae7e06a88030cd 100644 --- a/packages/block-library/src/file/block.json +++ b/packages/block-library/src/file/block.json @@ -56,7 +56,18 @@ }, "supports": { "anchor": true, - "align": true + "align": true, + "spacing": { + "margin": true, + "padding": true + }, + "__experimentalStyle": { + "spacing": { + "margin": { + "bottom": "1.5em" + } + } + } }, "viewScript": "file:./view.min.js", "editorStyle": "wp-block-file-editor", diff --git a/packages/block-library/src/file/style.scss b/packages/block-library/src/file/style.scss index 3d3dc9b8ced481..f58599910f7540 100644 --- a/packages/block-library/src/file/style.scss +++ b/packages/block-library/src/file/style.scss @@ -1,5 +1,6 @@ .wp-block-file { - margin-bottom: 1.5em; + // This block has customizable padding, border-box makes that more predictable. + box-sizing: border-box; &:not(.wp-element-button) { font-size: 0.8em; From ec8bbe69aafb56e6730d80e1fd408a0b3d949036 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 14 Mar 2023 07:30:19 +0100 Subject: [PATCH 2/4] tentatively add margin to classic.scss --- packages/block-library/src/classic.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/block-library/src/classic.scss b/packages/block-library/src/classic.scss index 3156786cb2b2ed..cb7c3284fe87c1 100644 --- a/packages/block-library/src/classic.scss +++ b/packages/block-library/src/classic.scss @@ -14,6 +14,10 @@ font-size: 1.125em; } +.wp-block-file { + margin-bottom: "1.5em"; +} + .wp-block-file__button { background: #32373c; color: $white; From 6c59b40292b52b2a588c4c761a7bb6c7e62c8d32 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 14 Mar 2023 07:30:43 +0100 Subject: [PATCH 3/4] Update classic.scss --- packages/block-library/src/classic.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/classic.scss b/packages/block-library/src/classic.scss index cb7c3284fe87c1..33273b959d4578 100644 --- a/packages/block-library/src/classic.scss +++ b/packages/block-library/src/classic.scss @@ -15,7 +15,7 @@ } .wp-block-file { - margin-bottom: "1.5em"; + margin-bottom: 1.5em; } .wp-block-file__button { From b8bb5c2dca08afda5ee4d100b5fe584170ea1d51 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Mon, 24 Jul 2023 09:56:28 +0200 Subject: [PATCH 4/4] Remove experimental bottom margin --- packages/block-library/src/classic.scss | 4 ---- packages/block-library/src/file/block.json | 7 ------- 2 files changed, 11 deletions(-) diff --git a/packages/block-library/src/classic.scss b/packages/block-library/src/classic.scss index 33273b959d4578..3156786cb2b2ed 100644 --- a/packages/block-library/src/classic.scss +++ b/packages/block-library/src/classic.scss @@ -14,10 +14,6 @@ font-size: 1.125em; } -.wp-block-file { - margin-bottom: 1.5em; -} - .wp-block-file__button { background: #32373c; color: $white; diff --git a/packages/block-library/src/file/block.json b/packages/block-library/src/file/block.json index d48629c7970a47..576fe34f5cf8f7 100644 --- a/packages/block-library/src/file/block.json +++ b/packages/block-library/src/file/block.json @@ -61,13 +61,6 @@ "margin": true, "padding": true }, - "__experimentalStyle": { - "spacing": { - "margin": { - "bottom": "1.5em" - } - } - }, "color": { "gradients": true, "link": true,