Skip to content

Fix: SCF Blocks are now forced into preview mode when editing a synced pattern. #135

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

Merged
merged 1 commit into from
May 16, 2025

Conversation

cbravobernal
Copy link
Contributor

What

Before this PR. SCF blocks could be on "edit" mode inside synced patterns. Now they are forced to be in preview mode, which is the block that the user will see both in editor and in frontend.

ACF 6.4.1 backport.

How to test

Before:

trunk.mov

After:

branch.mov

@cbravobernal cbravobernal requested review from kraftbj and priethor May 15, 2025 16:46
@cbravobernal cbravobernal self-assigned this May 15, 2025
@cbravobernal cbravobernal added the [Type] Bug Something isn't working label May 15, 2025
@@ -110,7 +110,7 @@ const md5 = require( 'md5' );
* @return boolean
*/
function isSiteEditor() {
return typeof pagenow === 'string' && pagenow === 'site-editor';
return document.querySelectorAll( 'iframe[name="editor-canvas"]' ).length > 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this backported 1:1? Is there any other condition that makes this iframe check more accurate than just wp.data.select('core/edit-site') to know if we are in the Site Editor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

@cbravobernal
Copy link
Contributor Author

I'm going to merge the PR for early "prod" testing.

@cbravobernal cbravobernal merged commit 3563b7a into trunk May 16, 2025
5 checks passed
@cbravobernal cbravobernal deleted the fix/force-preview-on-pattern branch May 16, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants