Gutenberg: Create way to manage shared blocks in bulk

Created on 20 Jun 2018  路  10Comments  路  Source: WordPress/gutenberg

It would be nice if there were a way of bulk managing shared blocks within the WP Admin. The main use case is for deletion: currently, one has to insert a shared block before it can be deleted. This makes deleting several shared blocks very cumbersome.

Some requirements:

  • Ability to paginate through more than 100 shared blocks
  • Ability to easily delete multiple shared blocks
  • (Optional) Ability to easily rename a shared block
  • (Optional) Ability to edit the contents of a shared block

Since shared blocks are implemented using a CPT, it might be possible to fulfil these requirements by simply linking users to wp-admin/edit.php?post_type=wp_block.

cc. @mtias

[Feature] Reusable Blocks [Type] Enhancement

All 10 comments

Yes, I like starting simple just with what wp-admin offers for bulk deleting before building custom UI in the block library. Could be just a "cog" icon in the shared blocks panel that links to that view. Not sure if we should disable edit for content, only allowing title edits and deleting.

For me the shared blocks is one of the features who has most potential with Gutenberg. Being able to bulk edit them seems like a no brainer. In my world the best thing would be to let them be treated as any CPT, so you could assign taxonomies to them, set custom post statuses etc. For the project I'm working on we are already (at a very early stage) starting to run in to the problem of having too many shared blocks and no good way of dealing with them.

Been experimenting with a few things here. Some notes:

  • Displaying wp_block posts in WP Admin is easy enough by changing how we register the CPT
  • Removing the _Edit_ and _Add New_ buttons is very hacky but do-able
  • #7453 ties in very nicely with this as it treats shared blocks more like regular CPTs. This means we can edit a shared block in WP Admin using Gutenberg like any old post

    • This lets users edit a shared block and leave it as a draft, which is cool. We have to be careful about handling this though because draft shared blocks is not something we support in the editor

I'm thinking the best path forward is to, for now, expose shared blocks in WP Admin and hackily hide the _Edit_ and _Add New_ buttons. If/when #7453 goes ahead we can revisit this and possibly allow shared blocks to be edited like a regular post.

Sounds like a good initial path for me. Also, others can build on top of it if they want.

Adding needs design here since we'd need to link to the page to manage the post type from the inserter. I imagine a cog button on the shared blocks panel or similar.

A suggestion for the design would be this:

artboard

I put it at the far bottom corner because having in the actual title bar felt like an accidental click was possible.

This looks good to me.

One thing, given it's at the bottom, it could include text next to the icon for clarity.

After deleting 50+ reusable blocks today I can not stress enough the importance of at least some initial implementation of this. It doesn't need to be fancy in my world, just access to wp-admin/edit.php?post_type=wp_block would be plenty good to start with. My 5 cents :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

melchoyce picture melchoyce  路  95Comments

DeveloperWil picture DeveloperWil  路  102Comments

Pikkals picture Pikkals  路  98Comments

azaozz picture azaozz  路  91Comments

tofumatt picture tofumatt  路  86Comments