Open gsallman opened 5 years ago
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.
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.
This issue is being tracked in the jetpack repo: https://github.com/WordPress/gutenberg/issues/15134
We need to add shortcode transform in Jetpack for Tiled gallery shortcodes: https://github.com/Automattic/jetpack/issues/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!
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.
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:
Expected behavior on converting to blocks Gutenberg should create a classic block with the jetpack gallery shortcode in it.
Screenshots Original Post:
After converting to blocks:
![image](https://user-images.githubusercontent.com/5794634/56622042-365cfc80-65f4-11e9-8975-447b02020e7e.png)
Desktop (please complete the following information):
Additional context