@wordpress/block-library 7.14.2 → 7.14.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/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/gallery/deprecated.js +4 -4
- package/build/gallery/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +12 -12
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +16 -6
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/post-content/edit.js +6 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-featured-image/index.js +1 -1
- package/build/post-featured-image/overlay.js +2 -2
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-template/edit.js +13 -28
- package/build/post-template/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/utils.js +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/quote/index.js +0 -1
- package/build/quote/index.js.map +1 -1
- package/build/quote/transforms.js +2 -2
- package/build/quote/transforms.js.map +1 -1
- package/build/template-part/edit/index.js +2 -2
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/index.js +2 -2
- package/build/template-part/index.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/gallery/deprecated.js +4 -4
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +12 -12
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +16 -6
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/post-content/edit.js +6 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -1
- package/build-module/post-featured-image/overlay.js +2 -2
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-template/edit.js +14 -29
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/utils.js +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/quote/index.js +0 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/transforms.js +2 -2
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/template-part/edit/index.js +3 -3
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/classic-rtl.css +85 -0
- package/build-style/classic.css +85 -0
- package/build-style/code/style-rtl.css +3 -0
- package/build-style/code/style.css +3 -0
- package/build-style/editor-rtl.css +39 -29
- package/build-style/editor.css +39 -29
- package/build-style/post-featured-image/editor-rtl.css +39 -29
- package/build-style/post-featured-image/editor.css +39 -29
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +12 -12
- package/src/classic.scss +15 -0
- package/src/code/style.scss +12 -7
- package/src/comment-template/index.php +18 -8
- package/src/comments-pagination-next/block.json +1 -1
- package/src/comments-pagination-numbers/block.json +1 -1
- package/src/comments-pagination-previous/block.json +1 -1
- package/src/gallery/deprecated.js +4 -4
- package/src/navigation/edit/index.js +12 -10
- package/src/navigation/menu-items-to-blocks.js +39 -22
- package/src/navigation/test/menu-items-to-blocks.js +6 -0
- package/src/navigation-submenu/index.php +10 -1
- package/src/post-content/edit.js +3 -1
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/editor.scss +79 -72
- package/src/post-featured-image/index.php +18 -24
- package/src/post-featured-image/overlay.js +17 -14
- package/src/post-template/edit.js +14 -23
- package/src/query/edit/inspector-controls/index.js +1 -4
- package/src/query/utils.js +1 -1
- package/src/quote/block.json +0 -1
- package/src/quote/transforms.js +1 -1
- package/src/template-part/edit/index.js +60 -58
- package/src/template-part/index.js +2 -2
|
@@ -83,16 +83,25 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
|
|
|
83
83
|
$has_custom_gradient = isset( $attributes['customGradient'] ) && $attributes['customGradient'];
|
|
84
84
|
$has_solid_overlay = isset( $attributes['overlayColor'] ) && $attributes['overlayColor'];
|
|
85
85
|
$has_custom_overlay = isset( $attributes['customOverlayColor'] ) && $attributes['customOverlayColor'];
|
|
86
|
-
$class_names = array(
|
|
87
|
-
|
|
88
|
-
);
|
|
89
|
-
$styles_properties = array();
|
|
86
|
+
$class_names = array( 'wp-block-post-featured-image__overlay' );
|
|
87
|
+
$styles = array();
|
|
90
88
|
|
|
91
89
|
if ( ! $has_dim_background ) {
|
|
92
90
|
return '';
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
//
|
|
93
|
+
// Apply border classes and styles.
|
|
94
|
+
$border_attributes = get_block_core_post_featured_image_border_attributes( $attributes );
|
|
95
|
+
|
|
96
|
+
if ( ! empty( $border_attributes['class'] ) ) {
|
|
97
|
+
$class_names[] = $border_attributes['class'];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if ( ! empty( $border_attributes['style'] ) ) {
|
|
101
|
+
$styles[] = $border_attributes['style'];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Apply overlay and gradient classes.
|
|
96
105
|
if ( $has_dim_background ) {
|
|
97
106
|
$class_names[] = 'has-background-dim';
|
|
98
107
|
$class_names[] = "has-background-dim-{$attributes['dimRatio']}";
|
|
@@ -110,35 +119,20 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
|
|
|
110
119
|
$class_names[] = "has-{$attributes['gradient']}-gradient-background";
|
|
111
120
|
}
|
|
112
121
|
|
|
113
|
-
//
|
|
114
|
-
if ( ! empty( $attributes['style']['border']['radius'] ) ) {
|
|
115
|
-
$styles_properties['border-radius'] = $attributes['style']['border']['radius'];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if ( ! empty( $attributes['style']['border']['width'] ) ) {
|
|
119
|
-
$styles_properties['border-width'] = $attributes['style']['border']['width'];
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
+
// Apply background styles.
|
|
122
123
|
if ( $has_custom_gradient ) {
|
|
123
|
-
$
|
|
124
|
+
$styles[] = sprintf( 'background-image: %s;', $attributes['customGradient'] );
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
if ( $has_custom_overlay ) {
|
|
127
|
-
$
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
$styles = '';
|
|
131
|
-
|
|
132
|
-
foreach ( $styles_properties as $style_attribute => $style_attribute_value ) {
|
|
133
|
-
$styles .= "{$style_attribute}: $style_attribute_value; ";
|
|
128
|
+
$styles[] = sprintf( 'background-color: %s;', $attributes['customOverlayColor'] );
|
|
134
129
|
}
|
|
135
130
|
|
|
136
131
|
return sprintf(
|
|
137
132
|
'<span class="%s" style="%s" aria-hidden="true"></span>',
|
|
138
133
|
esc_attr( implode( ' ', $class_names ) ),
|
|
139
|
-
esc_attr(
|
|
134
|
+
esc_attr( safecss_filter_attr( implode( ' ', $styles ) ) )
|
|
140
135
|
);
|
|
141
|
-
|
|
142
136
|
}
|
|
143
137
|
|
|
144
138
|
/**
|
|
@@ -47,20 +47,23 @@ const Overlay = ( {
|
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
49
|
<>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
{ !! dimRatio && (
|
|
51
|
+
<span
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
className={ classnames(
|
|
54
|
+
'wp-block-post-featured-image__overlay',
|
|
55
|
+
dimRatioToClass( dimRatio ),
|
|
56
|
+
{
|
|
57
|
+
[ overlayColor.class ]: overlayColor.class,
|
|
58
|
+
'has-background-dim': dimRatio !== undefined,
|
|
59
|
+
'has-background-gradient': gradientValue,
|
|
60
|
+
[ gradientClass ]: gradientClass,
|
|
61
|
+
},
|
|
62
|
+
borderProps.className
|
|
63
|
+
) }
|
|
64
|
+
style={ overlayStyles }
|
|
65
|
+
/>
|
|
66
|
+
) }
|
|
64
67
|
<InspectorControls __experimentalGroup="color">
|
|
65
68
|
<ColorGradientSettingsDropdown
|
|
66
69
|
__experimentalHasMultipleOrigins
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
store as blockEditorStore,
|
|
18
18
|
} from '@wordpress/block-editor';
|
|
19
19
|
import { Spinner } from '@wordpress/components';
|
|
20
|
-
import { store as coreStore
|
|
20
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
21
21
|
|
|
22
22
|
const TEMPLATE = [
|
|
23
23
|
[ 'core/post-title' ],
|
|
@@ -101,19 +101,6 @@ export default function PostTemplateEdit( {
|
|
|
101
101
|
} ) {
|
|
102
102
|
const [ { page } ] = queryContext;
|
|
103
103
|
const [ activeBlockContextId, setActiveBlockContextId ] = useState();
|
|
104
|
-
|
|
105
|
-
let categorySlug = null;
|
|
106
|
-
if ( templateSlug?.startsWith( 'category-' ) ) {
|
|
107
|
-
categorySlug = templateSlug.replace( 'category-', '' );
|
|
108
|
-
}
|
|
109
|
-
const { records: categories, hasResolved: hasResolvedCategories } =
|
|
110
|
-
useEntityRecords( 'taxonomy', 'category', {
|
|
111
|
-
context: 'view',
|
|
112
|
-
per_page: -1,
|
|
113
|
-
_fields: [ 'id' ],
|
|
114
|
-
slug: categorySlug,
|
|
115
|
-
} );
|
|
116
|
-
|
|
117
104
|
const { posts, blocks } = useSelect(
|
|
118
105
|
( select ) => {
|
|
119
106
|
const { getEntityRecords, getTaxonomies } = select( coreStore );
|
|
@@ -123,12 +110,22 @@ export default function PostTemplateEdit( {
|
|
|
123
110
|
per_page: -1,
|
|
124
111
|
context: 'view',
|
|
125
112
|
} );
|
|
113
|
+
const templateCategory =
|
|
114
|
+
inherit &&
|
|
115
|
+
templateSlug?.startsWith( 'category-' ) &&
|
|
116
|
+
getEntityRecords( 'taxonomy', 'category', {
|
|
117
|
+
context: 'view',
|
|
118
|
+
per_page: 1,
|
|
119
|
+
_fields: [ 'id' ],
|
|
120
|
+
slug: templateSlug.replace( 'category-', '' ),
|
|
121
|
+
} );
|
|
126
122
|
const query = {
|
|
127
123
|
offset: perPage ? perPage * ( page - 1 ) + offset : 0,
|
|
128
124
|
order,
|
|
129
125
|
orderby: orderBy,
|
|
130
126
|
};
|
|
131
|
-
|
|
127
|
+
// There is no need to build the taxQuery if we inherit.
|
|
128
|
+
if ( taxQuery && ! inherit ) {
|
|
132
129
|
// We have to build the tax query for the REST API and use as
|
|
133
130
|
// keys the taxonomies `rest_base` with the `term ids` as values.
|
|
134
131
|
const builtTaxQuery = Object.entries( taxQuery ).reduce(
|
|
@@ -174,11 +171,8 @@ export default function PostTemplateEdit( {
|
|
|
174
171
|
if ( templateSlug?.startsWith( 'archive-' ) ) {
|
|
175
172
|
query.postType = templateSlug.replace( 'archive-', '' );
|
|
176
173
|
postType = query.postType;
|
|
177
|
-
} else if (
|
|
178
|
-
query.
|
|
179
|
-
category: categories.map( ( { id } ) => id ),
|
|
180
|
-
};
|
|
181
|
-
taxQuery = query.taxQuery;
|
|
174
|
+
} else if ( templateCategory ) {
|
|
175
|
+
query.categories = templateCategory[ 0 ]?.id;
|
|
182
176
|
}
|
|
183
177
|
}
|
|
184
178
|
// When we preview Query Loop blocks we should prefer the current
|
|
@@ -210,9 +204,6 @@ export default function PostTemplateEdit( {
|
|
|
210
204
|
parents,
|
|
211
205
|
restQueryArgs,
|
|
212
206
|
previewPostType,
|
|
213
|
-
categories,
|
|
214
|
-
categorySlug,
|
|
215
|
-
hasResolvedCategories,
|
|
216
207
|
]
|
|
217
208
|
);
|
|
218
209
|
const blockContexts = useMemo(
|
|
@@ -241,10 +241,7 @@ export default function QueryInspectorControls( {
|
|
|
241
241
|
</ToolsPanelItem>
|
|
242
242
|
) }
|
|
243
243
|
{ isPostTypeHierarchical &&
|
|
244
|
-
|
|
245
|
-
allowedControls,
|
|
246
|
-
'parents'
|
|
247
|
-
) && (
|
|
244
|
+
isControlAllowed( allowedControls, 'parents' ) && (
|
|
248
245
|
<ToolsPanelItem
|
|
249
246
|
hasValue={ () => !! parents?.length }
|
|
250
247
|
label={ __( 'Parents' ) }
|
package/src/query/utils.js
CHANGED
package/src/quote/block.json
CHANGED
package/src/quote/transforms.js
CHANGED
|
@@ -133,64 +133,66 @@ export default function TemplatePartEdit( {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
return (
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{ isPlaceholder && (
|
|
145
|
-
<TagName { ...blockProps }>
|
|
146
|
-
<TemplatePartPlaceholder
|
|
147
|
-
area={ attributes.area }
|
|
148
|
-
templatePartId={ templatePartId }
|
|
149
|
-
clientId={ clientId }
|
|
150
|
-
setAttributes={ setAttributes }
|
|
151
|
-
onOpenSelectionModal={ () =>
|
|
152
|
-
setIsTemplatePartSelectionOpen( true )
|
|
153
|
-
}
|
|
154
|
-
/>
|
|
155
|
-
</TagName>
|
|
156
|
-
) }
|
|
157
|
-
{ canReplace && (
|
|
158
|
-
<BlockSettingsMenuControls>
|
|
159
|
-
{ () => (
|
|
160
|
-
<MenuItem
|
|
161
|
-
onClick={ () => {
|
|
162
|
-
setIsTemplatePartSelectionOpen( true );
|
|
163
|
-
} }
|
|
164
|
-
>
|
|
165
|
-
{ createInterpolateElement(
|
|
166
|
-
__( 'Replace <BlockTitle />' ),
|
|
167
|
-
{
|
|
168
|
-
BlockTitle: (
|
|
169
|
-
<BlockTitle
|
|
170
|
-
clientId={ clientId }
|
|
171
|
-
maximumLength={ 25 }
|
|
172
|
-
/>
|
|
173
|
-
),
|
|
174
|
-
}
|
|
175
|
-
) }
|
|
176
|
-
</MenuItem>
|
|
177
|
-
) }
|
|
178
|
-
</BlockSettingsMenuControls>
|
|
179
|
-
) }
|
|
180
|
-
{ isEntityAvailable && (
|
|
181
|
-
<TemplatePartInnerBlocks
|
|
182
|
-
tagName={ TagName }
|
|
183
|
-
blockProps={ blockProps }
|
|
184
|
-
postId={ templatePartId }
|
|
185
|
-
hasInnerBlocks={ innerBlocks.length > 0 }
|
|
186
|
-
layout={ layout }
|
|
136
|
+
<>
|
|
137
|
+
<RecursionProvider uniqueId={ templatePartId }>
|
|
138
|
+
<TemplatePartAdvancedControls
|
|
139
|
+
tagName={ tagName }
|
|
140
|
+
setAttributes={ setAttributes }
|
|
141
|
+
isEntityAvailable={ isEntityAvailable }
|
|
142
|
+
templatePartId={ templatePartId }
|
|
143
|
+
defaultWrapper={ areaObject.tagName }
|
|
187
144
|
/>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
145
|
+
{ isPlaceholder && (
|
|
146
|
+
<TagName { ...blockProps }>
|
|
147
|
+
<TemplatePartPlaceholder
|
|
148
|
+
area={ attributes.area }
|
|
149
|
+
templatePartId={ templatePartId }
|
|
150
|
+
clientId={ clientId }
|
|
151
|
+
setAttributes={ setAttributes }
|
|
152
|
+
onOpenSelectionModal={ () =>
|
|
153
|
+
setIsTemplatePartSelectionOpen( true )
|
|
154
|
+
}
|
|
155
|
+
/>
|
|
156
|
+
</TagName>
|
|
157
|
+
) }
|
|
158
|
+
{ canReplace && (
|
|
159
|
+
<BlockSettingsMenuControls>
|
|
160
|
+
{ () => (
|
|
161
|
+
<MenuItem
|
|
162
|
+
onClick={ () => {
|
|
163
|
+
setIsTemplatePartSelectionOpen( true );
|
|
164
|
+
} }
|
|
165
|
+
>
|
|
166
|
+
{ createInterpolateElement(
|
|
167
|
+
__( 'Replace <BlockTitle />' ),
|
|
168
|
+
{
|
|
169
|
+
BlockTitle: (
|
|
170
|
+
<BlockTitle
|
|
171
|
+
clientId={ clientId }
|
|
172
|
+
maximumLength={ 25 }
|
|
173
|
+
/>
|
|
174
|
+
),
|
|
175
|
+
}
|
|
176
|
+
) }
|
|
177
|
+
</MenuItem>
|
|
178
|
+
) }
|
|
179
|
+
</BlockSettingsMenuControls>
|
|
180
|
+
) }
|
|
181
|
+
{ isEntityAvailable && (
|
|
182
|
+
<TemplatePartInnerBlocks
|
|
183
|
+
tagName={ TagName }
|
|
184
|
+
blockProps={ blockProps }
|
|
185
|
+
postId={ templatePartId }
|
|
186
|
+
hasInnerBlocks={ innerBlocks.length > 0 }
|
|
187
|
+
layout={ layout }
|
|
188
|
+
/>
|
|
189
|
+
) }
|
|
190
|
+
{ ! isPlaceholder && ! isResolved && (
|
|
191
|
+
<TagName { ...blockProps }>
|
|
192
|
+
<Spinner />
|
|
193
|
+
</TagName>
|
|
194
|
+
) }
|
|
195
|
+
</RecursionProvider>
|
|
194
196
|
{ isTemplatePartSelectionOpen && (
|
|
195
197
|
<Modal
|
|
196
198
|
overlayClassName="block-editor-template-part__selection-modal"
|
|
@@ -215,6 +217,6 @@ export default function TemplatePartEdit( {
|
|
|
215
217
|
/>
|
|
216
218
|
</Modal>
|
|
217
219
|
) }
|
|
218
|
-
|
|
220
|
+
</>
|
|
219
221
|
);
|
|
220
222
|
}
|
|
@@ -62,13 +62,13 @@ export const init = () => {
|
|
|
62
62
|
'blockEditor.__unstableCanInsertBlockType',
|
|
63
63
|
'removeTemplatePartsFromPostTemplates',
|
|
64
64
|
(
|
|
65
|
-
|
|
65
|
+
canInsert,
|
|
66
66
|
blockType,
|
|
67
67
|
rootClientId,
|
|
68
68
|
{ getBlock, getBlockParentsByBlockName }
|
|
69
69
|
) => {
|
|
70
70
|
if ( blockType.name !== 'core/template-part' ) {
|
|
71
|
-
return
|
|
71
|
+
return canInsert;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
for ( const disallowedParentType of DISALLOWED_PARENTS ) {
|