-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: Document page attributes components and a way to have drafts as parent posts #12395
Documentation: Document page attributes components and a way to have drafts as parent posts #12395
Conversation
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 don't want to let perfect be the enemy of good so I'm not approving/denying, but there are some small docs things it'd be nice to fix. Cool to see this though!
PageAttributesCheck | ||
=================== | ||
|
||
This component is used to check if the page attributes section should be rendered or not. |
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 generally if these lines are intended to be separate paragraphs there should be a newline between each line. Otherwise, they can all be one line (we don't do line-wrapping in markdown).
Using these components, one can add a UI that allows changing page attributes in different scenarios/needs. | ||
|
||
PageAttributesCheck | ||
=================== |
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 believe these should be H2s — we should only have a single H1 per 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.
We should also standardise on a single type of heading syntax: #
or =
. I prefer #
but this isn't a blocker, just an observation. (I might look for markdown linters today and write a proposal for including one.)
@@ -0,0 +1,160 @@ | |||
Here components that provide the functionality available in `Page Attributes` panel of the document sidebar are documented. |
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 should have an H1 page title :)
156e4df
to
a8edd99
Compare
Thank you for your review @chrisvanpatten all your feedback was applied! |
a8edd99
to
7675468
Compare
7675468
to
b7ad77d
Compare
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.
Documentation seems fine. Tested that the example works as expected. This would be the result (no page attributes component will be shown in the document sidebar and a new sidebar will be added for this):
I'm a bit confused by this behavior, though. I'd think that we either want to:
- fix the current component and allow for drafts (if it is a backward compatibility issue).
- allow plugins to customize the parent checkbox contents (if what we want is to allow extensibility).
I'd want a second opinion on this before approving @youknowriad @jasmussen @mapk
Hi @nosolosw thank you for your review.
|
…proach that allow drafts as parent posts; Update: Allow PageAttributesParent to receive the items as a property;
b7ad77d
to
d114743
Compare
Is this still needed? Maybe not with the new Document Slot? |
Hi @youknowriad, the fact that "In the classic editor, it has possible to change the parent attributes UI to allow drafts to be selected as a parent of a page/post." and in Gutenberg, we don't have an easy way to do that still persists. |
Works for me 👍 |
After a recent change, |
@jorgefilipecosta @youknowriad Is this still relevant? What needs to be done in order for this PR to be moved forward/closed? :) |
I think we can close this PR. |
Fixes: #9089
In the classic editor, it has possible to change the parent attributes UI to allow drafts to be selected as a parent of a page/post.
@youknowriad suggested a reasonable way to do that in the new editor would be to implement Page Attributes as a sidebar and remove the existing panel.
This PR documents the set of page attributes components that help having a page attributes sidebar (they were undocumented).
It changes the PageAttributesParent component to allow it to receive the possible parent items as a prop if not passed it queries the items as before. This simple change allows plugin developers to use all the logic of the component but just pass a different prop with the items they want e.g.: draft posts and the subset resulting of some specific filter.
And in the end, we provide a code sample that does precisely what @youknowriad suggested implements page attributes in a sidebar, with the possibility of allowing draft posts to be selected as a parent and removes the existing Page attributes panel.
How has this been tested?
I pasted the code sample in the browser console, and I checked it works correctly.