From ebffd55dac642f8cbeae049295eac5b19b70ef20 Mon Sep 17 00:00:00 2001 From: Nick Diego Date: Thu, 10 Feb 2022 12:42:06 -0500 Subject: [PATCH 1/2] Restructure code bock styling. --- packages/block-library/src/code/block.json | 1 - packages/block-library/src/code/theme.scss | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/code/block.json b/packages/block-library/src/code/block.json index 36cacf66069a35..d41657196e4936 100644 --- a/packages/block-library/src/code/block.json +++ b/packages/block-library/src/code/block.json @@ -15,7 +15,6 @@ }, "supports": { "anchor": true, - "__experimentalSelector": ".wp-block-code > code", "typography": { "fontSize": true, "lineHeight": true, diff --git a/packages/block-library/src/code/theme.scss b/packages/block-library/src/code/theme.scss index 6bf155dde65e12..3ee4d8236aa637 100644 --- a/packages/block-library/src/code/theme.scss +++ b/packages/block-library/src/code/theme.scss @@ -1,9 +1,11 @@ .wp-block-code { border: 1px solid #ccc; border-radius: 4px; + font-family: Menlo, Consolas, monaco, monospace; + padding: 0.8em 1em; } +/* Ensures code markup inherits the font-family set on pre. */ .wp-block-code > code { - font-family: Menlo, Consolas, monaco, monospace; - padding: 0.8em 1em; + font-family: inherit; } From 90bab973eed7347c526c6911443fd3936d5a1065 Mon Sep 17 00:00:00 2001 From: Nick Diego Date: Wed, 23 Feb 2022 12:29:18 -0500 Subject: [PATCH 2/2] Move code styling to style.css --- packages/block-library/src/code/style.scss | 6 ++++-- packages/block-library/src/code/theme.scss | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/code/style.scss b/packages/block-library/src/code/style.scss index 35cab12be3c1eb..e8d3b07cd034fa 100644 --- a/packages/block-library/src/code/style.scss +++ b/packages/block-library/src/code/style.scss @@ -1,6 +1,8 @@ -// Provide a minimum of overflow handling. +// Provide a minimum of overflow handling and ensure the code markup inherits +// the font-family set on pre. .wp-block-code code { display: block; - white-space: pre-wrap; + font-family: inherit; overflow-wrap: break-word; + white-space: pre-wrap; } diff --git a/packages/block-library/src/code/theme.scss b/packages/block-library/src/code/theme.scss index 3ee4d8236aa637..668837a1e9fa65 100644 --- a/packages/block-library/src/code/theme.scss +++ b/packages/block-library/src/code/theme.scss @@ -4,8 +4,3 @@ font-family: Menlo, Consolas, monaco, monospace; padding: 0.8em 1em; } - -/* Ensures code markup inherits the font-family set on pre. */ -.wp-block-code > code { - font-family: inherit; -}