@wordpress/block-library 7.3.3 → 7.3.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-title/edit.js +7 -5
- package/build/comments-title/edit.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +5 -7
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation-link/edit.js +29 -30
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +14 -14
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +7 -5
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +5 -7
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation-link/edit.js +29 -30
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +14 -14
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-style/comment-content/style-rtl.css +81 -0
- package/build-style/comment-content/style.css +81 -0
- package/build-style/cover/style-rtl.css +1 -1
- package/build-style/cover/style.css +1 -1
- package/build-style/latest-posts/style-rtl.css +2 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/style-rtl.css +3 -1
- package/build-style/style.css +5 -1
- package/package.json +8 -8
- package/src/comment-author-name/index.php +7 -5
- package/src/comment-content/index.php +25 -3
- package/src/comment-content/style.scss +5 -0
- package/src/comments-title/edit.js +20 -4
- package/src/comments-title/index.php +14 -7
- package/src/cover/index.php +1 -1
- package/src/cover/style.scss +1 -1
- package/src/latest-posts/style.scss +4 -0
- package/src/navigation/edit/inner-blocks.js +5 -7
- package/src/navigation-link/edit.js +40 -43
- package/src/navigation-submenu/edit.js +13 -17
- package/src/post-comments-form/index.php +4 -1
- package/src/post-content/edit.js +15 -1
|
@@ -342,7 +342,35 @@ function navStripHTML( html ) {
|
|
|
342
342
|
* Add transforms to Link Control
|
|
343
343
|
*/
|
|
344
344
|
|
|
345
|
-
function LinkControlTransforms( {
|
|
345
|
+
function LinkControlTransforms( { clientId, replace } ) {
|
|
346
|
+
const { getBlock, blockTransforms } = useSelect(
|
|
347
|
+
( select ) => {
|
|
348
|
+
const {
|
|
349
|
+
getBlock: _getBlock,
|
|
350
|
+
getBlockRootClientId,
|
|
351
|
+
getBlockTransformItems,
|
|
352
|
+
} = select( blockEditorStore );
|
|
353
|
+
|
|
354
|
+
return {
|
|
355
|
+
getBlock: _getBlock,
|
|
356
|
+
blockTransforms: getBlockTransformItems(
|
|
357
|
+
[ _getBlock( clientId ) ],
|
|
358
|
+
getBlockRootClientId( clientId )
|
|
359
|
+
),
|
|
360
|
+
};
|
|
361
|
+
},
|
|
362
|
+
[ clientId ]
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
const featuredBlocks = [
|
|
366
|
+
'core/site-logo',
|
|
367
|
+
'core/social-links',
|
|
368
|
+
'core/search',
|
|
369
|
+
];
|
|
370
|
+
const transforms = blockTransforms.filter( ( item ) => {
|
|
371
|
+
return featuredBlocks.includes( item.name );
|
|
372
|
+
} );
|
|
373
|
+
|
|
346
374
|
if ( ! transforms?.length ) {
|
|
347
375
|
return null;
|
|
348
376
|
}
|
|
@@ -359,8 +387,11 @@ function LinkControlTransforms( { block, transforms, replace } ) {
|
|
|
359
387
|
key={ `transform-${ index }` }
|
|
360
388
|
onClick={ () =>
|
|
361
389
|
replace(
|
|
362
|
-
|
|
363
|
-
switchToBlockType(
|
|
390
|
+
clientId,
|
|
391
|
+
switchToBlockType(
|
|
392
|
+
getBlock( clientId ),
|
|
393
|
+
item.name
|
|
394
|
+
)
|
|
364
395
|
)
|
|
365
396
|
}
|
|
366
397
|
className="link-control-transform__item"
|
|
@@ -421,30 +452,20 @@ export default function NavigationLinkEdit( {
|
|
|
421
452
|
isAtMaxNesting,
|
|
422
453
|
isTopLevelLink,
|
|
423
454
|
isParentOfSelectedBlock,
|
|
424
|
-
|
|
455
|
+
hasChildren,
|
|
425
456
|
userCanCreatePages,
|
|
426
457
|
userCanCreatePosts,
|
|
427
|
-
thisBlock,
|
|
428
|
-
blockTransforms,
|
|
429
458
|
} = useSelect(
|
|
430
459
|
( select ) => {
|
|
431
460
|
const {
|
|
432
|
-
getBlock,
|
|
433
461
|
getBlocks,
|
|
462
|
+
getBlockCount,
|
|
434
463
|
getBlockName,
|
|
435
464
|
getBlockRootClientId,
|
|
436
|
-
getClientIdsOfDescendants,
|
|
437
465
|
hasSelectedInnerBlock,
|
|
438
|
-
getSelectedBlockClientId,
|
|
439
466
|
getBlockParentsByBlockName,
|
|
440
|
-
getBlockTransformItems,
|
|
441
467
|
} = select( blockEditorStore );
|
|
442
468
|
|
|
443
|
-
const selectedBlockId = getSelectedBlockClientId();
|
|
444
|
-
|
|
445
|
-
const descendants = getClientIdsOfDescendants( [ clientId ] )
|
|
446
|
-
.length;
|
|
447
|
-
|
|
448
469
|
return {
|
|
449
470
|
innerBlocks: getBlocks( clientId ),
|
|
450
471
|
isAtMaxNesting:
|
|
@@ -459,14 +480,7 @@ export default function NavigationLinkEdit( {
|
|
|
459
480
|
clientId,
|
|
460
481
|
true
|
|
461
482
|
),
|
|
462
|
-
|
|
463
|
-
clientId,
|
|
464
|
-
false
|
|
465
|
-
),
|
|
466
|
-
hasDescendants: !! descendants,
|
|
467
|
-
selectedBlockHasDescendants: !! getClientIdsOfDescendants( [
|
|
468
|
-
selectedBlockId,
|
|
469
|
-
] )?.length,
|
|
483
|
+
hasChildren: !! getBlockCount( clientId ),
|
|
470
484
|
userCanCreatePages: select( coreStore ).canUser(
|
|
471
485
|
'create',
|
|
472
486
|
'pages'
|
|
@@ -475,11 +489,6 @@ export default function NavigationLinkEdit( {
|
|
|
475
489
|
'create',
|
|
476
490
|
'posts'
|
|
477
491
|
),
|
|
478
|
-
thisBlock: getBlock( clientId ),
|
|
479
|
-
blockTransforms: getBlockTransformItems(
|
|
480
|
-
[ getBlock( clientId ) ],
|
|
481
|
-
getBlockRootClientId( clientId )
|
|
482
|
-
),
|
|
483
492
|
};
|
|
484
493
|
},
|
|
485
494
|
[ clientId ]
|
|
@@ -506,15 +515,6 @@ export default function NavigationLinkEdit( {
|
|
|
506
515
|
replaceBlock( clientId, newSubmenu );
|
|
507
516
|
}
|
|
508
517
|
|
|
509
|
-
const featuredBlocks = [
|
|
510
|
-
'core/site-logo',
|
|
511
|
-
'core/social-links',
|
|
512
|
-
'core/search',
|
|
513
|
-
];
|
|
514
|
-
const featuredTransforms = blockTransforms.filter( ( item ) => {
|
|
515
|
-
return featuredBlocks.includes( item.name );
|
|
516
|
-
} );
|
|
517
|
-
|
|
518
518
|
useEffect( () => {
|
|
519
519
|
// Show the LinkControl on mount if the URL is empty
|
|
520
520
|
// ( When adding a new menu item)
|
|
@@ -524,7 +524,7 @@ export default function NavigationLinkEdit( {
|
|
|
524
524
|
setIsLinkOpen( true );
|
|
525
525
|
}
|
|
526
526
|
// If block has inner blocks, transform to Submenu.
|
|
527
|
-
if (
|
|
527
|
+
if ( hasChildren ) {
|
|
528
528
|
transformToSubmenu();
|
|
529
529
|
}
|
|
530
530
|
}, [] );
|
|
@@ -634,7 +634,7 @@ export default function NavigationLinkEdit( {
|
|
|
634
634
|
'is-editing': isSelected || isParentOfSelectedBlock,
|
|
635
635
|
'is-dragging-within': isDraggingWithin,
|
|
636
636
|
'has-link': !! url,
|
|
637
|
-
'has-child':
|
|
637
|
+
'has-child': hasChildren,
|
|
638
638
|
'has-text-color': !! textColor || !! customTextColor,
|
|
639
639
|
[ getColorClassName( 'color', textColor ) ]: !! textColor,
|
|
640
640
|
'has-background': !! backgroundColor || customBackgroundColor,
|
|
@@ -860,10 +860,7 @@ export default function NavigationLinkEdit( {
|
|
|
860
860
|
! url
|
|
861
861
|
? () => (
|
|
862
862
|
<LinkControlTransforms
|
|
863
|
-
|
|
864
|
-
transforms={
|
|
865
|
-
featuredTransforms
|
|
866
|
-
}
|
|
863
|
+
clientId={ clientId }
|
|
867
864
|
replace={ replaceBlock }
|
|
868
865
|
/>
|
|
869
866
|
)
|
|
@@ -309,37 +309,33 @@ export default function NavigationSubmenuEdit( {
|
|
|
309
309
|
isTopLevelItem,
|
|
310
310
|
isParentOfSelectedBlock,
|
|
311
311
|
isImmediateParentOfSelectedBlock,
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
hasChildren,
|
|
313
|
+
selectedBlockHasChildren,
|
|
314
314
|
userCanCreatePages,
|
|
315
315
|
userCanCreatePosts,
|
|
316
316
|
onlyDescendantIsEmptyLink,
|
|
317
317
|
} = useSelect(
|
|
318
318
|
( select ) => {
|
|
319
319
|
const {
|
|
320
|
-
getClientIdsOfDescendants,
|
|
321
320
|
hasSelectedInnerBlock,
|
|
322
321
|
getSelectedBlockClientId,
|
|
323
322
|
getBlockParentsByBlockName,
|
|
324
323
|
getBlock,
|
|
324
|
+
getBlockCount,
|
|
325
|
+
getBlockOrder,
|
|
325
326
|
} = select( blockEditorStore );
|
|
326
327
|
|
|
327
328
|
let _onlyDescendantIsEmptyLink;
|
|
328
329
|
|
|
329
330
|
const selectedBlockId = getSelectedBlockClientId();
|
|
330
331
|
|
|
331
|
-
const
|
|
332
|
-
.length;
|
|
333
|
-
|
|
334
|
-
const selectedBlockDescendants = getClientIdsOfDescendants( [
|
|
335
|
-
selectedBlockId,
|
|
336
|
-
] );
|
|
332
|
+
const selectedBlockChildren = getBlockOrder( selectedBlockId );
|
|
337
333
|
|
|
338
334
|
// Check for a single descendant in the submenu. If that block
|
|
339
335
|
// is a link block in a "placeholder" state with no label then
|
|
340
336
|
// we can consider as an "empty" link.
|
|
341
|
-
if (
|
|
342
|
-
const singleBlock = getBlock(
|
|
337
|
+
if ( selectedBlockChildren?.length === 1 ) {
|
|
338
|
+
const singleBlock = getBlock( selectedBlockChildren[ 0 ] );
|
|
343
339
|
|
|
344
340
|
_onlyDescendantIsEmptyLink =
|
|
345
341
|
singleBlock?.name === 'core/navigation-link' &&
|
|
@@ -360,8 +356,8 @@ export default function NavigationSubmenuEdit( {
|
|
|
360
356
|
clientId,
|
|
361
357
|
false
|
|
362
358
|
),
|
|
363
|
-
|
|
364
|
-
|
|
359
|
+
hasChildren: !! getBlockCount( clientId ),
|
|
360
|
+
selectedBlockHasChildren: !! selectedBlockChildren?.length,
|
|
365
361
|
userCanCreatePages: select( coreStore ).canUser(
|
|
366
362
|
'create',
|
|
367
363
|
'pages'
|
|
@@ -481,7 +477,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
481
477
|
'is-editing': isSelected || isParentOfSelectedBlock,
|
|
482
478
|
'is-dragging-within': isDraggingWithin,
|
|
483
479
|
'has-link': !! url,
|
|
484
|
-
'has-child':
|
|
480
|
+
'has-child': hasChildren,
|
|
485
481
|
'has-text-color': !! textColor || !! customTextColor,
|
|
486
482
|
[ getColorClassName( 'color', textColor ) ]: !! textColor,
|
|
487
483
|
'has-background': !! backgroundColor || customBackgroundColor,
|
|
@@ -538,9 +534,9 @@ export default function NavigationSubmenuEdit( {
|
|
|
538
534
|
renderAppender:
|
|
539
535
|
isSelected ||
|
|
540
536
|
( isImmediateParentOfSelectedBlock &&
|
|
541
|
-
!
|
|
537
|
+
! selectedBlockHasChildren ) ||
|
|
542
538
|
// Show the appender while dragging to allow inserting element between item and the appender.
|
|
543
|
-
|
|
539
|
+
hasChildren
|
|
544
540
|
? InnerBlocks.ButtonBlockAppender
|
|
545
541
|
: false,
|
|
546
542
|
}
|
|
@@ -554,7 +550,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
554
550
|
}
|
|
555
551
|
|
|
556
552
|
const canConvertToLink =
|
|
557
|
-
!
|
|
553
|
+
! selectedBlockHasChildren || onlyDescendantIsEmptyLink;
|
|
558
554
|
|
|
559
555
|
return (
|
|
560
556
|
<Fragment>
|
|
@@ -25,10 +25,14 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
|
|
|
25
25
|
|
|
26
26
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
27
27
|
|
|
28
|
+
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
29
|
+
|
|
28
30
|
ob_start();
|
|
29
31
|
comment_form( array(), $block->context['postId'] );
|
|
30
32
|
$form = ob_get_clean();
|
|
31
33
|
|
|
34
|
+
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
35
|
+
|
|
32
36
|
// We use the outermost wrapping `<div />` returned by `comment_form()`
|
|
33
37
|
// which is identified by its default classname `comment-respond` to inject
|
|
34
38
|
// our wrapper attributes. This way, it is guaranteed that all styling applied
|
|
@@ -70,4 +74,3 @@ function post_comments_form_block_form_defaults( $fields ) {
|
|
|
70
74
|
|
|
71
75
|
return $fields;
|
|
72
76
|
}
|
|
73
|
-
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
package/src/post-content/edit.js
CHANGED
|
@@ -85,7 +85,21 @@ function Placeholder() {
|
|
|
85
85
|
const blockProps = useBlockProps();
|
|
86
86
|
return (
|
|
87
87
|
<div { ...blockProps }>
|
|
88
|
-
<p>
|
|
88
|
+
<p>
|
|
89
|
+
{ __(
|
|
90
|
+
'This is the Post Content block, it will display all the blocks in any single post or page.'
|
|
91
|
+
) }
|
|
92
|
+
</p>
|
|
93
|
+
<p>
|
|
94
|
+
{ __(
|
|
95
|
+
'That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.'
|
|
96
|
+
) }
|
|
97
|
+
</p>
|
|
98
|
+
<p>
|
|
99
|
+
{ __(
|
|
100
|
+
'If there are any Custom Post Types registered at your site, the Post Content block can display the contents of those entries as well.'
|
|
101
|
+
) }
|
|
102
|
+
</p>
|
|
89
103
|
</div>
|
|
90
104
|
);
|
|
91
105
|
}
|