Standardize alignment options for blocks based off of WP widgets #9557
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, the blocks based off of WordPress widgets seem to have little to no consistency in what alignment options they support. One would support all alignments while another only supported left, right, and center. Another would support center, wide, and full, but not left and right.
This PR gets rid of all these inconsistencies by making the blocks based off of WordPress widgets all support every alignment option.
It also simplifies the checks for valid alignment values using the
Array.prototype.includes
function.Additionally, I managed to fix a couple bugs while I was at it:
aligncenter
regardless of what is selected in the toolbar #7910.alignnone
class, which was inconsistent with other blocks.className
attribute used for custom classes was not defined and was not being appended to the outputclass
HTML attribute of the block.)Fixes #7910. Closes #8777. Closes #9413. Solves some cases of #7908, but there are still some cases of that issue that involve non-widget blocks. I think I should tackle those in another PR.