-
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
Expose preview_link
through the REST API and use within client
#6882
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ import createSelector from 'rememo'; | |
*/ | ||
import { serialize, getBlockType, getBlockTypes, hasBlockSupport } from '@wordpress/blocks'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { addQueryArgs } from '@wordpress/url'; | ||
import { moment } from '@wordpress/date'; | ||
|
||
/*** | ||
|
@@ -354,12 +353,7 @@ export function getEditedPostExcerpt( state ) { | |
* @return {string} Preview URL. | ||
*/ | ||
export function getEditedPostPreviewLink( state ) { | ||
const link = state.currentPost.link; | ||
if ( ! link ) { | ||
return null; | ||
} | ||
|
||
return addQueryArgs( link, { preview: 'true' } ); | ||
return getCurrentPost( state ).preview_link || null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make an issue for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
/** | ||
|
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 could be simplified further, see
getCurrentPostId()
for an example.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.
cc3dbea