@wordpress/block-editor 11.3.5 → 11.3.7
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 +11 -1
- package/build/components/block-inspector/index.js +11 -10
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js +46 -0
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/inserter/index.js +29 -17
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +10 -11
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +5 -108
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +242 -0
- package/build/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build/components/inserter/menu.js +4 -7
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +10 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/link-control/index.js +17 -44
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +28 -3
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +1 -1
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +5 -3
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +4 -1
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +28 -14
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +28 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-inspector/index.js +9 -9
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js +37 -0
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/inserter/index.js +28 -16
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +10 -11
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +6 -105
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +222 -0
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build-module/components/inserter/menu.js +4 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +10 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/link-control/index.js +16 -44
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +28 -4
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +5 -3
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +4 -1
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +28 -14
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +28 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +46 -8
- package/build-style/style.css +46 -8
- package/package.json +4 -4
- package/src/components/block-inspector/index.js +11 -14
- package/src/components/block-inspector/useBlockInspectorAnimationSettings.js +53 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/inserter/index.js +30 -11
- package/src/components/inserter/media-tab/hooks.js +9 -8
- package/src/components/inserter/media-tab/media-list.js +3 -122
- package/src/components/inserter/media-tab/media-preview.js +268 -0
- package/src/components/inserter/menu.js +14 -20
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/search-results.js +7 -1
- package/src/components/inserter/style.scss +25 -0
- package/src/components/link-control/index.js +23 -58
- package/src/components/link-control/style.scss +23 -7
- package/src/components/link-control/test/index.js +5 -134
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/off-canvas-editor/appender.js +30 -4
- package/src/components/off-canvas-editor/block-contents.js +1 -1
- package/src/components/off-canvas-editor/branch.js +3 -1
- package/src/components/off-canvas-editor/index.js +3 -0
- package/src/components/spacing-sizes-control/style.scss +1 -1
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +16 -6
- package/src/store/defaults.js +14 -1
- package/src/store/selectors.js +4 -1
- package/src/store/test/actions.js +4 -2
|
@@ -1699,6 +1699,7 @@
|
|
|
1699
1699
|
width: calc(100% - 32px);
|
|
1700
1700
|
display: block;
|
|
1701
1701
|
padding: 11px 16px;
|
|
1702
|
+
padding-left: 36px;
|
|
1702
1703
|
margin: 0;
|
|
1703
1704
|
position: relative;
|
|
1704
1705
|
border: 1px solid #ddd;
|
|
@@ -1738,10 +1739,20 @@
|
|
|
1738
1739
|
}
|
|
1739
1740
|
|
|
1740
1741
|
.block-editor-link-control__search-actions {
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1742
|
+
position: absolute;
|
|
1743
|
+
/*
|
|
1744
|
+
* Actions must be positioned on top of URLInput, since the input will grow
|
|
1745
|
+
* when suggestions are rendered.
|
|
1746
|
+
*
|
|
1747
|
+
* Compensate for:
|
|
1748
|
+
* - Border (1px)
|
|
1749
|
+
* - Vertically, for the difference in height between the input (40px) and
|
|
1750
|
+
* the icon buttons.
|
|
1751
|
+
* - Horizontally, pad to the minimum of: default input padding, or the
|
|
1752
|
+
* equivalent of the vertical padding.
|
|
1753
|
+
*/
|
|
1754
|
+
top: 3px;
|
|
1755
|
+
left: 19px;
|
|
1745
1756
|
}
|
|
1746
1757
|
|
|
1747
1758
|
.components-button .block-editor-link-control__search-submit .has-icon {
|
|
@@ -2026,10 +2037,9 @@
|
|
|
2026
2037
|
padding: 10px;
|
|
2027
2038
|
}
|
|
2028
2039
|
|
|
2029
|
-
.block-editor-link-
|
|
2040
|
+
.block-editor-link-control__tools {
|
|
2030
2041
|
display: flex;
|
|
2031
2042
|
align-items: center;
|
|
2032
|
-
justify-content: space-between;
|
|
2033
2043
|
border-top: 1px solid #ddd;
|
|
2034
2044
|
margin: 0;
|
|
2035
2045
|
padding: 16px;
|
|
@@ -2065,8 +2075,14 @@
|
|
|
2065
2075
|
position: absolute;
|
|
2066
2076
|
right: auto;
|
|
2067
2077
|
bottom: auto;
|
|
2078
|
+
/*
|
|
2079
|
+
* Position spinner to the left of the actions.
|
|
2080
|
+
*
|
|
2081
|
+
* Compensate for:
|
|
2082
|
+
* - Input padding right ($button-size)
|
|
2083
|
+
*/
|
|
2068
2084
|
top: calc(50% - 16px / 2);
|
|
2069
|
-
left:
|
|
2085
|
+
left: 36px;
|
|
2070
2086
|
}
|
|
2071
2087
|
|
|
2072
2088
|
.block-editor-link-control__search-item-action {
|
|
@@ -3276,6 +3292,7 @@
|
|
|
3276
3292
|
.block-editor-inserter__popover.is-quick .components-popover__content {
|
|
3277
3293
|
border: none;
|
|
3278
3294
|
outline: none;
|
|
3295
|
+
box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1);
|
|
3279
3296
|
}
|
|
3280
3297
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > * {
|
|
3281
3298
|
border-right: 1px solid #ccc;
|
|
@@ -3283,9 +3300,11 @@
|
|
|
3283
3300
|
}
|
|
3284
3301
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:first-child {
|
|
3285
3302
|
border-top: 1px solid #ccc;
|
|
3303
|
+
border-radius: 2px 2px 0 0;
|
|
3286
3304
|
}
|
|
3287
3305
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:last-child {
|
|
3288
3306
|
border-bottom: 1px solid #ccc;
|
|
3307
|
+
border-radius: 0 0 2px 2px;
|
|
3289
3308
|
}
|
|
3290
3309
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *.components-button {
|
|
3291
3310
|
border: 1px solid #1e1e1e;
|
|
@@ -3841,6 +3860,16 @@
|
|
|
3841
3860
|
margin: 0 auto;
|
|
3842
3861
|
max-width: 100%;
|
|
3843
3862
|
}
|
|
3863
|
+
.block-editor-inserter__media-list .block-editor-inserter__media-list__item .block-editor-inserter__media-list__item-preview .block-editor-inserter__media-list__item-preview-spinner {
|
|
3864
|
+
display: flex;
|
|
3865
|
+
height: 100%;
|
|
3866
|
+
width: 100%;
|
|
3867
|
+
position: absolute;
|
|
3868
|
+
justify-content: center;
|
|
3869
|
+
background: rgba(255, 255, 255, 0.7);
|
|
3870
|
+
align-items: center;
|
|
3871
|
+
pointer-events: none;
|
|
3872
|
+
}
|
|
3844
3873
|
.block-editor-inserter__media-list .block-editor-inserter__media-list__item:focus .block-editor-inserter__media-list__item-preview {
|
|
3845
3874
|
box-shadow: inset 0 0 0 2px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
3846
3875
|
outline: 2px solid transparent;
|
|
@@ -3858,6 +3887,15 @@
|
|
|
3858
3887
|
height: 100%;
|
|
3859
3888
|
}
|
|
3860
3889
|
|
|
3890
|
+
@media (min-width: 600px) {
|
|
3891
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal {
|
|
3892
|
+
max-width: 480px;
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal p {
|
|
3896
|
+
margin: 0;
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3861
3899
|
.block-editor-post-preview__dropdown {
|
|
3862
3900
|
padding: 0;
|
|
3863
3901
|
}
|
|
@@ -4019,7 +4057,7 @@
|
|
|
4019
4057
|
.component-spacing-sizes-control .components-range-control__marks :first-child {
|
|
4020
4058
|
display: none;
|
|
4021
4059
|
}
|
|
4022
|
-
.component-spacing-sizes-control
|
|
4060
|
+
.component-spacing-sizes-control .components-range-control__thumb-wrapper {
|
|
4023
4061
|
z-index: 3;
|
|
4024
4062
|
}
|
|
4025
4063
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-select-control {
|
package/build-style/style.css
CHANGED
|
@@ -1699,6 +1699,7 @@
|
|
|
1699
1699
|
width: calc(100% - 32px);
|
|
1700
1700
|
display: block;
|
|
1701
1701
|
padding: 11px 16px;
|
|
1702
|
+
padding-right: 36px;
|
|
1702
1703
|
margin: 0;
|
|
1703
1704
|
position: relative;
|
|
1704
1705
|
border: 1px solid #ddd;
|
|
@@ -1738,10 +1739,20 @@
|
|
|
1738
1739
|
}
|
|
1739
1740
|
|
|
1740
1741
|
.block-editor-link-control__search-actions {
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1742
|
+
position: absolute;
|
|
1743
|
+
/*
|
|
1744
|
+
* Actions must be positioned on top of URLInput, since the input will grow
|
|
1745
|
+
* when suggestions are rendered.
|
|
1746
|
+
*
|
|
1747
|
+
* Compensate for:
|
|
1748
|
+
* - Border (1px)
|
|
1749
|
+
* - Vertically, for the difference in height between the input (40px) and
|
|
1750
|
+
* the icon buttons.
|
|
1751
|
+
* - Horizontally, pad to the minimum of: default input padding, or the
|
|
1752
|
+
* equivalent of the vertical padding.
|
|
1753
|
+
*/
|
|
1754
|
+
top: 3px;
|
|
1755
|
+
right: 19px;
|
|
1745
1756
|
}
|
|
1746
1757
|
|
|
1747
1758
|
.components-button .block-editor-link-control__search-submit .has-icon {
|
|
@@ -2026,10 +2037,9 @@
|
|
|
2026
2037
|
padding: 10px;
|
|
2027
2038
|
}
|
|
2028
2039
|
|
|
2029
|
-
.block-editor-link-
|
|
2040
|
+
.block-editor-link-control__tools {
|
|
2030
2041
|
display: flex;
|
|
2031
2042
|
align-items: center;
|
|
2032
|
-
justify-content: space-between;
|
|
2033
2043
|
border-top: 1px solid #ddd;
|
|
2034
2044
|
margin: 0;
|
|
2035
2045
|
padding: 16px;
|
|
@@ -2065,8 +2075,14 @@
|
|
|
2065
2075
|
position: absolute;
|
|
2066
2076
|
left: auto;
|
|
2067
2077
|
bottom: auto;
|
|
2078
|
+
/*
|
|
2079
|
+
* Position spinner to the left of the actions.
|
|
2080
|
+
*
|
|
2081
|
+
* Compensate for:
|
|
2082
|
+
* - Input padding right ($button-size)
|
|
2083
|
+
*/
|
|
2068
2084
|
top: calc(50% - 16px / 2);
|
|
2069
|
-
right:
|
|
2085
|
+
right: 36px;
|
|
2070
2086
|
}
|
|
2071
2087
|
|
|
2072
2088
|
.block-editor-link-control__search-item-action {
|
|
@@ -3276,6 +3292,7 @@
|
|
|
3276
3292
|
.block-editor-inserter__popover.is-quick .components-popover__content {
|
|
3277
3293
|
border: none;
|
|
3278
3294
|
outline: none;
|
|
3295
|
+
box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1);
|
|
3279
3296
|
}
|
|
3280
3297
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > * {
|
|
3281
3298
|
border-left: 1px solid #ccc;
|
|
@@ -3283,9 +3300,11 @@
|
|
|
3283
3300
|
}
|
|
3284
3301
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:first-child {
|
|
3285
3302
|
border-top: 1px solid #ccc;
|
|
3303
|
+
border-radius: 2px 2px 0 0;
|
|
3286
3304
|
}
|
|
3287
3305
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:last-child {
|
|
3288
3306
|
border-bottom: 1px solid #ccc;
|
|
3307
|
+
border-radius: 0 0 2px 2px;
|
|
3289
3308
|
}
|
|
3290
3309
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *.components-button {
|
|
3291
3310
|
border: 1px solid #1e1e1e;
|
|
@@ -3841,6 +3860,16 @@
|
|
|
3841
3860
|
margin: 0 auto;
|
|
3842
3861
|
max-width: 100%;
|
|
3843
3862
|
}
|
|
3863
|
+
.block-editor-inserter__media-list .block-editor-inserter__media-list__item .block-editor-inserter__media-list__item-preview .block-editor-inserter__media-list__item-preview-spinner {
|
|
3864
|
+
display: flex;
|
|
3865
|
+
height: 100%;
|
|
3866
|
+
width: 100%;
|
|
3867
|
+
position: absolute;
|
|
3868
|
+
justify-content: center;
|
|
3869
|
+
background: rgba(255, 255, 255, 0.7);
|
|
3870
|
+
align-items: center;
|
|
3871
|
+
pointer-events: none;
|
|
3872
|
+
}
|
|
3844
3873
|
.block-editor-inserter__media-list .block-editor-inserter__media-list__item:focus .block-editor-inserter__media-list__item-preview {
|
|
3845
3874
|
box-shadow: inset 0 0 0 2px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
3846
3875
|
outline: 2px solid transparent;
|
|
@@ -3858,6 +3887,15 @@
|
|
|
3858
3887
|
height: 100%;
|
|
3859
3888
|
}
|
|
3860
3889
|
|
|
3890
|
+
@media (min-width: 600px) {
|
|
3891
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal {
|
|
3892
|
+
max-width: 480px;
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal p {
|
|
3896
|
+
margin: 0;
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3861
3899
|
.block-editor-post-preview__dropdown {
|
|
3862
3900
|
padding: 0;
|
|
3863
3901
|
}
|
|
@@ -4019,7 +4057,7 @@
|
|
|
4019
4057
|
.component-spacing-sizes-control .components-range-control__marks :first-child {
|
|
4020
4058
|
display: none;
|
|
4021
4059
|
}
|
|
4022
|
-
.component-spacing-sizes-control
|
|
4060
|
+
.component-spacing-sizes-control .components-range-control__thumb-wrapper {
|
|
4023
4061
|
z-index: 3;
|
|
4024
4062
|
}
|
|
4025
4063
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-select-control {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.7",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@wordpress/api-fetch": "^6.23.1",
|
|
38
38
|
"@wordpress/blob": "^3.26.1",
|
|
39
39
|
"@wordpress/blocks": "^12.3.3",
|
|
40
|
-
"@wordpress/components": "^23.3.
|
|
40
|
+
"@wordpress/components": "^23.3.5",
|
|
41
41
|
"@wordpress/compose": "^6.3.3",
|
|
42
42
|
"@wordpress/data": "^8.3.3",
|
|
43
43
|
"@wordpress/date": "^4.26.2",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@wordpress/keyboard-shortcuts": "^4.3.3",
|
|
54
54
|
"@wordpress/keycodes": "^3.26.2",
|
|
55
55
|
"@wordpress/notices": "^3.26.3",
|
|
56
|
-
"@wordpress/preferences": "^3.3.
|
|
56
|
+
"@wordpress/preferences": "^3.3.5",
|
|
57
57
|
"@wordpress/private-apis": "^0.8.1",
|
|
58
58
|
"@wordpress/rich-text": "^6.3.3",
|
|
59
59
|
"@wordpress/shortcode": "^3.26.1",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "8ce158f9e03a25797be5a6f16edd7509d62e90e4"
|
|
87
87
|
}
|
|
@@ -36,6 +36,7 @@ import { default as InspectorControlsTabs } from '../inspector-controls-tabs';
|
|
|
36
36
|
import useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';
|
|
37
37
|
import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
|
|
38
38
|
import PositionControls from '../inspector-controls-tabs/position-controls-panel';
|
|
39
|
+
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
|
|
39
40
|
|
|
40
41
|
function useContentBlocks( blockTypes, block ) {
|
|
41
42
|
const contentBlocksObjectAux = useMemo( () => {
|
|
@@ -56,7 +57,7 @@ function useContentBlocks( blockTypes, block ) {
|
|
|
56
57
|
( blockName ) => {
|
|
57
58
|
return !! contentBlocksObjectAux[ blockName ];
|
|
58
59
|
},
|
|
59
|
-
[
|
|
60
|
+
[ contentBlocksObjectAux ]
|
|
60
61
|
);
|
|
61
62
|
return useMemo( () => {
|
|
62
63
|
return getContentBlocks( [ block ], isContentBlock );
|
|
@@ -173,19 +174,15 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
|
173
174
|
const availableTabs = useInspectorControlsTabs( blockType?.name );
|
|
174
175
|
const showTabs = availableTabs?.length > 1;
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
return null;
|
|
187
|
-
},
|
|
188
|
-
[ selectedBlockClientId, blockType ]
|
|
177
|
+
// The block inspector animation settings will be completely
|
|
178
|
+
// removed in the future to create an API which allows the block
|
|
179
|
+
// inspector to transition between what it
|
|
180
|
+
// displays based on the relationship between the selected block
|
|
181
|
+
// and its parent, and only enable it if the parent is controlling
|
|
182
|
+
// its children blocks.
|
|
183
|
+
const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(
|
|
184
|
+
blockType,
|
|
185
|
+
selectedBlockClientId
|
|
189
186
|
);
|
|
190
187
|
|
|
191
188
|
if ( count > 1 ) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { store as blockEditorStore } from '../../store';
|
|
10
|
+
|
|
11
|
+
export default function useBlockInspectorAnimationSettings(
|
|
12
|
+
blockType,
|
|
13
|
+
selectedBlockClientId
|
|
14
|
+
) {
|
|
15
|
+
return useSelect(
|
|
16
|
+
( select ) => {
|
|
17
|
+
if ( blockType ) {
|
|
18
|
+
const globalBlockInspectorAnimationSettings =
|
|
19
|
+
select( blockEditorStore ).getSettings()
|
|
20
|
+
.blockInspectorAnimation;
|
|
21
|
+
|
|
22
|
+
// Get the name of the block that will allow it's children to be animated.
|
|
23
|
+
const animationParent =
|
|
24
|
+
globalBlockInspectorAnimationSettings?.animationParent;
|
|
25
|
+
|
|
26
|
+
// Determine whether the animationParent block is a parent of the selected block.
|
|
27
|
+
const { getSelectedBlockClientId, getBlockParentsByBlockName } =
|
|
28
|
+
select( blockEditorStore );
|
|
29
|
+
const _selectedBlockClientId = getSelectedBlockClientId();
|
|
30
|
+
const animationParentBlockClientId = getBlockParentsByBlockName(
|
|
31
|
+
_selectedBlockClientId,
|
|
32
|
+
animationParent,
|
|
33
|
+
true
|
|
34
|
+
)[ 0 ];
|
|
35
|
+
|
|
36
|
+
// If the selected block is not a child of the animationParent block,
|
|
37
|
+
// and not an animationParent block itself, don't animate.
|
|
38
|
+
if (
|
|
39
|
+
! animationParentBlockClientId &&
|
|
40
|
+
blockType.name !== animationParent
|
|
41
|
+
) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return globalBlockInspectorAnimationSettings?.[
|
|
46
|
+
blockType.name
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
},
|
|
51
|
+
[ selectedBlockClientId, blockType ]
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -147,7 +147,9 @@ export function BlockSettingsDropdown( {
|
|
|
147
147
|
__experimentalSelectBlock
|
|
148
148
|
? () => {
|
|
149
149
|
const blockToSelect =
|
|
150
|
-
previousBlockClientId ||
|
|
150
|
+
previousBlockClientId ||
|
|
151
|
+
nextBlockClientId ||
|
|
152
|
+
firstParentClientId;
|
|
151
153
|
|
|
152
154
|
if (
|
|
153
155
|
blockToSelect &&
|
|
@@ -166,6 +168,7 @@ export function BlockSettingsDropdown( {
|
|
|
166
168
|
__experimentalSelectBlock,
|
|
167
169
|
previousBlockClientId,
|
|
168
170
|
nextBlockClientId,
|
|
171
|
+
firstParentClientId,
|
|
169
172
|
selectedBlockClientIds,
|
|
170
173
|
]
|
|
171
174
|
);
|
|
@@ -9,7 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { speak } from '@wordpress/a11y';
|
|
10
10
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
11
11
|
import { Dropdown, Button } from '@wordpress/components';
|
|
12
|
-
import { Component } from '@wordpress/element';
|
|
12
|
+
import { forwardRef, Component } from '@wordpress/element';
|
|
13
13
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
14
14
|
import { compose, ifCondition } from '@wordpress/compose';
|
|
15
15
|
import { createBlock, store as blocksStore } from '@wordpress/blocks';
|
|
@@ -31,21 +31,26 @@ const defaultRenderToggle = ( {
|
|
|
31
31
|
toggleProps = {},
|
|
32
32
|
prioritizePatterns,
|
|
33
33
|
} ) => {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const {
|
|
35
|
+
as: Wrapper = Button,
|
|
36
|
+
label: labelProp,
|
|
37
|
+
onClick,
|
|
38
|
+
...rest
|
|
39
|
+
} = toggleProps;
|
|
40
|
+
|
|
41
|
+
let label = labelProp;
|
|
42
|
+
if ( ! label && hasSingleBlockType ) {
|
|
36
43
|
label = sprintf(
|
|
37
44
|
// translators: %s: the name of the block when there is only one
|
|
38
45
|
_x( 'Add %s', 'directly add the only allowed block' ),
|
|
39
46
|
blockTitle
|
|
40
47
|
);
|
|
41
|
-
} else if ( prioritizePatterns ) {
|
|
48
|
+
} else if ( ! label && prioritizePatterns ) {
|
|
42
49
|
label = __( 'Add pattern' );
|
|
43
|
-
} else {
|
|
50
|
+
} else if ( ! label ) {
|
|
44
51
|
label = _x( 'Add block', 'Generic label for block inserter button' );
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
const { onClick, ...rest } = toggleProps;
|
|
48
|
-
|
|
49
54
|
// Handle both onClick functions from the toggle and the parent component.
|
|
50
55
|
function handleClick( event ) {
|
|
51
56
|
if ( onToggle ) {
|
|
@@ -57,7 +62,7 @@ const defaultRenderToggle = ( {
|
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
return (
|
|
60
|
-
<
|
|
65
|
+
<Wrapper
|
|
61
66
|
icon={ plus }
|
|
62
67
|
label={ label }
|
|
63
68
|
tooltipPosition="bottom"
|
|
@@ -71,7 +76,7 @@ const defaultRenderToggle = ( {
|
|
|
71
76
|
);
|
|
72
77
|
};
|
|
73
78
|
|
|
74
|
-
class
|
|
79
|
+
class PrivateInserter extends Component {
|
|
75
80
|
constructor() {
|
|
76
81
|
super( ...arguments );
|
|
77
82
|
|
|
@@ -145,6 +150,7 @@ class Inserter extends Component {
|
|
|
145
150
|
prioritizePatterns,
|
|
146
151
|
onSelectOrClose,
|
|
147
152
|
selectBlockOnInsert,
|
|
153
|
+
orderInitialBlockItems,
|
|
148
154
|
} = this.props;
|
|
149
155
|
|
|
150
156
|
if ( isQuick ) {
|
|
@@ -168,6 +174,7 @@ class Inserter extends Component {
|
|
|
168
174
|
isAppender={ isAppender }
|
|
169
175
|
prioritizePatterns={ prioritizePatterns }
|
|
170
176
|
selectBlockOnInsert={ selectBlockOnInsert }
|
|
177
|
+
orderInitialBlockItems={ orderInitialBlockItems }
|
|
171
178
|
/>
|
|
172
179
|
);
|
|
173
180
|
}
|
|
@@ -219,7 +226,7 @@ class Inserter extends Component {
|
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
228
|
|
|
222
|
-
export
|
|
229
|
+
export const ComposedPrivateInserter = compose( [
|
|
223
230
|
withSelect(
|
|
224
231
|
( select, { clientId, rootClientId, shouldDirectInsert = true } ) => {
|
|
225
232
|
const {
|
|
@@ -416,4 +423,16 @@ export default compose( [
|
|
|
416
423
|
( { hasItems, isAppender, rootClientId, clientId } ) =>
|
|
417
424
|
hasItems || ( ! isAppender && ! rootClientId && ! clientId )
|
|
418
425
|
),
|
|
419
|
-
] )(
|
|
426
|
+
] )( PrivateInserter );
|
|
427
|
+
|
|
428
|
+
const Inserter = forwardRef( ( props, ref ) => {
|
|
429
|
+
return (
|
|
430
|
+
<ComposedPrivateInserter
|
|
431
|
+
ref={ ref }
|
|
432
|
+
{ ...props }
|
|
433
|
+
orderInitialBlockItems={ undefined }
|
|
434
|
+
/>
|
|
435
|
+
);
|
|
436
|
+
} );
|
|
437
|
+
|
|
438
|
+
export default Inserter;
|
|
@@ -98,13 +98,6 @@ function useInserterMediaCategories() {
|
|
|
98
98
|
) {
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
|
-
// When a category has set `isExternalResource` to `true`, we
|
|
102
|
-
// don't need to check for allowed mime types, as they are used
|
|
103
|
-
// for restricting uploads for this media type and not for
|
|
104
|
-
// inserting media from external sources.
|
|
105
|
-
if ( category.isExternalResource ) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
101
|
return Object.values( allowedMimeTypes ).some( ( mimeType ) =>
|
|
109
102
|
mimeType.startsWith( `${ category.mediaType }/` )
|
|
110
103
|
);
|
|
@@ -156,7 +149,15 @@ export function useMediaCategories( rootClientId ) {
|
|
|
156
149
|
if ( category.isExternalResource ) {
|
|
157
150
|
return [ category.name, true ];
|
|
158
151
|
}
|
|
159
|
-
|
|
152
|
+
let results = [];
|
|
153
|
+
try {
|
|
154
|
+
results = await category.fetch( {
|
|
155
|
+
per_page: 1,
|
|
156
|
+
} );
|
|
157
|
+
} catch ( e ) {
|
|
158
|
+
// If the request fails, we shallow the error and just don't show
|
|
159
|
+
// the category, in order to not break the media tab.
|
|
160
|
+
}
|
|
160
161
|
return [ category.name, !! results.length ];
|
|
161
162
|
} )
|
|
162
163
|
)
|
|
@@ -1,129 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import {
|
|
10
5
|
__unstableComposite as Composite,
|
|
11
6
|
__unstableUseCompositeState as useCompositeState,
|
|
12
|
-
__unstableCompositeItem as CompositeItem,
|
|
13
|
-
Tooltip,
|
|
14
|
-
DropdownMenu,
|
|
15
|
-
MenuGroup,
|
|
16
|
-
MenuItem,
|
|
17
7
|
} from '@wordpress/components';
|
|
18
|
-
import { __
|
|
19
|
-
import { useMemo, useCallback, useState } from '@wordpress/element';
|
|
20
|
-
import { cloneBlock } from '@wordpress/blocks';
|
|
21
|
-
import { moreVertical, external } from '@wordpress/icons';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
22
9
|
|
|
23
10
|
/**
|
|
24
11
|
* Internal dependencies
|
|
25
12
|
*/
|
|
26
|
-
import
|
|
27
|
-
import { getBlockAndPreviewFromMedia } from './utils';
|
|
28
|
-
|
|
29
|
-
const MAXIMUM_TITLE_LENGTH = 25;
|
|
30
|
-
const MEDIA_OPTIONS_POPOVER_PROPS = {
|
|
31
|
-
position: 'bottom left',
|
|
32
|
-
className:
|
|
33
|
-
'block-editor-inserter__media-list__item-preview-options__popover',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function MediaPreviewOptions( { category, media } ) {
|
|
37
|
-
if ( ! category.getReportUrl ) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const reportUrl = category.getReportUrl( media );
|
|
41
|
-
return (
|
|
42
|
-
<DropdownMenu
|
|
43
|
-
className="block-editor-inserter__media-list__item-preview-options"
|
|
44
|
-
label={ __( 'Options' ) }
|
|
45
|
-
popoverProps={ MEDIA_OPTIONS_POPOVER_PROPS }
|
|
46
|
-
icon={ moreVertical }
|
|
47
|
-
>
|
|
48
|
-
{ () => (
|
|
49
|
-
<MenuGroup>
|
|
50
|
-
<MenuItem
|
|
51
|
-
onClick={ () =>
|
|
52
|
-
window.open( reportUrl, '_blank' ).focus()
|
|
53
|
-
}
|
|
54
|
-
icon={ external }
|
|
55
|
-
>
|
|
56
|
-
{ sprintf(
|
|
57
|
-
/* translators: %s: The media type to report e.g: "image", "video", "audio" */
|
|
58
|
-
__( 'Report %s' ),
|
|
59
|
-
category.mediaType
|
|
60
|
-
) }
|
|
61
|
-
</MenuItem>
|
|
62
|
-
</MenuGroup>
|
|
63
|
-
) }
|
|
64
|
-
</DropdownMenu>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function MediaPreview( { media, onClick, composite, category } ) {
|
|
69
|
-
const [ isHovered, setIsHovered ] = useState( false );
|
|
70
|
-
const [ block, preview ] = useMemo(
|
|
71
|
-
() => getBlockAndPreviewFromMedia( media, category.mediaType ),
|
|
72
|
-
[ media, category.mediaType ]
|
|
73
|
-
);
|
|
74
|
-
const title = media.title?.rendered || media.title;
|
|
75
|
-
let truncatedTitle;
|
|
76
|
-
if ( title.length > MAXIMUM_TITLE_LENGTH ) {
|
|
77
|
-
const omission = '...';
|
|
78
|
-
truncatedTitle =
|
|
79
|
-
title.slice( 0, MAXIMUM_TITLE_LENGTH - omission.length ) + omission;
|
|
80
|
-
}
|
|
81
|
-
const onMouseEnter = useCallback( () => setIsHovered( true ), [] );
|
|
82
|
-
const onMouseLeave = useCallback( () => setIsHovered( false ), [] );
|
|
83
|
-
return (
|
|
84
|
-
<InserterDraggableBlocks isEnabled={ true } blocks={ [ block ] }>
|
|
85
|
-
{ ( { draggable, onDragStart, onDragEnd } ) => (
|
|
86
|
-
<div
|
|
87
|
-
className={ classnames(
|
|
88
|
-
'block-editor-inserter__media-list__list-item',
|
|
89
|
-
{
|
|
90
|
-
'is-hovered': isHovered,
|
|
91
|
-
}
|
|
92
|
-
) }
|
|
93
|
-
draggable={ draggable }
|
|
94
|
-
onDragStart={ onDragStart }
|
|
95
|
-
onDragEnd={ onDragEnd }
|
|
96
|
-
>
|
|
97
|
-
<Tooltip text={ truncatedTitle || title }>
|
|
98
|
-
{ /* Adding `is-hovered` class to the wrapper element is needed
|
|
99
|
-
because the options Popover is rendered outside of this node. */ }
|
|
100
|
-
<div
|
|
101
|
-
onMouseEnter={ onMouseEnter }
|
|
102
|
-
onMouseLeave={ onMouseLeave }
|
|
103
|
-
>
|
|
104
|
-
<CompositeItem
|
|
105
|
-
role="option"
|
|
106
|
-
as="div"
|
|
107
|
-
{ ...composite }
|
|
108
|
-
className="block-editor-inserter__media-list__item"
|
|
109
|
-
onClick={ () => onClick( block ) }
|
|
110
|
-
aria-label={ title }
|
|
111
|
-
>
|
|
112
|
-
<div className="block-editor-inserter__media-list__item-preview">
|
|
113
|
-
{ preview }
|
|
114
|
-
</div>
|
|
115
|
-
</CompositeItem>
|
|
116
|
-
<MediaPreviewOptions
|
|
117
|
-
category={ category }
|
|
118
|
-
media={ media }
|
|
119
|
-
/>
|
|
120
|
-
</div>
|
|
121
|
-
</Tooltip>
|
|
122
|
-
</div>
|
|
123
|
-
) }
|
|
124
|
-
</InserterDraggableBlocks>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
13
|
+
import { MediaPreview } from './media-preview';
|
|
127
14
|
|
|
128
15
|
function MediaList( {
|
|
129
16
|
mediaList,
|
|
@@ -132,12 +19,6 @@ function MediaList( {
|
|
|
132
19
|
label = __( 'Media List' ),
|
|
133
20
|
} ) {
|
|
134
21
|
const composite = useCompositeState();
|
|
135
|
-
const onPreviewClick = useCallback(
|
|
136
|
-
( block ) => {
|
|
137
|
-
onClick( cloneBlock( block ) );
|
|
138
|
-
},
|
|
139
|
-
[ onClick ]
|
|
140
|
-
);
|
|
141
22
|
return (
|
|
142
23
|
<Composite
|
|
143
24
|
{ ...composite }
|
|
@@ -150,7 +31,7 @@ function MediaList( {
|
|
|
150
31
|
key={ media.id || media.sourceId || index }
|
|
151
32
|
media={ media }
|
|
152
33
|
category={ category }
|
|
153
|
-
onClick={
|
|
34
|
+
onClick={ onClick }
|
|
154
35
|
composite={ composite }
|
|
155
36
|
/>
|
|
156
37
|
) ) }
|