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
Heading block: Add support for writingMode #54351
Conversation
The extra editor.scss shouldn't be needed. Can someone tell me why or help by pointing out where to fix this issue?: Meaning, that I need to use two different selectors to make the text rotation work, in this case, it meant adding the new editor.scss file. |
Size Change: +405 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
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.
Thanks for the PR @carolinan ! It's working well; I left a couple suggestions below about the selector.
@@ -7,4 +7,8 @@ h6 { | |||
&.has-background { | |||
padding: $block-bg-padding--v $block-bg-padding--h; | |||
} | |||
&.has-text-align-right[style*="writing-mode:vertical-rl"], | |||
&.has-text-align-left[style*="writing-mode:vertical-lr"] { |
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.
We could make make this selector disregard the space by changing it to
&.has-text-align-right[style*="writing-mode"]:where([style*="vertical-rl"]),
&.has-text-align-left[style*="writing-mode"]:where([style*="vertical-lr"])
Alternatively we could drop the writing-mode
altogether and just have e.g. &.has-text-align-right[style*="vertical-rl"]
as I believe writing-mode
is the only CSS property that accepts vertical-rl
and vertical-lr
values. That could break in the future if these values become valid for other properties though 😅
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 deleted my previous comment because I did not read the code correctly :)
It is working! Thank you.
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.
LGTM!
What?
Adds block support for typography writingMode to the heading block.
Why?
To enable vertical text for headings.
This is needed for one of the block patterns in Twenty Twenty-Four.
Testing Instructions
Activate a block theme.
The writing mode setting is disabled by default; set it to true in theme.json settings > typography > writingMode:
Create a new post or page, and add a heading block.
Enable the vertical text orientation option in the typography panel.
Save and view the front.
Confirm that the text is now vertical in the editor and the front.
Use the block toolbar and set the text alignment to right (ltr) or left (rtl).
Confirm that the text is now "upside down": the first letter in the heading is at the bottom.
Screenshot