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

Font sizes: update default values #37381

Merged
merged 6 commits into from
Dec 15, 2021
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
9 changes: 2 additions & 7 deletions lib/compat/wordpress-5.9/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@
"slug": "small",
"size": "13px"
},
{
"name": "Normal",
"slug": "normal",
"size": "16px"
},
{
"name": "Medium",
"slug": "medium",
Expand All @@ -215,8 +210,8 @@
"size": "36px"
},
{
"name": "Huge",
"slug": "huge",
"name": "Extra Large",
"slug": "x-large",
"size": "42px"
}
],
Expand Down
12 changes: 12 additions & 0 deletions packages/block-library/src/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
@include background-colors-deprecated();
@include foreground-colors-deprecated();
@include gradient-colors-deprecated();
// This CSS Custom Properties aren't used anymore as defaults,
// but we still need to keep them for backward compatibility.
--wp--preset--font-size--normal: 16px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be defined in the mixin instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to remove the mixin #37381 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Let's add a comment that these are for compatibility as well.

--wp--preset--font-size--huge: 42px;
}

// Font sizes (not used now, kept because of backward compatibility).
Expand All @@ -17,6 +21,14 @@
font-size: 2.625em;
}

.has-normal-font-size {
font-size: var(--wp--preset--font-size--normal) !important;
}

.has-huge-font-size {
font-size: var(--wp--preset--font-size--huge) !important;
}

// Text alignments.
.has-text-align-center {
text-align: center;
Expand Down
12 changes: 12 additions & 0 deletions packages/block-library/src/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
@include background-colors-deprecated();
@include foreground-colors-deprecated();
@include gradient-colors-deprecated();
// This CSS Custom Properties aren't used anymore as defaults,
// but we still need to keep them for backward compatibility.
--wp--preset--font-size--normal: 16px;
--wp--preset--font-size--huge: 42px;
}

// Font sizes (not used now, kept because of backward compatibility).
Expand All @@ -64,6 +68,14 @@
font-size: 42px;
}

.editor-styles-wrapper .has-normal-font-size {
font-size: var(--wp--preset--font-size--normal) !important;
}

.editor-styles-wrapper .has-huge-font-size {
font-size: var(--wp--preset--font-size--huge) !important;
}

/**
* Editor Normalization Styles
*
Expand Down