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

Make it easier to insert Block Pattern with keyboard #59513

Open
MadtownLems opened this issue Mar 1, 2024 · 4 comments
Open

Make it easier to insert Block Pattern with keyboard #59513

MadtownLems opened this issue Mar 1, 2024 · 4 comments
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Enhancement A suggestion for improvement.

Comments

@MadtownLems
Copy link

What problem does this address?

It's pretty easy to add most blocks while typing, by typing stuff like /heading. I'd love to be able to trigger the Pattern inserter in a similar way.

What is your proposed solution?

I have two proposed solutions, and I think both can co-exist.

  1. I think that "Pattern" should be one of the autocomplete things in the popup that appears when you hit / and start typing "pattern". Upon selecting it, it would launch the pattern viewer dialog. This thing:
    pattern-insert

  2. There could also be a standard keyboard shortcut for popping open the pattern inserter dialog.

@MadtownLems MadtownLems added the [Type] Enhancement A suggestion for improvement. label Mar 1, 2024
@jordesign jordesign added the [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced label Mar 3, 2024
@annezazu
Copy link
Contributor

annezazu commented Mar 4, 2024

Hey there! This came up previously in this issue that was later closed: #26116 Right now, you can search for patterns you've created using the slash inserter by searching for the name. I'd recommend closing this out as a result as the functionality it seems you want (to insert block patterns with a keyboard) exists unless I'm missing something. I'll await to hear back :)

@ndiego
Copy link
Member

ndiego commented Mar 4, 2024

I personally still think this would be useful. I never remember the name of a pattern and find myself trying to type /patt… all the time. A keyboard shortcut could work too.

@andersnoren
Copy link

andersnoren commented Apr 5, 2024

I'd love to see this as well.

Currently, it seems like patterns are only surfaced in the quick inserter if they are created by the user in the editor and stored in the database. Unless I'm missing something, patterns included in the theme (whether in /patterns/ or registered with register_block_pattern()) can't be surfaced in the quick inserter at all.

I'd propose that theme patterns be included in the quick inserter by default, unless the pattern is set to Inserter: no. We could also add a new Quick inserter setting that's defaulted to false, if we want it to be opt-in, but since user-created patterns are already included, including the theme patterns as well seems more consistent.

Edit: It seems a lot of this was already covered in #26116. After reading that discussion, I think the opt-in solution is a good compromise, since it would allow the theme developer to decide if it makes sense to include a pattern in the quick inserter or not. Full page layouts probably shouldn't be listed in the quick inserter, but there's a case to be made for including simpler content patterns.

@MadtownLems
Copy link
Author

I think opt-in for individual php-based patterns is the way to go, if at all. My fear is that developers won't use it responsibly or tactfully. I see lots of theme developers talking about the massive volume of patterns their themes ship with, and it could easily overload the quick inserter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants