-
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
Introduce a ResizableBox component #10347
Introduce a ResizableBox component #10347
Conversation
Thanks for jumping on the patch for this! 😄 I'l try to take a look this week, but I might have to wait a bit until after we clear out the 4.0 milestone. 😅 |
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 dig it! I think we need to add to the components
changelog to mention the new component we've introduced. 🤔
After that I think this is good! Thanks for doing this! ❤️
|
||
## Usage | ||
|
||
Most options are passed directly through to [re-resizable](https://github.com/bokuweb/re-resizable) so you may wish to refer to their documentation. Note that we set the `handleClasses` and `handleStyles` to enable the Gutenberg-specific styles. |
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'd argue that we don't so much set them as unset them; it might be worth clarifying exactly what we do here for clarity.
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.
Fair enough, I can see how it would be slightly confusing… we're setting the prop but unsetting the values. I'll update this :)
packages/components/CHANGELOG.md
Outdated
@@ -1,3 +1,9 @@ | |||
## 5.0.0 (Unreleased) |
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.
Not sure I'd count this as a 5.0.0
feature; it's more like 4.1.0
. It isn't a breaking change and it's just an addition.
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.
Fair point :)
I think the test failures are unrelated, see: #10364. Once that's merged you should probably rebase and then flag me for another review... but I think this is all good 👍 |
@tofumatt looks like Travis is still failing for the Undo and Split/Merge tests, which is likely unrelated. |
Yup, that one is an "expected" intermittent failure 😅 (restarted) |
It keeps failing, maybe something else is up? 😢 |
@tofumatt I’ll try the tests locally. It’s strange it only happens in the one environment in Travis… |
I got the local test environment set up and I can't get the undo test working there (split/merge seems good now)… but I also can't get the undo test working in |
Ten four, I've kicked the test server again and hopefully it'll work done 🤷♂️ |
Strangely I can't "pass" the undo test in I'm wondering if this might actually be a bug in |
lol okay just as I type that the test finally passes ¯_(ツ)_/¯ @tofumatt I think we're finally clear on this… phew… (Also should it still be held until 4.1? Will there still be a 4.1 at this point…?) |
Miguel and I were saying that actually replicating the test case manually indicates it might be a bit off. I think that test case could use some deeper examination…
- Matt (Sent from mobile)
… On 6 Oct 2018, at 13:28, Chris Van Patten ***@***.***> wrote:
lol okay just as I type that the test finally passes ¯_(ツ)_/¯
@tofumatt I think we're finally clear on this… phew…
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
In general I’m for merging as much stuff as possible and this is pretty minimal. I’ll have a look tomorrow, been a bit distracted by travel today. There will be a 4.1 by the way! In general Gutenberg development (including releases) will continue on GitHub, so while I’m not exactly sure how things will work after WordPress 5.0, I think the general idea will be that certain releases of WordPress will pull in a certain release of Gutenberg, if that makes sense. |
@tofumatt totally fair! Travel I’m going to try a git |
Thanks for tracking that one down!
- Matt (Sent from mobile)
… On 6 Oct 2018, at 22:00, Chris Van Patten ***@***.***> wrote:
@tofumatt just opened #10380 which tracks the undo issue. It looks related to the rich text state structure changes, which makes sense.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
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 dig it 👍
This introduced changes when running |
Ughhh I'm really sorry @aduth 😭 I should have caught that… |
display: none; | ||
|
||
// Show the resize handle when selected. | ||
.components-resizable-box__container.is-selected & { |
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.
Where do we document how a resizable box becomes "selected" to unhide itself? The current documentation for ResizableBox
has no indication of this default hidden state. It was quite the journey to find my way here, as I've found it quite difficult to use the component with the documentation as written.
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.
The behavior here was inherited from the original, non-componentized usages of ResizableBox; you can see it in previous PRs as well such as here.
There are probably other use-cases that would provide more valuable context, and could certainly be referenced and improved in the documentation.
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.
While I'd agree it often needs contextualized styling, the main problem for me was that in using the example from the documentation, there is nothing visual which appears. It took me quite a while to realize that the handles are hidden by default.
I understand this is largely a result of how it was used prior to this pull request, but it seems to me that as a generic component, there's no reason to hide those controls by default. I could imagine we might want to keep this behavior for blocks in a block list, but rather than styling in ResizableBox and in individual block stylesheets, it seems like something which should be managed in one of the stylesheets for the block list (apply consistently and exclusively to ResizableBox within blocks).
I could create an issue if it seems reasonable.
This is a follow-up to #10331 and fixes #10343.
This PR…
ResizableBox
component which wraps there-resizable
package to remove some code duplicationcore/image
andcore/spacer
to use this new componentI plan to flesh out the docs, but want to make sure I'm on the right track with this first!Still want to know if I'm on track, but I added additional docs anyway :)Testing