@wordpress/block-editor 10.0.3 → 10.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-parent-selector/index.js +2 -2
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +3 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +19 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +2 -2
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +10 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +5 -4
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/hooks/index.js +13 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +76 -23
- package/build/hooks/layout.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +2 -2
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +3 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +19 -16
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +2 -2
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +10 -3
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +6 -5
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +73 -23
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +24 -19
- package/build-style/style.css +24 -19
- package/package.json +9 -9
- package/src/components/block-parent-selector/index.js +2 -2
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +36 -21
- package/src/components/image-editor/use-transform-image.js +2 -2
- package/src/components/spacing-sizes-control/index.js +15 -3
- package/src/components/spacing-sizes-control/spacing-input-control.js +8 -7
- package/src/components/spacing-sizes-control/style.scss +28 -24
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +64 -21
- package/src/index.js +2 -0
|
@@ -4317,7 +4317,8 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4317
4317
|
.tools-panel-item-spacing {
|
|
4318
4318
|
display: grid;
|
|
4319
4319
|
grid-template-columns: auto 1fr auto;
|
|
4320
|
-
|
|
4320
|
+
align-items: center;
|
|
4321
|
+
grid-template-rows: 25px auto;
|
|
4321
4322
|
}
|
|
4322
4323
|
|
|
4323
4324
|
.component-spacing-sizes-control {
|
|
@@ -4332,19 +4333,28 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4332
4333
|
grid-row: 1/1;
|
|
4333
4334
|
align-self: center;
|
|
4334
4335
|
}
|
|
4336
|
+
.component-spacing-sizes-control .components-base-control__label {
|
|
4337
|
+
margin-bottom: 0;
|
|
4338
|
+
height: 16px;
|
|
4339
|
+
}
|
|
4335
4340
|
.component-spacing-sizes-control .components-spacing-sizes-control__side-labels {
|
|
4336
4341
|
grid-column: 1/1;
|
|
4337
|
-
min-height: 30px;
|
|
4338
4342
|
justify-content: left;
|
|
4343
|
+
height: 16px;
|
|
4344
|
+
margin-top: 12px;
|
|
4339
4345
|
}
|
|
4340
|
-
.component-spacing-sizes-control .components-spacing-sizes-
|
|
4341
|
-
|
|
4342
|
-
|
|
4346
|
+
.component-spacing-sizes-control .components-spacing-sizes-control__side-label {
|
|
4347
|
+
grid-column: 1/1;
|
|
4348
|
+
justify-self: left;
|
|
4349
|
+
margin-bottom: 0;
|
|
4350
|
+
}
|
|
4351
|
+
.component-spacing-sizes-control.is-unlinked .components-range-control.components-spacing-sizes-control__range-control {
|
|
4352
|
+
margin-top: 12px;
|
|
4343
4353
|
}
|
|
4344
4354
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-single,
|
|
4345
4355
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-all {
|
|
4346
4356
|
color: #757575;
|
|
4347
|
-
|
|
4357
|
+
margin-bottom: 0;
|
|
4348
4358
|
}
|
|
4349
4359
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-all {
|
|
4350
4360
|
grid-column: 2/2;
|
|
@@ -4359,6 +4369,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4359
4369
|
justify-self: end;
|
|
4360
4370
|
padding: 0;
|
|
4361
4371
|
}
|
|
4372
|
+
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-all.is-small.has-icon {
|
|
4373
|
+
padding: 0;
|
|
4374
|
+
min-width: 24px;
|
|
4375
|
+
height: 16px;
|
|
4376
|
+
}
|
|
4362
4377
|
.component-spacing-sizes-control .component-spacing-sizes-control__linked-button ~ .components-spacing-sizes-control__custom-toggle-all {
|
|
4363
4378
|
margin-left: 4px;
|
|
4364
4379
|
}
|
|
@@ -4366,10 +4381,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4366
4381
|
grid-column: 3/3;
|
|
4367
4382
|
justify-self: end;
|
|
4368
4383
|
}
|
|
4369
|
-
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-all.is-small.has-icon,
|
|
4370
4384
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-single.is-small.has-icon {
|
|
4371
4385
|
padding: 0;
|
|
4372
4386
|
min-width: 24px;
|
|
4387
|
+
height: 16px;
|
|
4388
|
+
margin-top: 12px;
|
|
4373
4389
|
}
|
|
4374
4390
|
.component-spacing-sizes-control .component-spacing-sizes-control__linked-button {
|
|
4375
4391
|
grid-column: 3/3;
|
|
@@ -4379,7 +4395,6 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4379
4395
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-value-range {
|
|
4380
4396
|
grid-column: span 2;
|
|
4381
4397
|
margin-right: 8px;
|
|
4382
|
-
padding-left: 8px;
|
|
4383
4398
|
height: 30px;
|
|
4384
4399
|
}
|
|
4385
4400
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-value-input {
|
|
@@ -4387,11 +4402,7 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4387
4402
|
}
|
|
4388
4403
|
.component-spacing-sizes-control .components-spacing-sizes-control__range-control {
|
|
4389
4404
|
grid-column: span 3;
|
|
4390
|
-
|
|
4391
|
-
height: 30px;
|
|
4392
|
-
}
|
|
4393
|
-
.component-spacing-sizes-control .components-range-control__wrapper {
|
|
4394
|
-
margin-bottom: 0;
|
|
4405
|
+
height: 40px;
|
|
4395
4406
|
}
|
|
4396
4407
|
.component-spacing-sizes-control .components-range-control__mark {
|
|
4397
4408
|
height: 4px;
|
|
@@ -4408,12 +4419,6 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4408
4419
|
.component-spacing-sizes-control [class*=ThumbWrapper-thumbColor] {
|
|
4409
4420
|
z-index: 3;
|
|
4410
4421
|
}
|
|
4411
|
-
.component-spacing-sizes-control .components-spacing-sizes-control__side-label {
|
|
4412
|
-
margin-left: 4px;
|
|
4413
|
-
grid-column: 1/1;
|
|
4414
|
-
justify-self: left;
|
|
4415
|
-
font-size: 12px;
|
|
4416
|
-
}
|
|
4417
4422
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-select-control {
|
|
4418
4423
|
grid-column: span 3;
|
|
4419
4424
|
}
|
package/build-style/style.css
CHANGED
|
@@ -4317,7 +4317,8 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4317
4317
|
.tools-panel-item-spacing {
|
|
4318
4318
|
display: grid;
|
|
4319
4319
|
grid-template-columns: auto 1fr auto;
|
|
4320
|
-
|
|
4320
|
+
align-items: center;
|
|
4321
|
+
grid-template-rows: 25px auto;
|
|
4321
4322
|
}
|
|
4322
4323
|
|
|
4323
4324
|
.component-spacing-sizes-control {
|
|
@@ -4332,19 +4333,28 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4332
4333
|
grid-row: 1/1;
|
|
4333
4334
|
align-self: center;
|
|
4334
4335
|
}
|
|
4336
|
+
.component-spacing-sizes-control .components-base-control__label {
|
|
4337
|
+
margin-bottom: 0;
|
|
4338
|
+
height: 16px;
|
|
4339
|
+
}
|
|
4335
4340
|
.component-spacing-sizes-control .components-spacing-sizes-control__side-labels {
|
|
4336
4341
|
grid-column: 1/1;
|
|
4337
|
-
min-height: 30px;
|
|
4338
4342
|
justify-content: left;
|
|
4343
|
+
height: 16px;
|
|
4344
|
+
margin-top: 12px;
|
|
4339
4345
|
}
|
|
4340
|
-
.component-spacing-sizes-control .components-spacing-sizes-
|
|
4341
|
-
|
|
4342
|
-
|
|
4346
|
+
.component-spacing-sizes-control .components-spacing-sizes-control__side-label {
|
|
4347
|
+
grid-column: 1/1;
|
|
4348
|
+
justify-self: left;
|
|
4349
|
+
margin-bottom: 0;
|
|
4350
|
+
}
|
|
4351
|
+
.component-spacing-sizes-control.is-unlinked .components-range-control.components-spacing-sizes-control__range-control {
|
|
4352
|
+
margin-top: 12px;
|
|
4343
4353
|
}
|
|
4344
4354
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-single,
|
|
4345
4355
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-all {
|
|
4346
4356
|
color: #757575;
|
|
4347
|
-
|
|
4357
|
+
margin-bottom: 0;
|
|
4348
4358
|
}
|
|
4349
4359
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-all {
|
|
4350
4360
|
grid-column: 2/2;
|
|
@@ -4359,6 +4369,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4359
4369
|
justify-self: end;
|
|
4360
4370
|
padding: 0;
|
|
4361
4371
|
}
|
|
4372
|
+
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-all.is-small.has-icon {
|
|
4373
|
+
padding: 0;
|
|
4374
|
+
min-width: 24px;
|
|
4375
|
+
height: 16px;
|
|
4376
|
+
}
|
|
4362
4377
|
.component-spacing-sizes-control .component-spacing-sizes-control__linked-button ~ .components-spacing-sizes-control__custom-toggle-all {
|
|
4363
4378
|
margin-right: 4px;
|
|
4364
4379
|
}
|
|
@@ -4366,10 +4381,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4366
4381
|
grid-column: 3/3;
|
|
4367
4382
|
justify-self: end;
|
|
4368
4383
|
}
|
|
4369
|
-
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-all.is-small.has-icon,
|
|
4370
4384
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-single.is-small.has-icon {
|
|
4371
4385
|
padding: 0;
|
|
4372
4386
|
min-width: 24px;
|
|
4387
|
+
height: 16px;
|
|
4388
|
+
margin-top: 12px;
|
|
4373
4389
|
}
|
|
4374
4390
|
.component-spacing-sizes-control .component-spacing-sizes-control__linked-button {
|
|
4375
4391
|
grid-column: 3/3;
|
|
@@ -4379,7 +4395,6 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4379
4395
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-value-range {
|
|
4380
4396
|
grid-column: span 2;
|
|
4381
4397
|
margin-left: 8px;
|
|
4382
|
-
padding-right: 8px;
|
|
4383
4398
|
height: 30px;
|
|
4384
4399
|
}
|
|
4385
4400
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-value-input {
|
|
@@ -4387,11 +4402,7 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4387
4402
|
}
|
|
4388
4403
|
.component-spacing-sizes-control .components-spacing-sizes-control__range-control {
|
|
4389
4404
|
grid-column: span 3;
|
|
4390
|
-
|
|
4391
|
-
height: 30px;
|
|
4392
|
-
}
|
|
4393
|
-
.component-spacing-sizes-control .components-range-control__wrapper {
|
|
4394
|
-
margin-bottom: 0;
|
|
4405
|
+
height: 40px;
|
|
4395
4406
|
}
|
|
4396
4407
|
.component-spacing-sizes-control .components-range-control__mark {
|
|
4397
4408
|
height: 4px;
|
|
@@ -4408,12 +4419,6 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4408
4419
|
.component-spacing-sizes-control [class*=ThumbWrapper-thumbColor] {
|
|
4409
4420
|
z-index: 3;
|
|
4410
4421
|
}
|
|
4411
|
-
.component-spacing-sizes-control .components-spacing-sizes-control__side-label {
|
|
4412
|
-
margin-right: 4px;
|
|
4413
|
-
grid-column: 1/1;
|
|
4414
|
-
justify-self: left;
|
|
4415
|
-
font-size: 12px;
|
|
4416
|
-
}
|
|
4417
4422
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-select-control {
|
|
4418
4423
|
grid-column: span 3;
|
|
4419
4424
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.4",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"@wordpress/a11y": "^3.17.1",
|
|
37
37
|
"@wordpress/api-fetch": "^6.14.1",
|
|
38
38
|
"@wordpress/blob": "^3.17.1",
|
|
39
|
-
"@wordpress/blocks": "^11.16.
|
|
40
|
-
"@wordpress/components": "^21.0.
|
|
39
|
+
"@wordpress/blocks": "^11.16.4",
|
|
40
|
+
"@wordpress/components": "^21.0.4",
|
|
41
41
|
"@wordpress/compose": "^5.15.2",
|
|
42
|
-
"@wordpress/data": "^7.1.
|
|
42
|
+
"@wordpress/data": "^7.1.3",
|
|
43
43
|
"@wordpress/date": "^4.17.1",
|
|
44
44
|
"@wordpress/deprecated": "^3.17.1",
|
|
45
45
|
"@wordpress/dom": "^3.17.2",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@wordpress/i18n": "^4.17.1",
|
|
50
50
|
"@wordpress/icons": "^9.8.1",
|
|
51
51
|
"@wordpress/is-shallow-equal": "^4.17.1",
|
|
52
|
-
"@wordpress/keyboard-shortcuts": "^3.15.
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^3.15.3",
|
|
53
53
|
"@wordpress/keycodes": "^3.17.1",
|
|
54
|
-
"@wordpress/notices": "^3.17.
|
|
55
|
-
"@wordpress/rich-text": "^5.15.
|
|
54
|
+
"@wordpress/notices": "^3.17.3",
|
|
55
|
+
"@wordpress/rich-text": "^5.15.3",
|
|
56
56
|
"@wordpress/shortcode": "^3.17.1",
|
|
57
|
-
"@wordpress/style-engine": "^1.0.
|
|
57
|
+
"@wordpress/style-engine": "^1.0.3",
|
|
58
58
|
"@wordpress/token-list": "^2.17.1",
|
|
59
59
|
"@wordpress/url": "^3.18.1",
|
|
60
60
|
"@wordpress/warning": "^2.17.1",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "491b4b522dffb4d25aca066ec55500f456ac4aa3"
|
|
83
83
|
}
|
|
@@ -83,10 +83,10 @@ export default function BlockParentSelector() {
|
|
|
83
83
|
label={ sprintf(
|
|
84
84
|
/* translators: %s: Name of the block's parent. */
|
|
85
85
|
__( 'Select %s' ),
|
|
86
|
-
blockInformation
|
|
86
|
+
blockInformation?.title
|
|
87
87
|
) }
|
|
88
88
|
showTooltip
|
|
89
|
-
icon={ <BlockIcon icon={ blockInformation
|
|
89
|
+
icon={ <BlockIcon icon={ blockInformation?.icon } /> }
|
|
90
90
|
/>
|
|
91
91
|
</div>
|
|
92
92
|
);
|
|
@@ -226,7 +226,7 @@ function BlockPopoverInbetween( {
|
|
|
226
226
|
forcePopoverRecompute
|
|
227
227
|
);
|
|
228
228
|
return () => {
|
|
229
|
-
previousElement.ownerDocument.defaultView
|
|
229
|
+
previousElement.ownerDocument.defaultView?.removeEventListener(
|
|
230
230
|
'resize',
|
|
231
231
|
forcePopoverRecompute
|
|
232
232
|
);
|
|
@@ -42,24 +42,15 @@ function BlockPopover(
|
|
|
42
42
|
ref,
|
|
43
43
|
usePopoverScroll( __unstableContentRef ),
|
|
44
44
|
] );
|
|
45
|
-
const style = useMemo( () => {
|
|
46
|
-
if ( ! selectedElement || lastSelectedElement !== selectedElement ) {
|
|
47
|
-
return {};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
position: 'absolute',
|
|
52
|
-
width: selectedElement.offsetWidth,
|
|
53
|
-
height: selectedElement.offsetHeight,
|
|
54
|
-
};
|
|
55
|
-
}, [ selectedElement, lastSelectedElement, __unstableRefreshSize ] );
|
|
56
45
|
|
|
57
|
-
const [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
)
|
|
46
|
+
const [
|
|
47
|
+
popoverDimensionsRecomputeCounter,
|
|
48
|
+
forceRecomputePopoverDimensions,
|
|
49
|
+
] = useReducer(
|
|
50
|
+
// Module is there to make sure that the counter doesn't overflow.
|
|
51
|
+
( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,
|
|
52
|
+
0
|
|
53
|
+
);
|
|
63
54
|
|
|
64
55
|
// When blocks are moved up/down, they are animated to their new position by
|
|
65
56
|
// updating the `transform` property manually (i.e. without using CSS
|
|
@@ -74,7 +65,7 @@ function BlockPopover(
|
|
|
74
65
|
}
|
|
75
66
|
|
|
76
67
|
const observer = new window.MutationObserver(
|
|
77
|
-
|
|
68
|
+
forceRecomputePopoverDimensions
|
|
78
69
|
);
|
|
79
70
|
observer.observe( selectedElement, { attributes: true } );
|
|
80
71
|
|
|
@@ -83,12 +74,36 @@ function BlockPopover(
|
|
|
83
74
|
};
|
|
84
75
|
}, [ selectedElement ] );
|
|
85
76
|
|
|
77
|
+
const style = useMemo( () => {
|
|
78
|
+
if (
|
|
79
|
+
// popoverDimensionsRecomputeCounter is by definition always equal or greater
|
|
80
|
+
// than 0. This check is only there to satisfy the correctness of the
|
|
81
|
+
// exhaustive-deps rule for the `useMemo` hook.
|
|
82
|
+
popoverDimensionsRecomputeCounter < 0 ||
|
|
83
|
+
! selectedElement ||
|
|
84
|
+
lastSelectedElement !== selectedElement
|
|
85
|
+
) {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
width: selectedElement.offsetWidth,
|
|
92
|
+
height: selectedElement.offsetHeight,
|
|
93
|
+
};
|
|
94
|
+
}, [
|
|
95
|
+
selectedElement,
|
|
96
|
+
lastSelectedElement,
|
|
97
|
+
__unstableRefreshSize,
|
|
98
|
+
popoverDimensionsRecomputeCounter,
|
|
99
|
+
] );
|
|
100
|
+
|
|
86
101
|
const popoverAnchor = useMemo( () => {
|
|
87
102
|
if (
|
|
88
|
-
//
|
|
103
|
+
// popoverDimensionsRecomputeCounter is by definition always equal or greater
|
|
89
104
|
// than 0. This check is only there to satisfy the correctness of the
|
|
90
105
|
// exhaustive-deps rule for the `useMemo` hook.
|
|
91
|
-
|
|
106
|
+
popoverDimensionsRecomputeCounter < 0 ||
|
|
92
107
|
! selectedElement ||
|
|
93
108
|
( bottomClientId && ! lastSelectedElement )
|
|
94
109
|
) {
|
|
@@ -132,7 +147,7 @@ function BlockPopover(
|
|
|
132
147
|
bottomClientId,
|
|
133
148
|
lastSelectedElement,
|
|
134
149
|
selectedElement,
|
|
135
|
-
|
|
150
|
+
popoverDimensionsRecomputeCounter,
|
|
136
151
|
] );
|
|
137
152
|
|
|
138
153
|
if ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {
|
|
@@ -41,7 +41,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
|
|
|
41
41
|
if ( angle === 0 ) {
|
|
42
42
|
setEditedUrl();
|
|
43
43
|
setRotation( angle );
|
|
44
|
-
setAspect(
|
|
44
|
+
setAspect( naturalWidth / naturalHeight );
|
|
45
45
|
setPosition( {
|
|
46
46
|
x: -( position.y * naturalAspectRatio ),
|
|
47
47
|
y: position.x * naturalAspectRatio,
|
|
@@ -80,7 +80,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
|
|
|
80
80
|
canvas.toBlob( ( blob ) => {
|
|
81
81
|
setEditedUrl( URL.createObjectURL( blob ) );
|
|
82
82
|
setRotation( angle );
|
|
83
|
-
setAspect(
|
|
83
|
+
setAspect( canvas.width / canvas.height );
|
|
84
84
|
setPosition( {
|
|
85
85
|
x: -( position.y * naturalAspectRatio ),
|
|
86
86
|
y: position.x * naturalAspectRatio,
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
9
|
import { useState } from '@wordpress/element';
|
|
5
10
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
11
|
+
import { BaseControl } from '@wordpress/components';
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* Internal dependencies
|
|
@@ -68,8 +73,15 @@ export default function SpacingSizesControl( {
|
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
return (
|
|
71
|
-
<fieldset
|
|
72
|
-
|
|
76
|
+
<fieldset
|
|
77
|
+
role="region"
|
|
78
|
+
className={ classnames( 'component-spacing-sizes-control', {
|
|
79
|
+
'is-unlinked': ! isLinked,
|
|
80
|
+
} ) }
|
|
81
|
+
>
|
|
82
|
+
<BaseControl.VisualLabel as="legend">
|
|
83
|
+
{ label }
|
|
84
|
+
</BaseControl.VisualLabel>
|
|
73
85
|
{ ! hasOneSide && (
|
|
74
86
|
<LinkedButton onClick={ toggleLinked } isLinked={ isLinked } />
|
|
75
87
|
) }
|
|
@@ -9,12 +9,12 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { useState, useMemo } from '@wordpress/element';
|
|
10
10
|
import { useSelect } from '@wordpress/data';
|
|
11
11
|
import {
|
|
12
|
+
BaseControl,
|
|
12
13
|
Button,
|
|
13
14
|
RangeControl,
|
|
14
15
|
CustomSelectControl,
|
|
15
16
|
__experimentalUnitControl as UnitControl,
|
|
16
17
|
__experimentalHStack as HStack,
|
|
17
|
-
__experimentalText as Text,
|
|
18
18
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
19
19
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
20
20
|
} from '@wordpress/components';
|
|
@@ -167,21 +167,21 @@ export default function SpacingInputControl( {
|
|
|
167
167
|
<>
|
|
168
168
|
{ side !== 'all' && (
|
|
169
169
|
<HStack className="components-spacing-sizes-control__side-labels">
|
|
170
|
-
<
|
|
170
|
+
<BaseControl.VisualLabel className="components-spacing-sizes-control__side-label">
|
|
171
171
|
{ LABELS[ side ] }
|
|
172
|
-
</
|
|
172
|
+
</BaseControl.VisualLabel>
|
|
173
173
|
|
|
174
174
|
{ showHint && (
|
|
175
|
-
<
|
|
175
|
+
<BaseControl.VisualLabel className="components-spacing-sizes-control__hint-single">
|
|
176
176
|
{ currentValueHint }
|
|
177
|
-
</
|
|
177
|
+
</BaseControl.VisualLabel>
|
|
178
178
|
) }
|
|
179
179
|
</HStack>
|
|
180
180
|
) }
|
|
181
181
|
{ side === 'all' && showHint && (
|
|
182
|
-
<
|
|
182
|
+
<BaseControl.VisualLabel className="components-spacing-sizes-control__hint-all">
|
|
183
183
|
{ currentValueHint }
|
|
184
|
-
</
|
|
184
|
+
</BaseControl.VisualLabel>
|
|
185
185
|
) }
|
|
186
186
|
|
|
187
187
|
{ ! disableCustomSpacingSizes && (
|
|
@@ -256,6 +256,7 @@ export default function SpacingInputControl( {
|
|
|
256
256
|
marks={ marks }
|
|
257
257
|
label={ ariaLabel }
|
|
258
258
|
hideLabelFromVision={ true }
|
|
259
|
+
__nextHasNoMarginBottom={ true }
|
|
259
260
|
/>
|
|
260
261
|
) }
|
|
261
262
|
{ ! showRangeControl && ! showCustomValueControl && (
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
.tools-panel-item-spacing {
|
|
2
2
|
display: grid;
|
|
3
3
|
grid-template-columns: auto 1fr auto;
|
|
4
|
-
|
|
4
|
+
align-items: center;
|
|
5
|
+
grid-template-rows: 25px auto;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
.component-spacing-sizes-control {
|
|
@@ -17,21 +18,34 @@
|
|
|
17
18
|
align-self: center;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
.components-base-control__label {
|
|
22
|
+
margin-bottom: 0;
|
|
23
|
+
height: $grid-unit-20;
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
.components-spacing-sizes-control__side-labels {
|
|
21
27
|
grid-column: 1 / 1;
|
|
22
|
-
min-height: 30px;
|
|
23
28
|
justify-content: left;
|
|
29
|
+
height: $grid-unit-20;
|
|
30
|
+
margin-top: $grid-unit-15;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.components-spacing-sizes-control__side-label {
|
|
34
|
+
grid-column: 1 / 1;
|
|
35
|
+
justify-self: left;
|
|
36
|
+
margin-bottom: 0;
|
|
24
37
|
}
|
|
25
38
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
&.is-unlinked {
|
|
40
|
+
.components-range-control.components-spacing-sizes-control__range-control {
|
|
41
|
+
margin-top: $grid-unit-15;
|
|
42
|
+
}
|
|
29
43
|
}
|
|
30
44
|
|
|
31
45
|
.components-spacing-sizes-control__hint-single,
|
|
32
46
|
.components-spacing-sizes-control__hint-all {
|
|
33
47
|
color: $gray-700;
|
|
34
|
-
|
|
48
|
+
margin-bottom: 0;
|
|
35
49
|
}
|
|
36
50
|
|
|
37
51
|
.components-spacing-sizes-control__hint-all {
|
|
@@ -47,6 +61,11 @@
|
|
|
47
61
|
grid-row: 1 / 1;
|
|
48
62
|
justify-self: end;
|
|
49
63
|
padding: 0;
|
|
64
|
+
&.is-small.has-icon {
|
|
65
|
+
padding: 0;
|
|
66
|
+
min-width: $icon-size;
|
|
67
|
+
height: $grid-unit-20;
|
|
68
|
+
}
|
|
50
69
|
}
|
|
51
70
|
|
|
52
71
|
.component-spacing-sizes-control__linked-button ~ .components-spacing-sizes-control__custom-toggle-all {
|
|
@@ -56,13 +75,11 @@
|
|
|
56
75
|
.components-spacing-sizes-control__custom-toggle-single {
|
|
57
76
|
grid-column: 3 / 3;
|
|
58
77
|
justify-self: end;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.components-spacing-sizes-control__custom-toggle-all,
|
|
62
|
-
.components-spacing-sizes-control__custom-toggle-single {
|
|
63
78
|
&.is-small.has-icon {
|
|
64
79
|
padding: 0;
|
|
65
80
|
min-width: $icon-size;
|
|
81
|
+
height: $grid-unit-20;
|
|
82
|
+
margin-top: $grid-unit-15;
|
|
66
83
|
}
|
|
67
84
|
}
|
|
68
85
|
|
|
@@ -75,7 +92,6 @@
|
|
|
75
92
|
.components-spacing-sizes-control__custom-value-range {
|
|
76
93
|
grid-column: span 2;
|
|
77
94
|
margin-left: $grid-unit-10;
|
|
78
|
-
padding-right: $grid-unit-10;
|
|
79
95
|
height: 30px;
|
|
80
96
|
}
|
|
81
97
|
|
|
@@ -85,12 +101,7 @@
|
|
|
85
101
|
|
|
86
102
|
.components-spacing-sizes-control__range-control {
|
|
87
103
|
grid-column: span 3;
|
|
88
|
-
|
|
89
|
-
height: 30px;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.components-range-control__wrapper {
|
|
93
|
-
margin-bottom: 0;
|
|
104
|
+
height: 40px;
|
|
94
105
|
}
|
|
95
106
|
|
|
96
107
|
.components-range-control__mark {
|
|
@@ -112,13 +123,6 @@
|
|
|
112
123
|
z-index: 3;
|
|
113
124
|
}
|
|
114
125
|
|
|
115
|
-
.components-spacing-sizes-control__side-label {
|
|
116
|
-
margin-right: $grid-unit-05;
|
|
117
|
-
grid-column: 1 / 1;
|
|
118
|
-
justify-self: left;
|
|
119
|
-
font-size: 12px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
126
|
.components-spacing-sizes-control__custom-select-control {
|
|
123
127
|
grid-column: span 3;
|
|
124
128
|
}
|
package/src/hooks/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import './metadata';
|
|
|
20
20
|
import './metadata-name';
|
|
21
21
|
|
|
22
22
|
export { useCustomSides } from './dimensions';
|
|
23
|
+
export { useLayoutClasses, useLayoutStyles } from './layout';
|
|
23
24
|
export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
|
|
24
25
|
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
|
|
25
26
|
export { getSpacingClassesAndStyles } from './use-spacing-props';
|