Add text alignment prop for centering image captions#941
Conversation
|
Hey @etoledom ! 👋 Can you look into the iOS implementation for this when you have some time? I'm hoping we can take some inspiration from how Reat native's |
87549c9 to
0f23262
Compare
|
Thank you @mchowning ! No worries, I'll check the iOS part 👍 |
|
Added a commit that handles text alignment on iOS Aztec Wrapper. Note: New lines on iOS is not yet handled correctly. ref: WordPress/gutenberg#14883 (review) @SergioEstevao could you take a look at the iOS part? |
|
I have tested this via Android emulator (Pixel 2 on API 27). All 7 cases in the description function as expected. However, I observed an issue where the text after the caret is lost after pressing [Backspace] to merge the two lines, followed by pressing [Enter] to split the line back to two. Steps to reproduce:
Expected result: The caption has 2 lines with the text: "Test" on each line. Actual result: The caption has 1 line with the text: "Test", and the 2nd line is empty. Screencast: |
Leaving merge conflict to be resolved manually
|
Thanks for updating the feature branches with the latest from @mkevins: this should be ready for retest. In my testing, the issue you observed is fixed by the latest changes that were pulled in from |
|
I tested the cases again, as well as the previously reported issue, and everything is now working as expected. 🎉 |
SergioEstevao
left a comment
There was a problem hiding this comment.
Tested it on iOS and it's working great.
|
There is some issue with UI Tests on PRs from external contributors. |
|
Great job @mchowning ! 🎉 |


Description
This PR adds a
textAlignproperty to theReactAztecManagerso the text in image captions can be centered. See the companion gutenberg PR for usage on the React Native side.This addresses the loss of center alignment for image captions that was introduced when the image caption was switched to use a
RichTextcomponent.textAlignprop still needs to be completed on iOS.Test Cases
Issue Adding New Lines to Styled Text
One issue that exists on Android is that tapping enter to add a new line to a caption that has styles applied will frequently not move the cursor to the newly created line. I think that this is a broader issue with
RichTextcomponents that span multiple lines (I'm looking at you list blocks), which will be resolved by @hypest's PR Fixing List Block Handling (see my comment on that PR discussing this issue). For that reason, I do not think this issue should block this PR.