-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Grid: Place new block after currently selected block when using slash inserter and splitting text #63333
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +1.2 kB (+0.07%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
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.
Hmm, this isn't fixing the issue for me:
![Screenshot 2024-07-10 at 4 47 09 PM](https://private-user-images.githubusercontent.com/8096000/347291449-715d34b9-7fc7-4423-a09c-f304e18dcda3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDE3NzQsIm5iZiI6MTcyNDEwMTQ3NCwicGF0aCI6Ii84MDk2MDAwLzM0NzI5MTQ0OS03MTVkMzRiOS03ZmM3LTQ0MjMtYTA5Yy1mMzA0ZTE4ZGNkYTMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTlUMjEwNDM0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDk3MTcxYzBlZmI2YjUwYjdiMzk1N2FjMDFmZjgyZjBiMGRkMmEyMmFlMGM5MTZmYTdmNmFhZGI3OGUxMzJhMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.ThX1aTSHlAe9OpI_iSKv4zHpnKqh6MbVyg60xjXiq14)
I think the problem is occupiedRects isn't refreshing when the amount of gridItems changes, possibly because the object itself hasn't changed?
So weird— it looks like the call to |
… seems broken" This reverts commit 9c5e811.
I figured out what's going on! There's a Not sure how to fix this yet. I asked in https://github.com/WordPress/gutenberg/pull/61915/files#r1673421903 whether the typography For now I think let's ignore this. |
…r and block splitting
Added 1adc921 which updates the placement logic in |
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.
Testing with the patch applied this is working well! I think we can go ahead and merge it and follow up with a fix for that Typography effect.
… inserter and splitting text (WordPress#63333) * useGridLayoutSync: Keep layout in sync regardless of whether Grid is selected * Don't use bulk version of updateBlockAttributes() for now. It seems broken * Revert "Don't use bulk version of updateBlockAttributes() for now. It seems broken" This reverts commit 9c5e811. * useGridLayoutSync: Update placement logic to accomodate slash inserter and block splitting Co-authored-by: noisysocks <noisysocks@git.wordpress.org> Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Part of #57478.
Currently in
trunk
if you use the slash inserter in a manual grid, or split a block (press Enter while typing text in a paragraph), the newly created block is inserted into the top-left-most empty cell.This PR changes that so that the newly created block is positioned after the previously selected block. Specifically, it begins at the bottom right cell of the previously selected block and scans left→right and top→bottom for the first empty cell. It will auto create rows if needed.
To test, you'll need to disable the
useEffect
inpackages/block-editor/src/components/global-styles/typography-panel.js
. See #63333 (comment). Here's a patch that does that: