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

Convert to Block replaces any Jetpack gallery with a default gallery #15134

Open
gsallman opened this issue Apr 23, 2019 · 5 comments
Open

Convert to Block replaces any Jetpack gallery with a default gallery #15134

gsallman opened this issue Apr 23, 2019 · 5 comments
Labels
[Feature] Convert to Blocks Internally: "raw handler" [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.

Comments

@gsallman
Copy link

gsallman commented Apr 23, 2019

Describe the bug
Clicking on 'Convert to Blocks' on a pre-gutenberg posts converts Jetpack [gallery] shortcodes
to a 'Guttenberg Gallery'.
To reproduce
Steps to reproduce the behavior:

  1. Create a post in the code editor with a couple of Jetpack rectangular (tiled mosaic) galleries.
  2. Switch to the visual editor
  3. Convert to Blocks
  4. The Jetpack Gallery code is deleted and replaced with the default Guttenberg Gallery function ruining the post's display.

Expected behavior
on converting to blocks Gutenberg should create a classic block with the jetpack gallery shortcode in it.

Screenshots
Original Post:
image
After converting to blocks:
image

Desktop (please complete the following information):

  • Win 10
  • Chrome
  • Version 73.0.3683.103 (Official Build) (64-bit)

Additional context

  • Guttenberg 5.5.0
  • I've searched for similar error reports and cannot find one.
  • The standard Gutenberg Gallery function does not meet the standards I require for displaying images compared to the Jetpack gallery function. Editing old posts and pages is a hugely time-consuming process when Gutenberg mashes up all the image galleries.
@swissspidy swissspidy added [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes. [Feature] Block Transforms Block transforms from one block to another labels Apr 24, 2019
@swissspidy
Copy link
Member

Sounds to me like Jetpack needs to provide a custom block transform to make this work. Gutenberg itself cannot know what Jetpack does with the gallery, so it's the plugin's the responsibility to provide that info IMHO.

@gsallman
Copy link
Author

gsallman commented Apr 24, 2019

Sounds to me like Jetpack needs to provide a custom block transform to make this work. Gutenberg itself cannot know what Jetpack does with the gallery, so it's the plugin's the responsibility to provide that info IMHO.

That's one way of looking at it. I'd like to offer an alternative viewpoint.

The Convert to Blocks function shouldn't convert a Gallery shortcode to a Gallery Block if the shortcode has invalid parameters (That is invalid as far as the original Gallery shortcode is concerned). Gallery shortcodes with invalid parameters should be converted to a shortcode block so that the author can edit any errors in the parameters -- or leave it 'as is' if it is working as intended. The presence of the Jetpack Gallery 'type' parameter makes the shortcode an invalid Gallery shortcode.

If this approach is used then if a site has any plugins (Jetpack, third party or home-brewed) that replace the Gallery shortcode they will not be impacted (assuming they have additional parameters). whereas the current Convert to Block function takes a working post/page and messes it up.

The above approach is also good practice in terms of ensuring the data to be converted is valid before converting it.

@talldan
Copy link
Contributor

talldan commented Aug 8, 2019

This issue is being tracked in the jetpack repo:
#15134

@simison
Copy link
Member

simison commented Jan 20, 2021

We need to add shortcode transform in Jetpack for Tiled gallery shortcodes: Automattic/jetpack#11779

Originally we couldn't, because Gutenberg didn't have mechanism to differentiate between identical shortcodes based on attributes (lots of plugins used to just extend [gallery] shortcode, including Jetpack). That is now possible so just Jetpack side needs sorting.

I think this issue can be closed since there isn't really any action item for Gutenberg. Feel free to re-open if you think it's needed!

@simison simison closed this as completed Jan 20, 2021
@simison
Copy link
Member

simison commented Jan 20, 2021

The Convert to Blocks function shouldn't convert a Gallery shortcode to a Gallery Block if the shortcode has invalid parameters

On second thought, seems like a valid reason to keep this open.

@simison simison reopened this Jan 20, 2021
@ellatrix ellatrix added [Feature] Convert to Blocks Internally: "raw handler" and removed [Feature] Paste [Feature] Block Transforms Block transforms from one block to another labels Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Convert to Blocks Internally: "raw handler" [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.
Projects
None yet
Development

No branches or pull requests

6 participants