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

Tiled gallery & slider blocks: conditionally transform shortcodes #11779

Open
simison opened this issue Feb 12, 2019 · 1 comment
Open

Tiled gallery & slider blocks: conditionally transform shortcodes #11779

simison opened this issue Feb 12, 2019 · 1 comment
Labels
[Block] Slideshow [Block] Tiled Gallery [Feature] Shortcodes / Embeds [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack

Comments

@simison
Copy link
Member

simison commented Feb 12, 2019

[gallery] shortcode transform is shared between the core gallery Tiled gallery and Slideshow blocks.

Whichever has higher priority set, happens to win (currently Tiled gallery wins update: shortcode transform from the Tiled gallery block was temporarily removed).

We should conditionally transform to Tiled gallery and Slideshow blocks only when valid layout attribute is set and let core gallery take care of the transform otherwise.

Problem / blocker

Core doesn't currently support using isMatch in shortcode transforms (WordPress/gutenberg#10674 and I don't see a way to divert transformation to some other block conditionally.

The Best way forward seems to get isMatch fixed in core.

isMatch could be something like this for Tiled gallery block:

isMatch: ( { layout } ) => LAYOUT_STYLES.map( style => style.name ).includes( layout )

...and for the slideshow block:

isMatch: ( { layout } ) => layout === 'slideshow'
@simison simison transferred this issue from Automattic/wp-calypso Apr 1, 2019
@simison simison added [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. [Feature] Shortcodes / Embeds [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Block] Slideshow labels Apr 1, 2019
@simison
Copy link
Member Author

simison commented Nov 20, 2019

isMatch for shortcodes (WordPress/gutenberg#18459) is now in so this could be implemented once that's in core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Slideshow [Block] Tiled Gallery [Feature] Shortcodes / Embeds [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack
Projects
None yet
Development

No branches or pull requests

2 participants