@wordpress/block-editor 10.1.1-next.4d3b314fd5.0 → 10.2.0
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/CHANGELOG.md +2 -0
- package/build/components/block-controls/slot.js +2 -2
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-inspector/index.js +4 -5
- package/build/components/block-inspector/index.js.map +1 -1
- 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 +20 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -5
- package/build/components/block-settings-menu/block-settings-dropdown.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/inserter/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/search-items.js +2 -17
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inspector-controls/slot.js +2 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/rich-text/index.js +17 -0
- package/build/components/rich-text/index.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/store/reducer.js +5 -3
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-controls/slot.js +3 -3
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-inspector/index.js +5 -6
- package/build-module/components/block-inspector/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 +20 -16
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.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/inserter/block-types-tab.js +3 -3
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/search-items.js +3 -17
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -2
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/rich-text/index.js +17 -0
- package/build-module/components/rich-text/index.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/store/reducer.js +5 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +28 -23
- package/build-style/style.css +28 -23
- package/package.json +28 -29
- package/src/components/block-controls/slot.js +3 -3
- package/src/components/block-inspector/index.js +6 -10
- 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 +37 -21
- package/src/components/block-settings-menu/block-settings-dropdown.js +7 -7
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +104 -33
- package/src/components/block-switcher/test/index.js +121 -61
- package/src/components/button-block-appender/style.scss +3 -1
- package/src/components/image-editor/use-transform-image.js +2 -2
- package/src/components/inserter/block-types-tab.js +3 -3
- package/src/components/inserter/search-items.js +3 -15
- package/src/components/inserter/test/search-items.js +4 -0
- package/src/components/inspector-controls/slot.js +6 -2
- package/src/components/responsive-block-control/test/index.js +73 -118
- package/src/components/rich-text/index.js +22 -0
- 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/store/reducer.js +4 -4
package/build-style/style.css
CHANGED
|
@@ -1764,10 +1764,10 @@
|
|
|
1764
1764
|
color: #000;
|
|
1765
1765
|
}
|
|
1766
1766
|
|
|
1767
|
-
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child {
|
|
1767
|
+
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child, .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child {
|
|
1768
1768
|
pointer-events: none;
|
|
1769
1769
|
}
|
|
1770
|
-
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after {
|
|
1770
|
+
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after, .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child::after, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child::after {
|
|
1771
1771
|
content: "";
|
|
1772
1772
|
position: absolute;
|
|
1773
1773
|
top: 0;
|
|
@@ -1777,7 +1777,7 @@
|
|
|
1777
1777
|
pointer-events: none;
|
|
1778
1778
|
border-radius: 2px;
|
|
1779
1779
|
}
|
|
1780
|
-
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after::before, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after::before {
|
|
1780
|
+
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after::before, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child::after::before, .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child::after::before, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child::after::before {
|
|
1781
1781
|
content: "";
|
|
1782
1782
|
position: absolute;
|
|
1783
1783
|
top: 0;
|
|
@@ -1788,7 +1788,7 @@
|
|
|
1788
1788
|
background: currentColor;
|
|
1789
1789
|
opacity: 0.1;
|
|
1790
1790
|
}
|
|
1791
|
-
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child .block-editor-inserter, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child .block-editor-inserter {
|
|
1791
|
+
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child .block-editor-inserter, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-list-appender:only-child .block-editor-inserter, .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child .block-editor-inserter, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > .block-list-appender:only-child .block-editor-inserter {
|
|
1792
1792
|
visibility: hidden;
|
|
1793
1793
|
}
|
|
1794
1794
|
|
|
@@ -4335,7 +4335,8 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4335
4335
|
.tools-panel-item-spacing {
|
|
4336
4336
|
display: grid;
|
|
4337
4337
|
grid-template-columns: auto 1fr auto;
|
|
4338
|
-
|
|
4338
|
+
align-items: center;
|
|
4339
|
+
grid-template-rows: 25px auto;
|
|
4339
4340
|
}
|
|
4340
4341
|
|
|
4341
4342
|
.component-spacing-sizes-control {
|
|
@@ -4350,19 +4351,28 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4350
4351
|
grid-row: 1/1;
|
|
4351
4352
|
align-self: center;
|
|
4352
4353
|
}
|
|
4354
|
+
.component-spacing-sizes-control .components-base-control__label {
|
|
4355
|
+
margin-bottom: 0;
|
|
4356
|
+
height: 16px;
|
|
4357
|
+
}
|
|
4353
4358
|
.component-spacing-sizes-control .components-spacing-sizes-control__side-labels {
|
|
4354
4359
|
grid-column: 1/1;
|
|
4355
|
-
min-height: 30px;
|
|
4356
4360
|
justify-content: left;
|
|
4361
|
+
height: 16px;
|
|
4362
|
+
margin-top: 12px;
|
|
4357
4363
|
}
|
|
4358
|
-
.component-spacing-sizes-control .components-spacing-sizes-
|
|
4359
|
-
|
|
4360
|
-
|
|
4364
|
+
.component-spacing-sizes-control .components-spacing-sizes-control__side-label {
|
|
4365
|
+
grid-column: 1/1;
|
|
4366
|
+
justify-self: left;
|
|
4367
|
+
margin-bottom: 0;
|
|
4368
|
+
}
|
|
4369
|
+
.component-spacing-sizes-control.is-unlinked .components-range-control.components-spacing-sizes-control__range-control {
|
|
4370
|
+
margin-top: 12px;
|
|
4361
4371
|
}
|
|
4362
4372
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-single,
|
|
4363
4373
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-all {
|
|
4364
4374
|
color: #757575;
|
|
4365
|
-
|
|
4375
|
+
margin-bottom: 0;
|
|
4366
4376
|
}
|
|
4367
4377
|
.component-spacing-sizes-control .components-spacing-sizes-control__hint-all {
|
|
4368
4378
|
grid-column: 2/2;
|
|
@@ -4377,6 +4387,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4377
4387
|
justify-self: end;
|
|
4378
4388
|
padding: 0;
|
|
4379
4389
|
}
|
|
4390
|
+
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-all.is-small.has-icon {
|
|
4391
|
+
padding: 0;
|
|
4392
|
+
min-width: 24px;
|
|
4393
|
+
height: 16px;
|
|
4394
|
+
}
|
|
4380
4395
|
.component-spacing-sizes-control .component-spacing-sizes-control__linked-button ~ .components-spacing-sizes-control__custom-toggle-all {
|
|
4381
4396
|
margin-right: 4px;
|
|
4382
4397
|
}
|
|
@@ -4384,10 +4399,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4384
4399
|
grid-column: 3/3;
|
|
4385
4400
|
justify-self: end;
|
|
4386
4401
|
}
|
|
4387
|
-
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-all.is-small.has-icon,
|
|
4388
4402
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-toggle-single.is-small.has-icon {
|
|
4389
4403
|
padding: 0;
|
|
4390
4404
|
min-width: 24px;
|
|
4405
|
+
height: 16px;
|
|
4406
|
+
margin-top: 12px;
|
|
4391
4407
|
}
|
|
4392
4408
|
.component-spacing-sizes-control .component-spacing-sizes-control__linked-button {
|
|
4393
4409
|
grid-column: 3/3;
|
|
@@ -4397,7 +4413,6 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4397
4413
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-value-range {
|
|
4398
4414
|
grid-column: span 2;
|
|
4399
4415
|
margin-left: 8px;
|
|
4400
|
-
padding-right: 8px;
|
|
4401
4416
|
height: 30px;
|
|
4402
4417
|
}
|
|
4403
4418
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-value-input {
|
|
@@ -4405,11 +4420,7 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4405
4420
|
}
|
|
4406
4421
|
.component-spacing-sizes-control .components-spacing-sizes-control__range-control {
|
|
4407
4422
|
grid-column: span 3;
|
|
4408
|
-
|
|
4409
|
-
height: 30px;
|
|
4410
|
-
}
|
|
4411
|
-
.component-spacing-sizes-control .components-range-control__wrapper {
|
|
4412
|
-
margin-bottom: 0;
|
|
4423
|
+
height: 40px;
|
|
4413
4424
|
}
|
|
4414
4425
|
.component-spacing-sizes-control .components-range-control__mark {
|
|
4415
4426
|
height: 4px;
|
|
@@ -4426,12 +4437,6 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
4426
4437
|
.component-spacing-sizes-control [class*=ThumbWrapper-thumbColor] {
|
|
4427
4438
|
z-index: 3;
|
|
4428
4439
|
}
|
|
4429
|
-
.component-spacing-sizes-control .components-spacing-sizes-control__side-label {
|
|
4430
|
-
margin-right: 4px;
|
|
4431
|
-
grid-column: 1/1;
|
|
4432
|
-
justify-self: left;
|
|
4433
|
-
font-size: 12px;
|
|
4434
|
-
}
|
|
4435
4440
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-select-control {
|
|
4436
4441
|
grid-column: span 3;
|
|
4437
4442
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,33 +33,32 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
35
|
"@react-spring/web": "^9.4.5",
|
|
36
|
-
"@wordpress/a11y": "^3.
|
|
37
|
-
"@wordpress/api-fetch": "^6.
|
|
38
|
-
"@wordpress/blob": "^3.
|
|
39
|
-
"@wordpress/blocks": "^11.18.
|
|
40
|
-
"@wordpress/components": "^21.
|
|
41
|
-
"@wordpress/compose": "^5.
|
|
42
|
-
"@wordpress/data": "^7.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^4.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
52
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
53
|
-
"@wordpress/keycodes": "^3.
|
|
54
|
-
"@wordpress/notices": "^3.
|
|
55
|
-
"@wordpress/rich-text": "^5.
|
|
56
|
-
"@wordpress/shortcode": "^3.
|
|
57
|
-
"@wordpress/style-engine": "^1.
|
|
58
|
-
"@wordpress/token-list": "^2.
|
|
59
|
-
"@wordpress/url": "^3.
|
|
60
|
-
"@wordpress/warning": "^2.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
62
|
-
"change-case": "^4.1.2",
|
|
36
|
+
"@wordpress/a11y": "^3.19.0",
|
|
37
|
+
"@wordpress/api-fetch": "^6.16.0",
|
|
38
|
+
"@wordpress/blob": "^3.19.0",
|
|
39
|
+
"@wordpress/blocks": "^11.18.0",
|
|
40
|
+
"@wordpress/components": "^21.2.0",
|
|
41
|
+
"@wordpress/compose": "^5.17.0",
|
|
42
|
+
"@wordpress/data": "^7.3.0",
|
|
43
|
+
"@wordpress/date": "^4.19.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.19.0",
|
|
45
|
+
"@wordpress/dom": "^3.19.0",
|
|
46
|
+
"@wordpress/element": "^4.17.0",
|
|
47
|
+
"@wordpress/hooks": "^3.19.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.19.0",
|
|
49
|
+
"@wordpress/i18n": "^4.19.0",
|
|
50
|
+
"@wordpress/icons": "^9.10.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.19.0",
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^3.17.0",
|
|
53
|
+
"@wordpress/keycodes": "^3.19.0",
|
|
54
|
+
"@wordpress/notices": "^3.19.0",
|
|
55
|
+
"@wordpress/rich-text": "^5.17.0",
|
|
56
|
+
"@wordpress/shortcode": "^3.19.0",
|
|
57
|
+
"@wordpress/style-engine": "^1.2.0",
|
|
58
|
+
"@wordpress/token-list": "^2.19.0",
|
|
59
|
+
"@wordpress/url": "^3.20.0",
|
|
60
|
+
"@wordpress/warning": "^2.19.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.19.0",
|
|
63
62
|
"classnames": "^2.3.1",
|
|
64
63
|
"colord": "^2.7.0",
|
|
65
64
|
"diff": "^4.0.2",
|
|
@@ -79,5 +78,5 @@
|
|
|
79
78
|
"publishConfig": {
|
|
80
79
|
"access": "public"
|
|
81
80
|
},
|
|
82
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "8d42d2febb7d0ba8372a33e560a62f5a5f6a9112"
|
|
83
82
|
}
|
|
@@ -5,7 +5,7 @@ import { useContext } from '@wordpress/element';
|
|
|
5
5
|
import {
|
|
6
6
|
__experimentalToolbarContext as ToolbarContext,
|
|
7
7
|
ToolbarGroup,
|
|
8
|
-
|
|
8
|
+
__experimentalUseSlotFills as useSlotFills,
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -16,8 +16,8 @@ import groups from './groups';
|
|
|
16
16
|
export default function BlockControlsSlot( { group = 'default', ...props } ) {
|
|
17
17
|
const accessibleToolbarState = useContext( ToolbarContext );
|
|
18
18
|
const Slot = groups[ group ].Slot;
|
|
19
|
-
const
|
|
20
|
-
const hasFills = Boolean(
|
|
19
|
+
const fills = useSlotFills( Slot.__unstableName );
|
|
20
|
+
const hasFills = Boolean( fills && fills.length );
|
|
21
21
|
|
|
22
22
|
if ( ! hasFills ) {
|
|
23
23
|
return null;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@wordpress/blocks';
|
|
11
11
|
import {
|
|
12
12
|
PanelBody,
|
|
13
|
-
|
|
13
|
+
__experimentalUseSlotFills as useSlotFills,
|
|
14
14
|
FlexItem,
|
|
15
15
|
__experimentalHStack as HStack,
|
|
16
16
|
__experimentalVStack as VStack,
|
|
@@ -143,7 +143,6 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
|
143
143
|
getSelectedBlockCount,
|
|
144
144
|
getBlockName,
|
|
145
145
|
__unstableGetContentLockingParent,
|
|
146
|
-
getTemplateLock,
|
|
147
146
|
} = select( blockEditorStore );
|
|
148
147
|
|
|
149
148
|
const _selectedBlockClientId = getSelectedBlockClientId();
|
|
@@ -157,12 +156,9 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
|
157
156
|
selectedBlockClientId: _selectedBlockClientId,
|
|
158
157
|
selectedBlockName: _selectedBlockName,
|
|
159
158
|
blockType: _blockType,
|
|
160
|
-
topLevelLockedBlock:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
: __unstableGetContentLockingParent(
|
|
164
|
-
_selectedBlockClientId
|
|
165
|
-
),
|
|
159
|
+
topLevelLockedBlock: __unstableGetContentLockingParent(
|
|
160
|
+
_selectedBlockClientId
|
|
161
|
+
),
|
|
166
162
|
};
|
|
167
163
|
}, [] );
|
|
168
164
|
|
|
@@ -284,8 +280,8 @@ const BlockInspectorSingleBlock = ( { clientId, blockName } ) => {
|
|
|
284
280
|
};
|
|
285
281
|
|
|
286
282
|
const AdvancedControls = () => {
|
|
287
|
-
const
|
|
288
|
-
const hasFills = Boolean(
|
|
283
|
+
const fills = useSlotFills( InspectorAdvancedControls.slotName );
|
|
284
|
+
const hasFills = Boolean( fills && fills.length );
|
|
289
285
|
|
|
290
286
|
if ( ! hasFills ) {
|
|
291
287
|
return null;
|
|
@@ -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 ) ) {
|
|
@@ -148,6 +163,7 @@ function BlockPopover(
|
|
|
148
163
|
// Render in the old slot if needed for backward compatibility,
|
|
149
164
|
// otherwise render in place (not in the default popover slot).
|
|
150
165
|
__unstableSlotName={ __unstablePopoverSlot || null }
|
|
166
|
+
placement="top-start"
|
|
151
167
|
resize={ false }
|
|
152
168
|
flip={ false }
|
|
153
169
|
shift
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { castArray
|
|
4
|
+
import { castArray } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from '@wordpress/element';
|
|
19
19
|
import { __, sprintf } from '@wordpress/i18n';
|
|
20
20
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
21
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
21
|
+
import { pipe, useCopyToClipboard } from '@wordpress/compose';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
@@ -241,7 +241,7 @@ export function BlockSettingsDropdown( {
|
|
|
241
241
|
/>
|
|
242
242
|
{ canDuplicate && (
|
|
243
243
|
<MenuItem
|
|
244
|
-
onClick={
|
|
244
|
+
onClick={ pipe(
|
|
245
245
|
onClose,
|
|
246
246
|
onDuplicate,
|
|
247
247
|
updateSelectionAfterDuplicate
|
|
@@ -254,7 +254,7 @@ export function BlockSettingsDropdown( {
|
|
|
254
254
|
{ canInsertDefaultBlock && (
|
|
255
255
|
<>
|
|
256
256
|
<MenuItem
|
|
257
|
-
onClick={
|
|
257
|
+
onClick={ pipe(
|
|
258
258
|
onClose,
|
|
259
259
|
onInsertBefore
|
|
260
260
|
) }
|
|
@@ -263,7 +263,7 @@ export function BlockSettingsDropdown( {
|
|
|
263
263
|
{ __( 'Insert before' ) }
|
|
264
264
|
</MenuItem>
|
|
265
265
|
<MenuItem
|
|
266
|
-
onClick={
|
|
266
|
+
onClick={ pipe(
|
|
267
267
|
onClose,
|
|
268
268
|
onInsertAfter
|
|
269
269
|
) }
|
|
@@ -275,7 +275,7 @@ export function BlockSettingsDropdown( {
|
|
|
275
275
|
) }
|
|
276
276
|
{ canMove && ! onlyBlock && (
|
|
277
277
|
<MenuItem
|
|
278
|
-
onClick={
|
|
278
|
+
onClick={ pipe( onClose, onMoveTo ) }
|
|
279
279
|
>
|
|
280
280
|
{ __( 'Move to' ) }
|
|
281
281
|
</MenuItem>
|
|
@@ -302,7 +302,7 @@ export function BlockSettingsDropdown( {
|
|
|
302
302
|
{ canRemove && (
|
|
303
303
|
<MenuGroup>
|
|
304
304
|
<MenuItem
|
|
305
|
-
onClick={
|
|
305
|
+
onClick={ pipe(
|
|
306
306
|
onClose,
|
|
307
307
|
onRemove,
|
|
308
308
|
updateSelectionAfterRemove
|
|
@@ -1,43 +1,114 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`BlockSwitcherDropdownMenu should render disabled block switcher with multi block of different types when no transforms 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="components-toolbar"
|
|
7
|
+
>
|
|
8
|
+
<div>
|
|
9
|
+
<button
|
|
10
|
+
aria-label="Block Name"
|
|
11
|
+
class="components-button components-toolbar__control block-editor-block-switcher__no-switcher-icon has-icon"
|
|
12
|
+
data-toolbar-item="true"
|
|
13
|
+
disabled=""
|
|
14
|
+
type="button"
|
|
15
|
+
>
|
|
16
|
+
<span
|
|
17
|
+
class="block-editor-block-icon has-colors"
|
|
18
|
+
>
|
|
19
|
+
<svg
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
focusable="false"
|
|
22
|
+
height="24"
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
|
+
width="24"
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
>
|
|
27
|
+
<path
|
|
28
|
+
d="M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
</span>
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
27
36
|
`;
|
|
28
37
|
|
|
29
38
|
exports[`BlockSwitcherDropdownMenu should render enabled block switcher with multi block when transforms exist 1`] = `
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
<div>
|
|
40
|
+
<div
|
|
41
|
+
class="components-toolbar"
|
|
42
|
+
>
|
|
43
|
+
<div
|
|
44
|
+
class="components-dropdown components-dropdown-menu block-editor-block-switcher"
|
|
45
|
+
tabindex="-1"
|
|
46
|
+
>
|
|
47
|
+
<button
|
|
48
|
+
aria-describedby="components-button__description-2"
|
|
49
|
+
aria-expanded="false"
|
|
50
|
+
aria-haspopup="true"
|
|
51
|
+
aria-label="Block Name"
|
|
52
|
+
class="components-button components-dropdown-menu__toggle has-icon"
|
|
53
|
+
data-toolbar-item="true"
|
|
54
|
+
type="button"
|
|
55
|
+
>
|
|
56
|
+
<span
|
|
57
|
+
class="block-editor-block-icon block-editor-block-switcher__toggle has-colors"
|
|
58
|
+
/>
|
|
59
|
+
</button>
|
|
60
|
+
<div
|
|
61
|
+
class="components-visually-hidden emotion-0 emotion-1"
|
|
62
|
+
data-wp-c16t="true"
|
|
63
|
+
data-wp-component="VisuallyHidden"
|
|
64
|
+
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
|
|
65
|
+
>
|
|
66
|
+
<span
|
|
67
|
+
id="components-button__description-2"
|
|
68
|
+
>
|
|
69
|
+
Change type of 2 blocks
|
|
70
|
+
</span>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
35
75
|
`;
|
|
36
76
|
|
|
37
77
|
exports[`BlockSwitcherDropdownMenu should render switcher with blocks 1`] = `
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
78
|
+
<div>
|
|
79
|
+
<div
|
|
80
|
+
class="components-toolbar"
|
|
81
|
+
>
|
|
82
|
+
<div
|
|
83
|
+
class="components-dropdown components-dropdown-menu block-editor-block-switcher"
|
|
84
|
+
tabindex="-1"
|
|
85
|
+
>
|
|
86
|
+
<button
|
|
87
|
+
aria-describedby="components-button__description-0"
|
|
88
|
+
aria-expanded="false"
|
|
89
|
+
aria-haspopup="true"
|
|
90
|
+
aria-label="Block Name"
|
|
91
|
+
class="components-button components-dropdown-menu__toggle has-icon"
|
|
92
|
+
data-toolbar-item="true"
|
|
93
|
+
type="button"
|
|
94
|
+
>
|
|
95
|
+
<span
|
|
96
|
+
class="block-editor-block-icon block-editor-block-switcher__toggle has-colors"
|
|
97
|
+
/>
|
|
98
|
+
</button>
|
|
99
|
+
<div
|
|
100
|
+
class="components-visually-hidden emotion-0 emotion-1"
|
|
101
|
+
data-wp-c16t="true"
|
|
102
|
+
data-wp-component="VisuallyHidden"
|
|
103
|
+
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
|
|
104
|
+
>
|
|
105
|
+
<span
|
|
106
|
+
id="components-button__description-0"
|
|
107
|
+
>
|
|
108
|
+
Block Name: Change block type or style
|
|
109
|
+
</span>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
43
114
|
`;
|