@wordpress/edit-site 5.5.0 → 5.6.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 (224) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +16 -10
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/app/index.js +4 -2
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/block-editor/editor-canvas.js +2 -1
  7. package/build/components/block-editor/editor-canvas.js.map +1 -1
  8. package/build/components/editor/index.js +2 -4
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/border-panel.js +20 -159
  11. package/build/components/global-styles/border-panel.js.map +1 -1
  12. package/build/components/global-styles/context-menu.js +2 -3
  13. package/build/components/global-styles/context-menu.js.map +1 -1
  14. package/build/components/global-styles/hooks.js +11 -26
  15. package/build/components/global-styles/hooks.js.map +1 -1
  16. package/build/components/global-styles/screen-block-list.js +2 -3
  17. package/build/components/global-styles/screen-block-list.js.map +1 -1
  18. package/build/components/global-styles/screen-border.js +13 -5
  19. package/build/components/global-styles/screen-border.js.map +1 -1
  20. package/build/components/global-styles/screen-root.js +2 -1
  21. package/build/components/global-styles/screen-root.js.map +1 -1
  22. package/build/components/global-styles/screen-style-variations.js +2 -1
  23. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  24. package/build/components/layout/index.js +7 -0
  25. package/build/components/layout/index.js.map +1 -1
  26. package/build/components/list/added-by.js +128 -136
  27. package/build/components/list/added-by.js.map +1 -1
  28. package/build/components/list/index.js +2 -1
  29. package/build/components/list/index.js.map +1 -1
  30. package/build/components/list/table.js +6 -5
  31. package/build/components/list/table.js.map +1 -1
  32. package/build/components/routes/link.js +4 -1
  33. package/build/components/routes/link.js.map +1 -1
  34. package/build/components/save-button/index.js +2 -5
  35. package/build/components/save-button/index.js.map +1 -1
  36. package/build/components/save-hub/index.js +82 -0
  37. package/build/components/save-hub/index.js.map +1 -0
  38. package/build/components/sidebar/index.js +2 -4
  39. package/build/components/sidebar/index.js.map +1 -1
  40. package/build/components/sidebar-navigation-screen/index.js +5 -2
  41. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  42. package/build/components/sidebar-navigation-screen-main/index.js +13 -13
  43. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  44. package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
  45. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  46. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
  47. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  48. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  49. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  50. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  51. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  52. package/build/components/sidebar-navigation-screen-template/index.js +59 -10
  53. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
  55. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  56. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  57. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  58. package/build/components/site-hub/index.js +3 -1
  59. package/build/components/site-hub/index.js.map +1 -1
  60. package/build/components/style-book/index.js +134 -19
  61. package/build/components/style-book/index.js.map +1 -1
  62. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  63. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  64. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  65. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  66. package/build/components/template-details/index.js +0 -3
  67. package/build/components/template-details/index.js.map +1 -1
  68. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  69. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  70. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  71. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  72. package/build/components/template-part-converter/index.js +19 -14
  73. package/build/components/template-part-converter/index.js.map +1 -1
  74. package/build/components/use-edited-entity-record/index.js +6 -6
  75. package/build/components/use-edited-entity-record/index.js.map +1 -1
  76. package/build/index.js +3 -0
  77. package/build/index.js.map +1 -1
  78. package/build/utils/history.js +8 -2
  79. package/build/utils/history.js.map +1 -1
  80. package/build-module/components/add-new-template/new-template.js +18 -11
  81. package/build-module/components/add-new-template/new-template.js.map +1 -1
  82. package/build-module/components/app/index.js +3 -2
  83. package/build-module/components/app/index.js.map +1 -1
  84. package/build-module/components/block-editor/editor-canvas.js +2 -1
  85. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  86. package/build-module/components/editor/index.js +2 -3
  87. package/build-module/components/editor/index.js.map +1 -1
  88. package/build-module/components/global-styles/border-panel.js +21 -157
  89. package/build-module/components/global-styles/border-panel.js.map +1 -1
  90. package/build-module/components/global-styles/context-menu.js +2 -2
  91. package/build-module/components/global-styles/context-menu.js.map +1 -1
  92. package/build-module/components/global-styles/hooks.js +11 -26
  93. package/build-module/components/global-styles/hooks.js.map +1 -1
  94. package/build-module/components/global-styles/screen-block-list.js +2 -2
  95. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  96. package/build-module/components/global-styles/screen-border.js +11 -2
  97. package/build-module/components/global-styles/screen-border.js.map +1 -1
  98. package/build-module/components/global-styles/screen-root.js +2 -1
  99. package/build-module/components/global-styles/screen-root.js.map +1 -1
  100. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  101. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  102. package/build-module/components/layout/index.js +7 -0
  103. package/build-module/components/layout/index.js.map +1 -1
  104. package/build-module/components/list/added-by.js +126 -137
  105. package/build-module/components/list/added-by.js.map +1 -1
  106. package/build-module/components/list/index.js +2 -1
  107. package/build-module/components/list/index.js.map +1 -1
  108. package/build-module/components/list/table.js +6 -5
  109. package/build-module/components/list/table.js.map +1 -1
  110. package/build-module/components/routes/link.js +5 -2
  111. package/build-module/components/routes/link.js.map +1 -1
  112. package/build-module/components/save-button/index.js +2 -5
  113. package/build-module/components/save-button/index.js.map +1 -1
  114. package/build-module/components/save-hub/index.js +68 -0
  115. package/build-module/components/save-hub/index.js.map +1 -0
  116. package/build-module/components/sidebar/index.js +2 -4
  117. package/build-module/components/sidebar/index.js.map +1 -1
  118. package/build-module/components/sidebar-navigation-screen/index.js +5 -2
  119. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  120. package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
  121. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  122. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
  123. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  124. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
  125. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  126. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  127. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  128. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  129. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  130. package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
  131. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  132. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
  133. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  134. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  135. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  136. package/build-module/components/site-hub/index.js +3 -1
  137. package/build-module/components/site-hub/index.js.map +1 -1
  138. package/build-module/components/style-book/index.js +135 -22
  139. package/build-module/components/style-book/index.js.map +1 -1
  140. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  141. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  142. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  143. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  144. package/build-module/components/template-details/index.js +0 -3
  145. package/build-module/components/template-details/index.js.map +1 -1
  146. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  147. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  148. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  149. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  150. package/build-module/components/template-part-converter/index.js +20 -15
  151. package/build-module/components/template-part-converter/index.js.map +1 -1
  152. package/build-module/components/use-edited-entity-record/index.js +6 -6
  153. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  154. package/build-module/index.js +4 -1
  155. package/build-module/index.js.map +1 -1
  156. package/build-module/utils/history.js +9 -3
  157. package/build-module/utils/history.js.map +1 -1
  158. package/build-style/style-rtl.css +168 -111
  159. package/build-style/style.css +168 -111
  160. package/package.json +31 -31
  161. package/src/components/add-new-template/new-template.js +57 -32
  162. package/src/components/add-new-template/style.scss +12 -1
  163. package/src/components/app/index.js +9 -6
  164. package/src/components/block-editor/editor-canvas.js +2 -1
  165. package/src/components/editor/index.js +61 -65
  166. package/src/components/global-styles/border-panel.js +24 -199
  167. package/src/components/global-styles/context-menu.js +2 -2
  168. package/src/components/global-styles/hooks.js +12 -36
  169. package/src/components/global-styles/screen-block-list.js +2 -2
  170. package/src/components/global-styles/screen-border.js +9 -2
  171. package/src/components/global-styles/screen-root.js +1 -1
  172. package/src/components/global-styles/screen-style-variations.js +5 -1
  173. package/src/components/global-styles/style.scss +10 -0
  174. package/src/components/layout/index.js +15 -0
  175. package/src/components/layout/style.scss +1 -3
  176. package/src/components/list/added-by.js +144 -140
  177. package/src/components/list/index.js +3 -1
  178. package/src/components/list/table.js +7 -4
  179. package/src/components/routes/link.js +9 -2
  180. package/src/components/save-button/index.js +2 -2
  181. package/src/components/save-hub/index.js +78 -0
  182. package/src/components/save-hub/style.scss +15 -0
  183. package/src/components/sidebar/index.js +2 -3
  184. package/src/components/sidebar/style.scss +4 -3
  185. package/src/components/sidebar-button/style.scss +2 -1
  186. package/src/components/sidebar-navigation-item/style.scss +1 -23
  187. package/src/components/sidebar-navigation-screen/index.js +6 -0
  188. package/src/components/sidebar-navigation-screen/style.scss +15 -0
  189. package/src/components/sidebar-navigation-screen-main/index.js +21 -8
  190. package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
  191. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
  192. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  193. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  194. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  195. package/src/components/sidebar-navigation-screen-template/index.js +82 -11
  196. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  197. package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
  198. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
  199. package/src/components/site-hub/index.js +5 -1
  200. package/src/components/site-hub/style.scss +5 -1
  201. package/src/components/style-book/index.js +209 -54
  202. package/src/components/style-book/style.scss +1 -45
  203. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  204. package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
  205. package/src/components/template-details/index.js +0 -3
  206. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  207. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  208. package/src/components/template-part-converter/index.js +28 -12
  209. package/src/components/use-edited-entity-record/index.js +26 -18
  210. package/src/index.js +5 -1
  211. package/src/store/test/actions.js +0 -2
  212. package/src/style.scss +2 -1
  213. package/src/utils/history.js +13 -9
  214. package/build/components/navigation-inspector/index.js +0 -161
  215. package/build/components/navigation-inspector/index.js.map +0 -1
  216. package/build/components/navigation-inspector/navigation-menu.js +0 -79
  217. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  218. package/build-module/components/navigation-inspector/index.js +0 -146
  219. package/build-module/components/navigation-inspector/index.js.map +0 -1
  220. package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
  221. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  222. package/src/components/navigation-inspector/index.js +0 -191
  223. package/src/components/navigation-inspector/navigation-menu.js +0 -84
  224. package/src/components/navigation-inspector/style.scss +0 -46
@@ -1,191 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
- import { useState, useEffect } from '@wordpress/element';
6
- import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
7
- import {
8
- store as blockEditorStore,
9
- BlockEditorProvider,
10
- } from '@wordpress/block-editor';
11
- import { speak } from '@wordpress/a11y';
12
- import { __ } from '@wordpress/i18n';
13
-
14
- /**
15
- * Internal dependencies
16
- */
17
- import NavigationMenu from './navigation-menu';
18
-
19
- const NAVIGATION_MENUS_QUERY = [ { per_page: -1, status: 'publish' } ];
20
-
21
- export default function NavigationInspector( { onSelect } ) {
22
- const {
23
- selectedNavigationBlockId,
24
- clientIdToRef,
25
- navigationMenus,
26
- isResolvingNavigationMenus,
27
- hasResolvedNavigationMenus,
28
- firstNavigationBlockId,
29
- } = useSelect( ( select ) => {
30
- const {
31
- __experimentalGetActiveBlockIdByBlockNames,
32
- __experimentalGetGlobalBlocksByName,
33
- getBlock,
34
- } = select( blockEditorStore );
35
-
36
- const { getEntityRecords, hasFinishedResolution, isResolving } =
37
- select( coreStore );
38
-
39
- const navigationMenusQuery = [
40
- 'postType',
41
- 'wp_navigation',
42
- NAVIGATION_MENUS_QUERY[ 0 ],
43
- ];
44
-
45
- // Get the active Navigation block (if present).
46
- const selectedNavId =
47
- __experimentalGetActiveBlockIdByBlockNames( 'core/navigation' );
48
-
49
- // Get all Navigation blocks currently within the editor canvas.
50
- const navBlockIds =
51
- __experimentalGetGlobalBlocksByName( 'core/navigation' );
52
- const idToRef = {};
53
- navBlockIds.forEach( ( id ) => {
54
- idToRef[ id ] = getBlock( id )?.attributes?.ref;
55
- } );
56
- return {
57
- selectedNavigationBlockId: selectedNavId,
58
- firstNavigationBlockId: navBlockIds?.[ 0 ],
59
- clientIdToRef: idToRef,
60
- navigationMenus: getEntityRecords( ...navigationMenusQuery ),
61
- isResolvingNavigationMenus: isResolving(
62
- 'getEntityRecords',
63
- navigationMenusQuery
64
- ),
65
- hasResolvedNavigationMenus: hasFinishedResolution(
66
- 'getEntityRecords',
67
- navigationMenusQuery
68
- ),
69
- };
70
- }, [] );
71
-
72
- const firstNavRefInTemplate = clientIdToRef[ firstNavigationBlockId ];
73
- const firstNavigationMenuRef = navigationMenus?.[ 0 ]?.id;
74
-
75
- // Default Navigation Menu is either:
76
- // - the Navigation Menu referenced by the first Nav block within the template.
77
- // - the first of the available Navigation Menus (`wp_navigation`) posts.
78
- const defaultNavigationMenuId =
79
- firstNavRefInTemplate || firstNavigationMenuRef;
80
-
81
- // The Navigation Menu manually selected by the user within the Nav inspector.
82
- const [ currentMenuId, setCurrentMenuId ] = useState(
83
- firstNavRefInTemplate
84
- );
85
-
86
- // If a Nav block is selected within the canvas then set the
87
- // Navigation Menu referenced by it's `ref` attribute to be
88
- // active within the Navigation sidebar.
89
- useEffect( () => {
90
- if ( selectedNavigationBlockId ) {
91
- setCurrentMenuId( clientIdToRef[ selectedNavigationBlockId ] );
92
- }
93
- }, [ selectedNavigationBlockId ] );
94
-
95
- const [ innerBlocks, onInput, onChange ] = useEntityBlockEditor(
96
- 'postType',
97
- 'wp_navigation',
98
- { id: currentMenuId || defaultNavigationMenuId }
99
- );
100
-
101
- const { isLoadingInnerBlocks, hasLoadedInnerBlocks } = useSelect(
102
- ( select ) => {
103
- const { isResolving, hasFinishedResolution } = select( coreStore );
104
- return {
105
- isLoadingInnerBlocks: isResolving( 'getEntityRecord', [
106
- 'postType',
107
- 'wp_navigation',
108
- currentMenuId || defaultNavigationMenuId,
109
- ] ),
110
- hasLoadedInnerBlocks: hasFinishedResolution(
111
- 'getEntityRecord',
112
- [
113
- 'postType',
114
- 'wp_navigation',
115
- currentMenuId || defaultNavigationMenuId,
116
- ]
117
- ),
118
- };
119
- },
120
- [ currentMenuId, defaultNavigationMenuId ]
121
- );
122
-
123
- const isLoading = ! ( hasResolvedNavigationMenus && hasLoadedInnerBlocks );
124
-
125
- const hasNavigationMenus = !! navigationMenus?.length;
126
-
127
- // Entity block editor will return entities that are not currently published.
128
- // Guard by only allowing their usage if there are published Nav Menus.
129
- const publishedInnerBlocks = hasNavigationMenus ? innerBlocks : [];
130
-
131
- const hasInnerBlocks = !! publishedInnerBlocks?.length;
132
-
133
- useEffect( () => {
134
- if ( isResolvingNavigationMenus ) {
135
- speak( 'Loading Navigation sidebar menus.' );
136
- }
137
-
138
- if ( hasResolvedNavigationMenus ) {
139
- speak( 'Navigation sidebar menus have loaded.' );
140
- }
141
- }, [ isResolvingNavigationMenus, hasResolvedNavigationMenus ] );
142
-
143
- useEffect( () => {
144
- if ( isLoadingInnerBlocks ) {
145
- speak( 'Loading Navigation sidebar selected menu items.' );
146
- }
147
-
148
- if ( hasLoadedInnerBlocks ) {
149
- speak( 'Navigation sidebar selected menu items have loaded.' );
150
- }
151
- }, [ isLoadingInnerBlocks, hasLoadedInnerBlocks ] );
152
-
153
- return (
154
- <div className="edit-site-navigation-inspector">
155
- { hasResolvedNavigationMenus && ! hasNavigationMenus && (
156
- <p className="edit-site-navigation-inspector__empty-msg">
157
- { __( 'There are no Navigation Menus.' ) }
158
- </p>
159
- ) }
160
-
161
- { ! hasResolvedNavigationMenus && (
162
- <div className="edit-site-navigation-inspector__placeholder" />
163
- ) }
164
- { isLoading && (
165
- <>
166
- <div className="edit-site-navigation-inspector__placeholder is-child" />
167
- <div className="edit-site-navigation-inspector__placeholder is-child" />
168
- <div className="edit-site-navigation-inspector__placeholder is-child" />
169
- </>
170
- ) }
171
- { hasInnerBlocks && ! isLoading && (
172
- <BlockEditorProvider
173
- value={ publishedInnerBlocks }
174
- onChange={ onChange }
175
- onInput={ onInput }
176
- >
177
- <NavigationMenu
178
- innerBlocks={ publishedInnerBlocks }
179
- onSelect={ onSelect }
180
- />
181
- </BlockEditorProvider>
182
- ) }
183
-
184
- { ! hasInnerBlocks && ! isLoading && (
185
- <p className="edit-site-navigation-inspector__empty-msg">
186
- { __( 'Navigation Menu is empty.' ) }
187
- </p>
188
- ) }
189
- </div>
190
- );
191
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- privateApis as blockEditorPrivateApis,
6
- store as blockEditorStore,
7
- BlockList,
8
- BlockTools,
9
- } from '@wordpress/block-editor';
10
- import { useEffect } from '@wordpress/element';
11
- import { useSelect, useDispatch } from '@wordpress/data';
12
-
13
- /**
14
- * Internal dependencies
15
- */
16
- import { unlock } from '../../private-apis';
17
-
18
- const ALLOWED_BLOCKS = {
19
- 'core/navigation': [
20
- 'core/navigation-link',
21
- 'core/search',
22
- 'core/social-links',
23
- 'core/page-list',
24
- 'core/spacer',
25
- 'core/home-link',
26
- 'core/site-title',
27
- 'core/site-logo',
28
- 'core/navigation-submenu',
29
- ],
30
- 'core/social-links': [ 'core/social-link' ],
31
- 'core/navigation-submenu': [
32
- 'core/navigation-link',
33
- 'core/navigation-submenu',
34
- ],
35
- 'core/navigation-link': [
36
- 'core/navigation-link',
37
- 'core/navigation-submenu',
38
- ],
39
- 'core/page-list': [ 'core/page-list-item' ],
40
- };
41
-
42
- export default function NavigationMenu( { innerBlocks, onSelect } ) {
43
- const { clientIdsTree } = useSelect( ( select ) => {
44
- const { __unstableGetClientIdsTree } = select( blockEditorStore );
45
- return {
46
- clientIdsTree: __unstableGetClientIdsTree(),
47
- };
48
- } );
49
- const { updateBlockListSettings } = useDispatch( blockEditorStore );
50
-
51
- const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );
52
-
53
- //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList
54
- //Think through a better way of doing this, possible with adding allowed blocks to block library metadata
55
- useEffect( () => {
56
- updateBlockListSettings( '', {
57
- allowedBlocks: ALLOWED_BLOCKS[ 'core/navigation' ],
58
- } );
59
- innerBlocks.forEach( ( block ) => {
60
- if ( ALLOWED_BLOCKS[ block.name ] ) {
61
- updateBlockListSettings( block.clientId, {
62
- allowedBlocks: ALLOWED_BLOCKS[ block.name ],
63
- } );
64
- }
65
- } );
66
- }, [ updateBlockListSettings, innerBlocks ] );
67
-
68
- // The hidden block is needed because it makes block edit side effects trigger.
69
- // For example a navigation page list load its items has an effect on edit to load its items.
70
- return (
71
- <>
72
- <OffCanvasEditor
73
- blocks={ clientIdsTree }
74
- onSelect={ onSelect }
75
- LeafMoreMenu={ LeafMoreMenu }
76
- />
77
- <div style={ { display: 'none' } }>
78
- <BlockTools>
79
- <BlockList />
80
- </BlockTools>
81
- </div>
82
- </>
83
- );
84
- }
@@ -1,46 +0,0 @@
1
- @keyframes loadingpulse {
2
- 0% {
3
- opacity: 1;
4
- }
5
- 50% {
6
- opacity: 0.5;
7
- }
8
- 100% {
9
- opacity: 1;
10
- }
11
- }
12
-
13
- .edit-site-navigation-inspector {
14
- .block-editor-list-view-leaf .block-editor-list-view-block-contents {
15
- white-space: normal;
16
- }
17
-
18
- .block-editor-list-view-block__title {
19
- margin-top: 3px;
20
- }
21
-
22
- .block-editor-list-view-block__menu-cell {
23
- padding-right: 0;
24
- }
25
-
26
- .edit-site-navigation-inspector__select-menu {
27
- margin-bottom: $grid-unit-10;
28
- }
29
- }
30
-
31
- .edit-site-navigation-inspector__placeholder {
32
- padding: $grid-unit-10;
33
- margin: $grid-unit-10;
34
- background-color: $gray-100;
35
- animation: loadingpulse 1s linear infinite;
36
- animation-delay: 0.5s; // avoid animating for fast network responses
37
-
38
- &.is-child {
39
- margin-left: $grid-unit-30;
40
- width: 50%;
41
- }
42
- }
43
-
44
- .edit-site-navigation-inspector__empty-msg {
45
- padding: 0 $grid-unit-10;
46
- }