-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Only load Gutenberg Polyfill in Gutenberg pages #6849
Conversation
It seems like a legit fix, however, I'd prefer to have someone else double check PHP logic. |
|
||
if ( ! gutenberg_can_edit_post( $post ) ) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be handy to define a is_editor_page
function to check whether we're loading a Gutenberg page or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, maybe some logic can be shared with pieces of gutenberg_init
? Not sure if anything should be different there. It doesn't have the admin and post checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I don't really understand why it has these checks here, and gutenberg_init
does not.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 153 to 159 in 70e9e4f
if ( isset( $_GET['classic-editor'] ) ) { | |
return false; | |
} | |
if ( ! gutenberg_can_edit_post( $post ) ) { | |
return false; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the issue for me. Would be nice to either share the logic with gutenberg_init
or explain why different checks are needed. Would also be nice to explain why this is needed: "Ensure the editor module is loaded before third party plugins."
This is needed before the previous APIs defined in |
The checks are not different. This has an extra check to ensure we're on the editor page |
Merging as this fixed the issue and it's a temporary polyfill anyway. |
This PR fixes #6847 by avoiding to load the Gutenberg scripts in the classic editor.
This avoids any TinyMCE conflict.
I also added an e2e test to avoid this kind of regressions in the future.