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

Remove reusable block removes complete block from editor #12791

Closed
Stojdza opened this issue Dec 11, 2018 · 16 comments · Fixed by #27026
Closed

Remove reusable block removes complete block from editor #12791

Stojdza opened this issue Dec 11, 2018 · 16 comments · Fixed by #27026
Assignees
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress

Comments

@Stojdza
Copy link

Stojdza commented Dec 11, 2018

Remove reusable block removes complete block from editor.

Steps to reproduce

  1. Starting at URL: https://wpcalypso.wordpress.com/block-editor/post
  2. Create Paragraph block
  3. Select More options -> Add to Reusable Blocks -> Save
  4. Select More options -> Remove from Reusable Blocks -> Confirm

What I expected

That block is not Reusable Block anymore and it should stay in Editor

What happened instead

Complete block is removed from Editor
NOTE: From confirmation window is clear that block will be deleted. but from More options menu it looks like that block will only be removed from reusable blocks.

Browser / OS version

Chrome 70 / macOS High Sierra 10.13.3

Screenshot / Video

screen shot 2018-10-10 at 14 23 47

screen shot 2018-10-10 at 14 23 55

@swissspidy
Copy link
Member

That block is not Reusable Block anymore and it should stay in Editor

Note that this is what the "Convert to Regular Block" option is for.

Perhaps we can change the labels to make this more clear.

@swissspidy swissspidy added Needs Design Feedback Needs general design feedback. [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) labels Dec 11, 2018
@melchoyce
Copy link
Contributor

I ran into this as well and was super confused. Honestly, I wonder if we shouldn't have this option in the menu at all — maybe it should only live within the Reusable Blocks screen.

@swissspidy
Copy link
Member

maybe it should only live within the Reusable Blocks screen.

Sounds like a good thing to explore.

I wonder what happens when you do that by the way. Will the block be silently removed from all posts it's being used in? Does the Reusable Blocks screen show which posts are using the block? (A often requested feature for attachments, by the way)

@melchoyce
Copy link
Contributor

I wonder what happens when you do that by the way. Will the block be silently removed from all posts it's being used in?

We'll definitely need some good copy in an "are you sure?" prompt when deleting reusable blocks.

Does the Reusable Blocks screen show which posts are using the block? (A often requested feature for attachments, by the way)

I think that would be great, personally.

@karmatosed karmatosed added Needs Design Needs design efforts. and removed Needs Design Feedback Needs general design feedback. labels Apr 23, 2019
@melchoyce
Copy link
Contributor

I recently did it again — I selected "Remove from reusable blocks" thinking it would detach this instance from my reusable block, which is how I expect it to work. Then it deleted all instances of the reusable block 😩 I still think you should only be able to delete all instances from the reusable block management screen, not directly from the editor, and that "remove from reusable blocks" in the block dropdown should detach the instance.

@auntieC
Copy link

auntieC commented Jun 3, 2019

I had the same issue, lost two days worth of work. The ability to delete block entirely should not reside within the post editor at all.

Is there a way to fix this?

@mapk
Copy link
Contributor

mapk commented Dec 27, 2019

The recommended action seems to be:

1. Hide the "Remove from reusable blocks" action item from the popover block menu.

Screen Shot 2019-12-27 at 3 36 03 PM

2. Only allow that option in the reusable block management screen.

Screen Shot 2019-12-27 at 3 37 52 PM

3. Require a second notification before trashing the reusable block with some options.

dialog-delete-reusable-block

@mapk mapk added Needs Design Feedback Needs general design feedback. and removed Needs Design Needs design efforts. labels Dec 27, 2019
@wittwitsan
Copy link
Member

From this week design triage, we came up with the idea of replacing "Remove from Reusable Blocks" with "Manage Reusable Block" instead and rearrange/grouping actions of managing Reusable block into the same section.

More options

For a quick fix, it can be just a link to "Manage All Reusable Blocks" screen.


A further idea for "Manage Reusable Block" is showing a modal popup as same as "Block Manager" from tools & options.

Here is the proposal for managing selected Reusable Block modal showing all post instances that will be affected by the action:

Manage Selected Reusable Block v1

@karmatosed
Copy link
Member

I really like the idea of a quick fix. Let's see about moving this to development, thanks.

@karmatosed karmatosed added Needs Dev Ready for, and needs developer efforts and removed Needs Design Feedback Needs general design feedback. labels Apr 6, 2020
@noisysocks noisysocks added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Apr 20, 2020
@wallstead
Copy link
Contributor

I see this issue has been sitting a while. If there is still interest I'd like to take on dev for this as my first issue.

@mapk
Copy link
Contributor

mapk commented Nov 11, 2020

@wallstead, that would be great! It looks like we've got the "Convert to blocks" as a button in the toolbar now, so all we need here is to swap the "Remove from Reusable blocks" button to one that says, "Manage Reusable blocks" and it should take the user to the Reusable blocks manage screen. This will require a notification if there are unsaved changes so the user doesn't lose any changes.

Frame 1

@wallstead
Copy link
Contributor

@mapk Great! I'll start work on this today.

@Two-Motion
Copy link

This is a problem for me as well. Not getting confused by what "remove from reusable block" means, but the fact that I might accidentally click it. I work with reusable blocks all the time across many pages. It's an accident just waiting to happen and no way to fix it when it does. Even a simple "Are you sure you want to delete this block?" would be really great.

@wallstead
Copy link
Contributor

I just submitted the above pull request, it's my first ever so please let me know if I need to do anything else other than keep checking in here!

wallstead added a commit to wallstead/gutenberg that referenced this issue Nov 19, 2020
* Removed ReusableBlockDeleteButton component and added ReusableBlocksManageButton in its place.

* On click, ReusableBlocksManageButton sends the user to the reusable blocks management screen.

* Added '@wordpress/url' dependency to the package. This is used to build the  url for the reusable blocks management screen.

Fixes WordPress#12791.
talldan pushed a commit that referenced this issue Nov 23, 2020
…27026)

* Replace 'Remove from Reusable blocks' with 'Manage Reusable blocks'.

* Removed ReusableBlockDeleteButton component and added ReusableBlocksManageButton in its place.

* On click, ReusableBlocksManageButton sends the user to the reusable blocks management screen.

* Added '@wordpress/url' dependency to the package. This is used to build the  url for the reusable blocks management screen.

Fixes #12791.

* Fix logic and dependency for new 'Manage Reusable blocks' menu item.

* Use file link for new @wordpress/url dependency.

* Rename abbreviated blockObj variable to reusableBlock to follow coding standards.

* Simplified logic to check if the 'Manage Reusable blocks' menu item should be visible.

* Use MenuItem's href prop to create an a tag instead of relying on onClick on a button.

Fixes #27026.

* Update package lock. (#27026)

* Remove unused e2e test for deleting reusable blocks. (#27026)
@KennySing
Copy link

So how do i detach a single instance of a reusable block from its global "symbol".

For example

Page 1

  • Reusable Block 1

Page 2

  • Reusable Block 1

Page 3

  • Reusable Block 1 (i want to convert this into a static version of Reusable Block 1)

@talldan
Copy link
Contributor

talldan commented Jun 17, 2021

@KennySing There's a button on the toolbar of the reusable block:
Screenshot 2021-06-17 at 1 01 20 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.