-
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
Custom Margin/Padding to column block #25988
Custom Margin/Padding to column block #25988
Conversation
71ee566
to
374d540
Compare
This is a very nice PR as it's the first one to potentially introduce the margin support flag that can be expanded to several blocks later. I'd love a lot of eyes on this one: @jasmussen @ItsJonQ @nosolosw |
Thank you for the PR, exciting! I'm afraid I can't get the custom spacing to work, honeslty anywhere, not on the Cover block either, and I'm opting in using This is what I see in the mean time, and I suppose it can serve as a "before" screenshot: |
@jasmussen I believe you have to example it via an @AlexChariyska Thank you for attempting this! ✨ VisualizersThe blue visualizers (that appear for 📏
|
So I updated the request and added visualizers for the margin props as well. The changes include refactoring of the BoxControlVisualizer to accept object of spacing values (margin & padding) in order to decide which borders to visualize for the block. About the second part to accept more custom values (ex. margin: auto) I think something like the custom relative units can be done as a logic (25825). |
b256c06
to
73234e8
Compare
Adding support for the 🤔 TrickinessAt the moment, the
This does not allow for string values like It also does not do CSS style validation. I've realized that this is incredibly important - especially to have it built into the control. For example, a valid value for (Not taking into consideration values like Thankfully, I was able to come up with ideas on how we may tackle this! 🪓 Patch Current UnitControlWe could adjust the Long term, we need a more robust solution 👍 |
daceeca
to
b16552d
Compare
b16552d
to
94c6586
Compare
@AlexChariyska Haii! Wow! Thanks for making the update to add I took it for a spin, and it looks like adding values via the (input) controls are working, for both Padding and Margin (including I'm not able to see the visualizers though (for either one). Just leaving this update now, in case it helps with debugging/development :) UpdateI'm not too sure what may be causing this. The values don't appear to be applied correctly on the first attempt. I recorded a video screencast detailing this: In the video, I've added a new Cover block. It has no values for padding or margin to start. So far so good. I click away. After that, then the Padding values seem to work. Same thing happens for 🤔 |
Here is a similar PR for the Group block. It would be nice to move padding and margin out of the experimental status making it available for a larger testing base. Making it available in the Gutenberg plugin. |
@ItsJonQ Hey, I'm not sure what might be causing the problem. I'm following the steps you described and I can't reproduce the problem. Can you check again if you are up to date with @paaljoachim I think it's ok to leave it as is because it provides a point of reference. You can return to the default state by resetting the values. The blocks will also move to the edges of the view if you unlink the values and change each individually. |
ff012fc
to
32b64a9
Compare
@kirilzh Haiii! Apologies for the delayed response! Happy New Year :). I hope you're doing well. I just pulled the latest from this PR. I'm still having issues with the controls. Here's a screen recording: |
dcf535a
to
e4c73c4
Compare
@AlexChariyska Haii! Your latest update seemed to do the trick for me. The margin/padding values are being applied as expected now 🎉 |
e4c73c4
to
35fd9f5
Compare
35fd9f5
to
90de8b0
Compare
Great work here @AlexChariyska and @kirilzh. I made #28451 based off of this. One thing I came across is that trying to zero the values doesn't seem to work. spacing-margin-zero.mp4I am in favor of this feature. I think I'd like it even more if it supported negative values and that would enable it to support use cases such as #24504. Though it might be a trick to figure out what to do with the Visualizer for such cases. I do think this has some potential as a pitfall for some users. It probably requires an understanding of margin collapsing and auto margins in order for some of the behavior to be expected. |
If I remember correctly the Spacing panel is being renamed to Dimensions. @ItsJonQ |
The spacing support (currently only padding) was added to the Column block in #31778. |
Description
#24874 Custom functionality for adding margin and padding spacing in column/s blocks.
How has this been tested?
Screenshots
Types of changes
New Feature, created a hook for custom margin added in SpacingPanelControl.
Adds support for spacing in column/s block json.
How to test:
In order to enable the custom padding functionality in lib/experimental-default-theme.json you have to set to true the customPadding key:
"spacing": { "customPadding": true }
Currently, the custom margin and padding functionality are added only to the columns/column blocks.
Checklist: