-
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
Improve dropcap behavior #28685
Improve dropcap behavior #28685
Conversation
Size Change: -108 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
WordPress 5.7 beta 3 and Gutenberg plugin 10. Just looking at the above one can clearly see that this PR fixes a specific aspect. |
A complicated issue indeed. It makes sense to not explicitly set a min height to allow flow around the dropcap, and to have a way to force a clear (in the case of a color or a dropcap in the following paragraph block). Do you think the color 'hack' is obvious enough? Might be more discoverable to add a toggle to the sidebar to allow dropcap floating? Then it can be applied in any usecase. |
Good thought. I could swear we had a ticket somewhere about adding "clear floats" to the Advanced section of the inspector. That would do the same. |
Here you are Joen..:-) |
Nice :D an old one! |
Oh sorry, I thought the rules were from that later PR. Thank you Ella. |
ede1948
to
03d17c0
Compare
The code that this PR reverts was originally meant to fix #18409 (thanks for pointing that out, Ella). As far as I can tell, that issue is addressed both in the master branch, and this PR. Master: This branch: But in addition to that issue no longer being the case, this PR enables two small paragraphs to wrap around the dropcap. Before: After: As such, I'm going to take this out of draft and ask for a review. I think it's a better and simpler solution. |
@@ -14,18 +14,18 @@ import { | |||
InspectorControls, | |||
RichText, | |||
useBlockProps, | |||
getFontSize, | |||
//getFontSize, |
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.
Should comments be removed?
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.
Yes they should 🤦 — Thank you.
03d17c0
to
405e14d
Compare
@@ -28,6 +28,11 @@ | |||
font-style: normal; | |||
} | |||
|
|||
// Prevent the dropcap from breaking out of the box when a background is applied. | |||
p.has-drop-cap.has-background { |
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.
Shouldn't this happen regardless of background?
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.
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.
Always great to remove these hacky workarounds.
f88b781
to
801f614
Compare
This PR is effectively a revert of #18409, and for that reason it needs a good review.
Fixes #10832. Here's the problem: in 18409 a min-height was applied to any paragraph that had a dropcap. This effectively means that if you have a short line of text, the next paragraph in line will not wrap around the dropcap, causing a space in the flow:
This PR fixes that by effectively removing that min-height entirely:
In addition to that, it adds a clearing behavior to paragraphs that have a background color, so that this is possible:
That last bit is a bit contentious, as you might actually want to keep the float behavior, to accomplish this:
That part is being discussed in #10832 (comment).
See also #28685 (comment) for additional examples.