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

Blocks: Add the missing alignments classNames to the Cover Image Block's markup #4060

Merged
merged 1 commit into from Dec 20, 2017

Conversation

Projects
None yet
3 participants
@youknowriad
Contributor

youknowriad commented Dec 18, 2017

closes #2650

Tiny PR adding the missing alignment classNames to the cover image block. It also declares a "deprecated" version to avoid invalidating old cover image blocks.

Testing instructions

  • Declare wide alignment support for your theme:
add_theme_support( 'gutenberg', array(
        'wide-images' => true,
) );
  • Add a cover image
  • Click "full alignment" button
  • Switch to the Code editor, you should see a "alignfull" className on the cover-image's figure wrapper.

@youknowriad youknowriad self-assigned this Dec 18, 2017

@aduth

Seems an extreme change to fix a minor bug 😕 But unless we want to relent that a class name change is not an invalidating change (it could have breaking impact) or that fixing bugs might invalidate old blocks, seems necessary.

Show outdated Hide outdated blocks/library/cover-image/index.js Outdated
@youknowriad

This comment has been minimized.

Show comment
Hide comment
@youknowriad

youknowriad Dec 19, 2017

Contributor

@aduth I think the default value is "center". What if we avoid adding the className if the alignment is "center" and avoid the "deprecated" declaration entirely?

Contributor

youknowriad commented Dec 19, 2017

@aduth I think the default value is "center". What if we avoid adding the className if the alignment is "center" and avoid the "deprecated" declaration entirely?

@aduth

This comment has been minimized.

Show comment
Hide comment
@aduth

aduth Dec 19, 2017

Member

Is the default center? For images it would be alignnone. Not sure if we made a point to be consistent with those defaults across block types (could be relevant for #4069).

Member

aduth commented Dec 19, 2017

Is the default center? For images it would be alignnone. Not sure if we made a point to be consistent with those defaults across block types (could be relevant for #4069).

@youknowriad

This comment has been minimized.

Show comment
Hide comment
@youknowriad

youknowriad Dec 19, 2017

Contributor

mmmm, It's not. I guess I assumed it was "center" because I had a "centered" cover image when testing.

So this makes things easier IMO. We can just drop the "deprecated" declaration as is. This could produce "invalid" blocks but the chance for it to happen is small.

Contributor

youknowriad commented Dec 19, 2017

mmmm, It's not. I guess I assumed it was "center" because I had a "centered" cover image when testing.

So this makes things easier IMO. We can just drop the "deprecated" declaration as is. This could produce "invalid" blocks but the chance for it to happen is small.

@gziolo

This comment has been minimized.

Show comment
Hide comment
@gziolo

gziolo Dec 20, 2017

Member

Yes, I also share the same view. That it is a lot of code to add and process to fix a very small bug for a relatively simple block. We should watch closely how deprecation feature is used for blocks and take an action if this becomes too complicated to manage. On the other hand, maybe we should always copy and paste the version that gets updated but put everything in their own file to make sure it doesn't pollute the existing solution.

The fix itself looks good :)

Member

gziolo commented Dec 20, 2017

Yes, I also share the same view. That it is a lot of code to add and process to fix a very small bug for a relatively simple block. We should watch closely how deprecation feature is used for blocks and take an action if this becomes too complicated to manage. On the other hand, maybe we should always copy and paste the version that gets updated but put everything in their own file to make sure it doesn't pollute the existing solution.

The fix itself looks good :)

@youknowriad

This comment has been minimized.

Show comment
Hide comment
@youknowriad

youknowriad Dec 20, 2017

Contributor

Ok, since the default use-case is not affected, I've removed the deprecated block's definition. What do you think about moving forward as is?

Contributor

youknowriad commented Dec 20, 2017

Ok, since the default use-case is not affected, I've removed the deprecated block's definition. What do you think about moving forward as is?

@gziolo

gziolo approved these changes Dec 20, 2017

Let's apply this as it is :)

@youknowriad youknowriad merged commit ed74c1e into master Dec 20, 2017

3 checks passed

codecov/project 40.16% (+1.22%) compared to 64ac510
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@youknowriad youknowriad deleted the update/cover-image-alignment-classname branch Dec 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment