-
Notifications
You must be signed in to change notification settings - Fork 4.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
Documentation: PostPreviewButton editor component #62036
Documentation: PostPreviewButton editor component #62036
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -99,6 +99,18 @@ function writeInterstitialMessage( targetDocument ) { | |||
targetDocument.close(); | |||
} | |||
|
|||
/** | |||
* A button for post preview. It uses WordPress data selectors to get the necessary data for the preview, such as the post ID, the current post link, the preview link, and whether the post is saveable and viewable. When the button is clicked, it opens a new window or tab for the preview, writes the interstitial message to this window, and then navigates to the actual preview link. The button is disabled if the post is not saveable. |
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 think we should have a bit higher level description..
* A button for post preview. It uses WordPress data selectors to get the necessary data for the preview, such as the post ID, the current post link, the preview link, and whether the post is saveable and viewable. When the button is clicked, it opens a new window or tab for the preview, writes the interstitial message to this window, and then navigates to the actual preview link. The button is disabled if the post is not saveable. | |
* Renders a button that opens a new window or tab for the preview, writes the interstitial message to this window, and then navigates to the actual preview link. The button is not rendered if the post is not viewable and disabled if the post is not saveable. |
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.
Also just noticed this.. We should probably wrap this comment in more lines to be consistent with our code base. I thought we had a linting rule for the max length of comments line, but it seems we don't 😄
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.
Thank you! It seems this PR and some others from you will need an extra rebase, because a linting error slipped in trunk, but already fixed.
* Add JSDocs for PostPreviewButton editor component * Auto-generate editor docs for PostPreviewButton component add * Refine PostPreviewButton editor component JSDocs * Auto-generate editor docs for PostPreviewButton updates
* Add JSDocs for PostPreviewButton editor component * Auto-generate editor docs for PostPreviewButton component add * Refine PostPreviewButton editor component JSDocs * Auto-generate editor docs for PostPreviewButton updates
What? & Why?
Addresses one item in #60358
Adding documentation to existing editor components can help with any of the following:
How?
Add a JSDoc comment to the
PostPreviewButton
component and runnpm run docs:build
to populate theREADME
with the newly added documents.