@wordpress/block-library 9.7.1-next.1f6eadc42.0 → 9.8.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/categories/edit.js +38 -17
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +10 -3
- package/build/categories/index.js.map +1 -1
- package/build/categories/variations.js +43 -0
- package/build/categories/variations.js.map +1 -0
- package/build/embed/edit.js +1 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-preview.js +80 -100
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -0
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/form/view.js +1 -0
- package/build/form/view.js.map +1 -1
- package/build/image/image.js +5 -2
- package/build/image/image.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/navigation-submenu/index.js +13 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/post-template/edit.js +6 -1
- package/build/post-template/edit.js.map +1 -1
- package/build/post-title/index.js +1 -4
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/format-controls.js +102 -0
- package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +45 -9
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +26 -10
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +3 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +12 -1
- package/build/query/utils.js.map +1 -1
- package/build/site-title/index.js +1 -4
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +13 -11
- package/build/social-link/edit.js.map +1 -1
- package/build-module/categories/edit.js +40 -19
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +10 -3
- package/build-module/categories/index.js.map +1 -1
- package/build-module/categories/variations.js +36 -0
- package/build-module/categories/variations.js.map +1 -0
- package/build-module/embed/edit.js +1 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +1 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +80 -100
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +1 -0
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/form/view.js +1 -0
- package/build-module/form/view.js.map +1 -1
- package/build-module/image/image.js +5 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/navigation-submenu/index.js +13 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/post-template/edit.js +6 -1
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-title/index.js +1 -4
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
- package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +45 -9
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +27 -11
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +3 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +12 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/site-title/index.js +1 -4
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +14 -12
- package/build-module/social-link/edit.js.map +1 -1
- package/build-style/editor-rtl.css +1 -1
- package/build-style/editor.css +1 -1
- package/build-style/gallery/editor-rtl.css +1 -1
- package/build-style/gallery/editor.css +1 -1
- package/build-style/post-title/style-rtl.css +4 -18
- package/build-style/post-title/style.css +4 -18
- package/build-style/site-title/style-rtl.css +4 -18
- package/build-style/site-title/style.css +4 -18
- package/build-style/style-rtl.css +8 -36
- package/build-style/style.css +8 -36
- package/package.json +35 -35
- package/src/categories/block.json +7 -2
- package/src/categories/edit.js +69 -30
- package/src/categories/index.js +2 -0
- package/src/categories/index.php +21 -9
- package/src/categories/variations.js +40 -0
- package/src/comments-pagination-next/index.php +1 -1
- package/src/comments-pagination-previous/index.php +2 -1
- package/src/embed/embed-preview.js +96 -112
- package/src/image/image.js +2 -1
- package/src/navigation-submenu/block.json +13 -0
- package/src/post-template/edit.js +6 -0
- package/src/post-template/index.php +5 -0
- package/src/post-title/block.json +1 -4
- package/src/post-title/style.scss +4 -21
- package/src/query/block.json +3 -1
- package/src/query/edit/inspector-controls/format-controls.js +90 -0
- package/src/query/edit/inspector-controls/index.js +68 -9
- package/src/query/edit/query-content.js +38 -5
- package/src/query/utils.js +16 -1
- package/src/site-title/block.json +1 -4
- package/src/site-title/style.scss +4 -21
- package/src/social-link/edit.js +11 -7
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { useInstanceId } from '@wordpress/compose';
|
|
6
|
-
import { useEffect } from '@wordpress/element';
|
|
6
|
+
import { useEffect, useCallback } from '@wordpress/element';
|
|
7
7
|
import {
|
|
8
8
|
BlockControls,
|
|
9
9
|
InspectorControls,
|
|
@@ -32,6 +32,7 @@ export default function QueryContent( {
|
|
|
32
32
|
openPatternSelectionModal,
|
|
33
33
|
name,
|
|
34
34
|
clientId,
|
|
35
|
+
context,
|
|
35
36
|
} ) {
|
|
36
37
|
const {
|
|
37
38
|
queryId,
|
|
@@ -41,6 +42,7 @@ export default function QueryContent( {
|
|
|
41
42
|
tagName: TagName = 'div',
|
|
42
43
|
query: { inherit } = {},
|
|
43
44
|
} = attributes;
|
|
45
|
+
const { postType } = context;
|
|
44
46
|
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
45
47
|
useDispatch( blockEditorStore );
|
|
46
48
|
const instanceId = useInstanceId( QueryContent );
|
|
@@ -48,6 +50,16 @@ export default function QueryContent( {
|
|
|
48
50
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
49
51
|
template: TEMPLATE,
|
|
50
52
|
} );
|
|
53
|
+
const isTemplate = useSelect(
|
|
54
|
+
( select ) => {
|
|
55
|
+
const currentTemplate =
|
|
56
|
+
select( coreStore ).__experimentalGetTemplateForLink()?.type;
|
|
57
|
+
const isInTemplate = 'wp_template' === currentTemplate;
|
|
58
|
+
const isInSingularContent = postType !== undefined;
|
|
59
|
+
return isInTemplate && ! isInSingularContent;
|
|
60
|
+
},
|
|
61
|
+
[ postType ]
|
|
62
|
+
);
|
|
51
63
|
const { postsPerPage } = useSelect( ( select ) => {
|
|
52
64
|
const { getSettings } = select( blockEditorStore );
|
|
53
65
|
const { getEntityRecord, getEntityRecordEdits, canUser } =
|
|
@@ -81,6 +93,10 @@ export default function QueryContent( {
|
|
|
81
93
|
// Changes in query property (which is an object) need to be in the same callback,
|
|
82
94
|
// because updates are batched after the render and changes in different query properties
|
|
83
95
|
// would cause to override previous wanted changes.
|
|
96
|
+
const updateQuery = useCallback(
|
|
97
|
+
( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),
|
|
98
|
+
[ query, setAttributes ]
|
|
99
|
+
);
|
|
84
100
|
useEffect( () => {
|
|
85
101
|
const newQuery = {};
|
|
86
102
|
// When we inherit from global query always need to set the `perPage`
|
|
@@ -90,11 +106,24 @@ export default function QueryContent( {
|
|
|
90
106
|
} else if ( ! query.perPage && postsPerPage ) {
|
|
91
107
|
newQuery.perPage = postsPerPage;
|
|
92
108
|
}
|
|
109
|
+
// We need to reset the `inherit` value if not in a template, as queries
|
|
110
|
+
// are not inherited when outside a template (e.g. when in singular content).
|
|
111
|
+
if ( ! isTemplate && query.inherit ) {
|
|
112
|
+
newQuery.inherit = false;
|
|
113
|
+
}
|
|
93
114
|
if ( !! Object.keys( newQuery ).length ) {
|
|
94
115
|
__unstableMarkNextChangeAsNotPersistent();
|
|
95
116
|
updateQuery( newQuery );
|
|
96
117
|
}
|
|
97
|
-
}, [
|
|
118
|
+
}, [
|
|
119
|
+
query.perPage,
|
|
120
|
+
postsPerPage,
|
|
121
|
+
inherit,
|
|
122
|
+
isTemplate,
|
|
123
|
+
query.inherit,
|
|
124
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
125
|
+
updateQuery,
|
|
126
|
+
] );
|
|
98
127
|
// We need this for multi-query block pagination.
|
|
99
128
|
// Query parameters for each block are scoped to their ID.
|
|
100
129
|
useEffect( () => {
|
|
@@ -102,9 +131,12 @@ export default function QueryContent( {
|
|
|
102
131
|
__unstableMarkNextChangeAsNotPersistent();
|
|
103
132
|
setAttributes( { queryId: instanceId } );
|
|
104
133
|
}
|
|
105
|
-
}, [
|
|
106
|
-
|
|
107
|
-
|
|
134
|
+
}, [
|
|
135
|
+
queryId,
|
|
136
|
+
instanceId,
|
|
137
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
138
|
+
setAttributes,
|
|
139
|
+
] );
|
|
108
140
|
const updateDisplayLayout = ( newDisplayLayout ) =>
|
|
109
141
|
setAttributes( {
|
|
110
142
|
displayLayout: { ...displayLayout, ...newDisplayLayout },
|
|
@@ -135,6 +167,7 @@ export default function QueryContent( {
|
|
|
135
167
|
setDisplayLayout={ updateDisplayLayout }
|
|
136
168
|
setAttributes={ setAttributes }
|
|
137
169
|
clientId={ clientId }
|
|
170
|
+
isTemplate={ isTemplate }
|
|
138
171
|
/>
|
|
139
172
|
</InspectorControls>
|
|
140
173
|
<BlockControls>
|
package/src/query/utils.js
CHANGED
|
@@ -94,6 +94,7 @@ export const mapToIHasNameAndId = ( entities, path ) => {
|
|
|
94
94
|
* Returns a helper object that contains:
|
|
95
95
|
* 1. An `options` object from the available post types, to be passed to a `SelectControl`.
|
|
96
96
|
* 2. A helper map with available taxonomies per post type.
|
|
97
|
+
* 3. A helper map with post format support per post type.
|
|
97
98
|
*
|
|
98
99
|
* @return {Object} The helper object related to post types.
|
|
99
100
|
*/
|
|
@@ -124,7 +125,21 @@ export const usePostTypes = () => {
|
|
|
124
125
|
} ) ),
|
|
125
126
|
[ postTypes ]
|
|
126
127
|
);
|
|
127
|
-
|
|
128
|
+
const postTypeFormatSupportMap = useMemo( () => {
|
|
129
|
+
if ( ! postTypes?.length ) {
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
return postTypes.reduce( ( accumulator, type ) => {
|
|
133
|
+
accumulator[ type.slug ] =
|
|
134
|
+
type.supports?.[ 'post-formats' ] || false;
|
|
135
|
+
return accumulator;
|
|
136
|
+
}, {} );
|
|
137
|
+
}, [ postTypes ] );
|
|
138
|
+
return {
|
|
139
|
+
postTypesTaxonomiesMap,
|
|
140
|
+
postTypesSelectOptions,
|
|
141
|
+
postTypeFormatSupportMap,
|
|
142
|
+
};
|
|
128
143
|
};
|
|
129
144
|
|
|
130
145
|
/**
|
|
@@ -2,31 +2,14 @@
|
|
|
2
2
|
// This block has customizable padding, border-box makes that more predictable.
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
&[class*="-font-family"] :where(a),
|
|
9
|
-
&[style*="font-family"] :where(a) {
|
|
5
|
+
:where(a) {
|
|
6
|
+
color: inherit;
|
|
10
7
|
font-family: inherit;
|
|
11
|
-
}
|
|
12
|
-
&[class*="-font-size"] :where(a),
|
|
13
|
-
&[style*="font-size"] :where(a) {
|
|
14
8
|
font-size: inherit;
|
|
15
|
-
}
|
|
16
|
-
&[style*="line-height"] :where(a) {
|
|
17
|
-
line-height: inherit;
|
|
18
|
-
}
|
|
19
|
-
&[style*="font-style"] :where(a) {
|
|
20
9
|
font-style: inherit;
|
|
21
|
-
|
|
22
|
-
&[style*="letter-spacing"] :where(a) {
|
|
10
|
+
font-weight: inherit;
|
|
23
11
|
letter-spacing: inherit;
|
|
24
|
-
|
|
25
|
-
&[style*="text-decoration"] :where(a) {
|
|
12
|
+
line-height: inherit;
|
|
26
13
|
text-decoration: inherit;
|
|
27
14
|
}
|
|
28
|
-
|
|
29
|
-
:where(a) {
|
|
30
|
-
color: inherit;
|
|
31
|
-
}
|
|
32
15
|
}
|
package/src/social-link/edit.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
PanelBody,
|
|
23
23
|
PanelRow,
|
|
24
24
|
TextControl,
|
|
25
|
+
__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
|
|
25
26
|
} from '@wordpress/components';
|
|
26
27
|
import { __ } from '@wordpress/i18n';
|
|
27
28
|
import { keyboardReturn } from '@wordpress/icons';
|
|
@@ -78,15 +79,18 @@ const SocialLinkURLPopover = ( {
|
|
|
78
79
|
}
|
|
79
80
|
removeBlock( clientId );
|
|
80
81
|
} }
|
|
82
|
+
suffix={
|
|
83
|
+
<InputControlSuffixWrapper variant="control">
|
|
84
|
+
<Button
|
|
85
|
+
icon={ keyboardReturn }
|
|
86
|
+
label={ __( 'Apply' ) }
|
|
87
|
+
type="submit"
|
|
88
|
+
size="small"
|
|
89
|
+
/>
|
|
90
|
+
</InputControlSuffixWrapper>
|
|
91
|
+
}
|
|
81
92
|
/>
|
|
82
93
|
</div>
|
|
83
|
-
<Button
|
|
84
|
-
// TODO: Switch to `true` (40px size) if possible.
|
|
85
|
-
__next40pxDefaultSize={ false }
|
|
86
|
-
icon={ keyboardReturn }
|
|
87
|
-
label={ __( 'Apply' ) }
|
|
88
|
-
type="submit"
|
|
89
|
-
/>
|
|
90
94
|
</form>
|
|
91
95
|
</URLPopover>
|
|
92
96
|
);
|