-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Reusable Blocks: "Manage All Reusable Blocks" single item edit experience #9964
Comments
I 100% vote for adding title and editing support, I see no reason why this shouldnt exist. |
I think an editing experience would be awesome, and also a great opportunity to test/build functionality for streamlining the Gutenberg UI for non-post/page contexts (hiding taxonomies, simplifying the "publish" flow, hiding scheduling/visibility, etc). Barring that, a simple preview would be a nice option, with some kind of message on how to edit the reusable block within Gutenberg. |
I definitely think you should be able to edit a Reusable Block by itself in an instance of the Gutenberg editor. It seems weird that you would have to open or create a post just to edit an existing Reusable Block, regardless of whether you want to create/edit a particular post or not. Actually, I think you should also be able to create Reusable Blocks using an Add New button from the Reusable Blocks list, just like any normal post type. The Divi Builder lets you do this sort of thing with modules/rows/sections saved to its Divi Library: |
To elaborate on my previous comment (and echo a lot of what ZebulanStanphill just wrote): As a reusable block now support multiple blocks there's a bunch of possibilities with using them as templates (additional thought here: It would be great to have the option to import reusable blocks in to posts as regular blocks and skip the "convert to regular block" step). Being able to open/edit/create these templates as a regular CPT would be so sweet! I also think it would be great to have taxonomy support to be able to categorise and filter the blocks. We use Gutenberg for our intranet and we already have 100s (will probably be 1000s in a few weeks) of these blocks. There's a lot of content that we want to re-use all over the place and the reusable blocks in Gutenberg is by far the best implementation of anything like this is Wordpress but in our case the more functionality they have the better. I understand that many users will use it to a less extent than us so many of the features I'm dreaming of could be optional and turned off by default. |
Speaking of which, I made an issue for this: #8403.
I agree that the ability to organize Reusable Blocks with categories and tags would be very useful, particularly when you have a lot of them. Divi lets you create categories for stuff saved in the Divi Library, and I think that the Gutenberg Reusable Blocks should allow for something similar. |
The reusable blocks (templates) are just a regular post type, I wonder how hard it will be to just open Gutenberg with this CPT and edit it like any other CPT supporting |
I have no idea if it's hard or not, but for me it would be the ultimate solution for sure! I guess that would also allow for setting reading and editing exceptions (with the Press Permit plugin) to specific blocks which is something else I'm dreaming of. |
@youknowriad just for kicks a few weeks ago I used the |
Could we show the code editor here? I would LOVE LOVE LOVE a way to just select all the JSON and share it on pastebin. I fully expect someone to create "blockbin.com" or something in that vein, to streamline this process. I think it's going to be huge. |
@chrisvanpatten that sounds like a perfect temp solution for me. You wouldn’t happen to have that code lying around? I’ve looked at the filter documentation but I’m lousy at php and I have no idea what arguments needs to be added to get this funtionallity. Any help would be very appreciated! |
@chrisvanpatten I would also love to see your code for this. +1 to this getting included in Core. |
https://gist.github.com/mrpritchett/06bbec273fd7b6fa658bb3397f8e193c So I've been able to generate a solution that is most of the way there. The above code will give you an admin menu link to the blocks list, you will be able to click and edit both title and blocks in the editor, but the blocks will be broken on whatever page/post you have them on with the error |
Cool! I guess your problem with that editing breaks the blocks is the same cause as this: #5754 |
Or this? #9278 Or those might be the same issue, I dont know hehe |
I'll look into those. I was able to get around it at least as a prototype by using different controllers depending on what context I'm in. Not production-ready code, but it works for now. |
I’ll beta test it for you, I don’t need production ready code, just proof of concepts so I can show people how it (hopefully) will work in the future :) |
The gist above can be placed in your theme's functions.php. Then simply go to the Blocks Admin menu item, create a new reusable block (or modify a pre-existing one) and test that it works both in a page/post editor and on the front end. It works for me. Again, it's not production ready by any means and I wouldn't use it anywhere publicly accessible. |
The gist works great! I also added taxonomy support to make the block list filterable and made wp_block public which enables presspermit permission capabilities so you can have reading and editing exceptions on reusable blocks, worked straight away in both the post editor and when inserting reusable blocks. |
Closed by #10751. |
Related: #9788
As of #9788, we now surface a "Manage All Reusable Blocks" link to post listing of reusable block types more prominently. The primary use case here (one assumes) is for importing, exporting, or deleting reusable blocks. However, when clicking into the detail page for one of these reusable blocks, the user may be left confused as there is nothing for them to edit or preview in the main column of the single reusable block editor. This is technically to be expected because the
wp_block
type does not have theeditor
supports.Proposal: Should we consider adding
editor
and/ortitle
support for the reusable block type? Or at least present the user with some preview of the block? Or an explanation as to why they should not expect to see any content in the main column of the editor? Should we add additional labels to avoid defaults such as "Edit Post"?The main problem seems to be that the original implementation of reusable blocks was made as if they were not intended to be exposed through traditional default scaffolded UI for editing.
The text was updated successfully, but these errors were encountered: