Fix in-between inserter not showing for wrapping horizontal block lists#32615
Fix in-between inserter not showing for wrapping horizontal block lists#32615
Conversation
| } ); | ||
|
|
||
| if ( ! element ) { | ||
| if ( isBlockInsertionPointVisible() ) { |
There was a problem hiding this comment.
Not sure if this change is right, I wasn't fully able to understand the original code.
I wasn't sure why this early return didn't hide the insertion point in trunk.
There was a problem hiding this comment.
We should probably be adding it to all early returns below.
|
Size Change: -44 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
|
Nice to consolidate, drag and drop and the in-between inserter are indeed very similar, both are coordinate to insertion index. I wonder if we could reuse even more code? Would be cool to have a function where you can put in coordinates and get a root client ID and index. :) |
packages/block-editor/src/components/block-list/use-in-between-inserter.js
Show resolved
Hide resolved
packages/block-editor/src/components/block-list/use-in-between-inserter.js
Show resolved
Hide resolved
|
Looks like there's a few e2e tests failing related to the insertion point. |
65151f3 to
cf38d68
Compare
cf38d68 to
9012f6f
Compare
|
@talldan the fix for the e2e test is strange. For some reason in the e2e test run the inserter mouseover is more sensitive than in a local dev site, ie. the activation zone is much narrower. The console logs below are the mouse x and y In the dev site the inserter appears to behave exactly the same as before this change, and I can't work out why it is different in the e2e chrome instance. |


Description
Fixes the issue mentioned here - #32589 (review)
Uses the same edge detection system as drag and drop to determine in which position to show the in-between inserter.
Performance might be a little worse, but hopefully not too much of an impact.
How has this been tested?
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.jsfiles for terms that need renaming or removal).