@wordpress/block-library 7.3.3 → 7.3.6
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/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/navigation/edit/index.js +5 -28
- package/build/navigation/edit/index.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/index.js +0 -1
- package/build/navigation/index.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/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/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/index.js +1 -2
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +6 -28
- package/build-module/navigation/edit/index.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/index.js +0 -1
- package/build-module/navigation/index.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-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/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/post-comments/style-rtl.css +5 -1
- package/build-style/post-comments/style.css +5 -1
- package/build-style/style-rtl.css +8 -2
- package/build-style/style.css +10 -2
- 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/comment-template/index.php +4 -0
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-title/edit.js +20 -4
- package/src/comments-title/index.php +18 -7
- package/src/cover/index.php +1 -1
- package/src/cover/style.scss +1 -1
- package/src/index.js +0 -2
- package/src/latest-posts/style.scss +4 -0
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +6 -36
- 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/style.scss +5 -2
- package/src/post-comments-form/index.php +8 -1
- package/src/post-content/edit.js +15 -1
- package/src/post-excerpt/edit.js +14 -1
- package/build/navigation-area/edit.js +0 -110
- package/build/navigation-area/edit.js.map +0 -1
- package/build/navigation-area/index.js +0 -62
- package/build/navigation-area/index.js.map +0 -1
- package/build/navigation-area/inner-blocks.js +0 -34
- package/build/navigation-area/inner-blocks.js.map +0 -1
- package/build/navigation-area/save.js +0 -18
- package/build/navigation-area/save.js.map +0 -1
- package/build-module/navigation-area/edit.js +0 -94
- package/build-module/navigation-area/edit.js.map +0 -1
- package/build-module/navigation-area/index.js +0 -48
- package/build-module/navigation-area/index.js.map +0 -1
- package/build-module/navigation-area/inner-blocks.js +0 -26
- package/build-module/navigation-area/inner-blocks.js.map +0 -1
- package/build-module/navigation-area/save.js +0 -10
- package/build-module/navigation-area/save.js.map +0 -1
- package/src/navigation-area/block.json +0 -23
- package/src/navigation-area/edit.js +0 -111
- package/src/navigation-area/index.js +0 -26
- package/src/navigation-area/index.php +0 -22
- package/src/navigation-area/inner-blocks.js +0 -24
- package/src/navigation-area/save.js +0 -8
package/src/index.js
CHANGED
|
@@ -54,7 +54,6 @@ import * as mediaText from './media-text';
|
|
|
54
54
|
import * as missing from './missing';
|
|
55
55
|
import * as more from './more';
|
|
56
56
|
import * as navigation from './navigation';
|
|
57
|
-
import * as navigationArea from './navigation-area';
|
|
58
57
|
import * as navigationLink from './navigation-link';
|
|
59
58
|
import * as navigationSubmenu from './navigation-submenu';
|
|
60
59
|
import * as nextpage from './nextpage';
|
|
@@ -279,7 +278,6 @@ export const __experimentalRegisterExperimentalCoreBlocks = process.env
|
|
|
279
278
|
...( enableFSEBlocks
|
|
280
279
|
? [
|
|
281
280
|
commentAuthorAvatar,
|
|
282
|
-
navigationArea,
|
|
283
281
|
postComment,
|
|
284
282
|
postCommentsCount,
|
|
285
283
|
postCommentsLink,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { noop } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -26,7 +25,7 @@ import {
|
|
|
26
25
|
getColorClassName,
|
|
27
26
|
Warning,
|
|
28
27
|
} from '@wordpress/block-editor';
|
|
29
|
-
import { EntityProvider
|
|
28
|
+
import { EntityProvider } from '@wordpress/core-data';
|
|
30
29
|
|
|
31
30
|
import { useDispatch, useSelect, useRegistry } from '@wordpress/data';
|
|
32
31
|
import {
|
|
@@ -109,7 +108,6 @@ function Navigation( {
|
|
|
109
108
|
setOverlayBackgroundColor,
|
|
110
109
|
overlayTextColor,
|
|
111
110
|
setOverlayTextColor,
|
|
112
|
-
context: { navigationArea },
|
|
113
111
|
|
|
114
112
|
// These props are used by the navigation editor to override specific
|
|
115
113
|
// navigation block settings.
|
|
@@ -129,34 +127,12 @@ function Navigation( {
|
|
|
129
127
|
hasIcon,
|
|
130
128
|
} = attributes;
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
setAreaMenu = noop;
|
|
134
|
-
// Navigation areas are deprecated and on their way out. Let's not perform
|
|
135
|
-
// the request unless we're in an environment where the endpoint exists.
|
|
136
|
-
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
137
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
138
|
-
[ areaMenu, setAreaMenu ] = useEntityProp(
|
|
139
|
-
'root',
|
|
140
|
-
'navigationArea',
|
|
141
|
-
'navigation',
|
|
142
|
-
navigationArea
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const navigationAreaMenu = areaMenu === 0 ? undefined : areaMenu;
|
|
147
|
-
|
|
148
|
-
const ref = navigationArea ? navigationAreaMenu : attributes.ref;
|
|
130
|
+
const ref = attributes.ref;
|
|
149
131
|
|
|
150
132
|
const registry = useRegistry();
|
|
151
|
-
const setRef =
|
|
152
|
-
( postId )
|
|
153
|
-
|
|
154
|
-
if ( navigationArea ) {
|
|
155
|
-
setAreaMenu( postId );
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
[ navigationArea ]
|
|
159
|
-
);
|
|
133
|
+
const setRef = ( postId ) => {
|
|
134
|
+
setAttributes( { ref: postId } );
|
|
135
|
+
};
|
|
160
136
|
|
|
161
137
|
const [ hasAlreadyRendered, RecursionProvider ] = useNoRecursiveRenders(
|
|
162
138
|
`navigationMenu/${ ref }`
|
|
@@ -261,8 +237,6 @@ function Navigation( {
|
|
|
261
237
|
setHasSavedUnsavedInnerBlocks,
|
|
262
238
|
] = useState( false );
|
|
263
239
|
|
|
264
|
-
const isWithinUnassignedArea = !! navigationArea && ! ref;
|
|
265
|
-
|
|
266
240
|
const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] = useState(
|
|
267
241
|
false
|
|
268
242
|
);
|
|
@@ -322,13 +296,12 @@ function Navigation( {
|
|
|
322
296
|
// - there is no classic menu conversion process in progress.
|
|
323
297
|
// - there is no menu creation process in progress.
|
|
324
298
|
// - there are no uncontrolled blocks.
|
|
325
|
-
// - (legacy) there is a Navigation Area without a ref attribute pointing to a Navigation Post.
|
|
326
299
|
const isPlaceholder =
|
|
327
300
|
! ref &&
|
|
328
301
|
! isCreatingNavigationMenu &&
|
|
329
302
|
! isConvertingClassicMenu &&
|
|
330
303
|
hasResolvedNavigationMenus &&
|
|
331
|
-
|
|
304
|
+
! hasUncontrolledInnerBlocks;
|
|
332
305
|
|
|
333
306
|
const isEntityAvailable =
|
|
334
307
|
! isNavigationMenuMissing && isNavigationMenuResolved;
|
|
@@ -567,9 +540,6 @@ function Navigation( {
|
|
|
567
540
|
|
|
568
541
|
const resetToEmptyBlock = useCallback( () => {
|
|
569
542
|
registry.batch( () => {
|
|
570
|
-
if ( navigationArea ) {
|
|
571
|
-
setAreaMenu( 0 );
|
|
572
|
-
}
|
|
573
543
|
setAttributes( {
|
|
574
544
|
ref: undefined,
|
|
575
545
|
} );
|
|
@@ -44,12 +44,12 @@ export default function NavigationInnerBlocks( {
|
|
|
44
44
|
} ) {
|
|
45
45
|
const {
|
|
46
46
|
isImmediateParentOfSelectedBlock,
|
|
47
|
-
|
|
47
|
+
selectedBlockHasChildren,
|
|
48
48
|
isSelected,
|
|
49
49
|
} = useSelect(
|
|
50
50
|
( select ) => {
|
|
51
51
|
const {
|
|
52
|
-
|
|
52
|
+
getBlockCount,
|
|
53
53
|
hasSelectedInnerBlock,
|
|
54
54
|
getSelectedBlockClientId,
|
|
55
55
|
} = select( blockEditorStore );
|
|
@@ -60,9 +60,7 @@ export default function NavigationInnerBlocks( {
|
|
|
60
60
|
clientId,
|
|
61
61
|
false
|
|
62
62
|
),
|
|
63
|
-
|
|
64
|
-
selectedBlockId,
|
|
65
|
-
] )?.length,
|
|
63
|
+
selectedBlockHasChildren: !! getBlockCount( selectedBlockId ),
|
|
66
64
|
|
|
67
65
|
// This prop is already available but computing it here ensures it's
|
|
68
66
|
// fresh compared to isImmediateParentOfSelectedBlock.
|
|
@@ -93,7 +91,7 @@ export default function NavigationInnerBlocks( {
|
|
|
93
91
|
// appender.
|
|
94
92
|
const parentOrChildHasSelection =
|
|
95
93
|
isSelected ||
|
|
96
|
-
( isImmediateParentOfSelectedBlock && !
|
|
94
|
+
( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );
|
|
97
95
|
|
|
98
96
|
const placeholder = useMemo( () => <PlaceholderPreview />, [] );
|
|
99
97
|
|
|
@@ -127,7 +125,7 @@ export default function NavigationInnerBlocks( {
|
|
|
127
125
|
renderAppender:
|
|
128
126
|
isSelected ||
|
|
129
127
|
( isImmediateParentOfSelectedBlock &&
|
|
130
|
-
!
|
|
128
|
+
! selectedBlockHasChildren ) ||
|
|
131
129
|
// Show the appender while dragging to allow inserting element between item and the appender.
|
|
132
130
|
parentOrChildHasSelection
|
|
133
131
|
? InnerBlocks.ButtonBlockAppender
|
|
@@ -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>
|
|
@@ -44,11 +44,14 @@
|
|
|
44
44
|
.comment-meta {
|
|
45
45
|
font-size: 0.875em;
|
|
46
46
|
line-height: 1.5;
|
|
47
|
-
margin-left: -3.25em;
|
|
48
|
-
|
|
49
47
|
b {
|
|
50
48
|
font-weight: normal;
|
|
51
49
|
}
|
|
50
|
+
.comment-awaiting-moderation {
|
|
51
|
+
margin-top: 1em;
|
|
52
|
+
margin-bottom: 1em;
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
.comment-body .commentmetadata {
|
|
@@ -18,6 +18,10 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
|
|
|
18
18
|
return '';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
if ( post_password_required( $block->context['postId'] ) ) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
$classes = 'comment-respond'; // See comment further below.
|
|
22
26
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
23
27
|
$classes .= 'has-text-align-' . $attributes['textAlign'];
|
|
@@ -25,10 +29,14 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
|
|
|
25
29
|
|
|
26
30
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
27
31
|
|
|
32
|
+
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
33
|
+
|
|
28
34
|
ob_start();
|
|
29
35
|
comment_form( array(), $block->context['postId'] );
|
|
30
36
|
$form = ob_get_clean();
|
|
31
37
|
|
|
38
|
+
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
39
|
+
|
|
32
40
|
// We use the outermost wrapping `<div />` returned by `comment_form()`
|
|
33
41
|
// which is identified by its default classname `comment-respond` to inject
|
|
34
42
|
// our wrapper attributes. This way, it is guaranteed that all styling applied
|
|
@@ -70,4 +78,3 @@ function post_comments_form_block_form_defaults( $fields ) {
|
|
|
70
78
|
|
|
71
79
|
return $fields;
|
|
72
80
|
}
|
|
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
|
}
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -57,7 +57,20 @@ export default function PostExcerptEditor( {
|
|
|
57
57
|
return document.body.textContent || document.body.innerText || '';
|
|
58
58
|
}, [ renderedExcerpt ] );
|
|
59
59
|
if ( ! postType || ! postId ) {
|
|
60
|
-
return
|
|
60
|
+
return (
|
|
61
|
+
<div { ...blockProps }>
|
|
62
|
+
<p>
|
|
63
|
+
{ __(
|
|
64
|
+
'This is the Post Excerpt block, it will display the excerpt from single posts.'
|
|
65
|
+
) }
|
|
66
|
+
</p>
|
|
67
|
+
<p>
|
|
68
|
+
{ __(
|
|
69
|
+
'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'
|
|
70
|
+
) }
|
|
71
|
+
</p>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
61
74
|
}
|
|
62
75
|
if ( isProtected && ! userCanEdit ) {
|
|
63
76
|
return (
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _i18n = require("@wordpress/i18n");
|
|
13
|
-
|
|
14
|
-
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
15
|
-
|
|
16
|
-
var _coreData = require("@wordpress/core-data");
|
|
17
|
-
|
|
18
|
-
var _components = require("@wordpress/components");
|
|
19
|
-
|
|
20
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
21
|
-
|
|
22
|
-
var _data = require("@wordpress/data");
|
|
23
|
-
|
|
24
|
-
var _innerBlocks = _interopRequireDefault(require("./inner-blocks"));
|
|
25
|
-
|
|
26
|
-
var _placeholderPreview = _interopRequireDefault(require("../navigation/edit/placeholder/placeholder-preview"));
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* WordPress dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal dependencies
|
|
34
|
-
*/
|
|
35
|
-
function NavigationAreaBlock(_ref) {
|
|
36
|
-
let {
|
|
37
|
-
attributes,
|
|
38
|
-
setAttributes
|
|
39
|
-
} = _ref;
|
|
40
|
-
const {
|
|
41
|
-
area
|
|
42
|
-
} = attributes;
|
|
43
|
-
const {
|
|
44
|
-
navigationAreas,
|
|
45
|
-
hasResolvedNavigationAreas
|
|
46
|
-
} = (0, _data.useSelect)(select => {
|
|
47
|
-
const {
|
|
48
|
-
getEntityRecords,
|
|
49
|
-
hasFinishedResolution
|
|
50
|
-
} = select(_coreData.store);
|
|
51
|
-
return {
|
|
52
|
-
navigationAreas: getEntityRecords('root', 'navigationArea'),
|
|
53
|
-
hasResolvedNavigationAreas: hasFinishedResolution('getEntityRecords', ['root', 'navigationArea'])
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
const navigationMenuId = navigationAreas !== null && navigationAreas !== void 0 && navigationAreas.length ? navigationAreas[area] : undefined;
|
|
57
|
-
const choices = (0, _element.useMemo)(() => navigationAreas === null || navigationAreas === void 0 ? void 0 : navigationAreas.map(_ref2 => {
|
|
58
|
-
let {
|
|
59
|
-
name,
|
|
60
|
-
description
|
|
61
|
-
} = _ref2;
|
|
62
|
-
return {
|
|
63
|
-
label: description,
|
|
64
|
-
value: name
|
|
65
|
-
};
|
|
66
|
-
}), [navigationAreas]);
|
|
67
|
-
(0, _deprecated.default)('wp.blockLibrary.NavigationArea', {
|
|
68
|
-
since: '12.0',
|
|
69
|
-
plugin: 'gutenberg'
|
|
70
|
-
});
|
|
71
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarDropdownMenu, {
|
|
72
|
-
label: (0, _i18n.__)('Select Area'),
|
|
73
|
-
text: (0, _i18n.__)('Select Area'),
|
|
74
|
-
icon: null
|
|
75
|
-
}, _ref3 => {
|
|
76
|
-
let {
|
|
77
|
-
onClose
|
|
78
|
-
} = _ref3;
|
|
79
|
-
return (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItemsChoice, {
|
|
80
|
-
value: area,
|
|
81
|
-
onSelect: selectedArea => {
|
|
82
|
-
setAttributes({
|
|
83
|
-
area: selectedArea
|
|
84
|
-
});
|
|
85
|
-
onClose();
|
|
86
|
-
},
|
|
87
|
-
choices: choices
|
|
88
|
-
}));
|
|
89
|
-
}))), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
|
|
90
|
-
title: (0, _i18n.__)('Options')
|
|
91
|
-
}, (0, _element.createElement)(_components.SelectControl, {
|
|
92
|
-
label: (0, _i18n._x)('Area'),
|
|
93
|
-
value: area // `undefined` is required for the preload attribute to be unset.
|
|
94
|
-
,
|
|
95
|
-
onChange: value => setAttributes({
|
|
96
|
-
area: value
|
|
97
|
-
}),
|
|
98
|
-
options: choices
|
|
99
|
-
}))), !hasResolvedNavigationAreas && (0, _element.createElement)(_placeholderPreview.default, {
|
|
100
|
-
isLoading: true
|
|
101
|
-
}), // Render inner blocks only when navigationMenuId is known so
|
|
102
|
-
// that inner blocks template is correct from the start.
|
|
103
|
-
hasResolvedNavigationAreas && (0, _element.createElement)(_innerBlocks.default, {
|
|
104
|
-
navigationMenuId: navigationMenuId
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
var _default = NavigationAreaBlock;
|
|
109
|
-
exports.default = _default;
|
|
110
|
-
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/edit.js"],"names":["NavigationAreaBlock","attributes","setAttributes","area","navigationAreas","hasResolvedNavigationAreas","select","getEntityRecords","hasFinishedResolution","coreStore","navigationMenuId","length","undefined","choices","map","name","description","label","value","since","plugin","onClose","selectedArea"],"mappings":";;;;;;;;;AAcA;;AAXA;;AACA;;AACA;;AACA;;AASA;;AACA;;AAKA;;AACA;;AAtBA;AACA;AACA;;AAgBA;AACA;AACA;AAIA,SAASA,mBAAT,OAA8D;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAAgC;AAC7D,QAAM;AAAEC,IAAAA;AAAF,MAAWF,UAAjB;AAEA,QAAM;AAAEG,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,MAAkD,qBACrDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAA8CF,MAAM,CACzDG,eADyD,CAA1D;AAGA,WAAO;AACNL,MAAAA,eAAe,EAAEG,gBAAgB,CAAE,MAAF,EAAU,gBAAV,CAD3B;AAENF,MAAAA,0BAA0B,EAAEG,qBAAqB,CAChD,kBADgD,EAEhD,CAAE,MAAF,EAAU,gBAAV,CAFgD;AAF3C,KAAP;AAOA,GAZsD,CAAxD;AAcA,QAAME,gBAAgB,GAAGN,eAAe,SAAf,IAAAA,eAAe,WAAf,IAAAA,eAAe,CAAEO,MAAjB,GACtBP,eAAe,CAAED,IAAF,CADO,GAEtBS,SAFH;AAIA,QAAMC,OAAO,GAAG,sBACf,MACCT,eADD,aACCA,eADD,uBACCA,eAAe,CAAEU,GAAjB,CAAsB;AAAA,QAAE;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAF;AAAA,WAA+B;AACpDC,MAAAA,KAAK,EAAED,WAD6C;AAEpDE,MAAAA,KAAK,EAAEH;AAF6C,KAA/B;AAAA,GAAtB,CAFc,EAMf,CAAEX,eAAF,CANe,CAAhB;AASA,2BAAY,gCAAZ,EAA8C;AAC7Ce,IAAAA,KAAK,EAAE,MADsC;AAE7CC,IAAAA,MAAM,EAAE;AAFqC,GAA9C;AAKA,SACC,qDACC,4BAAC,0BAAD,QACC,4BAAC,wBAAD,QACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAG,cAAI,aAAJ,CADT;AAEC,IAAA,IAAI,EAAG,cAAI,aAAJ,CAFR;AAGC,IAAA,IAAI,EAAG;AAHR,KAKG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,qBAAD,QACC,4BAAC,2BAAD;AACC,MAAA,KAAK,EAAGlB,IADT;AAEC,MAAA,QAAQ,EAAKmB,YAAF,IAAoB;AAC9BpB,QAAAA,aAAa,CAAE;AAAEC,UAAAA,IAAI,EAAEmB;AAAR,SAAF,CAAb;AACAD,QAAAA,OAAO;AACP,OALF;AAMC,MAAA,OAAO,EAAGR;AANX,MADD,CADC;AAAA,GALH,CADD,CADD,CADD,EAuBC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,SAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,MAAJ,CADT;AAEC,IAAA,KAAK,EAAGV,IAFT,CAGC;AAHD;AAIC,IAAA,QAAQ,EAAKe,KAAF,IACVhB,aAAa,CAAE;AACdC,MAAAA,IAAI,EAAEe;AADQ,KAAF,CALf;AASC,IAAA,OAAO,EAAGL;AATX,IADD,CADD,CAvBD,EAsCG,CAAER,0BAAF,IAAgC,4BAAC,2BAAD;AAAoB,IAAA,SAAS;AAA7B,IAtCnC,EAwCE;AACA;AACAA,EAAAA,0BAA0B,IACzB,4BAAC,oBAAD;AAAa,IAAA,gBAAgB,EAAGK;AAAhC,IA3CH,CADD;AAiDA;;eAEcV,mB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport deprecated from '@wordpress/deprecated';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tMenuGroup,\n\tMenuItemsChoice,\n\tPanelBody,\n\tSelectControl,\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { BlockControls, InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InnerBlocks from './inner-blocks';\nimport PlaceholderPreview from '../navigation/edit/placeholder/placeholder-preview';\n\nfunction NavigationAreaBlock( { attributes, setAttributes } ) {\n\tconst { area } = attributes;\n\n\tconst { navigationAreas, hasResolvedNavigationAreas } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tnavigationAreas: getEntityRecords( 'root', 'navigationArea' ),\n\t\t\t\thasResolvedNavigationAreas: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'root', 'navigationArea' ]\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t);\n\tconst navigationMenuId = navigationAreas?.length\n\t\t? navigationAreas[ area ]\n\t\t: undefined;\n\n\tconst choices = useMemo(\n\t\t() =>\n\t\t\tnavigationAreas?.map( ( { name, description } ) => ( {\n\t\t\t\tlabel: description,\n\t\t\t\tvalue: name,\n\t\t\t} ) ),\n\t\t[ navigationAreas ]\n\t);\n\n\tdeprecated( 'wp.blockLibrary.NavigationArea', {\n\t\tsince: '12.0',\n\t\tplugin: 'gutenberg',\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\tlabel={ __( 'Select Area' ) }\n\t\t\t\t\t\ttext={ __( 'Select Area' ) }\n\t\t\t\t\t\ticon={ null }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\t\t\t\tonSelect={ ( selectedArea ) => {\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { area: selectedArea } );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Options' ) }>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ _x( 'Area' ) }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ choices }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! hasResolvedNavigationAreas && <PlaceholderPreview isLoading /> }\n\t\t\t{\n\t\t\t\t// Render inner blocks only when navigationMenuId is known so\n\t\t\t\t// that inner blocks template is correct from the start.\n\t\t\t\thasResolvedNavigationAreas && (\n\t\t\t\t\t<InnerBlocks navigationMenuId={ navigationMenuId } />\n\t\t\t\t)\n\t\t\t}\n\t\t</>\n\t);\n}\n\nexport default NavigationAreaBlock;\n"]}
|