Skip to content

Commit

Permalink
prep build 08/05
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Aug 5, 2024
2 parents f47169a + 8b1b939 commit 1fd557e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
33 changes: 20 additions & 13 deletions packages/block-editor/src/components/grid/use-grid-layout-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
);

const previouslySelectedBlockRect = usePrevious( selectedBlockRect );
const previousIsManualPlacement = usePrevious(
gridLayout.isManualPlacement
);

useEffect( () => {
const updates = {};
Expand Down Expand Up @@ -121,19 +124,22 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
};
}
} else {
// When in auto mode, remove all of the columnStart and rowStart values.
for ( const clientId of blockOrder ) {
const attributes = getBlockAttributes( clientId );
const { columnStart, rowStart, ...layout } =
attributes.style?.layout ?? {};
// Only update attributes if columnStart or rowStart are set.
if ( columnStart || rowStart ) {
updates[ clientId ] = {
style: {
...attributes.style,
layout,
},
};
// Remove all of the columnStart and rowStart values
// when switching from manual to auto mode,
if ( previousIsManualPlacement === true ) {
for ( const clientId of blockOrder ) {
const attributes = getBlockAttributes( clientId );
const { columnStart, rowStart, ...layout } =
attributes.style?.layout ?? {};
// Only update attributes if columnStart or rowStart are set.
if ( columnStart || rowStart ) {
updates[ clientId ] = {
style: {
...attributes.style,
layout,
},
};
}
}
}

Expand Down Expand Up @@ -162,6 +168,7 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
gridLayout,
blockOrder,
previouslySelectedBlockRect,
previousIsManualPlacement,
// These won't change, but the linter thinks they might:
__unstableMarkNextChangeAsNotPersistent,
getBlockAttributes,
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/src/library/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const send = (
<Path
fillRule="evenodd"
clipRule="evenodd"
d="M5.333 12.154c-1.03-.424-1.032-1.883-.002-2.31l12.261-5.085c1.03-.426 2.06.605 1.634 1.634l-5.084 12.262c-.427 1.03-1.886 1.027-2.31-.003l-1.896-4.603-4.603-1.895Zm6.061 1.498 1.594 3.87 3.87-9.334-5.464 5.463Zm4.403-6.524-9.333 3.87 3.87 1.593 5.463-5.463Z"
d="M6.332 5.748c-1.03-.426-2.06.607-1.632 1.636l1.702 3.93 7.481.575c.123.01.123.19 0 .2l-7.483.575-1.7 3.909c-.429 1.029.602 2.062 1.632 1.636l12.265-5.076c1.03-.426 1.03-1.884 0-2.31L6.332 5.748Z"
/>
</SVG>
);
Expand Down

0 comments on commit 1fd557e

Please sign in to comment.