-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Post excerpt block - add color, fontSize, lineHeight, and text alignment. #23945
Merged
Addison-Stavlo
merged 12 commits into
master
from
update/post-excerpt-block-color-typrography-flags
Jul 20, 2020
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1e8c93e
add text align
Addison-Stavlo 1af97c8
add wrapper and line-height inherit
Addison-Stavlo 691c73f
php format
Addison-Stavlo 2311564
get this working in site editor?
Addison-Stavlo c477041
set initial readMore, get rid of extra parent component
Addison-Stavlo 55357ca
styles to ensure link color is shown
Addison-Stavlo a62b280
no elipsis
Addison-Stavlo 29f30d5
dont initialize for now /shrug
Addison-Stavlo 404fe64
add custom warning if no post found in context
Addison-Stavlo 1c32d9b
more simple error fix
Addison-Stavlo 5821974
actually we need this warning... otherwise user can edit what cannot …
Addison-Stavlo b0a3cf8
get rid of important
Addison-Stavlo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
.wp-block-post-excerpt__excerpt.is-inline { | ||
display: inline-block; | ||
.wp-block-post-excerpt { | ||
|
||
.wp-block-post-excerpt__excerpt.is-inline { | ||
display: inline-block; | ||
} | ||
|
||
|
||
} | ||
|
||
.wp-block[data-type="core/post-excerpt"].has-link-color .wp-block-post-excerpt a { | ||
color: var(--wp--style--color--link); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need
!important
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either that or more specificity. Since there are a handful of nested elements in this block theme supplied generic link style rules overwrite our link color selection when we also have a background color applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example of rule with higher-specificity and where does it come from? (Just to help with the reasoning)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing (maybe there is a better way to deal with this), but currently I am testing the link colors with the Seedlet-Blocks theme (I can't seem to get the option to show up for 2020/2019-blocks). When a background is applied, the link color selection stops working because of this rule:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this is an area where the theme should adapt its styles. Ideally, with global styles (and the link color feature is part of global styles), the themes don't provide as much detailed CSS but it's more "managed".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering about this as well - Theme styles being too restrictive vs. block styles not defining enough. Although, I was having trouble finding another theme where I could test link colors anymore (I remember previously testing them on one of the 2020/2019/blocks themes but they don't seem present anymore?).
Since link colors in simple blocks such as paragraphs work on Seedlet, I figured these more complex/nested element blocks should adapt their styles accordingly. After all
has-background a
does not seem like a very opinionated rule, and makes sense for a theme to supply a default style for links used in background areas. So perhaps blocks like this need some sort of rule to ensure that if a custom link color is applied at the block level, the nested elements are explicitly given a style rule to properly show that selection?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a Seedlet theme bug, though.
That
:not( .has-background-background-color )
increases the specificity enough to override the block's link color.If you try to remove that
:not()
, you'll see that the block's rule doesn't need the!important
anymore.All the same, you could leave the
:not()
on the theme, and add another class to the block's rule to make the color work without!important
, e.g.AFAIK, this happens because
:not( .class )
works as if it added a.NOT-class
to the selected element.So you'd have
.wp-block-post-author.has-link-color
(2 "classes" of specificity) selected by the editor styles, and something like.has-background.NOT-has-background-background-color
(again, 2 classes of specificity) selected by the theme styles.Since the theme styles are loaded after the editor's, given the same specificity, they prevail.
I'm not entirely sure of the purpose of that
:not( .has-background-background-color )
(defined here: editor, front end), by the way.It basically forces a text color to all text blocks with a background, except those using the
background
palette color as background color.I kinda suspect this selector could be revised in the theme, since there's already an override (editor, front end) for blocks with
p
as root element.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well put, thanks @Copons! Updated 😄