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 ability to transform between Image and Cover Image blocks #6475

Closed
chrisvanpatten opened this issue Apr 27, 2018 · 7 comments · Fixed by #9743
Closed

Add ability to transform between Image and Cover Image blocks #6475

chrisvanpatten opened this issue Apr 27, 2018 · 7 comments · Fixed by #9743
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Block] Image Affects the Image Block [Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement.

Comments

@chrisvanpatten
Copy link
Member

chrisvanpatten commented Apr 27, 2018

Issue Overview

Currently, it's not possible to transform between the Image and Cover Image blocks.

These seem like natural candidates for a mutual transform because they're essentially both an image ID plus text, although one displays it over the top of the image, of course:

Image block:
untitled___ chris_van_patten _wordpress

Cover Image block:
untitled___ chris_van_patten _wordpress

Steps to Reproduce (for bugs)

  1. Insert an Image or Cover Image block
  2. Try to transform it to the other block
  3. Find that you can't :)

Expected Behavior

You should be able to transform between the two!

Current Behavior

Currently, an Image block can only be transformed into a Gallery block, and a Cover Image block can only be transformed into a Heading block.

Possible Solution

Enable transformation between these two blocks, mapping…

  • Image ←→ Cover Image (background)
  • Caption ←→ Cover Image Text

Presumably, block alignment could also be carried over, along with the caption's formatting (excluding alignment, which is possible in the Cover Image Text but not in image captions).

Fixed background and dimness settings would be either discarded (if transforming to Image) or set to the defaults (if transforming to Cover Image).

Related Issues and/or PRs

This was inspired by #5683.

@chrisvanpatten
Copy link
Member Author

Just realised this is probably slightly reduced in scope a bit by #5452, although I think you could still theoretically still do Image → Cover Image; just convert the image caption to a paragraph block inside Cover Image.

@karmatosed
Copy link
Member

I can see this as a good enhancement to make and add to the list for transforms, it makes sense and thanks for suggesting.

@karmatosed karmatosed added the [Type] Enhancement A suggestion for improvement. label Apr 28, 2018
@karmatosed karmatosed added this to the Merge Proposal: Editor milestone Apr 28, 2018
@youknowriad
Copy link
Contributor

We're thinking of adding nested support to the cover image block, which will make this transformation less "natural". Do you think it's fine to transform only the image and drop the citation/text?

@chrisvanpatten
Copy link
Member Author

@youknowriad less natural in which direction?

Here's what I'd envision:

Image → Cover Image

Sets Image as the Cover Image, and converts the caption to a nested Paragraph block inside Cover Image

Cover Image → Image

This one is a bit trickier but probably the most logical approach is that it actually converts to Image, and then any of the nested blocks are added below the image.

To be honest I'm not sure it's actually possible to transform one block to many with the current API, but if it is, I think this approach makes sense. It's non-destructive and I think pretty natural.

@youknowriad
Copy link
Contributor

Sounds good to me @chrisvanpatten I didn't think about adding those as blocks following the image block, but it also means you can't go back.

@chrisvanpatten
Copy link
Member Author

At the risk of blowing everything up, is there a world in which the image caption also supports nested blocks?

I can imagine a world when someone might want a heading in a caption, e.g. a "Figure 1" and then the caption text below that.

If image caption becomes a nested block, that obviously makes it possible to go seamlessly back and forth… although that could introduce other back-compat issues I have definitely not thought about.

@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented May 11, 2018

To be honest I'm not sure it's actually possible to transform one block to many with the current API, but if it is, I think this approach makes sense. It's non-destructive and I think pretty natural.

@chrisvanpatten This is already possible; the Gallery block does it when you convert it to Image blocks. Many to one works as well: if you select multiple Image blocks, you can transform them into a Gallery block via the More Options ellipsis menu.

(On a side note, when the transforms are removed from More Options (see #6449), how will you be able to do this? Will the block toolbar be available in the multiple block selection?)

@designsimply designsimply added the [Feature] Blocks Overall functionality of blocks label Jul 17, 2018
@mtias mtias removed this from the Merge Proposal: Editor milestone Jul 19, 2018
@kjellr kjellr mentioned this issue Jul 25, 2018
7 tasks
@sarahmonster sarahmonster mentioned this issue Aug 2, 2018
11 tasks
@sarahmonster sarahmonster added [Block] Image Affects the Image Block [Block] Cover Affects the Cover Block - used to display content laid over a background image labels Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Block] Image Affects the Image Block [Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants