-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site Editor: Update hrefs to not specifically refer to themes.php?page=gutenberg-edit-site #36705
Conversation
…e=gutenberg-edit-site. This allows the JavaScript to work in Core where the URL will be site-editor.php.
Size Change: -15 B (0%) Total Size: 1.1 MB
ℹ️ View Unchanged
|
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 would do it another way but this is fine too 😆 .
@@ -36,8 +36,7 @@ export default function NewTemplatePart( { postType } ) { | |||
} ); | |||
|
|||
// Navigate to the created template part editor. | |||
window.location.search = addQueryArgs( '', { | |||
page: 'gutenberg-edit-site', | |||
window.location.href = addQueryArgs( window.location.href, { |
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.
Would it be easier if we use window.location.pathname
?
window.location.href = addQueryArgs( window.location.href, { | |
window.location.href = addQueryArgs( window.location.pathname, { |
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.
Most links in WP Admin use absolute, not relative, URLs, so I say let's do that. (Also I don't want to wait for CI again 😂.)
href={ addQueryArgs( '', { | ||
page: 'gutenberg-edit-site', | ||
href={ addQueryArgs( window.location.href, { | ||
postId: undefined, |
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.
Having to reset postId
and postType
has probably the same amount of efforts as having to pass page=gutenberg-edit-site
😅 . In the future, we can hopefully abstract this away in #36488 so I don't think it matters either way.
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.
Yeah a router would be nice 😀
…e=gutenberg-edit-site. (#36705) This allows the JavaScript to work in Core where the URL will be site-editor.php.
Description
Fixes https://github.com/WordPress/gutenberg/pull/36379/files#r753881439.
This allows the JavaScript to work in Core where the URL will be
site-editor.php
, notthemes.php?page=gutenberg-edit-site
.How has this been tested?
Checklist:
*.native.js
files for terms that need renaming or removal).