-
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
Add resizer to template part focus mode #35728
Conversation
Size Change: +942 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
This is awesome! Nice job. It works great on desktop but I think we need to accommodate mobile devices.
Kapture.2021-10-19.at.11.10.22.mp4It's a little weird that selecting Tablet and Mobile will adjust the height, but I suppose #35512 will address this because template parts should always have a height set by their content. |
function ResizableEditor( { enabledResizing, settings, ...props } ) { | ||
const deviceType = useSelect( | ||
( select ) => | ||
select( editSiteStore ).__experimentalGetPreviewDeviceType(), |
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.
Maybe we could drop the __experimental
now? Seems like we're committed to this feature 🤷♂️
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.
Yeah it seems pretty stable now? c.c. @tellthemachines since you've reviewed the original PR in #21309.
packages/edit-site/src/components/block-editor/resizable-editor.js
Outdated
Show resolved
Hide resolved
Weird. It's working on my side though. Tested in Chrome, Firefox, and Safari.
I thinks there's a bigger issue with RWD on this screen 😅 . We should probably handle this separately.
That's a good idea! What size do we think is too small though? Reaching the mobile breakpoint might be a good start?
If you think of the canvas as a screen rather than a component that it feels less weird 😅. Though I agree this should be discussed in #35512. |
Huh. OK then! 🤷♂️
Yeah Gutenberg often uses |
Very cool! A few thoughts / issues: This is related to #35536 but I noticed that sometimes the in-between inserter overflows the canvas if you resize when it is visible: I've felt for a long time that clicking the gray background area should deselect all blocks. When the canvas is shrunk down to a small size here that feels especially important. I'll open a separate issue for that. We should definitely use resize handles like on wp.org, and place them on the gray background. At the moment it feels like you're setting a width option for the template part which of course is not what is happening here. Excited about this one :D |
Yeah, I noticed this too, and yes I think this is out of the scope of this PR.
Agree 👍 ! This has bugged me for quite some time too.
Makes sense! Will do. |
The resize handles now have styles similar to .org. Also, if you're focusing on the handle, pressing Left and Right arrow keys should also resize the canvas. Kapture.2021-10-20.at.16.36.59.mp4 |
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 made some style adjustments but this is looking great!
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 work!
66249fa
to
b75bd4a
Compare
* trunk: (494 commits) remove consecutive rc warning (#35855) Update Changelog for 11.8.0-rc.2 Bump plugin version to 11.8.0-rc.2 [RNMobile] Disable React Native E2E Tests (iOS) (#35844) Add section about using the schema during development (#35835) Add a method to disable auto-accepting dialogs (#35828) Wrap NavigationContainer with SafeAreaView. (#35570) Update Appium to 1.22.0 (#35829) Post Comment: Handle the case where a comment does not exist (#35810) Clear selected block when clicking on the gray background (#35816) Post excerpt: Don't print the wrapper when there is no excerpt (#35749) [Block] Navigation: Fix padding for social links on mobile (#35824) Fix issue with responsive navigation causing wrapping. (#35820) [Block Editor]: Fix displaying only `none` alignment option (#35822) Add API to access global settings, styles, and stylesheet (#34843) Mobile Release v1.64.1 (#35804) Add resizer to template part focus mode (#35728) Update Changelog for 11.7.1 Gallery block: Only show the gallery upload error message if mixed multiple files uploaded (#35790) Update Changelog for 11.8.0-rc.1 ...
Sweet! |
Description
Close #35249.
Add a horizontal resizer to template part focus mode. Whether a vertical resizer is needed can be discussed in another PR or in #35512.
The size is synced with the preview options in the header. Manually resizing it will set the device type to
responsive
, a dummy state that will not show on the preview options dropdown, so clicking on the same option can reset to the defined size.The resize handle is the default one provided by
<ResizableBox>
. We can change this to something more like the one in wp.org though if needed.How has this been tested?
tt1-blocks
themeScreenshots
Kapture.2021-10-18.at.20.09.19.mp4
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).