@wordpress/block-library 8.1.0 → 8.2.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.
Files changed (168) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/archives/edit.js +1 -0
  4. package/build/archives/edit.js.map +1 -1
  5. package/build/audio/edit.js +2 -0
  6. package/build/audio/edit.js.map +1 -1
  7. package/build/comments/edit/comments-inspector-controls.js +9 -3
  8. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  9. package/build/embed/embed-preview.js +1 -0
  10. package/build/embed/embed-preview.js.map +1 -1
  11. package/build/file/inspector.js +1 -0
  12. package/build/file/inspector.js.map +1 -1
  13. package/build/gallery/edit.js +2 -0
  14. package/build/gallery/edit.js.map +1 -1
  15. package/build/gallery/gallery.js +1 -0
  16. package/build/gallery/gallery.js.map +1 -1
  17. package/build/gallery/v1/edit.js +2 -0
  18. package/build/gallery/v1/edit.js.map +1 -1
  19. package/build/group/edit.js +1 -0
  20. package/build/group/edit.js.map +1 -1
  21. package/build/group/index.js +3 -0
  22. package/build/group/index.js.map +1 -1
  23. package/build/image/image.js +6 -10
  24. package/build/image/image.js.map +1 -1
  25. package/build/latest-posts/edit.js +11 -8
  26. package/build/latest-posts/edit.js.map +1 -1
  27. package/build/navigation/edit/index.js +6 -3
  28. package/build/navigation/edit/index.js.map +1 -1
  29. package/build/navigation/edit/menu-inspector-controls.js +64 -27
  30. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  31. package/build/navigation/edit/navigation-menu-selector.js +4 -2
  32. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  33. package/build/navigation/leaf-more-menu.js +95 -0
  34. package/build/navigation/leaf-more-menu.js.map +1 -0
  35. package/build/navigation-link/edit.js +6 -3
  36. package/build/navigation-link/edit.js.map +1 -1
  37. package/build/navigation-link/update-attributes.js +3 -3
  38. package/build/navigation-link/update-attributes.js.map +1 -1
  39. package/build/page-list-item/index.js +2 -1
  40. package/build/page-list-item/index.js.map +1 -1
  41. package/build/post-author/edit.js +2 -0
  42. package/build/post-author/edit.js.map +1 -1
  43. package/build/post-featured-image/dimension-controls.js +1 -0
  44. package/build/post-featured-image/dimension-controls.js.map +1 -1
  45. package/build/query/edit/inspector-controls/index.js +1 -0
  46. package/build/query/edit/inspector-controls/index.js.map +1 -1
  47. package/build/query/edit/inspector-controls/order-control.js +1 -0
  48. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  49. package/build/query/edit/inspector-controls/sticky-control.js +1 -0
  50. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
  51. package/build/query/edit/query-content.js +8 -1
  52. package/build/query/edit/query-content.js.map +1 -1
  53. package/build/social-link/edit.js +2 -1
  54. package/build/social-link/edit.js.map +1 -1
  55. package/build/table/edit.js +1 -0
  56. package/build/table/edit.js.map +1 -1
  57. package/build/tag-cloud/edit.js +1 -0
  58. package/build/tag-cloud/edit.js.map +1 -1
  59. package/build/template-part/edit/advanced-controls.js +12 -1
  60. package/build/template-part/edit/advanced-controls.js.map +1 -1
  61. package/build/video/edit-common-settings.js +6 -5
  62. package/build/video/edit-common-settings.js.map +1 -1
  63. package/build/video/edit.js +1 -0
  64. package/build/video/edit.js.map +1 -1
  65. package/build/video/tracks-editor.js +1 -0
  66. package/build/video/tracks-editor.js.map +1 -1
  67. package/build-module/archives/edit.js +1 -0
  68. package/build-module/archives/edit.js.map +1 -1
  69. package/build-module/audio/edit.js +2 -0
  70. package/build-module/audio/edit.js.map +1 -1
  71. package/build-module/comments/edit/comments-inspector-controls.js +9 -3
  72. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  73. package/build-module/embed/embed-preview.js +1 -0
  74. package/build-module/embed/embed-preview.js.map +1 -1
  75. package/build-module/file/inspector.js +1 -0
  76. package/build-module/file/inspector.js.map +1 -1
  77. package/build-module/gallery/edit.js +2 -0
  78. package/build-module/gallery/edit.js.map +1 -1
  79. package/build-module/gallery/gallery.js +1 -0
  80. package/build-module/gallery/gallery.js.map +1 -1
  81. package/build-module/gallery/v1/edit.js +2 -0
  82. package/build-module/gallery/v1/edit.js.map +1 -1
  83. package/build-module/group/edit.js +1 -0
  84. package/build-module/group/edit.js.map +1 -1
  85. package/build-module/group/index.js +3 -0
  86. package/build-module/group/index.js.map +1 -1
  87. package/build-module/image/image.js +6 -10
  88. package/build-module/image/image.js.map +1 -1
  89. package/build-module/latest-posts/edit.js +12 -9
  90. package/build-module/latest-posts/edit.js.map +1 -1
  91. package/build-module/navigation/edit/index.js +6 -3
  92. package/build-module/navigation/edit/index.js.map +1 -1
  93. package/build-module/navigation/edit/menu-inspector-controls.js +63 -29
  94. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  95. package/build-module/navigation/edit/navigation-menu-selector.js +4 -2
  96. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  97. package/build-module/navigation/leaf-more-menu.js +76 -0
  98. package/build-module/navigation/leaf-more-menu.js.map +1 -0
  99. package/build-module/navigation-link/edit.js +6 -3
  100. package/build-module/navigation-link/edit.js.map +1 -1
  101. package/build-module/navigation-link/update-attributes.js +3 -3
  102. package/build-module/navigation-link/update-attributes.js.map +1 -1
  103. package/build-module/page-list-item/index.js +2 -1
  104. package/build-module/page-list-item/index.js.map +1 -1
  105. package/build-module/post-author/edit.js +2 -0
  106. package/build-module/post-author/edit.js.map +1 -1
  107. package/build-module/post-featured-image/dimension-controls.js +1 -0
  108. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  109. package/build-module/query/edit/inspector-controls/index.js +1 -0
  110. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  111. package/build-module/query/edit/inspector-controls/order-control.js +1 -0
  112. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  113. package/build-module/query/edit/inspector-controls/sticky-control.js +1 -0
  114. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
  115. package/build-module/query/edit/query-content.js +8 -1
  116. package/build-module/query/edit/query-content.js.map +1 -1
  117. package/build-module/social-link/edit.js +2 -1
  118. package/build-module/social-link/edit.js.map +1 -1
  119. package/build-module/table/edit.js +1 -0
  120. package/build-module/table/edit.js.map +1 -1
  121. package/build-module/tag-cloud/edit.js +1 -0
  122. package/build-module/tag-cloud/edit.js.map +1 -1
  123. package/build-module/template-part/edit/advanced-controls.js +12 -1
  124. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  125. package/build-module/video/edit-common-settings.js +6 -5
  126. package/build-module/video/edit-common-settings.js.map +1 -1
  127. package/build-module/video/edit.js +1 -0
  128. package/build-module/video/edit.js.map +1 -1
  129. package/build-module/video/tracks-editor.js +1 -0
  130. package/build-module/video/tracks-editor.js.map +1 -1
  131. package/package.json +29 -29
  132. package/src/archives/edit.js +1 -0
  133. package/src/audio/edit.js +2 -0
  134. package/src/comments/edit/comments-inspector-controls.js +12 -2
  135. package/src/embed/embed-preview.js +1 -0
  136. package/src/file/inspector.js +1 -0
  137. package/src/gallery/edit.js +2 -0
  138. package/src/gallery/gallery.js +1 -0
  139. package/src/gallery/v1/edit.js +2 -0
  140. package/src/group/block.json +3 -0
  141. package/src/group/edit.js +1 -0
  142. package/src/image/image.js +26 -36
  143. package/src/latest-posts/edit.js +6 -7
  144. package/src/navigation/edit/index.js +3 -0
  145. package/src/navigation/edit/menu-inspector-controls.js +98 -68
  146. package/src/navigation/edit/navigation-menu-selector.js +5 -2
  147. package/src/navigation/leaf-more-menu.js +93 -0
  148. package/src/navigation-link/edit.js +18 -7
  149. package/src/navigation-link/index.php +30 -3
  150. package/src/navigation-link/update-attributes.js +1 -1
  151. package/src/navigation-submenu/index.php +2 -2
  152. package/src/page-list/index.php +5 -0
  153. package/src/page-list-item/block.json +2 -1
  154. package/src/post-author/edit.js +2 -0
  155. package/src/post-featured-image/dimension-controls.js +1 -0
  156. package/src/query/edit/inspector-controls/index.js +1 -0
  157. package/src/query/edit/inspector-controls/order-control.js +1 -0
  158. package/src/query/edit/inspector-controls/sticky-control.js +1 -0
  159. package/src/query/edit/query-content.js +13 -0
  160. package/src/rss/index.php +1 -1
  161. package/src/social-link/edit.js +2 -1
  162. package/src/table/edit.js +1 -0
  163. package/src/tag-cloud/edit.js +1 -0
  164. package/src/template-part/edit/advanced-controls.js +24 -0
  165. package/src/video/edit-common-settings.js +6 -5
  166. package/src/video/edit.js +1 -0
  167. package/src/video/tracks-editor.js +1 -0
  168. package/tsconfig.tsbuildinfo +1 -1
@@ -727,6 +727,7 @@ function Navigation( {
727
727
  onCreateNew={ createUntitledEmptyNavigationMenu }
728
728
  onSelectClassicMenu={ onSelectClassicMenu }
729
729
  onSelectNavigationMenu={ onSelectNavigationMenu }
730
+ isLoading={ isLoading }
730
731
  />
731
732
  { stylingInspectorControls }
732
733
  <ResponsiveWrapper
@@ -768,6 +769,7 @@ function Navigation( {
768
769
  onCreateNew={ createUntitledEmptyNavigationMenu }
769
770
  onSelectClassicMenu={ onSelectClassicMenu }
770
771
  onSelectNavigationMenu={ onSelectNavigationMenu }
772
+ isLoading={ isLoading }
771
773
  />
772
774
  <Warning>
773
775
  { __(
@@ -842,6 +844,7 @@ function Navigation( {
842
844
  onCreateNew={ createUntitledEmptyNavigationMenu }
843
845
  onSelectClassicMenu={ onSelectClassicMenu }
844
846
  onSelectNavigationMenu={ onSelectNavigationMenu }
847
+ isLoading={ isLoading }
845
848
  />
846
849
  { stylingInspectorControls }
847
850
  { isEntityAvailable && (
@@ -10,6 +10,7 @@ import {
10
10
  PanelBody,
11
11
  __experimentalHStack as HStack,
12
12
  __experimentalHeading as Heading,
13
+ Spinner,
13
14
  } from '@wordpress/components';
14
15
  import { useSelect } from '@wordpress/data';
15
16
  import { __ } from '@wordpress/i18n';
@@ -19,26 +20,17 @@ import { __ } from '@wordpress/i18n';
19
20
  */
20
21
  import ManageMenusButton from './manage-menus-button';
21
22
  import NavigationMenuSelector from './navigation-menu-selector';
23
+ import { LeafMoreMenu } from '../leaf-more-menu';
22
24
 
23
- const MenuInspectorControls = ( {
25
+ /* translators: %s: The name of a menu. */
26
+ const actionLabel = __( "Switch to '%s'" );
27
+
28
+ const ExperimentMainContent = ( {
24
29
  clientId,
25
- createNavigationMenuIsSuccess,
26
- createNavigationMenuIsError,
27
- currentMenuId = null,
30
+ currentMenuId,
31
+ isLoading,
28
32
  isNavigationMenuMissing,
29
- isManageMenusButtonDisabled,
30
- onCreateNew,
31
- onSelectClassicMenu,
32
- onSelectNavigationMenu,
33
33
  } ) => {
34
- const isOffCanvasNavigationEditorEnabled =
35
- window?.__experimentalEnableOffCanvasNavigationEditor === true;
36
- const menuControlsSlot = window?.__experimentalEnableBlockInspectorTabs
37
- ? 'list'
38
- : undefined;
39
- /* translators: %s: The name of a menu. */
40
- const actionLabel = __( "Switch to '%s'" );
41
-
42
34
  // Provide a hierarchy of clientIds for the given Navigation block (clientId).
43
35
  // This is required else the list view will display the entire block tree.
44
36
  const clientIdsTree = useSelect(
@@ -49,6 +41,94 @@ const MenuInspectorControls = ( {
49
41
  [ clientId ]
50
42
  );
51
43
 
44
+ if ( currentMenuId && isNavigationMenuMissing ) {
45
+ return <p>{ __( 'Select or create a menu' ) }</p>;
46
+ }
47
+
48
+ if ( isLoading ) {
49
+ return <Spinner />;
50
+ }
51
+
52
+ return (
53
+ <OffCanvasEditor
54
+ blocks={ clientIdsTree }
55
+ isExpanded={ true }
56
+ selectBlockInCanvas={ false }
57
+ LeafMoreMenu={ LeafMoreMenu }
58
+ />
59
+ );
60
+ };
61
+
62
+ const ExperimentControls = ( props ) => {
63
+ const {
64
+ createNavigationMenuIsSuccess,
65
+ createNavigationMenuIsError,
66
+ currentMenuId = null,
67
+ onCreateNew,
68
+ onSelectClassicMenu,
69
+ onSelectNavigationMenu,
70
+ } = props;
71
+
72
+ return (
73
+ <>
74
+ <HStack className="wp-block-navigation-off-canvas-editor__header">
75
+ <Heading
76
+ className="wp-block-navigation-off-canvas-editor__title"
77
+ level={ 2 }
78
+ >
79
+ { __( 'Menu' ) }
80
+ </Heading>
81
+ <NavigationMenuSelector
82
+ currentMenuId={ currentMenuId }
83
+ onSelectClassicMenu={ onSelectClassicMenu }
84
+ onSelectNavigationMenu={ onSelectNavigationMenu }
85
+ onCreateNew={ onCreateNew }
86
+ createNavigationMenuIsSuccess={
87
+ createNavigationMenuIsSuccess
88
+ }
89
+ createNavigationMenuIsError={ createNavigationMenuIsError }
90
+ actionLabel={ actionLabel }
91
+ />
92
+ </HStack>
93
+ <ExperimentMainContent { ...props } />
94
+ </>
95
+ );
96
+ };
97
+
98
+ const DefaultControls = ( props ) => {
99
+ const {
100
+ createNavigationMenuIsSuccess,
101
+ createNavigationMenuIsError,
102
+ currentMenuId = null,
103
+ isManageMenusButtonDisabled,
104
+ onCreateNew,
105
+ onSelectClassicMenu,
106
+ onSelectNavigationMenu,
107
+ } = props;
108
+
109
+ return (
110
+ <>
111
+ <NavigationMenuSelector
112
+ currentMenuId={ currentMenuId }
113
+ onSelectClassicMenu={ onSelectClassicMenu }
114
+ onSelectNavigationMenu={ onSelectNavigationMenu }
115
+ onCreateNew={ onCreateNew }
116
+ createNavigationMenuIsSuccess={ createNavigationMenuIsSuccess }
117
+ createNavigationMenuIsError={ createNavigationMenuIsError }
118
+ actionLabel={ actionLabel }
119
+ />
120
+ <ManageMenusButton disabled={ isManageMenusButtonDisabled } />
121
+ </>
122
+ );
123
+ };
124
+
125
+ const MenuInspectorControls = ( props ) => {
126
+ const isOffCanvasNavigationEditorEnabled =
127
+ window?.__experimentalEnableOffCanvasNavigationEditor === true;
128
+ const menuControlsSlot = isOffCanvasNavigationEditorEnabled
129
+ ? 'list'
130
+ : undefined;
131
+
52
132
  return (
53
133
  <InspectorControls __experimentalGroup={ menuControlsSlot }>
54
134
  <PanelBody
@@ -57,59 +137,9 @@ const MenuInspectorControls = ( {
57
137
  }
58
138
  >
59
139
  { isOffCanvasNavigationEditorEnabled ? (
60
- <>
61
- <HStack className="wp-block-navigation-off-canvas-editor__header">
62
- <Heading
63
- className="wp-block-navigation-off-canvas-editor__title"
64
- level={ 2 }
65
- >
66
- { __( 'Menu' ) }
67
- </Heading>
68
- <NavigationMenuSelector
69
- currentMenuId={ currentMenuId }
70
- onSelectClassicMenu={ onSelectClassicMenu }
71
- onSelectNavigationMenu={
72
- onSelectNavigationMenu
73
- }
74
- onCreateNew={ onCreateNew }
75
- createNavigationMenuIsSuccess={
76
- createNavigationMenuIsSuccess
77
- }
78
- createNavigationMenuIsError={
79
- createNavigationMenuIsError
80
- }
81
- actionLabel={ actionLabel }
82
- />
83
- </HStack>
84
- { currentMenuId && isNavigationMenuMissing ? (
85
- <p>{ __( 'Select or create a menu' ) }</p>
86
- ) : (
87
- <OffCanvasEditor
88
- blocks={ clientIdsTree }
89
- isExpanded={ true }
90
- selectBlockInCanvas={ false }
91
- />
92
- ) }
93
- </>
140
+ <ExperimentControls { ...props } />
94
141
  ) : (
95
- <>
96
- <NavigationMenuSelector
97
- currentMenuId={ currentMenuId }
98
- onSelectClassicMenu={ onSelectClassicMenu }
99
- onSelectNavigationMenu={ onSelectNavigationMenu }
100
- onCreateNew={ onCreateNew }
101
- createNavigationMenuIsSuccess={
102
- createNavigationMenuIsSuccess
103
- }
104
- createNavigationMenuIsError={
105
- createNavigationMenuIsError
106
- }
107
- actionLabel={ actionLabel }
108
- />
109
- <ManageMenusButton
110
- disabled={ isManageMenusButtonDisabled }
111
- />
112
- </>
142
+ <DefaultControls { ...props } />
113
143
  ) }
114
144
  </PanelBody>
115
145
  </InspectorControls>
@@ -69,7 +69,10 @@ function NavigationMenuSelector( {
69
69
  navigationMenus?.map( ( { id, title } ) => {
70
70
  const label = decodeEntities( title.rendered );
71
71
  if ( id === currentMenuId && ! isCreatingMenu ) {
72
- setSelectorLabel( currentTitle );
72
+ setSelectorLabel(
73
+ /* translators: %s is the name of a navigation menu. */
74
+ sprintf( __( 'You are currently editing %s' ), label )
75
+ );
73
76
  setEnableOptions( shouldEnableMenuSelector );
74
77
  }
75
78
  return {
@@ -102,7 +105,7 @@ function NavigationMenuSelector( {
102
105
  if ( ! hasResolvedNavigationMenus ) {
103
106
  setSelectorLabel( __( 'Loading …' ) );
104
107
  } else if ( noMenuSelected || noBlockMenus || menuUnavailable ) {
105
- setSelectorLabel( __( 'Select menu' ) );
108
+ setSelectorLabel( __( 'Choose a Navigation menu' ) );
106
109
  setEnableOptions( shouldEnableMenuSelector );
107
110
  }
108
111
 
@@ -0,0 +1,93 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createBlock } from '@wordpress/blocks';
5
+ import { addSubmenu, moreVertical } from '@wordpress/icons';
6
+ import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
7
+ import { useDispatch } from '@wordpress/data';
8
+ import { store as blockEditorStore, BlockTitle } from '@wordpress/block-editor';
9
+ import { __, sprintf } from '@wordpress/i18n';
10
+
11
+ const POPOVER_PROPS = {
12
+ className: 'block-editor-block-settings-menu__popover',
13
+ position: 'bottom right',
14
+ variant: 'toolbar',
15
+ };
16
+
17
+ export const LeafMoreMenu = ( props ) => {
18
+ const { clientId, block } = props;
19
+
20
+ const { insertBlock, replaceBlock, removeBlocks, replaceInnerBlocks } =
21
+ useDispatch( blockEditorStore );
22
+
23
+ const label = sprintf(
24
+ /* translators: %s: block name */
25
+ __( 'Remove %s' ),
26
+ BlockTitle( { clientId, maximumLength: 25 } )
27
+ );
28
+
29
+ return (
30
+ <DropdownMenu
31
+ icon={ moreVertical }
32
+ label={ __( 'Options' ) }
33
+ className="block-editor-block-settings-menu"
34
+ popoverProps={ POPOVER_PROPS }
35
+ noIcons
36
+ { ...props }
37
+ >
38
+ { ( { onClose } ) => (
39
+ <MenuGroup>
40
+ <MenuItem
41
+ icon={ addSubmenu }
42
+ onClick={ () => {
43
+ const updateSelectionOnInsert = false;
44
+ const newLink = createBlock(
45
+ 'core/navigation-link'
46
+ );
47
+ if ( block.name === 'core/navigation-submenu' ) {
48
+ insertBlock(
49
+ newLink,
50
+ block.innerBlocks.length,
51
+ clientId,
52
+ updateSelectionOnInsert
53
+ );
54
+ } else {
55
+ // Convert to a submenu if the block currently isn't one.
56
+ const newSubmenu = createBlock(
57
+ 'core/navigation-submenu',
58
+ block.attributes,
59
+ block.innerBlocks
60
+ );
61
+
62
+ // The following must happen as two independent actions.
63
+ // Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds
64
+ // selector to determine which block is "active". As the UX needs the newLink to be
65
+ // the "active" block it must be the last block to be inserted.
66
+ // Therefore the Submenu is first created and **then** the newLink is inserted
67
+ // thus ensuring it is the last inserted block.
68
+ replaceBlock( clientId, newSubmenu );
69
+
70
+ replaceInnerBlocks(
71
+ newSubmenu.clientId,
72
+ [ newLink ],
73
+ updateSelectionOnInsert
74
+ );
75
+ }
76
+ onClose();
77
+ } }
78
+ >
79
+ { __( 'Add submenu item' ) }
80
+ </MenuItem>
81
+ <MenuItem
82
+ onClick={ () => {
83
+ removeBlocks( [ clientId ], false );
84
+ onClose();
85
+ } }
86
+ >
87
+ { label }
88
+ </MenuItem>
89
+ </MenuGroup>
90
+ ) }
91
+ </DropdownMenu>
92
+ );
93
+ };
@@ -375,12 +375,19 @@ export default function NavigationLinkEdit( {
375
375
  const DEFAULT_BLOCK = {
376
376
  name: 'core/navigation-link',
377
377
  };
378
- const innerBlocksProps = useInnerBlocksProps( blockProps, {
379
- allowedBlocks: ALLOWED_BLOCKS,
380
- __experimentalDefaultBlock: DEFAULT_BLOCK,
381
- __experimentalDirectInsert: true,
382
- renderAppender: false,
383
- } );
378
+
379
+ const innerBlocksProps = useInnerBlocksProps(
380
+ {
381
+ ...blockProps,
382
+ className: 'remove-outline', // Remove the outline from the inner blocks container.
383
+ },
384
+ {
385
+ allowedBlocks: ALLOWED_BLOCKS,
386
+ __experimentalDefaultBlock: DEFAULT_BLOCK,
387
+ __experimentalDirectInsert: true,
388
+ renderAppender: false,
389
+ }
390
+ );
384
391
 
385
392
  if ( ! url || isInvalid || isDraft ) {
386
393
  blockProps.onClick = () => setIsLinkOpen( true );
@@ -435,7 +442,11 @@ export default function NavigationLinkEdit( {
435
442
  <TextControl
436
443
  value={ url || '' }
437
444
  onChange={ ( urlValue ) => {
438
- setAttributes( { url: urlValue } );
445
+ updateAttributes(
446
+ { url: urlValue },
447
+ setAttributes,
448
+ attributes
449
+ );
439
450
  } }
440
451
  label={ __( 'URL' ) }
441
452
  autoComplete="off"
@@ -120,6 +120,33 @@ function block_core_navigation_link_render_submenu_icon() {
120
120
  return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>';
121
121
  }
122
122
 
123
+ /**
124
+ * Decodes a url if it's encoded, returning the same url if not.
125
+ *
126
+ * @param string $url The url to decode.
127
+ *
128
+ * @return string $url Returns the decoded url.
129
+ */
130
+ function block_core_navigation_link_maybe_urldecode( $url ) {
131
+ $is_url_encoded = false;
132
+ $query = parse_url( $url, PHP_URL_QUERY );
133
+ $query_params = wp_parse_args( $query );
134
+
135
+ foreach ( $query_params as $query_param ) {
136
+ if ( rawurldecode( $query_param ) !== $query_param ) {
137
+ $is_url_encoded = true;
138
+ break;
139
+ }
140
+ }
141
+
142
+ if ( $is_url_encoded ) {
143
+ return rawurldecode( $url );
144
+ }
145
+
146
+ return $url;
147
+ }
148
+
149
+
123
150
  /**
124
151
  * Renders the `core/navigation-link` block.
125
152
  *
@@ -171,7 +198,7 @@ function render_block_core_navigation_link( $attributes, $content, $block ) {
171
198
 
172
199
  // Start appending HTML attributes to anchor tag.
173
200
  if ( isset( $attributes['url'] ) ) {
174
- $html .= ' href="' . esc_url( $attributes['url'] ) . '"';
201
+ $html .= ' href="' . esc_url( block_core_navigation_link_maybe_urldecode( $attributes['url'] ) ) . '"';
175
202
  }
176
203
 
177
204
  if ( $is_active ) {
@@ -363,11 +390,11 @@ add_action( 'init', 'register_block_core_navigation_link' );
363
390
  function gutenberg_disable_tabs_for_navigation_link_block( $settings ) {
364
391
  $current_tab_settings = _wp_array_get(
365
392
  $settings,
366
- array( '__experimentalBlockInspectorTabs' ),
393
+ array( 'blockInspectorTabs' ),
367
394
  array()
368
395
  );
369
396
 
370
- $settings['__experimentalBlockInspectorTabs'] = array_merge(
397
+ $settings['blockInspectorTabs'] = array_merge(
371
398
  $current_tab_settings,
372
399
  array( 'core/navigation-link' => false )
373
400
  );
@@ -89,7 +89,7 @@ export const updateAttributes = (
89
89
 
90
90
  setAttributes( {
91
91
  // Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.
92
- ...( newUrl && { url: encodeURI( safeDecodeURI( newUrl ) ) } ),
92
+ ...{ url: newUrl ? encodeURI( safeDecodeURI( newUrl ) ) : newUrl },
93
93
  ...( label && { label } ),
94
94
  ...( undefined !== opensInNewTab && { opensInNewTab } ),
95
95
  ...( id && Number.isInteger( id ) && { id } ),
@@ -308,11 +308,11 @@ add_action( 'init', 'register_block_core_navigation_submenu' );
308
308
  function gutenberg_disable_tabs_for_navigation_submenu_block( $settings ) {
309
309
  $current_tab_settings = _wp_array_get(
310
310
  $settings,
311
- array( '__experimentalBlockInspectorTabs' ),
311
+ array( 'blockInspectorTabs' ),
312
312
  array()
313
313
  );
314
314
 
315
- $settings['__experimentalBlockInspectorTabs'] = array_merge(
315
+ $settings['blockInspectorTabs'] = array_merge(
316
316
  $current_tab_settings,
317
317
  array( 'core/navigation-submenu' => false )
318
318
  );
@@ -308,6 +308,11 @@ function render_block_core_page_list( $attributes, $content, $block ) {
308
308
  $nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
309
309
 
310
310
  if ( 0 !== $parent_page_id ) {
311
+ // If the parent page has no child pages, there is nothing to show.
312
+ if ( ! array_key_exists( $parent_page_id, $pages_with_children ) ) {
313
+ return;
314
+ }
315
+
311
316
  $nested_pages = block_core_page_list_nest_pages(
312
317
  $pages_with_children[ $parent_page_id ],
313
318
  $pages_with_children
@@ -44,7 +44,8 @@
44
44
  "reusable": false,
45
45
  "html": false,
46
46
  "lock": false,
47
- "inserter": false
47
+ "inserter": false,
48
+ "__experimentalToolbar": false
48
49
  },
49
50
  "editorStyle": "wp-block-page-list-editor",
50
51
  "style": "wp-block-page-list"
@@ -112,6 +112,7 @@ function PostAuthorEdit( {
112
112
  />
113
113
  ) ) || (
114
114
  <SelectControl
115
+ __nextHasNoMarginBottom
115
116
  label={ __( 'Author' ) }
116
117
  value={ authorId }
117
118
  options={ authorOptions }
@@ -127,6 +128,7 @@ function PostAuthorEdit( {
127
128
  />
128
129
  { showAvatar && (
129
130
  <SelectControl
131
+ __nextHasNoMarginBottom
130
132
  label={ __( 'Avatar size' ) }
131
133
  value={ attributes.avatarSize }
132
134
  options={ avatarSizes }
@@ -160,6 +160,7 @@ const DimensionControls = ( {
160
160
  panelId={ clientId }
161
161
  >
162
162
  <SelectControl
163
+ __nextHasNoMarginBottom
163
164
  label={ __( 'Image size' ) }
164
165
  value={ sizeSlug || DEFAULT_SIZE }
165
166
  options={ imageSizeOptions }
@@ -144,6 +144,7 @@ export default function QueryInspectorControls( {
144
144
  ) }
145
145
  { showPostTypeControl && (
146
146
  <SelectControl
147
+ __nextHasNoMarginBottom
147
148
  options={ postTypesSelectOptions }
148
149
  value={ postType }
149
150
  label={ __( 'Post type' ) }
@@ -27,6 +27,7 @@ const orderOptions = [
27
27
  function OrderControl( { order, orderBy, onChange } ) {
28
28
  return (
29
29
  <SelectControl
30
+ __nextHasNoMarginBottom
30
31
  label={ __( 'Order by' ) }
31
32
  value={ `${ orderBy }/${ order }` }
32
33
  options={ orderOptions }
@@ -13,6 +13,7 @@ const stickyOptions = [
13
13
  export default function StickyControl( { value, onChange } ) {
14
14
  return (
15
15
  <SelectControl
16
+ __nextHasNoMarginBottom
16
17
  label={ __( 'Sticky posts' ) }
17
18
  options={ stickyOptions }
18
19
  value={ value }
@@ -94,6 +94,17 @@ export default function QueryContent( {
94
94
  setAttributes( {
95
95
  displayLayout: { ...displayLayout, ...newDisplayLayout },
96
96
  } );
97
+ const htmlElementMessages = {
98
+ main: __(
99
+ 'The <main> element should be used for the primary content of your document only. '
100
+ ),
101
+ section: __(
102
+ "The <section> element should represent a standalone portion of the document that can't be better represented by another element."
103
+ ),
104
+ aside: __(
105
+ "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
106
+ ),
107
+ };
97
108
  return (
98
109
  <>
99
110
  <QueryInspectorControls
@@ -113,6 +124,7 @@ export default function QueryContent( {
113
124
  </BlockControls>
114
125
  <InspectorControls __experimentalGroup="advanced">
115
126
  <SelectControl
127
+ __nextHasNoMarginBottom
116
128
  label={ __( 'HTML element' ) }
117
129
  options={ [
118
130
  { label: __( 'Default (<div>)' ), value: 'div' },
@@ -124,6 +136,7 @@ export default function QueryContent( {
124
136
  onChange={ ( value ) =>
125
137
  setAttributes( { tagName: value } )
126
138
  }
139
+ help={ htmlElementMessages[ TagName ] }
127
140
  />
128
141
  </InspectorControls>
129
142
  <TagName { ...innerBlocksProps } />
package/src/rss/index.php CHANGED
@@ -48,7 +48,7 @@ function render_block_core_rss( $attributes ) {
48
48
  if ( $date ) {
49
49
  $date = sprintf(
50
50
  '<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ',
51
- esc_attr( date_i18n( get_option( 'c' ), $date ) ),
51
+ esc_attr( date_i18n( 'c', $date ) ),
52
52
  esc_attr( date_i18n( get_option( 'date_format' ), $date ) )
53
53
  );
54
54
  }
@@ -43,6 +43,7 @@ const SocialLinkURLPopover = ( {
43
43
  >
44
44
  <div className="block-editor-url-input">
45
45
  <URLInput
46
+ __nextHasNoMarginBottom
46
47
  value={ url }
47
48
  onChange={ ( nextURL ) =>
48
49
  setAttributes( { url: nextURL } )
@@ -105,7 +106,7 @@ const SocialLinkEdit = ( {
105
106
  help={ __(
106
107
  'Briefly describe the link to help screen reader users.'
107
108
  ) }
108
- value={ label }
109
+ value={ label || '' }
109
110
  onChange={ ( value ) =>
110
111
  setAttributes( { label: value } )
111
112
  }
package/src/table/edit.js CHANGED
@@ -510,6 +510,7 @@ function TableEdit( {
510
510
  ) }
511
511
  { ! isEmpty && (
512
512
  <RichText
513
+ identifier="caption"
513
514
  tagName="figcaption"
514
515
  className={ __experimentalGetElementClassName( 'caption' ) }
515
516
  aria-label={ __( 'Table caption text' ) }
@@ -109,6 +109,7 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
109
109
  <InspectorControls>
110
110
  <PanelBody title={ __( 'Settings' ) }>
111
111
  <SelectControl
112
+ __nextHasNoMarginBottom
112
113
  label={ __( 'Taxonomy' ) }
113
114
  options={ getTaxonomyOptions() }
114
115
  value={ taxonomy }
@@ -49,6 +49,27 @@ export function TemplatePartAdvancedControls( {
49
49
  };
50
50
  }, [] );
51
51
 
52
+ const htmlElementMessages = {
53
+ header: __(
54
+ 'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'
55
+ ),
56
+ main: __(
57
+ 'The <main> element should be used for the primary content of your document only. '
58
+ ),
59
+ section: __(
60
+ "The <section> element should represent a standalone portion of the document that can't be better represented by another element."
61
+ ),
62
+ article: __(
63
+ 'The <article> element should represent a self-contained, syndicatable portion of the document.'
64
+ ),
65
+ aside: __(
66
+ "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
67
+ ),
68
+ footer: __(
69
+ 'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'
70
+ ),
71
+ };
72
+
52
73
  return (
53
74
  <InspectorControls __experimentalGroup="advanced">
54
75
  { isEntityAvailable && (
@@ -63,6 +84,7 @@ export function TemplatePartAdvancedControls( {
63
84
  />
64
85
 
65
86
  <SelectControl
87
+ __nextHasNoMarginBottom
66
88
  label={ __( 'Area' ) }
67
89
  labelPosition="top"
68
90
  options={ areaOptions }
@@ -72,6 +94,7 @@ export function TemplatePartAdvancedControls( {
72
94
  </>
73
95
  ) }
74
96
  <SelectControl
97
+ __nextHasNoMarginBottom
75
98
  label={ __( 'HTML element' ) }
76
99
  options={ [
77
100
  {
@@ -92,6 +115,7 @@ export function TemplatePartAdvancedControls( {
92
115
  ] }
93
116
  value={ tagName || '' }
94
117
  onChange={ ( value ) => setAttributes( { tagName: value } ) }
118
+ help={ htmlElementMessages[ tagName ] }
95
119
  />
96
120
  { ! hasInnerBlocks && (
97
121
  <TemplatePartImportControls