-
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
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:
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: