-
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
Try using manualPlacement
attribute to set manual grid mode and allow responsive behaviour in both modes.
#62777
Merged
Merged
Changes from 25 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
2869ebc
Try version of grid where manual mode means all blocks have a columnS…
noisysocks c31682c
Fix some rebase breakage
tellthemachines 8cfb76f
Clean up deleted files
tellthemachines 4cbbdeb
Fix visualiser
tellthemachines 47d7665
Show appender on manual grid
tellthemachines 7e06bf8
markup reordering on drag and drop
tellthemachines 2a3c600
Reorder markup when using movers
tellthemachines f552760
Jump through a few hoops
tellthemachines c36c2fa
Fix string concatenation bugs
tellthemachines 9c3c1dd
Undo folder rename
tellthemachines e6f033c
Update file path
tellthemachines 82046c4
Fix undo weirdness
tellthemachines fd45870
Fix col and row start on resize
tellthemachines 5caa1fa
Try to escape indent hell
noisysocks ee87f98
Try using `manualPlacement` attribute to set manual grid mode.
tellthemachines 5dff3ec
Fix up the styles
tellthemachines fc33eea
Fix rows logic and fix front end
tellthemachines ba2aad6
sort out folder rename
tellthemachines dccead9
Fix some more stuff
tellthemachines dae808e
update variable name
tellthemachines 1a40391
Fix row computation with overlapping blocks
tellthemachines c9f87ba
Improve row resizing behaviour
tellthemachines a0e0ef7
Add backport changelog
tellthemachines cd81df2
Fix unsetting columns in Auto mode
tellthemachines c2b5bed
Row height should be consistent with contents.
tellthemachines e0449de
Fix layout object causing effect to run endlessly and min rows
tellthemachines c88a962
Remove values when experiment disabled and add row number when it exists
tellthemachines 2804f30
Fix label positioning and help text
tellthemachines 787c1ca
Fix `minimumColumnWidth` logic
tellthemachines 07876e3
Fix row logic
tellthemachines 34787ef
Rename things
tellthemachines fe8cc84
defaults for non-existing values
tellthemachines 1f957bb
Clean up useGridLayoutSync
noisysocks e8be06a
Simplify bottomMostRow
noisysocks 2b30c4f
parse all the ints
tellthemachines 34b1465
move the parseInt
tellthemachines File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
https://github.com/WordPress/wordpress-develop/pull/6910 | ||
|
||
* https://github.com/WordPress/gutenberg/pull/59483 | ||
* https://github.com/WordPress/gutenberg/pull/60652 | ||
* https://github.com/WordPress/gutenberg/pull/62777 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,12 +30,14 @@ export function useGridLayoutSync( { clientId: gridClientId } ) { | |
useEffect( () => { | ||
const updates = {}; | ||
|
||
const { columnCount, rowCount = 2 } = gridLayout; | ||
const isManualGrid = !! columnCount; | ||
const { columnCount, rowCount, manualPlacement } = gridLayout; | ||
|
||
const isManualGrid = !! manualPlacement; | ||
|
||
if ( isManualGrid ) { | ||
const rects = []; | ||
let cellsTaken = 0; | ||
let lowestRowEnd = 0; | ||
|
||
// Respect the position of blocks that already have a columnStart and rowStart value. | ||
for ( const clientId of blockOrder ) { | ||
|
@@ -58,18 +60,11 @@ export function useGridLayoutSync( { clientId: gridClientId } ) { | |
rowSpan, | ||
} ) | ||
); | ||
lowestRowEnd = Math.max( lowestRowEnd, rowStart + rowSpan - 1 ); | ||
} | ||
|
||
// Ensure there's enough rows to fit all blocks. | ||
const minimumNeededRows = Math.ceil( cellsTaken / columnCount ); | ||
if ( rowCount < minimumNeededRows ) { | ||
updates[ gridClientId ] = { | ||
layout: { | ||
...gridLayout, | ||
rowCount: minimumNeededRows, | ||
}, | ||
}; | ||
} | ||
|
||
// When in manual mode, ensure that every block has a columnStart and rowStart value. | ||
for ( const clientId of blockOrder ) { | ||
|
@@ -104,6 +99,15 @@ export function useGridLayoutSync( { clientId: gridClientId } ) { | |
}, | ||
}, | ||
}; | ||
lowestRowEnd = Math.max( lowestRowEnd, rowStart + rowSpan - 1 ); | ||
} | ||
if ( rowCount < lowestRowEnd ) { | ||
updates[ gridClientId ] = { | ||
layout: { | ||
...gridLayout, | ||
rowCount: minimumNeededRows, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this supposed to be |
||
}, | ||
}; | ||
} | ||
} else { | ||
// When in auto mode, remove all of the columnStart and rowStart values. | ||
|
@@ -121,6 +125,15 @@ export function useGridLayoutSync( { clientId: gridClientId } ) { | |
}; | ||
} | ||
} | ||
// Remove row styles in auto mode | ||
if ( rowCount ) { | ||
updates[ gridClientId ] = { | ||
layout: { | ||
...gridLayout, | ||
rowCount: undefined, | ||
}, | ||
}; | ||
} | ||
} | ||
|
||
if ( Object.keys( updates ).length ) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is a somewhat confusing name because "lowest row end" could mean the bottom-most row or the smallest "row end".
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.
bottomestRow
? 😄