Skip to content
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

Add support for Gutenberg block alignment #131

Merged
merged 1 commit into from
Jul 4, 2020

Conversation

allejo
Copy link
Collaborator

@allejo allejo commented Jul 2, 2020

The HighlightablePlainText component was accidentally creating a new ref each time by calling createRef. We should have been using useRef, which will always return the same ref for us to use on each re-render. Since changing alignment Gutenberg causes a new instance of the component to mount, we shouldn't be creating a new reference each time.

Also added support for using block alignment.

Fixes #128

/cc @grgarside

@allejo allejo requested a review from westonruter July 2, 2020 06:14
src/index.js Outdated
Comment on lines 150 to 154
supports: {
...settings.supports,
align: true,
},

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test code?

Suggested change
supports: {
...settings.supports,
align: true,
},

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, my bad. Removed that commit 👍

Copy link

@MX-Qulin MX-Qulin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass~

Copy link

@grgar grgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this fix!

Copy link
Owner

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@westonruter westonruter merged commit 15e3e5d into develop Jul 4, 2020
@westonruter westonruter deleted the fix/gutenberg-alignment branch July 4, 2020 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding support for align to code block breaks the editor
4 participants