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

When changing a gallery block to multiple images, let the image blocks inherit the gallery alignment #11374

Closed
rowroll opened this issue Nov 1, 2018 · 4 comments · Fixed by #12242
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Feature] Block Transforms Block transforms from one block to another Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Milestone

Comments

@rowroll
Copy link

rowroll commented Nov 1, 2018

Is your feature request related to a problem? Please describe.
My blog is "old school" in that it just posts image after image, each with a caption. In the old editor I upload the images into the Media Library, give them captions, submit them all. Now I have to start a gallery block, upload the images, give them captions, then insert into the page. Then I need to change the gallery block into images, except the images all appear left aligned (breaking the style sheet?) and I have to individually align each image block to be the centered.

Describe the solution you'd like
I can give the gallery an alignment, then explode it into image blocks, and all the image blocks inherit that alignment.

Describe alternatives you've considered
Let me set the image blocks to be center aligned by default.

@designsimply designsimply added [Type] Enhancement A suggestion for improvement. Needs Testing Needs further testing to be confirmed. [Block] Gallery Affects the Gallery Block - used to display groups of images labels Nov 5, 2018
@designsimply
Copy link
Member

I think it's a good request. I tested and confirmed with WordPress 4.9.8 and Gutenberg 4.2.0 using Firefox 63.0.1 on macOS 10.13.6 that when you convert a gallery into images the alignment is not preserved. (1m50s)

@designsimply designsimply added Good First Issue An issue that's suitable for someone looking to contribute for the first time [Feature] Block Transforms Block transforms from one block to another and removed Needs Testing Needs further testing to be confirmed. labels Nov 7, 2018
andreilupu added a commit to andreilupu/gutenberg that referenced this issue Nov 9, 2018
@andreilupu
Copy link
Contributor

I've created a PR which makes the alignment to be persistent during a block conversion.

While I was testing it, I start having some thoughts about: "What about when transforming an image to a gallery?"

In my rush, I tried to make it work for vice-versa too, but when multiple images and each one has it's own alignment, which one should decide our new gallery alignment? Picking the alignment of the first image may sound like an answer, but it's too magic and inconsistent.

Curious about what do you think about this.

@rowroll
Copy link
Author

rowroll commented Nov 12, 2018

Hi,

I did not realize that it was possible to change images to a gallery, but yes, sure enough, that seems to work. I would expect the gallery to inherit the alignment of the images if they are all the same, but have no alignment if they differ. It's easy to add an alignment if needed to a gallery.

@youknowriad
Copy link
Contributor

We can just use the simplest approach as a start, if we're transforming one image, use the same alignment, if more than one, just ignore the alignment. The proposal by @rowroll is reasonable as well.

andreilupu added a commit to andreilupu/gutenberg that referenced this issue Nov 21, 2018
andreilupu added a commit to andreilupu/gutenberg that referenced this issue Nov 21, 2018
andreilupu added a commit to andreilupu/gutenberg that referenced this issue Nov 21, 2018
andreilupu added a commit to andreilupu/gutenberg that referenced this issue Nov 22, 2018
@jorgefilipecosta jorgefilipecosta added the [Status] In Progress Tracking issues with work in progress label Dec 3, 2018
@youknowriad youknowriad added this to the Future: 5.x milestone Dec 19, 2018
youknowriad pushed a commit that referenced this issue Dec 20, 2018
…rsa (#12242)

* Persist alignment when transforming a gallery to an image and vice-versa.

For #11374

* Optimize loop itteration for #12242
youknowriad pushed a commit that referenced this issue Jan 9, 2019
…rsa (#12242)

* Persist alignment when transforming a gallery to an image and vice-versa.

For #11374

* Optimize loop itteration for #12242
youknowriad pushed a commit that referenced this issue Jan 9, 2019
…rsa (#12242)

* Persist alignment when transforming a gallery to an image and vice-versa.

For #11374

* Optimize loop itteration for #12242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Feature] Block Transforms Block transforms from one block to another Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants