-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Add ability to delete a Reusable Block #3792
Comments
I know @karmatosed has some thoughts on this. My instincts go along this route: have a new section dedicated to re-usable blocks that lives in the ellipsis menu. This ellipsis menu item could take you to a completely separate "screen takeover" section, that lists all your reusable blocks with options to delete either. This could also provide a more relaxed interface for renaming or even editing the blocks, as I'm sure future enhancements are likely to require some real estate. Here are mockups for configuring "Publicize" as an extensibility pattern, something similar could be used here: The chief downside with the above is that it's a lot of new work. An alternative, for now, would be to simply add the "delete block" item to the block ellipsis menu: |
@jasmussen wouldn't it be alright to add a trash button to this mode? I agree with having a view for managing all the reusable blocks down the line. Another thinking is how to categorize them. I'd love for this to be less user involved. Say if you have 20 reusable blocks of type x, that we automatically group them under a category in the "saved" blocks panel in the inserter. If you have a mix of types and only 5 blocks, it's ok to just let them mix. The other thing is allowing the original icon to persist instead of forcing the icon to be the same. |
All of those ideas sound good to me, provided we can
Given how important this feature feels, I suspect it'll be important to have a nice big screen section to manage these from a central location. |
Indeed. The next generation of the Widgets admin screen. |
Just an idea, could the front-end remove the block if it's been removed, not render if the block doesn't exist, and then just add an admin ui to wherever you're storing blocks? I have a plugin that delivers the same concept as re-usable blocks. You cannot delete one from a post, just from the admin area. I've maintained it since 2015 (the code is from early 2014), and it has a visual editor integration using oEmbed. It does add some non-visual content in the case a block is not present (for debugging). But as it's implemented via CPT you get the benefit of powerful content and a deleted folder (users have to be really determined to ensure it's really deleted). |
To my understanding, it is also possible that some reusable blocks will be "orphaned", meaning saved in the database but not currently used anywhere. That's when they're "detached" but the If so, a dedicated UI to manage reusable blocks separately does make even more sense, as it would be the only place in the UI where they can be managed. |
I am also experiencing this issue, but want to give some more context to the issue. As an admin/user, not a developer, I expect reusable blocks to be one of the primary ways we give clients templates in a usable way (I know we can create blocks but the average admin isn't going to do that,.) |
I'm confused. This issue is marked as "closed", but I can't find (by poking around in WordPress or by searching the internet for docs) any way to edit or delete a reusable block. Can someone tell me where/how to do that, even if it means logging into the server via SSH and editing files? I don't know where to look. Thanks. |
Well, I just found "Remove from Reusable Blocks", which I swear wasn't there yesterday. Maybe when I updated Gutenberg today that feature became available, or maybe I'd just never seen it. So that answers the question about deletion. And the editing seems to work but with a delay (e.g. if you have 2 custom blocks in the same post and go to edit one). Okay. Sorry for the distraction. No real problem here. |
The user should be able to delete a Reusable Block that they've created.
Technically, this can be accomplished by:
delete_item
anddelete_item_permissions_check
methods inWP_REST_Reusable_Blocks_Controller
DELETE_REUSABLE_BLOCK
effect, which callsnew wp.api.models.ReusableBlocks( { id } ).destroy()
DELETE_REUSABLE_BLOCK
when the user confirms their intent to delete the blockSome discussion about how the UI for this should work is required. Some ideas:
X
icon to each Reusable Block in the Inserter. Clicking it would show an alert which confirms whether or not the user is OK with deleting the block. On confirmation, the block is deleted and a 'Reusable block deleted' notice is shown.cc. @jasmussen @mtias
The text was updated successfully, but these errors were encountered: