@wordpress/block-library 8.33.0 → 8.34.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/block/edit.js +15 -8
- package/build/block/edit.js.map +1 -1
- package/build/block-keyboard-shortcuts/index.js +95 -0
- package/build/block-keyboard-shortcuts/index.js.map +1 -0
- package/build/column/edit.js +28 -19
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +3 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/edit.js +69 -53
- package/build/columns/edit.js.map +1 -1
- package/build/columns/variations.js +18 -28
- package/build/columns/variations.js.map +1 -1
- package/build/comment-template/util.js +3 -1
- package/build/comment-template/util.js.map +1 -1
- package/build/cover/shared.js +3 -1
- package/build/cover/shared.js.map +1 -1
- package/build/embed/embed-placeholder.js +8 -3
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/util.js +3 -1
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +3 -1
- package/build/embed/variations.js.map +1 -1
- package/build/embed/wp-embed-preview.js +6 -2
- package/build/embed/wp-embed-preview.js.map +1 -1
- package/build/group/index.js +0 -8
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +18 -19
- package/build/group/placeholder.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +3 -1
- package/build/image/view.js.map +1 -1
- package/build/index.js +9 -1
- package/build/index.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +12 -4
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +15 -5
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/navigation/edit/are-blocks-dirty.js +9 -3
- package/build/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +3 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +1 -1
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/index.js +0 -9
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view.js +3 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +94 -85
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +2 -7
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/paragraph/index.js +0 -1
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +0 -1
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-excerpt/edit.js +3 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +3 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-navigation-link/variations.js +3 -1
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-template/edit.js +18 -8
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +3 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/private-apis.js +21 -0
- package/build/private-apis.js.map +1 -0
- package/build/query/edit/enhanced-pagination-modal.js +1 -1
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +6 -2
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +18 -6
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/utils.js +3 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-title/variations.js +3 -1
- package/build/query-title/variations.js.map +1 -1
- package/build/social-link/edit.js +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/variations.js +3 -1
- package/build/social-link/variations.js.map +1 -1
- package/build/template-part/variations.js +6 -2
- package/build/template-part/variations.js.map +1 -1
- package/build-module/block/edit.js +15 -8
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block-keyboard-shortcuts/index.js +88 -0
- package/build-module/block-keyboard-shortcuts/index.js.map +1 -0
- package/build-module/column/edit.js +28 -19
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +3 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/edit.js +69 -53
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/variations.js +18 -28
- package/build-module/columns/variations.js.map +1 -1
- package/build-module/comment-template/util.js +3 -1
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/cover/shared.js +3 -1
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +9 -4
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/util.js +3 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +3 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/embed/wp-embed-preview.js +6 -2
- package/build-module/embed/wp-embed-preview.js.map +1 -1
- package/build-module/group/index.js +0 -8
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +18 -19
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +3 -1
- package/build-module/image/view.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +12 -4
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +15 -5
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/navigation/edit/are-blocks-dirty.js +9 -3
- package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +3 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/index.js +0 -9
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view.js +3 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +94 -85
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +3 -8
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/paragraph/index.js +0 -1
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +0 -1
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-excerpt/edit.js +3 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +3 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +3 -1
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-template/edit.js +18 -8
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +3 -1
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/private-apis.js +14 -0
- package/build-module/private-apis.js.map +1 -0
- package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +6 -2
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +18 -6
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/utils.js +3 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-title/variations.js +3 -1
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/social-link/edit.js +1 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/variations.js +3 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/template-part/variations.js +6 -2
- package/build-module/template-part/variations.js.map +1 -1
- package/build-style/editor-rtl.css +15 -49
- package/build-style/editor.css +15 -49
- package/build-style/embed/editor-rtl.css +0 -3
- package/build-style/embed/editor.css +0 -3
- package/build-style/group/editor-rtl.css +0 -44
- package/build-style/group/editor.css +0 -44
- package/build-style/group/style-rtl.css +4 -0
- package/build-style/group/style.css +4 -0
- package/build-style/navigation-link/style-rtl.css +0 -8
- package/build-style/navigation-link/style.css +0 -8
- package/build-style/post-featured-image/editor-rtl.css +1 -0
- package/build-style/post-featured-image/editor.css +1 -0
- package/build-style/site-logo/editor-rtl.css +1 -0
- package/build-style/site-logo/editor.css +1 -0
- package/build-style/social-link/editor-rtl.css +13 -2
- package/build-style/social-link/editor.css +13 -2
- package/build-style/style-rtl.css +4 -8
- package/build-style/style.css +4 -8
- package/package.json +35 -34
- package/src/block/edit.js +19 -12
- package/src/block-keyboard-shortcuts/index.js +113 -0
- package/src/column/edit.js +26 -20
- package/src/column/edit.native.js +3 -1
- package/src/columns/edit.js +93 -83
- package/src/columns/variations.js +12 -34
- package/src/comment-template/util.js +3 -1
- package/src/cover/shared.js +3 -1
- package/src/embed/editor.scss +0 -2
- package/src/embed/embed-placeholder.js +21 -9
- package/src/embed/util.js +3 -1
- package/src/embed/variations.js +3 -1
- package/src/embed/wp-embed-preview.js +6 -2
- package/src/gallery/test/helpers.native.js +3 -3
- package/src/group/editor.scss +0 -47
- package/src/group/index.js +0 -8
- package/src/group/placeholder.js +18 -18
- package/src/group/style.scss +5 -0
- package/src/image/image.js +3 -1
- package/src/image/view.js +3 -1
- package/src/index.js +2 -0
- package/src/list-item/hooks/use-merge.js +12 -4
- package/src/list-item/hooks/use-outdent-list-item.js +15 -5
- package/src/navigation/block.json +0 -9
- package/src/navigation/edit/are-blocks-dirty.js +8 -3
- package/src/navigation/edit/deleted-navigation-warning.js +1 -1
- package/src/navigation/edit/menu-inspector-controls.js +3 -1
- package/src/navigation/edit/navigation-menu-selector.js +1 -1
- package/src/navigation/edit/test/navigation-menu-selector.js +5 -5
- package/src/navigation/view.js +3 -1
- package/src/navigation-link/edit.js +91 -91
- package/src/navigation-link/link-ui.js +74 -89
- package/src/navigation-link/style.scss +0 -12
- package/src/paragraph/block.json +0 -1
- package/src/post-excerpt/edit.js +3 -1
- package/src/post-featured-image/dimension-controls.js +3 -1
- package/src/post-featured-image/editor.scss +1 -0
- package/src/post-navigation-link/variations.js +3 -1
- package/src/post-template/edit.js +9 -4
- package/src/post-terms/edit.js +3 -1
- package/src/private-apis.js +13 -0
- package/src/query/edit/enhanced-pagination-modal.js +5 -1
- package/src/query/edit/inspector-controls/author-control.js +6 -2
- package/src/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +13 -3
- package/src/query/edit/inspector-controls/parent-control.js +18 -6
- package/src/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/src/query/index.php +1 -1
- package/src/query/utils.js +3 -1
- package/src/query-title/variations.js +3 -1
- package/src/site-logo/editor.scss +1 -0
- package/src/social-link/edit.js +2 -2
- package/src/social-link/editor.scss +25 -11
- package/src/social-link/variations.js +3 -1
- package/src/template-part/variations.js +6 -2
|
@@ -148,7 +148,6 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
|
|
|
148
148
|
export function LinkUI( props ) {
|
|
149
149
|
const [ addingBlock, setAddingBlock ] = useState( false );
|
|
150
150
|
const [ focusAddBlockButton, setFocusAddBlockButton ] = useState( false );
|
|
151
|
-
const [ showBackdrop, setShowBackdrop ] = useState( true );
|
|
152
151
|
const { saveEntityRecord } = useDispatch( coreStore );
|
|
153
152
|
const pagesPermissions = useResourcePermissions( 'pages' );
|
|
154
153
|
const postsPermissions = useResourcePermissions( 'posts' );
|
|
@@ -214,102 +213,88 @@ export function LinkUI( props ) {
|
|
|
214
213
|
const { onClose: onSelectBlock } = props;
|
|
215
214
|
|
|
216
215
|
return (
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
<Popover
|
|
217
|
+
placement="bottom"
|
|
218
|
+
onClose={ props.onClose }
|
|
219
|
+
anchor={ props.anchor }
|
|
220
|
+
shift
|
|
221
|
+
>
|
|
222
|
+
{ ! addingBlock && (
|
|
219
223
|
<div
|
|
220
|
-
|
|
221
|
-
aria-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
placement="bottom"
|
|
227
|
-
onClose={ props.onClose }
|
|
228
|
-
anchor={ props.anchor }
|
|
229
|
-
shift
|
|
230
|
-
>
|
|
231
|
-
{ ! addingBlock && (
|
|
232
|
-
<div
|
|
233
|
-
role="dialog"
|
|
234
|
-
aria-labelledby={ dialogTitleId }
|
|
235
|
-
aria-describedby={ dialogDescritionId }
|
|
236
|
-
>
|
|
237
|
-
<VisuallyHidden>
|
|
238
|
-
<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>
|
|
224
|
+
role="dialog"
|
|
225
|
+
aria-labelledby={ dialogTitleId }
|
|
226
|
+
aria-describedby={ dialogDescritionId }
|
|
227
|
+
>
|
|
228
|
+
<VisuallyHidden>
|
|
229
|
+
<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>
|
|
239
230
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if ( type === 'post' ) {
|
|
257
|
-
/* translators: %s: search term. */
|
|
258
|
-
format = __(
|
|
259
|
-
'Create draft post: <mark>%s</mark>'
|
|
260
|
-
);
|
|
261
|
-
} else {
|
|
262
|
-
/* translators: %s: search term. */
|
|
263
|
-
format = __(
|
|
264
|
-
'Create draft page: <mark>%s</mark>'
|
|
265
|
-
);
|
|
266
|
-
}
|
|
231
|
+
<p id={ dialogDescritionId }>
|
|
232
|
+
{ __(
|
|
233
|
+
'Search for and add a link to your Navigation.'
|
|
234
|
+
) }
|
|
235
|
+
</p>
|
|
236
|
+
</VisuallyHidden>
|
|
237
|
+
<LinkControl
|
|
238
|
+
hasTextControl
|
|
239
|
+
hasRichPreviews
|
|
240
|
+
value={ link }
|
|
241
|
+
showInitialSuggestions
|
|
242
|
+
withCreateSuggestion={ userCanCreate }
|
|
243
|
+
createSuggestion={ handleCreate }
|
|
244
|
+
createSuggestionButtonText={ ( searchTerm ) => {
|
|
245
|
+
let format;
|
|
267
246
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
247
|
+
if ( type === 'post' ) {
|
|
248
|
+
/* translators: %s: search term. */
|
|
249
|
+
format = __(
|
|
250
|
+
'Create draft post: <mark>%s</mark>'
|
|
251
|
+
);
|
|
252
|
+
} else {
|
|
253
|
+
/* translators: %s: search term. */
|
|
254
|
+
format = __(
|
|
255
|
+
'Create draft page: <mark>%s</mark>'
|
|
273
256
|
);
|
|
274
|
-
} }
|
|
275
|
-
noDirectEntry={ !! type }
|
|
276
|
-
noURLSuggestion={ !! type }
|
|
277
|
-
suggestionsQuery={ getSuggestionsQuery(
|
|
278
|
-
type,
|
|
279
|
-
kind
|
|
280
|
-
) }
|
|
281
|
-
onChange={ props.onChange }
|
|
282
|
-
onRemove={ props.onRemove }
|
|
283
|
-
onCancel={ props.onCancel }
|
|
284
|
-
renderControlBottom={ () =>
|
|
285
|
-
! link?.url?.length && (
|
|
286
|
-
<LinkUITools
|
|
287
|
-
focusAddBlockButton={
|
|
288
|
-
focusAddBlockButton
|
|
289
|
-
}
|
|
290
|
-
setAddingBlock={ () => {
|
|
291
|
-
setAddingBlock( true );
|
|
292
|
-
setFocusAddBlockButton( false );
|
|
293
|
-
} }
|
|
294
|
-
/>
|
|
295
|
-
)
|
|
296
257
|
}
|
|
297
|
-
/>
|
|
298
|
-
</div>
|
|
299
|
-
) }
|
|
300
258
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
259
|
+
return createInterpolateElement(
|
|
260
|
+
sprintf( format, searchTerm ),
|
|
261
|
+
{
|
|
262
|
+
mark: <mark />,
|
|
263
|
+
}
|
|
264
|
+
);
|
|
307
265
|
} }
|
|
308
|
-
|
|
266
|
+
noDirectEntry={ !! type }
|
|
267
|
+
noURLSuggestion={ !! type }
|
|
268
|
+
suggestionsQuery={ getSuggestionsQuery( type, kind ) }
|
|
269
|
+
onChange={ props.onChange }
|
|
270
|
+
onRemove={ props.onRemove }
|
|
271
|
+
onCancel={ props.onCancel }
|
|
272
|
+
renderControlBottom={ () =>
|
|
273
|
+
! link?.url?.length && (
|
|
274
|
+
<LinkUITools
|
|
275
|
+
focusAddBlockButton={ focusAddBlockButton }
|
|
276
|
+
setAddingBlock={ () => {
|
|
277
|
+
setAddingBlock( true );
|
|
278
|
+
setFocusAddBlockButton( false );
|
|
279
|
+
} }
|
|
280
|
+
/>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
309
283
|
/>
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
284
|
+
</div>
|
|
285
|
+
) }
|
|
286
|
+
|
|
287
|
+
{ addingBlock && (
|
|
288
|
+
<LinkUIBlockInserter
|
|
289
|
+
clientId={ props.clientId }
|
|
290
|
+
onBack={ () => {
|
|
291
|
+
setAddingBlock( false );
|
|
292
|
+
setFocusAddBlockButton( true );
|
|
293
|
+
} }
|
|
294
|
+
onSelectBlock={ onSelectBlock }
|
|
295
|
+
/>
|
|
296
|
+
) }
|
|
297
|
+
</Popover>
|
|
313
298
|
);
|
|
314
299
|
}
|
|
315
300
|
|
|
@@ -28,15 +28,3 @@
|
|
|
28
28
|
margin-left: $grid-unit-10;
|
|
29
29
|
text-transform: uppercase;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
// Ensure Popover `onClose` is fired for clicks on the canvas iframe.
|
|
33
|
-
// See https: //github.com/WordPress/gutenberg/pull/57756#discussion_r1475852009.
|
|
34
|
-
.components-popover-pointer-events-trap {
|
|
35
|
-
// Same z-index as popover, but rendered before the popover element
|
|
36
|
-
// in DOM order = it will display just under the popover
|
|
37
|
-
z-index: z-index(".components-popover");
|
|
38
|
-
position: fixed;
|
|
39
|
-
inset: 0;
|
|
40
|
-
background-color: transparent;
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
}
|
package/src/paragraph/block.json
CHANGED
package/src/post-excerpt/edit.js
CHANGED
|
@@ -89,7 +89,9 @@ export default function PostExcerptEditor( {
|
|
|
89
89
|
* excerpt has been produced from the content.
|
|
90
90
|
*/
|
|
91
91
|
const strippedRenderedExcerpt = useMemo( () => {
|
|
92
|
-
if ( ! renderedExcerpt )
|
|
92
|
+
if ( ! renderedExcerpt ) {
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
93
95
|
const document = new window.DOMParser().parseFromString(
|
|
94
96
|
renderedExcerpt,
|
|
95
97
|
'text/html'
|
|
@@ -81,7 +81,9 @@ const DimensionControls = ( {
|
|
|
81
81
|
* we don't want to set the attribute, as it would
|
|
82
82
|
* end up having the unit as value without any number.
|
|
83
83
|
*/
|
|
84
|
-
if ( isNaN( parsedValue ) && nextValue )
|
|
84
|
+
if ( isNaN( parsedValue ) && nextValue ) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
85
87
|
setAttributes( {
|
|
86
88
|
[ dimension ]: parsedValue < 0 ? '0' : nextValue,
|
|
87
89
|
} );
|
|
@@ -34,7 +34,9 @@ const variations = [
|
|
|
34
34
|
* Block by providing its attributes.
|
|
35
35
|
*/
|
|
36
36
|
variations.forEach( ( variation ) => {
|
|
37
|
-
if ( variation.isActive )
|
|
37
|
+
if ( variation.isActive ) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
38
40
|
variation.isActive = ( blockAttributes, variationAttributes ) =>
|
|
39
41
|
blockAttributes.type === variationAttributes.type;
|
|
40
42
|
} );
|
|
@@ -27,9 +27,9 @@ const TEMPLATE = [
|
|
|
27
27
|
[ 'core/post-excerpt' ],
|
|
28
28
|
];
|
|
29
29
|
|
|
30
|
-
function PostTemplateInnerBlocks() {
|
|
30
|
+
function PostTemplateInnerBlocks( { classList } ) {
|
|
31
31
|
const innerBlocksProps = useInnerBlocksProps(
|
|
32
|
-
{ className: 'wp-block-post' },
|
|
32
|
+
{ className: classnames( 'wp-block-post', classList ) },
|
|
33
33
|
{ template: TEMPLATE, __unstableDisableLayoutClassNames: true }
|
|
34
34
|
);
|
|
35
35
|
return <li { ...innerBlocksProps } />;
|
|
@@ -38,13 +38,14 @@ function PostTemplateInnerBlocks() {
|
|
|
38
38
|
function PostTemplateBlockPreview( {
|
|
39
39
|
blocks,
|
|
40
40
|
blockContextId,
|
|
41
|
+
classList,
|
|
41
42
|
isHidden,
|
|
42
43
|
setActiveBlockContextId,
|
|
43
44
|
} ) {
|
|
44
45
|
const blockPreviewProps = useBlockPreview( {
|
|
45
46
|
blocks,
|
|
46
47
|
props: {
|
|
47
|
-
className: 'wp-block-post',
|
|
48
|
+
className: classnames( 'wp-block-post', classList ),
|
|
48
49
|
},
|
|
49
50
|
} );
|
|
50
51
|
|
|
@@ -213,6 +214,7 @@ export default function PostTemplateEdit( {
|
|
|
213
214
|
posts?.map( ( post ) => ( {
|
|
214
215
|
postType: post.type,
|
|
215
216
|
postId: post.id,
|
|
217
|
+
classList: post.class_list ?? '',
|
|
216
218
|
} ) ),
|
|
217
219
|
[ posts ]
|
|
218
220
|
);
|
|
@@ -280,11 +282,14 @@ export default function PostTemplateEdit( {
|
|
|
280
282
|
{ blockContext.postId ===
|
|
281
283
|
( activeBlockContextId ||
|
|
282
284
|
blockContexts[ 0 ]?.postId ) ? (
|
|
283
|
-
<PostTemplateInnerBlocks
|
|
285
|
+
<PostTemplateInnerBlocks
|
|
286
|
+
classList={ blockContext.classList }
|
|
287
|
+
/>
|
|
284
288
|
) : null }
|
|
285
289
|
<MemoizedPostTemplateBlockPreview
|
|
286
290
|
blocks={ blocks }
|
|
287
291
|
blockContextId={ blockContext.postId }
|
|
292
|
+
classList={ blockContext.classList }
|
|
288
293
|
setActiveBlockContextId={
|
|
289
294
|
setActiveBlockContextId
|
|
290
295
|
}
|
package/src/post-terms/edit.js
CHANGED
|
@@ -49,7 +49,9 @@ export default function PostTermsEdit( {
|
|
|
49
49
|
|
|
50
50
|
const selectedTerm = useSelect(
|
|
51
51
|
( select ) => {
|
|
52
|
-
if ( ! term )
|
|
52
|
+
if ( ! term ) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
53
55
|
const { getTaxonomy } = select( coreStore );
|
|
54
56
|
const taxonomy = getTaxonomy( term );
|
|
55
57
|
return taxonomy?.visibility?.publicly_queryable ? taxonomy : {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { default as BlockKeyboardShortcuts } from './block-keyboard-shortcuts';
|
|
5
|
+
import { lock } from './lock-unlock';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export const privateApis = {};
|
|
11
|
+
lock( privateApis, {
|
|
12
|
+
BlockKeyboardShortcuts,
|
|
13
|
+
} );
|
|
@@ -27,7 +27,11 @@ export default function EnhancedPaginationModal( {
|
|
|
27
27
|
useUnsupportedBlocks( clientId );
|
|
28
28
|
|
|
29
29
|
useEffect( () => {
|
|
30
|
-
if (
|
|
30
|
+
if (
|
|
31
|
+
enhancedPagination &&
|
|
32
|
+
hasUnsupportedBlocks &&
|
|
33
|
+
! window.__experimentalFullPageClientSideNavigation
|
|
34
|
+
) {
|
|
31
35
|
setAttributes( { enhancedPagination: false } );
|
|
32
36
|
setOpen( true );
|
|
33
37
|
}
|
|
@@ -52,14 +52,18 @@ function AuthorControl( { value, onChange } ) {
|
|
|
52
52
|
|
|
53
53
|
const getIdByValue = ( entitiesMappedByName, authorValue ) => {
|
|
54
54
|
const id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;
|
|
55
|
-
if ( id )
|
|
55
|
+
if ( id ) {
|
|
56
|
+
return id;
|
|
57
|
+
}
|
|
56
58
|
};
|
|
57
59
|
const onAuthorChange = ( newValue ) => {
|
|
58
60
|
const ids = Array.from(
|
|
59
61
|
newValue.reduce( ( accumulator, author ) => {
|
|
60
62
|
// Verify that new values point to existing entities.
|
|
61
63
|
const id = getIdByValue( authorsInfo.mapByName, author );
|
|
62
|
-
if ( id )
|
|
64
|
+
if ( id ) {
|
|
65
|
+
accumulator.add( id );
|
|
66
|
+
}
|
|
63
67
|
return accumulator;
|
|
64
68
|
}, new Set() )
|
|
65
69
|
);
|
|
@@ -8,7 +8,9 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
8
8
|
const CreateNewPostLink = ( {
|
|
9
9
|
attributes: { query: { postType } = {} } = {},
|
|
10
10
|
} ) => {
|
|
11
|
-
if ( ! postType )
|
|
11
|
+
if ( ! postType ) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
12
14
|
const newPostUrl = addQueryArgs( 'post-new.php', {
|
|
13
15
|
post_type: postType,
|
|
14
16
|
} );
|
|
@@ -15,9 +15,15 @@ export default function EnhancedPaginationControl( {
|
|
|
15
15
|
clientId,
|
|
16
16
|
} ) {
|
|
17
17
|
const { hasUnsupportedBlocks } = useUnsupportedBlocks( clientId );
|
|
18
|
+
const fullPageClientSideNavigation =
|
|
19
|
+
window.__experimentalFullPageClientSideNavigation;
|
|
18
20
|
|
|
19
21
|
let help = __( 'Browsing between pages requires a full page reload.' );
|
|
20
|
-
if (
|
|
22
|
+
if ( fullPageClientSideNavigation ) {
|
|
23
|
+
help = __(
|
|
24
|
+
'Experimental full-page client-side navigation setting enabled.'
|
|
25
|
+
);
|
|
26
|
+
} else if ( enhancedPagination ) {
|
|
21
27
|
help = __(
|
|
22
28
|
"Browsing between pages won't require a full page reload, unless non-compatible blocks are detected."
|
|
23
29
|
);
|
|
@@ -32,8 +38,12 @@ export default function EnhancedPaginationControl( {
|
|
|
32
38
|
<ToggleControl
|
|
33
39
|
label={ __( 'Force page reload' ) }
|
|
34
40
|
help={ help }
|
|
35
|
-
checked={
|
|
36
|
-
|
|
41
|
+
checked={
|
|
42
|
+
! enhancedPagination && ! fullPageClientSideNavigation
|
|
43
|
+
}
|
|
44
|
+
disabled={
|
|
45
|
+
hasUnsupportedBlocks || fullPageClientSideNavigation
|
|
46
|
+
}
|
|
37
47
|
onChange={ ( value ) => {
|
|
38
48
|
setAttributes( {
|
|
39
49
|
enhancedPagination: ! value,
|
|
@@ -55,7 +55,9 @@ function ParentControl( { parents, postType, onChange } ) {
|
|
|
55
55
|
);
|
|
56
56
|
const currentParents = useSelect(
|
|
57
57
|
( select ) => {
|
|
58
|
-
if ( ! parents?.length )
|
|
58
|
+
if ( ! parents?.length ) {
|
|
59
|
+
return EMPTY_ARRAY;
|
|
60
|
+
}
|
|
59
61
|
const { getEntityRecords } = select( coreStore );
|
|
60
62
|
return getEntityRecords( 'postType', postType, {
|
|
61
63
|
...BASE_QUERY,
|
|
@@ -71,7 +73,9 @@ function ParentControl( { parents, postType, onChange } ) {
|
|
|
71
73
|
if ( ! parents?.length ) {
|
|
72
74
|
setValue( EMPTY_ARRAY );
|
|
73
75
|
}
|
|
74
|
-
if ( ! currentParents?.length )
|
|
76
|
+
if ( ! currentParents?.length ) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
75
79
|
const currentParentsInfo = getEntitiesInfo(
|
|
76
80
|
mapToIHasNameAndId( currentParents, 'title.rendered' )
|
|
77
81
|
);
|
|
@@ -91,27 +95,35 @@ function ParentControl( { parents, postType, onChange } ) {
|
|
|
91
95
|
}, [ parents, currentParents ] );
|
|
92
96
|
|
|
93
97
|
const entitiesInfo = useMemo( () => {
|
|
94
|
-
if ( ! searchResults?.length )
|
|
98
|
+
if ( ! searchResults?.length ) {
|
|
99
|
+
return EMPTY_ARRAY;
|
|
100
|
+
}
|
|
95
101
|
return getEntitiesInfo(
|
|
96
102
|
mapToIHasNameAndId( searchResults, 'title.rendered' )
|
|
97
103
|
);
|
|
98
104
|
}, [ searchResults ] );
|
|
99
105
|
// Update suggestions only when the query has resolved.
|
|
100
106
|
useEffect( () => {
|
|
101
|
-
if ( ! searchHasResolved )
|
|
107
|
+
if ( ! searchHasResolved ) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
102
110
|
setSuggestions( entitiesInfo.names );
|
|
103
111
|
}, [ entitiesInfo.names, searchHasResolved ] );
|
|
104
112
|
|
|
105
113
|
const getIdByValue = ( entitiesMappedByName, entity ) => {
|
|
106
114
|
const id = entity?.id || entitiesMappedByName?.[ entity ]?.id;
|
|
107
|
-
if ( id )
|
|
115
|
+
if ( id ) {
|
|
116
|
+
return id;
|
|
117
|
+
}
|
|
108
118
|
};
|
|
109
119
|
const onParentChange = ( newValue ) => {
|
|
110
120
|
const ids = Array.from(
|
|
111
121
|
newValue.reduce( ( accumulator, entity ) => {
|
|
112
122
|
// Verify that new values point to existing entities.
|
|
113
123
|
const id = getIdByValue( entitiesInfo.mapByName, entity );
|
|
114
|
-
if ( id )
|
|
124
|
+
if ( id ) {
|
|
125
|
+
accumulator.add( id );
|
|
126
|
+
}
|
|
115
127
|
return accumulator;
|
|
116
128
|
}, new Set() )
|
|
117
129
|
);
|
|
@@ -124,7 +124,9 @@ function TaxonomyItem( { taxonomy, termIds, onChange } ) {
|
|
|
124
124
|
// and to sanitize the provided `termIds`, by setting only the ones that exist.
|
|
125
125
|
const existingTerms = useSelect(
|
|
126
126
|
( select ) => {
|
|
127
|
-
if ( ! termIds?.length )
|
|
127
|
+
if ( ! termIds?.length ) {
|
|
128
|
+
return EMPTY_ARRAY;
|
|
129
|
+
}
|
|
128
130
|
const { getEntityRecords } = select( coreStore );
|
|
129
131
|
return getEntityRecords( 'taxonomy', taxonomy.slug, {
|
|
130
132
|
...BASE_QUERY,
|
|
@@ -140,7 +142,9 @@ function TaxonomyItem( { taxonomy, termIds, onChange } ) {
|
|
|
140
142
|
if ( ! termIds?.length ) {
|
|
141
143
|
setValue( EMPTY_ARRAY );
|
|
142
144
|
}
|
|
143
|
-
if ( ! existingTerms?.length )
|
|
145
|
+
if ( ! existingTerms?.length ) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
144
148
|
// Returns only the existing entity ids. This prevents the component
|
|
145
149
|
// from crashing in the editor, when non existing ids are provided.
|
|
146
150
|
const sanitizedValue = termIds.reduce( ( accumulator, id ) => {
|
|
@@ -157,7 +161,9 @@ function TaxonomyItem( { taxonomy, termIds, onChange } ) {
|
|
|
157
161
|
}, [ termIds, existingTerms ] );
|
|
158
162
|
// Update suggestions only when the query has resolved.
|
|
159
163
|
useEffect( () => {
|
|
160
|
-
if ( ! searchHasResolved )
|
|
164
|
+
if ( ! searchHasResolved ) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
161
167
|
setSuggestions( searchResults.map( ( result ) => result.name ) );
|
|
162
168
|
}, [ searchResults, searchHasResolved ] );
|
|
163
169
|
const onTermsChange = ( newTermValues ) => {
|
package/src/query/index.php
CHANGED
|
@@ -51,8 +51,8 @@ function render_block_core_query( $attributes, $content, $block ) {
|
|
|
51
51
|
// Add the necessary directives.
|
|
52
52
|
$p->set_attribute( 'data-wp-interactive', 'core/query' );
|
|
53
53
|
$p->set_attribute( 'data-wp-router-region', 'query-' . $attributes['queryId'] );
|
|
54
|
-
$p->set_attribute( 'data-wp-init', 'callbacks.setQueryRef' );
|
|
55
54
|
$p->set_attribute( 'data-wp-context', '{}' );
|
|
55
|
+
$p->set_attribute( 'data-wp-key', $attributes['queryId'] );
|
|
56
56
|
$content = $p->get_updated_html();
|
|
57
57
|
}
|
|
58
58
|
}
|
package/src/query/utils.js
CHANGED
|
@@ -108,7 +108,9 @@ export const usePostTypes = () => {
|
|
|
108
108
|
return filteredPostTypes;
|
|
109
109
|
}, [] );
|
|
110
110
|
const postTypesTaxonomiesMap = useMemo( () => {
|
|
111
|
-
if ( ! postTypes?.length )
|
|
111
|
+
if ( ! postTypes?.length ) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
112
114
|
return postTypes.reduce( ( accumulator, type ) => {
|
|
113
115
|
accumulator[ type.slug ] = type.taxonomies;
|
|
114
116
|
return accumulator;
|
|
@@ -38,7 +38,9 @@ const variations = [
|
|
|
38
38
|
* Block by providing its attributes.
|
|
39
39
|
*/
|
|
40
40
|
variations.forEach( ( variation ) => {
|
|
41
|
-
if ( variation.isActive )
|
|
41
|
+
if ( variation.isActive ) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
42
44
|
variation.isActive = ( blockAttributes, variationAttributes ) =>
|
|
43
45
|
blockAttributes.type === variationAttributes.type;
|
|
44
46
|
} );
|
package/src/social-link/edit.js
CHANGED
|
@@ -158,7 +158,7 @@ const SocialLinkEdit = ( {
|
|
|
158
158
|
/>
|
|
159
159
|
</InspectorControls>
|
|
160
160
|
<li { ...blockProps }>
|
|
161
|
-
<
|
|
161
|
+
<button
|
|
162
162
|
className="wp-block-social-link-anchor"
|
|
163
163
|
ref={ setPopoverAnchor }
|
|
164
164
|
onClick={ () => setPopover( true ) }
|
|
@@ -171,7 +171,7 @@ const SocialLinkEdit = ( {
|
|
|
171
171
|
>
|
|
172
172
|
{ socialLinkText }
|
|
173
173
|
</span>
|
|
174
|
-
</
|
|
174
|
+
</button>
|
|
175
175
|
{ isSelected && showURLPopover && (
|
|
176
176
|
<SocialLinkURLPopover
|
|
177
177
|
url={ url }
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
// The editor uses the button component, the frontend uses a link.
|
|
2
|
-
// Therefore we unstyle the button component to make it more like the frontend.
|
|
3
1
|
.wp-block-social-links .wp-social-link {
|
|
4
2
|
line-height: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
// The editor uses the button element, the frontend uses a link.
|
|
6
|
+
// Therefore we unstyle the button element to make it more like the frontend.
|
|
7
|
+
.wp-block-social-link-anchor {
|
|
8
|
+
align-items: center;
|
|
9
|
+
background: none;
|
|
10
|
+
border: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
font-size: inherit;
|
|
15
|
+
color: currentColor;
|
|
16
|
+
height: auto;
|
|
17
|
+
|
|
18
|
+
// This rule ensures social link buttons display correctly in template parts.
|
|
19
|
+
opacity: 1;
|
|
5
20
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
color: currentColor;
|
|
9
|
-
height: auto;
|
|
10
|
-
line-height: 0;
|
|
21
|
+
// This rule is duplicated from the style.scss and needs to be the same as there.
|
|
22
|
+
padding: 0.25em;
|
|
11
23
|
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
// Focus styles replicate the `@wordpress/components` button component.
|
|
25
|
+
&:focus:not(:disabled) {
|
|
26
|
+
border-radius: 2px;
|
|
27
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
14
28
|
|
|
15
|
-
//
|
|
16
|
-
|
|
29
|
+
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
30
|
+
outline: 3px solid transparent;
|
|
17
31
|
}
|
|
18
32
|
}
|
|
19
33
|
|
|
@@ -339,7 +339,9 @@ const variations = [
|
|
|
339
339
|
* Block by providing its attributes.
|
|
340
340
|
*/
|
|
341
341
|
variations.forEach( ( variation ) => {
|
|
342
|
-
if ( variation.isActive )
|
|
342
|
+
if ( variation.isActive ) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
343
345
|
variation.isActive = ( blockAttributes, variationAttributes ) =>
|
|
344
346
|
blockAttributes.service === variationAttributes.service;
|
|
345
347
|
} );
|
|
@@ -31,10 +31,14 @@ export function enhanceTemplatePartVariations( settings, name ) {
|
|
|
31
31
|
const { area, theme, slug } = blockAttributes;
|
|
32
32
|
// We first check the `area` block attribute which is set during insertion.
|
|
33
33
|
// This property is removed on the creation of a template part.
|
|
34
|
-
if ( area )
|
|
34
|
+
if ( area ) {
|
|
35
|
+
return area === variationAttributes.area;
|
|
36
|
+
}
|
|
35
37
|
// Find a matching variation from the created template part
|
|
36
38
|
// by checking the entity's `area` property.
|
|
37
|
-
if ( ! slug )
|
|
39
|
+
if ( ! slug ) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
38
42
|
const { getCurrentTheme, getEntityRecord } =
|
|
39
43
|
select( coreDataStore );
|
|
40
44
|
const entity = getEntityRecord(
|