Repository navigation
Improve insertion point and drag-n-drop in the widgets screen - #32953
Conversation
bfe201b to
9741301
Compare
|
Size Change: +1.9 kB (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
| let _destinationIndex; | ||
|
|
||
| if ( insertionIndex ) { | ||
| if ( insertionIndex !== undefined ) { |
There was a problem hiding this comment.
This line fixes #32931. If insertionIndex is 0 then it short-circuit the logic below, which is the case when the block list is empty.
| * | ||
| * @return {boolean} Is dragging within the target element. | ||
| */ | ||
| const useIsDraggingWithin = ( elementRef ) => { |
There was a problem hiding this comment.
This file is copy-pasted from index.js.
| @@ -1,41 +1,72 @@ | |||
| $panel-title-height: 48px; | |||
There was a problem hiding this comment.
This is probably a bad idea but I don't have other solutions for now.
talldan
left a comment
There was a problem hiding this comment.
Great stuff, this improves dragging into those empty areas massively 🎉
|
Quick note that I'm now seeing a hover outline around panel areas (even when not dragging). Not sure if this could be related to this PR or something else that merged recently! cc @kevin940726 panel-outline.mov |
|
I assume it's not intended but I like it :))) |
|
It's not a bug introduced in this PR and it has patch (#33015) already :), but thanks for noting! |
Description
Fix #32652, fix #32931.
Expand the size of Widget Area's
InnerBlocksto the entire panel, so that dropping anywhere on that panel works. The trick is to use some hacky negativemargin-topandpadding-topcombo to achieve the effects. We also have to elevate the z-index of the title element so that clicking on it still works. However, we don't wantdragenteranddragleaveevents being triggered when dragging blocks onto the title element, hence we setpointer-events: noneto the title element while dragging.The widget area now shows a ring outline when a block is dragging upon it, to compensate that the blue line indicator is still kind of buggy and not easy to fix at the time (#32880).
c.c. @critterverse for design reviews♥️ 🙇♂️ !
How has this been tested?
Screenshots
Kapture.2021-06-24.at.18.39.04.mp4
Types of changes
Bug fix
Checklist:
*.native.jsfiles for terms that need renaming or removal).