-
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
Editor: Bring back Inspector Advanced Controls #5952
Conversation
I added missing documentation and unit tests. |
ed3cc17
to
7d5d1ac
Compare
@jasmussen does this look good to you? I believe we discussed it before we just never got around to doing it. |
blocks/hooks/anchor.js
Outdated
return ( | ||
<Fragment> | ||
<BlockEdit { ...props } /> | ||
{ hasAnchor && ( |
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.
Minor: Given that we are changing this zone, hasAnchor may be confusing has it includes the isSelected condition. Maybe we can have a condition that checks this hasBlockSupport( props.name, 'anchor' ) && props.isSelected
and if true returns what the fragment we have without other checks.
Otherwise we just return <BlockEdit { ...props } />.
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.
Updated, good idea. Thanks 👍
@@ -9,4 +9,19 @@ export { Slot }; | |||
export { Fill }; | |||
export { Provider }; | |||
|
|||
export default { Slot, Fill, Provider }; | |||
export function createSlotFill( name ) { |
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.
Nice helper method 👍 It simplifies a lot the slot fill creation.
de16a67
to
39c4715
Compare
This looks good to me except for a few small things. The margins on the top panel collapse now causing the text settings header to be a bit snug up against the border: I think this is due to the addition of a div to group all the non-advanced content. But this div allows margins to collapse, because it has no border and no padding. You could hack your way out of that, but given another change I'd love to see, perhaps there's a different approach. More in a second. Can you add a top border to the Advanced section, so it looks like this? As you can see, there's a "separator" between the block type description at the top, and the advanced section below. Right now that description has a border, and in the mockup above I added a border to the bottom section as well. If you remove those borders, and instead create a "separator" component or something in that vein, we can insert that between divs, and not have to worry about collapsing margins. Make sense? Otherwise hit me up on chat and we'll walk through it. Nice work! 👍 👍 |
3fca331
to
36ca30c
Compare
With latest changes, looks good designwise 👍 👍 |
I applied the following changes:
|
Thank you for your @gziolo, the code looks good to me and is working well. |
There is also a pure CSS solution which should work well which is use the selector |
@jorgefilipecosta, good catch. I think we can also try to apply |
I will open a follow up because I have a fix that touches a half of the core blocks. The good part is that it greatly improves UI for all of them 👍 |
return cloneElement( child, { key: childKey } ); | ||
} ); | ||
} ) } | ||
{ isFunction( children ) ? children( fills.filter( Boolean ) ) : fills } |
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.
Why do we filter here?
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.
To get rid of empty elements. Some fills render nothing based on Redux state. If you want to prevent rendering a slot wrapper it it has no fill which render something this is the way to go. In retrospective, I think this could be also done outside. Should we move it out or improve here and add some comments?
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.
Comments would be good.
It was also strange to me that we filter only if the children
is passed as a function, but not otherwise.
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, filter( Boolean )
doesn't sound like a sufficient way to imitate React's treatment of "empty". For example, a child of 0
would be omitted here, but is a valid / non-empty child to render.
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.
Yes, I will open PR with all your comments addressed.
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.
Done #9371.
Description
Fixes: #5884.
Related PR: #3475.
From @DannyCooper:
From @mtias:
I tried to do the similar in #3475 but we decided to defer this decision. This PR introduces revised changes to make it happen.
This PR also introduces
createSlotFill
factory method to simplify the process of creating a pair of Slot and Fill components.How Has This Been Tested?
Paragraph
block.Heading
block.Image
block.Screenshots (jpeg or gifs if applicable):
Before
Note: this screenshot is old but should be enough to show the difference :)
After
Note: this one is up to date 👍
Checklist: