-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Gutenberg: Add WP.com shortlinks extension #29475
Conversation
Seems like a perfect case for clipboard component from Calypso, but at the same time I wouldn't complicate something that already works. https://wpcalypso.wordpress.com/devdocs/client/components/forms/clipboard-button/README.md |
Yeah, I thought that for the first iteration we could keep it simple and do what we already were doing in Calypso. Will wait for some design feedback to confirm that decision though. |
@@ -0,0 +1,39 @@ | |||
/** @format */ |
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.
We can drop Prettier pragmas since #29403
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.
👍 Good point, removed in 1e3979b
great initiative Marin! |
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.
tested locally, and after a rebase, it worked lovely!
) In the WP.com old editor, we used to have the shortlinks handy in the sidebar. We don't have them in Gutenberg, and they can sometimes be a very handy feature. This PR registers the post shortlink as a REST API field, and as a Gutenberg plugin, which are necessary to be able to build the UI for shortlinks in Gutenberg. #### Changes proposed in this Pull Request: * Add shortlinks to the REST API post response. * Register shortlinks as a Gutenberg plugin, so they're available in our block availability endpoint. #### Testing instructions: * Start a JN site with this branch. * Connect the site, and activate all recommended features. * Write a post and save it. * Type `wp.data.select( 'core/editor' ).getCurrentPost().jetpack_shortlink` in your browser console. * Verify it returns a correct shortlink that leads to the post you just created. * Type `window.Jetpack_Editor_Initial_State.available_blocks.shortlinks` in your browser console. * Verify it returns `{available: true}`. * Want to test the actual Gutenberg extension that uses this? Go to Automattic/wp-calypso#29475 and follow the test instructions there #### Proposed changelog entry for your changes: * Shortlinks: Register as REST API post field and Gutenberg plugin #### Notes I'm marking this as low priority, as it isn't super important to have. In the same time, I think it's handy to have it, and it's straightforward enough so we could have it ready for the next Jetpack version.
1e3979b
to
c22c84d
Compare
Thank you, folks!
Sounds like something that would make sense to be explored in another PR. Will merge this one, and will explore using a clipboard button next to the link. Stay tuned! |
…sh-2019 * origin/master: Signup: Fix logo SVG on mobile devices (#29508) Update dependency react-modal to v3.7.1 Gutenberg: Add WP.com shortlinks extension (#29475) Gutenlypso: launch to production (#29326) Gutenlypso: Keep changes when opting-out (#29431) Eslint: Use Gutenberg svg wrappers for extensions (#29531) Tiled gallery block: add mosaic layout (#29338) Tiled gallery: Remove redundant Fragment (#28994)
@MichaelArestad @simison: I've fiddled with adding the copy button, here's a PR: #29556 |
Fixes Automattic/jetpack#10925
Fixes #29221
In the WP.com old editor, we used to have the shortlinks handy in the sidebar. We don't have them in Gutenberg, and they can sometimes be a very handy feature. This PR creates the UI for the WP.com shortlinks, adds it to the Jetpack sidebar and registers it as a beta extension.
For inspiration of how it looks and works, we're borrowing from the legacy Calypso editor sidebar:
Also, see the corresponding Jetpack PR that's necessary for this to work: Automattic/jetpack#10981
Changes proposed in this Pull Request
Preview
Positioning in the Jetpack sidebar:
How it looks:
Focusing the field autoselects the shortlink:
Testing instructions
update/shortlinks-rest-api-gutenberg
Jetpack branch from this link: https://jurassic.ninja/create?shortlived&jetpack-beta&gutenpack&branch=update/shortlinks-rest-api-gutenberg&calypsobranch=add/jetpack-gutenberg-shortlinksNotes
I'm marking this as low priority, as it isn't super important to have. In the same time, I think it's handy to have it, and it's straightforward enough so we could have it ready for the next Jetpack version.