-
Notifications
You must be signed in to change notification settings - Fork 854
[GB 13.7] Gutenberg 13.7 Site Editor route fixes #25281
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
Changes from all commits
904c9b1
a27fc2a
455a398
9692cb7
b5e366b
afd2be2
3e61439
69ae1c0
59a22ef
f030bb3
2d03003
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: changed | ||
|
|
||
| Updated package dependencies. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: minor | ||
| Type: fixed | ||
|
|
||
| Change Site Editor route to `site-editor.php` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: minor | ||
| Type: bugfix | ||
|
|
||
| Calipsoify the `site-editor.php` route so that it opens the Site Editor from the Gutenframe. Gutenberg 13.7 deprecated the old routes and uses core's `site-editor.php`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -733,12 +733,15 @@ public static function add_iframed_editor_style() { | |
| return; | ||
| } | ||
|
|
||
| $allowed_pages = array( 'admin.php', 'themes.php' ); | ||
| $is_site_editor_page = in_array( $pagenow, $allowed_pages, true ) && | ||
| isset( $_GET['page'] ) && 'gutenberg-edit-site' === $_GET['page']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
|
|
||
| // WP 5.9 puts the site editor in `site-editor.php` when Gutenberg is not active. | ||
| if ( 'site-editor.php' !== $pagenow && ! $is_site_editor_page ) { | ||
| // Pre 13.7 pages that still need to be supported if < 13.7 is | ||
| // still installed. | ||
| $allowed_old_pages = array( 'admin.php', 'themes.php' ); | ||
| $is_old_site_editor_page = in_array( $pagenow, $allowed_old_pages, true ) && isset( $_GET['page'] ) && 'gutenberg-edit-site' === $_GET['page']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
| // For Gutenberg > 13.7, the core `site-editor.php` route is used instead | ||
| $is_site_editor_page = 'site-editor.php' === $pagenow; | ||
|
||
|
|
||
| $should_skip_adding_styles = ! $is_site_editor_page && ! $is_old_site_editor_page; | ||
| if ( $should_skip_adding_styles ) { | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -402,15 +402,18 @@ public function add_jetpack_menu() { | |||
| * Update Site Editor menu item's link and position. | ||||
| */ | ||||
| public function add_gutenberg_menus() { | ||||
| if ( self::CLASSIC_VIEW === $this->get_preferred_view( 'admin.php?page=gutenberg-edit-site' ) ) { | ||||
| if ( self::CLASSIC_VIEW === $this->get_preferred_view( 'site-editor.php' ) ) { | ||||
|
||||
| public function add_dashboard_switcher() { |
I'm not seeing a way the preferred view would get set specifically for the Site editor, other than manually appending the query parameter to the wp-admin url. If that's correct, I don't think we need to worry about persisting the preference.
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 miss-typed that last comment! Edited, it now reads: "I don't think we need to worry about persisting the preference."
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.
Hey @creativecoder, thanks for diving into this! Yeah, I was having a chat with @jeyip about the very same thing and we reached the same conclusion. It seems that we can assume the Site Editor has always been set to load inside the Gutenframe and that users couldn't change that.
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.
That being said, I'll leave an additional note that - as reported by you here - the Gutenframe isn't able to load the Site Editor in AT sites at the moment in any case, though.

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.
This one will work fine with 13.6 and 13.7. In envs with 13.6, it will redirect to
site-editor.php, which will in turn redirect tothemes.php .... If 13.7+ is active instead, it will work as is, as 13.7 uses this route for the Site Editor.Uh oh!
There was an error while loading. Please reload this page.
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'm not sure how to test this change from an integration standpoint, I asked the Jetpack folks here: p1659139972849529-slack-CDLH4C1UZ. However, the change is simple enough that it's feasible to accept it as is.