-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Unify how editor alignments are applied across blocks #21822
Changes from 5 commits
d945522
2a2069c
93f4883
cd4d52f
09fc8f7
f9906fb
30daa4d
b8a7228
470bd22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
.wp-block-cover-image, | ||
.wp-block-cover { | ||
|
||
&.components-placeholder h2 { | ||
color: inherit; | ||
} | ||
|
@@ -23,13 +22,14 @@ | |
.wp-block-cover__placeholder-background-options { | ||
width: 100%; | ||
} | ||
} | ||
|
||
// Apply max-width to floated items that have no intrinsic width. | ||
[data-align="left"] &, | ||
[data-align="right"] & { | ||
max-width: $content-width / 2; | ||
width: 100%; | ||
} | ||
[data-align="left"] > .wp-block-cover, | ||
[data-align="right"] > .wp-block-cover, | ||
[data-align="left"] > .wp-block-cover-image, | ||
[data-align="right"] > .wp-block-cover-image { | ||
max-width: $content-width / 2; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is width being defined here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just curious, it's not a comment to this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just guessing I believe if we don't do it and align a block (left or right) we won't notice any change as otherwise it will stay with a 100% width |
||
width: 100%; | ||
} | ||
|
||
.block-library-cover__reset-button { | ||
|
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.
This is just needed for the image block now, but we can remove it if ever we refactor it to use the "align" hook instead of a custom implementation.
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.
Can we not use the block context for this?
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'm not sure how you'd do so, retrieve the context value, alter it and add a new provider? It would work but it's also not great code either, I'd rather remove this at some point (after the image refactor).
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.
Actually, we can probably use getEditPropsWrapper
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 meant adding it to
useContext( BlockContext )
below