-
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
Image: Add caption positioning #31814
Conversation
@@ -394,6 +397,17 @@ export default function Image( { | |||
</> | |||
); | |||
|
|||
const captionControls = ( | |||
<Fill name="RichText.ToolbarControls.text-color"> |
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 using a reserved slot for text-color,
but we should probably add a custom one for text-alignment.
@@ -557,6 +571,7 @@ export default function Image( { | |||
which causes duplicated image upload. */ } | |||
{ ! temporaryURL && controls } | |||
{ img } | |||
{ isSelected && captionControls } |
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.
The fill is only added when the image block is selected to avoid duplicated controls. When the "Styles" panel is open, or there are other images in the editor.
Probably there's a better way to solve this. 🙇
Size Change: +199 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
Thank you, @ellatrix That makes sense. I will work on an update. Does using |
It's not great. I think we'll need to do something like this first: #31823. |
Closing this in favor of #31823. I think alignment controls can be a part of the new Caption block. |
Description
Adds text alignment control to image caption's inline toolbar.
I'm not 100% sure if this is the best way to add this feature, but I couldn't think of anything else without modifying RichText and having access to block attributes.
I would appreciate the sanity check of new caption positioning styles.
Fixes #12997.
How has this been tested?
Screenshots
CleanShot.2021-05-14.at.09.50.24.mp4
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).