Skip to content
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

Cherry-pick PRs for the WordPress 6.1 Beta 3 Release #44656

Merged
merged 23 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
eb2ded5
Quote block: stop slash inserter popup showing in citation (#44634)
glendaviesnz Oct 3, 2022
9d1fe96
Query Loop: Fix condition for displaying 'parents' control (#44630)
Mamaduka Oct 3, 2022
7e9fd39
Hide the Classic block in the Site Editor (#44554)
michalczaplinski Sep 30, 2022
1bbc3ab
Fix navigation block console error (#44594)
talldan Sep 30, 2022
50bb90d
Remove the invalid spacing preset setting (#44555)
glendaviesnz Sep 30, 2022
2159bbb
Add box-sizing. (#44580)
ndiego Sep 29, 2022
14d6500
Remove border from Global Styles previews (#44556)
ndiego Sep 29, 2022
ad37bdd
Spacing presets: Modify the styling of the input controls when in unl…
glendaviesnz Sep 29, 2022
4a0fbe0
[TypeScript] Preserve the generic signature of getEntityRecord and ge…
adamziel Sep 27, 2022
4b92996
Theme.json: fix some outline properties doesn't work properly on the …
t-hamano Sep 28, 2022
af3f84e
Add style-engine to gutenberg tsconfig references (#44516)
Sep 27, 2022
9aaf066
[Block Library - Query Loop]: Rename Query Loop variations `allowCont…
ntsekouras Sep 28, 2022
32de2fb
Post Featured Image: Fix borders after addition of overlay feature (#…
aaronrobertshaw Sep 27, 2022
61a1bc2
Template editor: fix crashes due to undefined vars (#44482)
glendaviesnz Sep 28, 2022
add234f
Template part: prevent adding block in post editor or inside post tem…
ramonjd Sep 27, 2022
33f9e9f
Fix rotated image crop area aspect ratio (#44425)
Sep 27, 2022
1876d24
Fix padding/margin visualizer accuracy (#44485)
talldan Sep 27, 2022
a3e9d0a
PostFeaturedImage: Fix application of default border style in editor …
aaronrobertshaw Sep 28, 2022
c5b3727
Theme.json: fix some shadow properties doesn't work properly on the s…
t-hamano Sep 29, 2022
d4cb2cc
ToggleGroupControl: fix unselected icon color (#44575)
ciampo Sep 29, 2022
b3343b9
TokenInput field: try alternative approach to fix screen reader focus…
ciampo Sep 29, 2022
d8fcfec
Add layout styles from Post Content block to post editor (#44258)
tellthemachines Sep 27, 2022
baa41ca
Edit Post: Optimize legacy post content layout (#44506)
tyxla Sep 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php
Original file line number Diff line number Diff line change
Expand Up @@ -1151,15 +1151,6 @@ protected static function get_property_value( $styles, $path, $theme_json = null
'classes' => array(),
'properties' => array( 'padding', 'margin' ),
),
array(
'path' => array( 'spacing', 'spacingScale' ),
'prevent_override' => false,
'use_default_names' => true,
'value_key' => 'size',
'css_vars' => '--wp--preset--spacing--$slug',
'classes' => array(),
'properties' => array( 'padding', 'margin' ),
),
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export default function BlockParentSelector() {
label={ sprintf(
/* translators: %s: Name of the block's parent. */
__( 'Select %s' ),
blockInformation.title
blockInformation?.title
) }
showTooltip
icon={ <BlockIcon icon={ blockInformation.icon } /> }
icon={ <BlockIcon icon={ blockInformation?.icon } /> }
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function BlockPopoverInbetween( {
forcePopoverRecompute
);
return () => {
previousElement.ownerDocument.defaultView.removeEventListener(
previousElement.ownerDocument.defaultView?.removeEventListener(
'resize',
forcePopoverRecompute
);
Expand Down
57 changes: 36 additions & 21 deletions packages/block-editor/src/components/block-popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,15 @@ function BlockPopover(
ref,
usePopoverScroll( __unstableContentRef ),
] );
const style = useMemo( () => {
if ( ! selectedElement || lastSelectedElement !== selectedElement ) {
return {};
}

return {
position: 'absolute',
width: selectedElement.offsetWidth,
height: selectedElement.offsetHeight,
};
}, [ selectedElement, lastSelectedElement, __unstableRefreshSize ] );

const [ popoverAnchorRecomputeCounter, forceRecomputePopoverAnchor ] =
useReducer(
// Module is there to make sure that the counter doesn't overflow.
( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,
0
);
const [
popoverDimensionsRecomputeCounter,
forceRecomputePopoverDimensions,
] = useReducer(
// Module is there to make sure that the counter doesn't overflow.
( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,
0
);

// When blocks are moved up/down, they are animated to their new position by
// updating the `transform` property manually (i.e. without using CSS
Expand All @@ -74,7 +65,7 @@ function BlockPopover(
}

const observer = new window.MutationObserver(
forceRecomputePopoverAnchor
forceRecomputePopoverDimensions
);
observer.observe( selectedElement, { attributes: true } );

Expand All @@ -83,12 +74,36 @@ function BlockPopover(
};
}, [ selectedElement ] );

const style = useMemo( () => {
if (
// popoverDimensionsRecomputeCounter is by definition always equal or greater
// than 0. This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverDimensionsRecomputeCounter < 0 ||
! selectedElement ||
lastSelectedElement !== selectedElement
) {
return {};
}

return {
position: 'absolute',
width: selectedElement.offsetWidth,
height: selectedElement.offsetHeight,
};
}, [
selectedElement,
lastSelectedElement,
__unstableRefreshSize,
popoverDimensionsRecomputeCounter,
] );

const popoverAnchor = useMemo( () => {
if (
// popoverAnchorRecomputeCounter is by definition always equal or greater
// popoverDimensionsRecomputeCounter is by definition always equal or greater
// than 0. This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverAnchorRecomputeCounter < 0 ||
popoverDimensionsRecomputeCounter < 0 ||
! selectedElement ||
( bottomClientId && ! lastSelectedElement )
) {
Expand Down Expand Up @@ -132,7 +147,7 @@ function BlockPopover(
bottomClientId,
lastSelectedElement,
selectedElement,
popoverAnchorRecomputeCounter,
popoverDimensionsRecomputeCounter,
] );

if ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
if ( angle === 0 ) {
setEditedUrl();
setRotation( angle );
setAspect( 1 / aspect );
setAspect( naturalWidth / naturalHeight );
setPosition( {
x: -( position.y * naturalAspectRatio ),
y: position.x * naturalAspectRatio,
Expand Down Expand Up @@ -80,7 +80,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
canvas.toBlob( ( blob ) => {
setEditedUrl( URL.createObjectURL( blob ) );
setRotation( angle );
setAspect( 1 / aspect );
setAspect( canvas.width / canvas.height );
setPosition( {
x: -( position.y * naturalAspectRatio ),
y: position.x * naturalAspectRatio,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/**
* External dependencies
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { __experimentalText as Text } from '@wordpress/components';
import { BaseControl } from '@wordpress/components';

/**
* Internal dependencies
Expand Down Expand Up @@ -68,8 +73,15 @@ export default function SpacingSizesControl( {
};

return (
<fieldset role="region" className="component-spacing-sizes-control">
<Text as="legend">{ label }</Text>
<fieldset
role="region"
className={ classnames( 'component-spacing-sizes-control', {
'is-unlinked': ! isLinked,
} ) }
>
<BaseControl.VisualLabel as="legend">
{ label }
</BaseControl.VisualLabel>
{ ! hasOneSide && (
<LinkedButton onClick={ toggleLinked } isLinked={ isLinked } />
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import classnames from 'classnames';
import { useState, useMemo } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import {
BaseControl,
Button,
RangeControl,
CustomSelectControl,
__experimentalUnitControl as UnitControl,
__experimentalHStack as HStack,
__experimentalText as Text,
__experimentalUseCustomUnits as useCustomUnits,
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
} from '@wordpress/components';
Expand Down Expand Up @@ -167,21 +167,21 @@ export default function SpacingInputControl( {
<>
{ side !== 'all' && (
<HStack className="components-spacing-sizes-control__side-labels">
<Text className="components-spacing-sizes-control__side-label">
<BaseControl.VisualLabel className="components-spacing-sizes-control__side-label">
{ LABELS[ side ] }
</Text>
</BaseControl.VisualLabel>

{ showHint && (
<Text className="components-spacing-sizes-control__hint-single">
<BaseControl.VisualLabel className="components-spacing-sizes-control__hint-single">
{ currentValueHint }
</Text>
</BaseControl.VisualLabel>
) }
</HStack>
) }
{ side === 'all' && showHint && (
<Text className="components-spacing-sizes-control__hint-all">
<BaseControl.VisualLabel className="components-spacing-sizes-control__hint-all">
{ currentValueHint }
</Text>
</BaseControl.VisualLabel>
) }

{ ! disableCustomSpacingSizes && (
Expand Down Expand Up @@ -256,6 +256,7 @@ export default function SpacingInputControl( {
marks={ marks }
label={ ariaLabel }
hideLabelFromVision={ true }
__nextHasNoMarginBottom={ true }
/>
) }
{ ! showRangeControl && ! showCustomValueControl && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.tools-panel-item-spacing {
display: grid;
grid-template-columns: auto 1fr auto;
grid-row-gap: $grid-unit-05;
align-items: center;
grid-template-rows: 25px auto;
}

.component-spacing-sizes-control {
Expand All @@ -17,21 +18,34 @@
align-self: center;
}

.components-base-control__label {
margin-bottom: 0;
height: $grid-unit-20;
}

.components-spacing-sizes-control__side-labels {
grid-column: 1 / 1;
min-height: 30px;
justify-content: left;
height: $grid-unit-20;
margin-top: $grid-unit-15;
}

.components-spacing-sizes-control__side-label {
grid-column: 1 / 1;
justify-self: left;
margin-bottom: 0;
}

.components-spacing-sizes-control__hint-single {
margin-top: 0;
margin-left: 0;
&.is-unlinked {
.components-range-control.components-spacing-sizes-control__range-control {
margin-top: $grid-unit-15;
}
}

.components-spacing-sizes-control__hint-single,
.components-spacing-sizes-control__hint-all {
color: $gray-700;
font-size: 12px;
margin-bottom: 0;
}

.components-spacing-sizes-control__hint-all {
Expand All @@ -47,6 +61,11 @@
grid-row: 1 / 1;
justify-self: end;
padding: 0;
&.is-small.has-icon {
padding: 0;
min-width: $icon-size;
height: $grid-unit-20;
}
}

.component-spacing-sizes-control__linked-button ~ .components-spacing-sizes-control__custom-toggle-all {
Expand All @@ -56,13 +75,11 @@
.components-spacing-sizes-control__custom-toggle-single {
grid-column: 3 / 3;
justify-self: end;
}

.components-spacing-sizes-control__custom-toggle-all,
.components-spacing-sizes-control__custom-toggle-single {
&.is-small.has-icon {
padding: 0;
min-width: $icon-size;
height: $grid-unit-20;
margin-top: $grid-unit-15;
}
}

Expand All @@ -75,7 +92,6 @@
.components-spacing-sizes-control__custom-value-range {
grid-column: span 2;
margin-left: $grid-unit-10;
padding-right: $grid-unit-10;
height: 30px;
}

Expand All @@ -85,12 +101,7 @@

.components-spacing-sizes-control__range-control {
grid-column: span 3;
padding-right: $grid-unit-10;
height: 30px;
}

.components-range-control__wrapper {
margin-bottom: 0;
height: 40px;
}

.components-range-control__mark {
Expand All @@ -112,13 +123,6 @@
z-index: 3;
}

.components-spacing-sizes-control__side-label {
margin-right: $grid-unit-05;
grid-column: 1 / 1;
justify-self: left;
font-size: 12px;
}

.components-spacing-sizes-control__custom-select-control {
grid-column: span 3;
}
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import './metadata';
import './metadata-name';

export { useCustomSides } from './dimensions';
export { useLayoutClasses, useLayoutStyles } from './layout';
export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
export { getSpacingClassesAndStyles } from './use-spacing-props';
Expand Down
Loading