Use supports align in cover block to fix some align related bugs; #12878
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.
Fixes: #12333
Description
The cover block was not using the supports align mechanism, replicating its code on the block itself (when the block was created, I think the mechanism did not exist).
The supports align mechanism was improved with time, to for example not show wide and full alignments on the editor if the theme does not supports them.
As the cover block did not use the align mechanism it has not the logic to check wide and full theme support.
This causes two problems:
How has this been tested?
I copied the following blocks with all the possible alignments to a new post in a theme that does not support wide alignments:
This blocks were created with wordpress 5.0.1, to make sure we are not changing the markup and invalidating previous blocks.
I verified the wide and full blocks appear as standard blocks.
I published the post with all these blocks.
I changed to a theme that supports wide and full alignments, I opened the post again and verified the wide, and full blocks now appear as wide and full.