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 Synced Patterns lockable so content cannot be edited inline #32353

Closed
vyskoczilova opened this issue May 31, 2021 · 24 comments · Fixed by #57036
Closed

Make Synced Patterns lockable so content cannot be edited inline #32353

vyskoczilova opened this issue May 31, 2021 · 24 comments · Fixed by #57036
Assignees
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@vyskoczilova
Copy link
Contributor

vyskoczilova commented May 31, 2021

What problem does this address?

The seamless experience of editing reusable blocks (in core since 5.7) causes a lot of trouble for my clients. They are struggling to know when they are editing a reusable block and when the normal content.

For example, you have a reusable block in a column and you want to add another content to the column, no to the RB. What do you do? Users do click on the existing content and click on the + icon.

I've been explaining it since the 5.7 is out and it doesn't help at all. They don't want to pay that much attention to the editing and "locked" reusable block content would be the best.

What is your proposed solution?

Option to disable direct editing for reusable blocks - either allow to return to the state before 5.7 was released or just lock it (and users would go to revealed wp_blocks post archive or something).

I would love to select a reusable block just as a parent to move it around, but not the child (I think that's the part when it causes a lot of trouble).

If I miss a filter or something I'll be really glad if you point me in the right direction. I've tried to disable it via CSS and pointer events and it's just super tricky and kind of mission impossible when I want to move the blocks but not to edit them (eg you need to select them via list view and then move them around):

.is-reusable {
    opacity: 0.5;
    cursor: not-allowed;
	.block-editor-block-list__layout > * {
		pointer-events: none;
	}
	.block-list-appender {
		display: none;
	}
}
@Mamaduka Mamaduka added the [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) label May 31, 2021
@jameskoster
Copy link
Contributor

There's an issue here (#32317) exploring a similar concept for the Query block. A similar pattern is required for editing content in the template editor as well.

@MadtownLems
Copy link

I love this idea. I would definitely disable direct editing of Reusable Blocks in the current Gutenberg implementation.

It's super unclear to people that they are impacting content beyond the current post/page, and this solves that.

@mtias
Copy link
Member

mtias commented Aug 27, 2021

There's now a hover overlay rendered on reusable blocks that should give clearer indication. It might still warrant an extra click to to the children.

@vyskoczilova
Copy link
Contributor Author

@mtias Yeah, that's cool. But still, a possibility to "lock" unwanted changes to reusable blocks (maybe it could be turned on/off in the settings) would be perfect. I could imagine that if the "Edit reusable blocks directly" is enabled, you will see this, otherwise, new CPT "Reusable blocks" will be added to the menu and users could edit reusable blocks there. At least this would solve a lot of headaches for my clients.

@mtias
Copy link
Member

mtias commented Sep 13, 2021

Yes, locking in general is definitely an important aspect to develop. It should be coming soon: #29864. The initial infrastructure is there, we need to develop a UI now so it can be controlled.

@paaljoachim
Copy link
Contributor

Hey @mtias

We have this issue:
Reusable block: Add a lock to the parent toolbar to protect the inner content from accidental editing.
#32461

Along with this PR:
#32710

@noisybird
Copy link

Yes, or maybe have an option for the reusable block to be converted into a regular block before it can be edited. An alert of some sort maybe?

@andreaslindahl
Copy link

Yes, this really need to be fixed. I have clients that, unknowingly, add content to the reusable block, since it's editable from any page or post it's used on, when they really mean to add content AFTER the reusable block.

@BenWittert
Copy link

I would like to +1 this request, I have a large enterprise client who is experiencing significant issues as a result of this, they have many users accidentally/unknowingly are altering reusable blocks, as they think it is part of the page/post that they are on.

The client considers this to be a huge issue, they feel that reusable blocks are no longer fit for purpose in their current state.

@turbomacs
Copy link

+1 here as well.

@skorasaurus skorasaurus added the [Type] Enhancement A suggestion for improvement. label Feb 10, 2022
@mchildress
Copy link

So glad this is on the radar. In our multisite instance, we are building child themes in which I plan to use a combination of local templates and reusable blocks for site administrators to select from when building their child sites at a local university. Upon clicking the blue Update button a message appears in the right column with a subtitle Select the changes you want to save and the checkboxes to save these changes to both the page and the Reusable block(s) are checked. It would be great to know how to uncheck those boxes by default (see graphic) but I like the idea of locking as well as a long term solution. Definitely a concern because I envision that many of our site administrators may overwrite their reusable blocks accidentally.

@girlg33k
Copy link

girlg33k commented Apr 1, 2022

Yes, please push this fix soon. I've had to replace reusable blocks that some team members have mistakenly deleted the contents for on a couple of sites. I have trained them, however humans are not infallible, especially when they are busy, stressed, or tired so a warning message or the ability to lock the contents of a reusable block would be ideal.

@paaljoachim
Copy link
Contributor

paaljoachim commented Apr 1, 2022

Hello everyone.

This PR by @Mamaduka is being worked on. It adds a lock to Reusable blocks.
#39950

It can use feedback!

@Giorgos-pl
Copy link

Version 6.1.1 and i'm editing a page, inserted a RB and converted to a regular block. It is pre-selected to save the reusable block. It's completely paranoid!
chrome_aNVpQcuMbQ

@BenWittert
Copy link

@paaljoachim will this functionality be included in WP 6.2?

@paaljoachim
Copy link
Contributor

paaljoachim commented Mar 6, 2023

My setup.
WordPress beta tester plugin.
WP 6.2 beta 4.
Theme: Twenty Twenty Three.
Browser: Brave

Going through a few comments in this issue:

@BenWittert Ben.
In WP 6.2 we will have the following feature.
We can now after having added a Reusable block to the content of a page/post/CPT click the 3 dots in the Reusable block toolbar and lock the block. Be it Restrict editing, Disable movement or Prevent removal. This is only for the instance added to that specific page/post. Blocks in general added to a page/post can be locked.

Screenshot 2023-03-06 at 13 50 03

A lock is then seen in the toolbar.

Option to disable direct editing for reusable blocks - either allow to return to the state before 5.7 was released or just lock it (and users would go to revealed wp_blocks post archive or something).

From the sentence I quoted it seems there is a need to automatically lock the Reusable block as it is being added to the page/post. Not needing to manually click the 3 dots -> lock -> content editing.
Is this correct? I would find it helpful that Reusable blocks are by default locked when adding these to a page/post.
There might be a way that this can be done through code.


@Giorgos-pl
In WP 6.1.1

The theme Twenty Twenty Tree active.
No plugins active.
Using the Brave browser.

I made a Reusable block.
Clicked the 3 dots to "Convert to regular blocks" (or one can click the duplicate icon seen in the toolbar.)
After converting I adjusted the former Reusable block and no additional dot is seen in the Update post/page button.
So it sounds like something is just not right. I would suggest @Giorgos-pl that you create a new bug issue https://github.com/WordPress/gutenberg/issues/new/choose and fill in the questions that show up. I tested but did not locate the bug you mentioned.


Please let me know if there is anything that I missed.
Thank you.

@BenWittert
Copy link

From the sentence I quoted it seems there is a need to automatically lock the Reusable block as it is being added to the page/post. Not needing to manually click the 3 dots -> lock -> content editing.
Is this correct? I would find it helpful that Reusable blocks are by default locked when adding these to a page/post.

@paaljoachim in the use cases of my customers, they would want the ability to have reusable blocks automatically locked.

The challenge they are facing is editorial teams accidentally editing and changing reusable blocks. So they want the blocks to be locked by default whenever they are used.

@paaljoachim
Copy link
Contributor

@mtias
Matias can you comment on this?

I believe what we do need is a way to where we inside preferences by default should have a checkbox for having Reusable blocks automatically locked. So when a customer adds a Reusable block into a page/post it is pre-locked and can not so easily be edited/moved/etc. Making accidental changes harder to do. To edit one would then need to click the lock seen in the toolbar.

Screenshot 2023-03-07 at 11 07 32

There might be ways to through code to add this lock today and even make it harder for the customer to unlock a Reusable block.

@cbirdsong
Copy link

Agree 100% – locking not being set at the block and/or site level makes this feature far less useful.

@wnolfm
Copy link

wnolfm commented Mar 7, 2023

You could probably filter the metadata for core/block using block_type_metadata to lock by default.

@jameskoster
Copy link
Contributor

There could be some overlap between this and #43608.

@jordesign jordesign changed the title Disable direct editing of reusable blocks Make Synced Patterns lockable so content cannot be edited inline Oct 30, 2023
@jordesign
Copy link
Contributor

I've updated the title for clarity - but also noting that this kind of thing may be resolved with Partial Syncing
#53705

@talldan
Copy link
Contributor

talldan commented Nov 2, 2023

I've added this as something to explore on the partial syncing tracking issue 👍

@glendaviesnz
Copy link
Contributor

glendaviesnz commented Nov 29, 2023

The plan currently with the work being done to enable partial syncing pattern blocks is that full global editing of synced patterns will be disabled in the editor by default. Certain parts of the pattern will be able to be flagged as editable just for that instance of the pattern, and there will be an Edit button in the toolbar that will redirect to the site editor or wp-admin patterns page for editing the full pattern in ways that globally affect all patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment