@wordpress/edit-site 5.13.0 → 5.14.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 (470) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +1 -7
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +11 -11
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +2 -2
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +69 -14
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/block-editor/editor-canvas.js +1 -1
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/block-editor/inserter-media-categories.js +1 -22
  13. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  14. package/build/components/block-editor/site-editor-canvas.js +29 -32
  15. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/use-site-editor-settings.js +9 -12
  17. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  18. package/build/components/canvas-spinner/index.js +1 -18
  19. package/build/components/canvas-spinner/index.js.map +1 -1
  20. package/build/components/create-pattern-modal/index.js +9 -9
  21. package/build/components/create-pattern-modal/index.js.map +1 -1
  22. package/build/components/create-template-part-modal/index.js +1 -1
  23. package/build/components/create-template-part-modal/index.js.map +1 -1
  24. package/build/components/editor/index.js +11 -1
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/global-styles/palette.js +1 -1
  27. package/build/components/global-styles/palette.js.map +1 -1
  28. package/build/components/global-styles/ui.js +7 -2
  29. package/build/components/global-styles/ui.js.map +1 -1
  30. package/build/components/header-edit-mode/document-actions/index.js +9 -1
  31. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  32. package/build/components/header-edit-mode/index.js +41 -10
  33. package/build/components/header-edit-mode/index.js.map +1 -1
  34. package/build/components/header-edit-mode/more-menu/index.js +47 -17
  35. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  36. package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
  37. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  38. package/build/components/keyboard-shortcuts/edit-mode.js +32 -1
  39. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  40. package/build/components/keyboard-shortcuts/register.js +9 -0
  41. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  42. package/build/components/layout/index.js +103 -26
  43. package/build/components/layout/index.js.map +1 -1
  44. package/build/components/page/header.js +1 -1
  45. package/build/components/page/header.js.map +1 -1
  46. package/build/components/page/index.js +3 -1
  47. package/build/components/page/index.js.map +1 -1
  48. package/build/components/page-actions/delete-page-menu-item.js +2 -1
  49. package/build/components/page-actions/delete-page-menu-item.js.map +1 -1
  50. package/build/components/page-content-focus-manager/back-to-page-notification.js +9 -3
  51. package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  52. package/build/components/page-main/index.js +8 -4
  53. package/build/components/page-main/index.js.map +1 -1
  54. package/build/components/{page-library → page-patterns}/grid-item.js +61 -33
  55. package/build/components/page-patterns/grid-item.js.map +1 -0
  56. package/build/components/{page-library → page-patterns}/grid.js +1 -1
  57. package/build/components/page-patterns/grid.js.map +1 -0
  58. package/build/components/{page-library → page-patterns}/index.js +6 -6
  59. package/build/components/page-patterns/index.js.map +1 -0
  60. package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
  61. package/build/components/page-patterns/no-patterns.js.map +1 -0
  62. package/build/components/{page-library → page-patterns}/patterns-list.js +9 -7
  63. package/build/components/page-patterns/patterns-list.js.map +1 -0
  64. package/build/components/page-patterns/search-items.js.map +1 -0
  65. package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
  66. package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
  67. package/build/components/{page-library → page-patterns}/use-patterns.js +12 -2
  68. package/build/components/page-patterns/use-patterns.js.map +1 -0
  69. package/build/components/{page-library → page-patterns}/utils.js +3 -3
  70. package/build/components/page-patterns/utils.js.map +1 -0
  71. package/build/components/page-template-parts/index.js +103 -0
  72. package/build/components/page-template-parts/index.js.map +1 -0
  73. package/build/components/page-templates/index.js +1 -0
  74. package/build/components/page-templates/index.js.map +1 -1
  75. package/build/components/preferences-modal/enable-feature.js +5 -1
  76. package/build/components/preferences-modal/enable-feature.js.map +1 -1
  77. package/build/components/preferences-modal/index.js +43 -4
  78. package/build/components/preferences-modal/index.js.map +1 -1
  79. package/build/components/sidebar/index.js +6 -6
  80. package/build/components/sidebar/index.js.map +1 -1
  81. package/build/components/sidebar-edit-mode/index.js +4 -2
  82. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  83. package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
  84. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  85. package/build/components/sidebar-navigation-screen/index.js +7 -3
  86. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  87. package/build/components/sidebar-navigation-screen-global-styles/index.js +69 -5
  88. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  89. package/build/components/sidebar-navigation-screen-main/index.js +2 -2
  90. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  91. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +7 -16
  92. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  93. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
  94. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  95. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +6 -6
  96. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  97. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +10 -1
  98. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  99. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +9 -3
  100. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  101. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
  102. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  103. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +29 -0
  104. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
  105. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +27 -4
  106. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  107. package/build/components/sidebar-navigation-screen-page/page-details.js +11 -4
  108. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  109. package/build/components/sidebar-navigation-screen-page/status-label.js +1 -1
  110. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  111. package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
  112. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  113. package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
  114. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  115. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  116. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  117. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -0
  118. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  119. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  120. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  121. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +55 -15
  122. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  123. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  124. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
  125. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  126. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
  127. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  128. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  129. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  130. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  131. package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
  132. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  133. package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  134. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  135. package/build/components/site-hub/index.js +1 -1
  136. package/build/components/site-hub/index.js.map +1 -1
  137. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  138. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  139. package/build/components/template-actions/index.js +22 -6
  140. package/build/components/template-actions/index.js.map +1 -1
  141. package/build/components/welcome-guide/editor.js +1 -1
  142. package/build/components/welcome-guide/editor.js.map +1 -1
  143. package/build/components/welcome-guide/index.js +5 -1
  144. package/build/components/welcome-guide/index.js.map +1 -1
  145. package/build/components/welcome-guide/page.js +70 -0
  146. package/build/components/welcome-guide/page.js.map +1 -0
  147. package/build/components/welcome-guide/styles.js +1 -1
  148. package/build/components/welcome-guide/styles.js.map +1 -1
  149. package/build/components/welcome-guide/template.js +71 -0
  150. package/build/components/welcome-guide/template.js.map +1 -0
  151. package/build/hooks/commands/use-common-commands.js +37 -0
  152. package/build/hooks/commands/use-common-commands.js.map +1 -1
  153. package/build/hooks/commands/use-edit-mode-commands.js +195 -44
  154. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  155. package/build/index.js +9 -0
  156. package/build/index.js.map +1 -1
  157. package/build/store/actions.js +5 -2
  158. package/build/store/actions.js.map +1 -1
  159. package/build/store/selectors.js +2 -1
  160. package/build/store/selectors.js.map +1 -1
  161. package/build/utils/get-is-list-page.js +2 -2
  162. package/build/utils/get-is-list-page.js.map +1 -1
  163. package/build/utils/template-part-create.js +2 -2
  164. package/build/utils/template-part-create.js.map +1 -1
  165. package/build-module/components/add-new-page/index.js +1 -6
  166. package/build-module/components/add-new-page/index.js.map +1 -1
  167. package/build-module/components/add-new-pattern/index.js +11 -11
  168. package/build-module/components/add-new-pattern/index.js.map +1 -1
  169. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
  170. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  171. package/build-module/components/add-new-template/new-template.js +72 -17
  172. package/build-module/components/add-new-template/new-template.js.map +1 -1
  173. package/build-module/components/block-editor/editor-canvas.js +1 -1
  174. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  175. package/build-module/components/block-editor/inserter-media-categories.js +1 -22
  176. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  177. package/build-module/components/block-editor/site-editor-canvas.js +29 -32
  178. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  179. package/build-module/components/block-editor/use-site-editor-settings.js +9 -12
  180. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  181. package/build-module/components/canvas-spinner/index.js +1 -15
  182. package/build-module/components/canvas-spinner/index.js.map +1 -1
  183. package/build-module/components/create-pattern-modal/index.js +9 -9
  184. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  185. package/build-module/components/create-template-part-modal/index.js +1 -1
  186. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  187. package/build-module/components/editor/index.js +11 -1
  188. package/build-module/components/editor/index.js.map +1 -1
  189. package/build-module/components/global-styles/palette.js +1 -1
  190. package/build-module/components/global-styles/palette.js.map +1 -1
  191. package/build-module/components/global-styles/ui.js +8 -3
  192. package/build-module/components/global-styles/ui.js.map +1 -1
  193. package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
  194. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  195. package/build-module/components/header-edit-mode/index.js +43 -12
  196. package/build-module/components/header-edit-mode/index.js.map +1 -1
  197. package/build-module/components/header-edit-mode/more-menu/index.js +44 -20
  198. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  199. package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
  200. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  201. package/build-module/components/keyboard-shortcuts/edit-mode.js +29 -1
  202. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  203. package/build-module/components/keyboard-shortcuts/register.js +9 -0
  204. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  205. package/build-module/components/layout/index.js +103 -26
  206. package/build-module/components/layout/index.js.map +1 -1
  207. package/build-module/components/page/header.js +1 -1
  208. package/build-module/components/page/header.js.map +1 -1
  209. package/build-module/components/page/index.js +2 -1
  210. package/build-module/components/page/index.js.map +1 -1
  211. package/build-module/components/page-actions/delete-page-menu-item.js +2 -1
  212. package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -1
  213. package/build-module/components/page-content-focus-manager/back-to-page-notification.js +9 -3
  214. package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  215. package/build-module/components/page-main/index.js +6 -3
  216. package/build-module/components/page-main/index.js.map +1 -1
  217. package/build-module/components/{page-library → page-patterns}/grid-item.js +65 -35
  218. package/build-module/components/page-patterns/grid-item.js.map +1 -0
  219. package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
  220. package/build-module/components/page-patterns/grid.js.map +1 -0
  221. package/build-module/components/{page-library → page-patterns}/index.js +5 -5
  222. package/build-module/components/page-patterns/index.js.map +1 -0
  223. package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
  224. package/build-module/components/page-patterns/no-patterns.js.map +1 -0
  225. package/build-module/components/{page-library → page-patterns}/patterns-list.js +9 -7
  226. package/build-module/components/page-patterns/patterns-list.js.map +1 -0
  227. package/build-module/components/page-patterns/search-items.js.map +1 -0
  228. package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
  229. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
  230. package/build-module/components/{page-library → page-patterns}/use-patterns.js +12 -2
  231. package/build-module/components/page-patterns/use-patterns.js.map +1 -0
  232. package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
  233. package/build-module/components/page-patterns/utils.js.map +1 -0
  234. package/build-module/components/page-template-parts/index.js +82 -0
  235. package/build-module/components/page-template-parts/index.js.map +1 -0
  236. package/build-module/components/page-templates/index.js +1 -0
  237. package/build-module/components/page-templates/index.js.map +1 -1
  238. package/build-module/components/preferences-modal/enable-feature.js +5 -1
  239. package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
  240. package/build-module/components/preferences-modal/index.js +38 -5
  241. package/build-module/components/preferences-modal/index.js.map +1 -1
  242. package/build-module/components/sidebar/index.js +5 -5
  243. package/build-module/components/sidebar/index.js.map +1 -1
  244. package/build-module/components/sidebar-edit-mode/index.js +4 -2
  245. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  246. package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
  247. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  248. package/build-module/components/sidebar-navigation-screen/index.js +7 -3
  249. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  250. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +67 -5
  251. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen-main/index.js +2 -2
  253. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +8 -17
  255. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
  257. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  258. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +5 -6
  259. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  260. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +11 -1
  261. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  262. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +8 -4
  263. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  264. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
  265. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  266. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +20 -0
  267. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
  268. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +26 -6
  269. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  270. package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -4
  271. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  272. package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -1
  273. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  274. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
  275. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  276. package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
  277. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  278. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  279. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  280. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +21 -0
  281. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  282. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  283. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  284. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +54 -16
  285. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  286. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  287. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
  288. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  289. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
  290. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  291. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  292. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  293. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  294. package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
  295. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  297. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  298. package/build-module/components/site-hub/index.js +1 -1
  299. package/build-module/components/site-hub/index.js.map +1 -1
  300. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  301. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  302. package/build-module/components/template-actions/index.js +24 -7
  303. package/build-module/components/template-actions/index.js.map +1 -1
  304. package/build-module/components/welcome-guide/editor.js +1 -1
  305. package/build-module/components/welcome-guide/editor.js.map +1 -1
  306. package/build-module/components/welcome-guide/index.js +3 -1
  307. package/build-module/components/welcome-guide/index.js.map +1 -1
  308. package/build-module/components/welcome-guide/page.js +59 -0
  309. package/build-module/components/welcome-guide/page.js.map +1 -0
  310. package/build-module/components/welcome-guide/styles.js +1 -1
  311. package/build-module/components/welcome-guide/styles.js.map +1 -1
  312. package/build-module/components/welcome-guide/template.js +60 -0
  313. package/build-module/components/welcome-guide/template.js.map +1 -0
  314. package/build-module/hooks/commands/use-common-commands.js +37 -1
  315. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  316. package/build-module/hooks/commands/use-edit-mode-commands.js +193 -46
  317. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  318. package/build-module/index.js +4 -0
  319. package/build-module/index.js.map +1 -1
  320. package/build-module/store/actions.js +5 -2
  321. package/build-module/store/actions.js.map +1 -1
  322. package/build-module/store/selectors.js +2 -1
  323. package/build-module/store/selectors.js.map +1 -1
  324. package/build-module/utils/get-is-list-page.js +2 -2
  325. package/build-module/utils/get-is-list-page.js.map +1 -1
  326. package/build-module/utils/template-part-create.js +1 -1
  327. package/build-module/utils/template-part-create.js.map +1 -1
  328. package/build-style/style-rtl.css +167 -51
  329. package/build-style/style.css +167 -51
  330. package/package.json +39 -39
  331. package/src/components/add-new-page/index.js +1 -6
  332. package/src/components/add-new-pattern/index.js +11 -13
  333. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
  334. package/src/components/add-new-template/new-template.js +120 -24
  335. package/src/components/add-new-template/style.scss +30 -2
  336. package/src/components/block-editor/editor-canvas.js +3 -1
  337. package/src/components/block-editor/inserter-media-categories.js +1 -21
  338. package/src/components/block-editor/site-editor-canvas.js +7 -1
  339. package/src/components/block-editor/use-site-editor-settings.js +8 -12
  340. package/src/components/canvas-spinner/index.js +1 -11
  341. package/src/components/canvas-spinner/style.scss +4 -0
  342. package/src/components/create-pattern-modal/index.js +11 -12
  343. package/src/components/create-template-part-modal/index.js +1 -1
  344. package/src/components/editor/index.js +16 -1
  345. package/src/components/editor/style.scss +4 -0
  346. package/src/components/global-styles/palette.js +10 -9
  347. package/src/components/global-styles/stories/index.js +1 -0
  348. package/src/components/global-styles/ui.js +34 -24
  349. package/src/components/header-edit-mode/document-actions/index.js +9 -1
  350. package/src/components/header-edit-mode/document-actions/style.scss +8 -0
  351. package/src/components/header-edit-mode/index.js +112 -62
  352. package/src/components/header-edit-mode/more-menu/index.js +74 -30
  353. package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
  354. package/src/components/keyboard-shortcuts/edit-mode.js +35 -2
  355. package/src/components/keyboard-shortcuts/register.js +10 -0
  356. package/src/components/layout/index.js +140 -76
  357. package/src/components/layout/style.scss +47 -1
  358. package/src/components/page/header.js +1 -1
  359. package/src/components/page/index.js +5 -1
  360. package/src/components/page-actions/delete-page-menu-item.js +1 -0
  361. package/src/components/page-content-focus-manager/back-to-page-notification.js +7 -2
  362. package/src/components/page-main/index.js +6 -3
  363. package/src/components/{page-library → page-patterns}/grid-item.js +83 -34
  364. package/src/components/{page-library → page-patterns}/grid.js +1 -1
  365. package/src/components/{page-library → page-patterns}/index.js +5 -5
  366. package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
  367. package/src/components/{page-library → page-patterns}/patterns-list.js +13 -9
  368. package/src/components/{page-library → page-patterns}/style.scss +19 -15
  369. package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
  370. package/src/components/{page-library → page-patterns}/use-patterns.js +11 -2
  371. package/src/components/{page-library → page-patterns}/utils.js +3 -3
  372. package/src/components/page-template-parts/index.js +105 -0
  373. package/src/components/page-templates/index.js +1 -1
  374. package/src/components/preferences-modal/enable-feature.js +5 -2
  375. package/src/components/preferences-modal/index.js +35 -4
  376. package/src/components/sidebar/index.js +6 -6
  377. package/src/components/sidebar-button/style.scss +1 -1
  378. package/src/components/sidebar-edit-mode/index.js +4 -2
  379. package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
  380. package/src/components/sidebar-navigation-item/style.scss +2 -1
  381. package/src/components/sidebar-navigation-screen/index.js +4 -2
  382. package/src/components/sidebar-navigation-screen/style.scss +7 -2
  383. package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -1
  384. package/src/components/sidebar-navigation-screen-global-styles/index.js +57 -17
  385. package/src/components/sidebar-navigation-screen-main/index.js +2 -2
  386. package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +14 -35
  387. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
  388. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +9 -8
  389. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +12 -1
  390. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +16 -7
  391. package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -7
  392. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
  393. package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +24 -0
  394. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +39 -8
  395. package/src/components/sidebar-navigation-screen-page/page-details.js +8 -3
  396. package/src/components/sidebar-navigation-screen-page/status-label.js +1 -1
  397. package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
  398. package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
  399. package/src/components/sidebar-navigation-screen-pattern/style.scss +29 -0
  400. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  401. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +43 -1
  402. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  403. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +75 -22
  404. package/src/components/sidebar-navigation-screen-patterns/style.scss +3 -0
  405. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
  406. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
  407. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  408. package/src/components/sidebar-navigation-screen-template/style.scss +15 -15
  409. package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
  410. package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
  411. package/src/components/site-hub/index.js +1 -1
  412. package/src/components/site-hub/style.scss +4 -3
  413. package/src/components/start-template-options/style.scss +0 -3
  414. package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  415. package/src/components/template-actions/index.js +38 -8
  416. package/src/components/welcome-guide/editor.js +1 -1
  417. package/src/components/welcome-guide/index.js +4 -0
  418. package/src/components/welcome-guide/page.js +75 -0
  419. package/src/components/welcome-guide/style.scss +15 -1
  420. package/src/components/welcome-guide/styles.js +1 -1
  421. package/src/components/welcome-guide/template.js +82 -0
  422. package/src/hooks/commands/use-common-commands.js +32 -1
  423. package/src/hooks/commands/use-edit-mode-commands.js +182 -38
  424. package/src/index.js +4 -0
  425. package/src/store/actions.js +8 -1
  426. package/src/store/selectors.js +5 -0
  427. package/src/store/test/selectors.js +2 -0
  428. package/src/style.scss +3 -2
  429. package/src/utils/get-is-list-page.js +4 -3
  430. package/src/utils/template-part-create.js +1 -1
  431. package/build/components/page-library/grid-item.js.map +0 -1
  432. package/build/components/page-library/grid.js.map +0 -1
  433. package/build/components/page-library/index.js.map +0 -1
  434. package/build/components/page-library/no-patterns.js.map +0 -1
  435. package/build/components/page-library/patterns-list.js.map +0 -1
  436. package/build/components/page-library/search-items.js.map +0 -1
  437. package/build/components/page-library/use-library-settings.js.map +0 -1
  438. package/build/components/page-library/use-patterns.js.map +0 -1
  439. package/build/components/page-library/utils.js.map +0 -1
  440. package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  441. package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
  442. package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  443. package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  444. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  445. package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  446. package/build-module/components/page-library/grid-item.js.map +0 -1
  447. package/build-module/components/page-library/grid.js.map +0 -1
  448. package/build-module/components/page-library/index.js.map +0 -1
  449. package/build-module/components/page-library/no-patterns.js.map +0 -1
  450. package/build-module/components/page-library/patterns-list.js.map +0 -1
  451. package/build-module/components/page-library/search-items.js.map +0 -1
  452. package/build-module/components/page-library/use-library-settings.js.map +0 -1
  453. package/build-module/components/page-library/use-patterns.js.map +0 -1
  454. package/build-module/components/page-library/utils.js.map +0 -1
  455. package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  456. package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
  457. package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  458. package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  459. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  460. package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  461. package/src/components/sidebar-navigation-screen-library/style.scss +0 -7
  462. /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
  463. /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  464. /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
  465. /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
  466. /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  467. /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
  468. /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
  469. /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  470. /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
@@ -16,6 +16,7 @@ import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-nav
16
16
  import ScreenNavigationMoreMenu from './more-menu';
17
17
  import SingleNavigationMenu from './single-navigation-menu';
18
18
  import useNavigationMenuHandlers from './use-navigation-menu-handlers';
19
+ import buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';
19
20
  export const postType = `wp_navigation`;
20
21
  export default function SidebarNavigationScreenNavigationMenu() {
21
22
  const {
@@ -33,13 +34,11 @@ export default function SidebarNavigationScreenNavigationMenu() {
33
34
  } = useSelect(select => {
34
35
  const {
35
36
  isSavingEntityRecord,
36
- isDeletingEntityRecord,
37
- getEditedEntityRecord: getEditedEntityRecordSelector
37
+ isDeletingEntityRecord
38
38
  } = select(coreStore);
39
39
  return {
40
40
  isSaving: isSavingEntityRecord('postType', postType, postId),
41
- isDeleting: isDeletingEntityRecord('postType', postType, postId),
42
- getEditedEntityRecord: getEditedEntityRecordSelector
41
+ isDeleting: isDeletingEntityRecord('postType', postType, postId)
43
42
  };
44
43
  }, [postId]);
45
44
  const isLoading = isResolving || isSaving || isDeleting;
@@ -52,7 +51,7 @@ export default function SidebarNavigationScreenNavigationMenu() {
52
51
 
53
52
  const _handleDelete = () => handleDelete(navigationMenu);
54
53
 
55
- const _handleSave = () => handleSave(navigationMenu);
54
+ const _handleSave = edits => handleSave(navigationMenu, edits);
56
55
 
57
56
  const _handleDuplicate = () => handleDuplicate(navigationMenu);
58
57
 
@@ -78,7 +77,7 @@ export default function SidebarNavigationScreenNavigationMenu() {
78
77
  onSave: _handleSave,
79
78
  onDuplicate: _handleDuplicate
80
79
  }),
81
- title: decodeEntities(menuTitle),
80
+ title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
82
81
  description: __('This Navigation Menu is empty.')
83
82
  });
84
83
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"names":["useEntityRecord","store","coreStore","__experimentalUseNavigator","useNavigator","Spinner","__","useSelect","decodeEntities","SidebarNavigationScreenWrapper","ScreenNavigationMoreMenu","SingleNavigationMenu","useNavigationMenuHandlers","postType","SidebarNavigationScreenNavigationMenu","params","postId","record","navigationMenu","isResolving","isSaving","isDeleting","select","isSavingEntityRecord","isDeletingEntityRecord","getEditedEntityRecord","getEditedEntityRecordSelector","isLoading","menuTitle","title","rendered","slug","handleSave","handleDelete","handleDuplicate","_handleDelete","_handleSave","_handleDuplicate","content","raw"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,KAAK,IAAIC,SAAnC,QAAoD,sBAApD;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,OAFD,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,+CAA/C;AACA,OAAOC,wBAAP,MAAqC,aAArC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,yBAAP,MAAsC,gCAAtC;AAEA,OAAO,MAAMC,QAAQ,GAAI,eAAlB;AAEP,eAAe,SAASC,qCAAT,GAAiD;AAC/D,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFZ,YAAY,EAFhB;AAIA,QAAM;AAAEa,IAAAA,MAAM,EAAEC,cAAV;AAA0BC,IAAAA;AAA1B,MAA0CnB,eAAe,CAC9D,UAD8D,EAE9Da,QAF8D,EAG9DG,MAH8D,CAA/D;AAMA,QAAM;AAAEI,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA2Bd,SAAS,CACvCe,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,oBADK;AAELC,MA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AAS,EAAG/B,cAAc,CAAEoB,SAAF,CAD3B;AAEC,QAAA,QAAQ,EAAGO,aAFZ;AAGC,QAAA,MAAM,EAAGC,WAHV;AAIC,QAAA,WAAW,EAAGC;AAJf,QAFF;AASC,MAAA,KAAK,EAAG7B,cAAc,CAAEoB,SAAF,CATvB;AAUC,MAAA,WAAW,EAAGtB,EAAE,CAAE,gCAAF;AAVjB,MADD;AAcA;;AAED,SACC,cAAC,oBAAD;AACC,IAAA,cAAc,EAAGY,cADlB;AAEC,IAAA,YAAY,EAAGiB,aAFhB;AAGC,IAAA,UAAU,EAAGC,WAHd;AAIC,IAAA,eAAe,EAAGC;AAJnB,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tSpinner,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport SingleNavigationMenu from './single-navigation-menu';\nimport useNavigationMenuHandlers from './use-navigation-menu-handlers';\n\nexport const postType = `wp_navigation`;\n\nexport default function SidebarNavigationScreenNavigationMenu() {\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\n\tconst { record: navigationMenu, isResolving } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\n\tconst { isSaving, isDeleting } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisSavingEntityRecord,\n\t\t\t\tisDeletingEntityRecord,\n\t\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t\t} = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tisSaving: isSavingEntityRecord( 'postType', postType, postId ),\n\t\t\t\tisDeleting: isDeletingEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t\t};\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst isLoading = isResolving || isSaving || isDeleting;\n\n\tconst menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst _handleDelete = () => handleDelete( navigationMenu );\n\tconst _handleSave = () => handleSave( navigationMenu );\n\tconst _handleDuplicate = () => handleDuplicate( navigationMenu );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! navigationMenu ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'Navigation Menu missing.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! navigationMenu?.content?.raw ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tactions={\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ _handleDelete }\n\t\t\t\t\t\tonSave={ _handleSave }\n\t\t\t\t\t\tonDuplicate={ _handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ decodeEntities( menuTitle ) }\n\t\t\t\tdescription={ __( 'This Navigation Menu is empty.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SingleNavigationMenu\n\t\t\tnavigationMenu={ navigationMenu }\n\t\t\thandleDelete={ _handleDelete }\n\t\t\thandleSave={ _handleSave }\n\t\t\thandleDuplicate={ _handleDuplicate }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"names":["useEntityRecord","store","coreStore","__experimentalUseNavigator","useNavigator","Spinner","__","useSelect","decodeEntities","SidebarNavigationScreenWrapper","ScreenNavigationMoreMenu","SingleNavigationMenu","useNavigationMenuHandlers","buildNavigationLabel","postType","SidebarNavigationScreenNavigationMenu","params","postId","record","navigationMenu","isResolving","isSaving","isDeleting","select","isSavingEntityRecord","isDeletingEntityRecord","isLoading","menuTitle","title","rendered","slug","handleSave","handleDelete","handleDuplicate","_handleDelete","_handleSave","edits","_handleDuplicate","content","raw","id","status"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,KAAK,IAAIC,SAAnC,QAAoD,sBAApD;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,OAFD,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,+CAA/C;AACA,OAAOC,wBAAP,MAAqC,aAArC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,yBAAP,MAAsC,gCAAtC;AACA,OAAOC,oBAAP,MAAiC,sEAAjC;AAEA,OAAO,MAAMC,QAAQ,GAAI,eAAlB;AAEP,eAAe,SAASC,qCAAT,GAAiD;AAC/D,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFb,YAAY,EAFhB;AAIA,QAAM;AAAEc,IAAAA,MAAM,EAAEC,cAAV;AAA0BC,IAAAA;AAA1B,MAA0CpB,eAAe,CAC9D,UAD8D,EAE9Dc,QAF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OAAhB,EAAyBC,GAAhC,EAAsC;AACrC,WACC,cAAC,8BAAD;AACC,MAAA,OAAO,EACN,cAAC,wBAAD;AACC,QAAA,SAAS,EAAG/B,cAAc,CAAEmB,SAAF,CAD3B;AAEC,QAAA,QAAQ,EAAGO,aAFZ;AAGC,QAAA,MAAM,EAAGC,WAHV;AAIC,QAAA,WAAW,EAAGE;AAJf,QAFF;AASC,MAAA,KAAK,EAAGxB,oBAAoB,CAC3BM,cAAc,EAAES,KADW,EAE3BT,cAAc,EAAEqB,EAFW,EAG3BrB,cAAc,EAAEsB,MAHW,CAT7B;AAcC,MAAA,WAAW,EAAGnC,EAAE,CAAE,gCAAF;AAdjB,MADD;AAkBA;;AAED,SACC,cAAC,oBAAD;AACC,IAAA,cAAc,EAAGa,cADlB;AAEC,IAAA,YAAY,EAAGe,aAFhB;AAGC,IAAA,UAAU,EAAGC,WAHd;AAIC,IAAA,eAAe,EAAGE;AAJnB,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tSpinner,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport SingleNavigationMenu from './single-navigation-menu';\nimport useNavigationMenuHandlers from './use-navigation-menu-handlers';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\n\nexport const postType = `wp_navigation`;\n\nexport default function SidebarNavigationScreenNavigationMenu() {\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\n\tconst { record: navigationMenu, isResolving } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\n\tconst { isSaving, isDeleting } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isDeletingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tisSaving: isSavingEntityRecord( 'postType', postType, postId ),\n\t\t\t\tisDeleting: isDeletingEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst isLoading = isResolving || isSaving || isDeleting;\n\n\tconst menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst _handleDelete = () => handleDelete( navigationMenu );\n\tconst _handleSave = ( edits ) => handleSave( navigationMenu, edits );\n\tconst _handleDuplicate = () => handleDuplicate( navigationMenu );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! navigationMenu ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'Navigation Menu missing.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! navigationMenu?.content?.raw ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tactions={\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ _handleDelete }\n\t\t\t\t\t\tonSave={ _handleSave }\n\t\t\t\t\t\tonDuplicate={ _handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\t\tnavigationMenu?.title,\n\t\t\t\t\tnavigationMenu?.id,\n\t\t\t\t\tnavigationMenu?.status\n\t\t\t\t) }\n\t\t\t\tdescription={ __( 'This Navigation Menu is empty.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SingleNavigationMenu\n\t\t\tnavigationMenu={ navigationMenu }\n\t\t\thandleDelete={ _handleDelete }\n\t\t\thandleSave={ _handleSave }\n\t\t\thandleDuplicate={ _handleDuplicate }\n\t\t/>\n\t);\n}\n"]}
@@ -6,12 +6,17 @@ import { createElement } from "@wordpress/element";
6
6
  import { __experimentalHStack as HStack, __experimentalVStack as VStack, Button, TextControl, Modal } from '@wordpress/components';
7
7
  import { __ } from '@wordpress/i18n';
8
8
  import { useState } from '@wordpress/element';
9
+
10
+ const notEmptyString = testString => testString?.trim()?.length > 0;
11
+
9
12
  export default function RenameModal({
10
13
  menuTitle,
11
14
  onClose,
12
15
  onSave
13
16
  }) {
14
17
  const [editedMenuTitle, setEditedMenuTitle] = useState(menuTitle);
18
+ const titleHasChanged = editedMenuTitle !== menuTitle;
19
+ const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle);
15
20
  return createElement(Modal, {
16
21
  title: __('Rename'),
17
22
  onRequestClose: onClose
@@ -30,11 +35,16 @@ export default function RenameModal({
30
35
  variant: "tertiary",
31
36
  onClick: onClose
32
37
  }, __('Cancel')), createElement(Button, {
33
- disabled: editedMenuTitle === menuTitle,
38
+ disabled: !isEditedMenuTitleValid,
34
39
  variant: "primary",
35
40
  type: "submit",
36
41
  onClick: e => {
37
42
  e.preventDefault();
43
+
44
+ if (!isEditedMenuTitleValid) {
45
+ return;
46
+ }
47
+
38
48
  onSave({
39
49
  title: editedMenuTitle
40
50
  }); // Immediate close avoids ability to hit save multiple times.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","__","useState","RenameModal","menuTitle","onClose","onSave","editedMenuTitle","setEditedMenuTitle","e","preventDefault","title"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,MAHD,EAICC,WAJD,EAKCC,KALD,QAMO,uBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA,eAAe,SAASC,WAAT,CAAsB;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,OAAb;AAAsBC,EAAAA;AAAtB,CAAtB,EAAuD;AACrE,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0CN,QAAQ,CAAEE,SAAF,CAAxD;AAEA,SACC,cAAC,KAAD;AAAO,IAAA,KAAK,EAAGH,EAAE,CAAE,QAAF,CAAjB;AAAgC,IAAA,cAAc,EAAGI;AAAjD,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,WAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGE,eAFT;AAGC,IAAA,WAAW,EAAGN,EAAE,CAAE,kBAAF,CAHjB;AAIC,IAAA,QAAQ,EAAGO;AAJZ,IADD,EAOC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,UAAhB;AAA2B,IAAA,OAAO,EAAGH;AAArC,KACGJ,EAAE,CAAE,QAAF,CADL,CADD,EAKC,cAAC,MAAD;AACC,IAAA,QAAQ,EAAGM,eAAe,KAAKH,SADhC;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,IAAI,EAAC,QAHN;AAIC,IAAA,OAAO,EAAKK,CAAF,IAAS;AAClBA,MAAAA,CAAC,CAACC,cAAF;AACAJ,MAAAA,MAAM,CAAE;AAAEK,QAAAA,KAAK,EAAEJ;AAAT,OAAF,CAAN,CAFkB,CAIlB;;AACAF,MAAAA,OAAO;AACP;AAVF,KAYGJ,EAAE,CAAE,MAAF,CAZL,CALD,CAPD,CADD,CADD,CADD;AAkCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\nexport default function RenameModal( { menuTitle, onClose, onSave } ) {\n\tconst [ editedMenuTitle, setEditedMenuTitle ] = useState( menuTitle );\n\n\treturn (\n\t\t<Modal title={ __( 'Rename' ) } onRequestClose={ onClose }>\n\t\t\t<form className=\"sidebar-navigation__rename-modal-form\">\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedMenuTitle }\n\t\t\t\t\t\tplaceholder={ __( 'Navigation title' ) }\n\t\t\t\t\t\tonChange={ setEditedMenuTitle }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdisabled={ editedMenuTitle === menuTitle }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tonSave( { title: editedMenuTitle } );\n\n\t\t\t\t\t\t\t\t// Immediate close avoids ability to hit save multiple times.\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","__","useState","notEmptyString","testString","trim","length","RenameModal","menuTitle","onClose","onSave","editedMenuTitle","setEditedMenuTitle","titleHasChanged","isEditedMenuTitleValid","e","preventDefault","title"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,MAHD,EAICC,WAJD,EAKCC,KALD,QAMO,uBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;;AAEA,MAAMC,cAAc,GAAKC,UAAF,IAAkBA,UAAU,EAAEC,IAAZ,IAAoBC,MAApB,GAA6B,CAAtE;;AAEA,eAAe,SAASC,WAAT,CAAsB;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,OAAb;AAAsBC,EAAAA;AAAtB,CAAtB,EAAuD;AACrE,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0CV,QAAQ,CAAEM,SAAF,CAAxD;AAEA,QAAMK,eAAe,GAAGF,eAAe,KAAKH,SAA5C;AAEA,QAAMM,sBAAsB,GAC3BD,eAAe,IAAIV,cAAc,CAAEQ,eAAF,CADlC;AAGA,SACC,cAAC,KAAD;AAAO,IAAA,KAAK,EAAGV,EAAE,CAAE,QAAF,CAAjB;AAAgC,IAAA,cAAc,EAAGQ;AAAjD,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,WAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGE,eAFT;AAGC,IAAA,WAAW,EAAGV,EAAE,CAAE,kBAAF,CAHjB;AAIC,IAAA,QAAQ,EAAGW;AAJZ,IADD,EAOC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,UAAhB;AAA2B,IAAA,OAAO,EAAGH;AAArC,KACGR,EAAE,CAAE,QAAF,CADL,CADD,EAKC,cAAC,MAAD;AACC,IAAA,QAAQ,EAAG,CAAEa,sBADd;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,IAAI,EAAC,QAHN;AAIC,IAAA,OAAO,EAAKC,CAAF,IAAS;AAClBA,MAAAA,CAAC,CAACC,cAAF;;AAEA,UAAK,CAAEF,sBAAP,EAAgC;AAC/B;AACA;;AACDJ,MAAAA,MAAM,CAAE;AAAEO,QAAAA,KAAK,EAAEN;AAAT,OAAF,CAAN,CANkB,CAQlB;;AACAF,MAAAA,OAAO;AACP;AAdF,KAgBGR,EAAE,CAAE,MAAF,CAhBL,CALD,CAPD,CADD,CADD,CADD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\nconst notEmptyString = ( testString ) => testString?.trim()?.length > 0;\n\nexport default function RenameModal( { menuTitle, onClose, onSave } ) {\n\tconst [ editedMenuTitle, setEditedMenuTitle ] = useState( menuTitle );\n\n\tconst titleHasChanged = editedMenuTitle !== menuTitle;\n\n\tconst isEditedMenuTitleValid =\n\t\ttitleHasChanged && notEmptyString( editedMenuTitle );\n\n\treturn (\n\t\t<Modal title={ __( 'Rename' ) } onRequestClose={ onClose }>\n\t\t\t<form className=\"sidebar-navigation__rename-modal-form\">\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedMenuTitle }\n\t\t\t\t\t\tplaceholder={ __( 'Navigation title' ) }\n\t\t\t\t\t\tonChange={ setEditedMenuTitle }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdisabled={ ! isEditedMenuTitleValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\t\t\tif ( ! isEditedMenuTitleValid ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSave( { title: editedMenuTitle } );\n\n\t\t\t\t\t\t\t\t// Immediate close avoids ability to hit save multiple times.\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
3
  /**
4
4
  * WordPress dependencies
@@ -12,6 +12,8 @@ import { decodeEntities } from '@wordpress/html-entities';
12
12
  import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';
13
13
  import ScreenNavigationMoreMenu from './more-menu';
14
14
  import NavigationMenuEditor from './navigation-menu-editor';
15
+ import buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';
16
+ import EditButton from './edit-button';
15
17
  export default function SingleNavigationMenu({
16
18
  navigationMenu,
17
19
  handleDelete,
@@ -20,13 +22,15 @@ export default function SingleNavigationMenu({
20
22
  }) {
21
23
  const menuTitle = navigationMenu?.title?.rendered;
22
24
  return createElement(SidebarNavigationScreenWrapper, {
23
- actions: createElement(ScreenNavigationMoreMenu, {
25
+ actions: createElement(Fragment, null, createElement(EditButton, {
26
+ postId: navigationMenu?.id
27
+ }), createElement(ScreenNavigationMoreMenu, {
24
28
  menuTitle: decodeEntities(menuTitle),
25
29
  onDelete: handleDelete,
26
30
  onSave: handleSave,
27
31
  onDuplicate: handleDuplicate
28
- }),
29
- title: decodeEntities(menuTitle),
32
+ })),
33
+ title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
30
34
  description: __('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
31
35
  }, createElement(NavigationMenuEditor, {
32
36
  navigationMenuId: navigationMenu?.id
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"names":["__","decodeEntities","SidebarNavigationScreenWrapper","ScreenNavigationMoreMenu","NavigationMenuEditor","SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","id"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,+CAA/C;AACA,OAAOC,wBAAP,MAAqC,aAArC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AAEA,eAAe,SAASC,oBAAT,CAA+B;AAC7CC,EAAAA,cAD6C;AAE7CC,EAAAA,YAF6C;AAG7CC,EAAAA,eAH6C;AAI7CC,EAAAA;AAJ6C,CAA/B,EAKX;AACH,QAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAhB,EAAuBC,QAAzC;AAEA,SACC,cAAC,8BAAD;AACC,IAAA,OAAO,EACN,cAAC,wBAAD;AACC,MAAA,SAAS,EAAGX,cAAc,CAAES,SAAF,CAD3B;AAEC,MAAA,QAAQ,EAAGH,YAFZ;AAGC,MAAA,MAAM,EAAGE,UAHV;AAIC,MAAA,WAAW,EAAGD;AAJf,MAFF;AASC,IAAA,KAAK,EAAGP,cAAc,CAAES,SAAF,CATvB;AAUC,IAAA,WAAW,EAAGV,EAAE,CACf,kGADe;AAVjB,KAcC,cAAC,oBAAD;AAAsB,IAAA,gBAAgB,EAAGM,cAAc,EAAEO;AAAzD,IAdD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t/>\n\t\t\t}\n\t\t\ttitle={ decodeEntities( menuTitle ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"names":["__","decodeEntities","SidebarNavigationScreenWrapper","ScreenNavigationMoreMenu","NavigationMenuEditor","buildNavigationLabel","EditButton","SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","id","status"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,+CAA/C;AACA,OAAOC,wBAAP,MAAqC,aAArC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,oBAAP,MAAiC,sEAAjC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,eAAe,SAASC,oBAAT,CAA+B;AAC7CC,EAAAA,cAD6C;AAE7CC,EAAAA,YAF6C;AAG7CC,EAAAA,eAH6C;AAI7CC,EAAAA;AAJ6C,CAA/B,EAKX;AACH,QAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAhB,EAAuBC,QAAzC;AAEA,SACC,cAAC,8BAAD;AACC,IAAA,OAAO,EACN,8BACC,cAAC,UAAD;AAAY,MAAA,MAAM,EAAGN,cAAc,EAAEO;AAArC,MADD,EAEC,cAAC,wBAAD;AACC,MAAA,SAAS,EAAGd,cAAc,CAAEW,SAAF,CAD3B;AAEC,MAAA,QAAQ,EAAGH,YAFZ;AAGC,MAAA,MAAM,EAAGE,UAHV;AAIC,MAAA,WAAW,EAAGD;AAJf,MAFD,CAFF;AAYC,IAAA,KAAK,EAAGL,oBAAoB,CAC3BG,cAAc,EAAEK,KADW,EAE3BL,cAAc,EAAEO,EAFW,EAG3BP,cAAc,EAAEQ,MAHW,CAZ7B;AAiBC,IAAA,WAAW,EAAGhB,EAAE,CACf,kGADe;AAjBjB,KAqBC,cAAC,oBAAD;AAAsB,IAAA,gBAAgB,EAAGQ,cAAc,EAAEO;AAAzD,IArBD,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\nimport EditButton from './edit-button';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<EditButton postId={ navigationMenu?.id } />\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\tnavigationMenu?.title,\n\t\t\t\tnavigationMenu?.id,\n\t\t\t\tnavigationMenu?.status\n\t\t\t) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"]}
@@ -69,7 +69,11 @@ function useSaveNavigationMenu() {
69
69
  createErrorNotice
70
70
  } = useDispatch(noticesStore);
71
71
 
72
- const handleSave = async (navigationMenu, edits = {}) => {
72
+ const handleSave = async (navigationMenu, edits) => {
73
+ if (!edits) {
74
+ return;
75
+ }
76
+
73
77
  const postId = navigationMenu?.id; // Prepare for revert in case of error.
74
78
 
75
79
  const originalRecord = getEditedEntityRecord('postType', 'wp_navigation', postId); // Apply the edits.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"names":["store","coreStore","__experimentalUseNavigator","useNavigator","__","sprintf","useSelect","useDispatch","noticesStore","postType","useDeleteNavigationMenu","goTo","deleteEntityRecord","createSuccessNotice","createErrorNotice","handleDelete","navigationMenu","postId","id","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","saveEditedEntityRecord","handleSave","edits","originalRecord","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,YAAlB,QAAsC,oBAAtC;AACA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,GAAzB;;AAEA,SAASC,uBAAT,GAAmC;AAClC,QAAM;AAAEC,IAAAA;AAAF,MAAWR,YAAY,EAA7B;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAyBL,WAAW,CAAEN,SAAF,CAA1C;AAEA,QAAM;AAAEY,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACLP,WAAW,CAAEC,YAAF,CADZ;;AAGA,QAAMO,YAAY,GAAG,MAAQC,cAAR,IAA4B;AAChD,UAAMC,MAAM,GAAGD,cAAc,EAAEE,EAA/B;;AACA,QAAI;AACH,YAAMN,kBAAkB,CACvB,UADuB,EAEvBH,QAFuB,EAGvBQ,MAHuB,EAIvB;AACCE,QAAAA,KAAK,EAAE;AADR,OAJuB,EAOvB;AACCC,QAAAA,YAAY,EAAE;AADf,OAPuB,CAAxB;AAWAP,MAAAA,mBAAmB,CAAET,EAAE,CAAE,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B,WAAL,EAAmB;AAClB3B,QAAAA,mBAAmB,CAAET,EAAE,CAAE,4BAAF,CAAJ,EAAsC;AACxDiB,UAAAA,IAAI,EAAE;AADkD,SAAtC,CAAnB;AAGAV,QAAAA,IAAI,CAAG,eAAeF,QAAU,IAAI+B,WAAW,CAACtB,EAAI,EAAhD,CAAJ;AACA;AACD,KAxBD,CAwBE,OAAQI,KAAR,EAAgB;AACjBR,MAAAA,iBAAiB,CAChBT,OAAO;AACN;AACAD,MAAAA,EAAE,CAAG,2CAAH,CAFI,EAGNkB,KAAK,EAAEC,OAHD,CADS,EAOhB;AACCF,QAAAA,IAAI,EAAE;AADP,OAPgB,CAAjB;AAWA;AACD,GAzCD;;AA2CA,SAAOc,eAAP;AACA;;AAED,eAAe,SAASS,yBAAT,GAAqC;AACnD,SAAO;AACN7B,IAAAA,YAAY,EAAEL,uBAAuB,EAD/B;AAENoB,IAAAA,UAAU,EAAEN,qBAAqB,EAF3B;AAGNW,IAAAA,eAAe,EAAEF,0BAA0B;AAHrC,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Deleted Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tgoTo( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits = {} ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_navigation',\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveEditedEntityRecord( 'postType', postType, postId, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tgoTo( `/navigation/${ postType }/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"names":["store","coreStore","__experimentalUseNavigator","useNavigator","__","sprintf","useSelect","useDispatch","noticesStore","postType","useDeleteNavigationMenu","goTo","deleteEntityRecord","createSuccessNotice","createErrorNotice","handleDelete","navigationMenu","postId","id","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","saveEditedEntityRecord","handleSave","edits","originalRecord","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,YAAlB,QAAsC,oBAAtC;AACA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,GAAzB;;AAEA,SAASC,uBAAT,GAAmC;AAClC,QAAM;AAAEC,IAAAA;AAAF,MAAWR,YAAY,EAA7B;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAyBL,WAAW,CAAEN,SAAF,CAA1C;AAEA,QAAM;AAAEY,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACLP,WAAW,CAAEC,YAAF,CADZ;;AAGA,QAAMO,YAAY,GAAG,MAAQC,cAAR,IAA4B;AAChD,UAAMC,MAAM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C;AACC4B,QAAAA,KAAK,EAAEhC,OAAO;AACb;AACAD,QAAAA,EAAE,CAAE,WAAF,CAFW,EAGbgC,SAHa,CADf;AAMCK,QAAAA,OAAO,EAAEzB,cAAc,EAAEyB,OAAhB,EAAyBC,GANnC;AAOCC,QAAAA,MAAM,EAAE;AAPT,OAHyC,EAYzC;AACCvB,QAAAA,YAAY,EAAE;AADf,OAZyC,CAA1C;;AAiBA,UAAKoB,WAAL,EAAmB;AAClB3B,QAAAA,mBAAmB,CAAET,EAAE,CAAE,4BAAF,CAAJ,EAAsC;AACxDiB,UAAAA,IAAI,EAAE;AADkD,SAAtC,CAAnB;AAGAV,QAAAA,IAAI,CAAG,eAAeF,QAAU,IAAI+B,WAAW,CAACtB,EAAI,EAAhD,CAAJ;AACA;AACD,KAxBD,CAwBE,OAAQI,KAAR,EAAgB;AACjBR,MAAAA,iBAAiB,CAChBT,OAAO;AACN;AACAD,MAAAA,EAAE,CAAG,2CAAH,CAFI,EAGNkB,KAAK,EAAEC,OAHD,CADS,EAOhB;AACCF,QAAAA,IAAI,EAAE;AADP,OAPgB,CAAjB;AAWA;AACD,GAzCD;;AA2CA,SAAOc,eAAP;AACA;;AAED,eAAe,SAASS,yBAAT,GAAqC;AACnD,SAAO;AACN7B,IAAAA,YAAY,EAAEL,uBAAuB,EAD/B;AAENoB,IAAAA,UAAU,EAAEN,qBAAqB,EAF3B;AAGNW,IAAAA,eAAe,EAAEF,0BAA0B;AAHrC,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Deleted Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tgoTo( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_navigation',\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveEditedEntityRecord( 'postType', postType, postId, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tgoTo( `/navigation/${ postType }/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __, sprintf } from '@wordpress/i18n';
5
+ import { decodeEntities } from '@wordpress/html-entities'; // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
6
+
7
+ export default function buildNavigationLabel(title, id, status) {
8
+ if (!title?.rendered) {
9
+ /* translators: %s is the index of the menu in the list of menus. */
10
+ return sprintf(__('(no title %s)'), id);
11
+ }
12
+
13
+ if (status === 'publish') {
14
+ return decodeEntities(title?.rendered);
15
+ }
16
+
17
+ return sprintf( // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
18
+ __('%1$s (%2$s)'), decodeEntities(title?.rendered), status);
19
+ }
20
+ //# sourceMappingURL=build-navigation-label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js"],"names":["__","sprintf","decodeEntities","buildNavigationLabel","title","id","status","rendered"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,cAAT,QAA+B,0BAA/B,C,CAEA;;AACA,eAAe,SAASC,oBAAT,CAA+BC,KAA/B,EAAsCC,EAAtC,EAA0CC,MAA1C,EAAmD;AACjE,MAAK,CAAEF,KAAK,EAAEG,QAAd,EAAyB;AACxB;AACA,WAAON,OAAO,CAAED,EAAE,CAAE,eAAF,CAAJ,EAAyBK,EAAzB,CAAd;AACA;;AAED,MAAKC,MAAM,KAAK,SAAhB,EAA4B;AAC3B,WAAOJ,cAAc,CAAEE,KAAK,EAAEG,QAAT,CAArB;AACA;;AAED,SAAON,OAAO,EACb;AACAD,EAAAA,EAAE,CAAE,aAAF,CAFW,EAGbE,cAAc,CAAEE,KAAK,EAAEG,QAAT,CAHD,EAIbD,MAJa,CAAd;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nexport default function buildNavigationLabel( title, id, status ) {\n\tif ( ! title?.rendered ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title?.rendered );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title?.rendered ),\n\t\tstatus\n\t);\n}\n"]}
@@ -4,7 +4,8 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __, sprintf } from '@wordpress/i18n';
7
- import { useEntityRecords } from '@wordpress/core-data';
7
+ import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
8
+ import { useSelect } from '@wordpress/data';
8
9
  import { decodeEntities } from '@wordpress/html-entities';
9
10
  import { __experimentalItemGroup as ItemGroup, Spinner } from '@wordpress/components';
10
11
  import { navigation } from '@wordpress/icons';
@@ -17,7 +18,8 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
17
18
  import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
18
19
  import { useLink } from '../routes/link';
19
20
  import SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';
20
- import useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers'; // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
21
+ import useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';
22
+ import { unlock } from '../../lock-unlock'; // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
21
23
 
22
24
  function buildMenuLabel(title, id, status) {
23
25
  if (!title?.rendered) {
@@ -31,14 +33,32 @@ function buildMenuLabel(title, id, status) {
31
33
 
32
34
  return sprintf( // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
33
35
  __('%1$s (%2$s)'), decodeEntities(title?.rendered), status);
34
- }
36
+ } // Save a boolean to prevent us creating a fallback more than once per session.
37
+
35
38
 
39
+ let hasCreatedFallback = false;
36
40
  export default function SidebarNavigationScreenNavigationMenus() {
37
41
  const {
38
42
  records: navigationMenus,
39
- isResolving: isLoading
43
+ isResolving: isResolvingNavigationMenus,
44
+ hasResolved: hasResolvedNavigationMenus
40
45
  } = useEntityRecords('postType', `wp_navigation`, PRELOADED_NAVIGATION_MENUS_QUERY);
41
- const firstNavigationMenu = navigationMenus?.[0];
46
+ const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
47
+ const {
48
+ getNavigationFallbackId
49
+ } = unlock(useSelect(coreStore));
50
+ const firstNavigationMenu = navigationMenus?.[0]; // Save a boolean to prevent us creating a fallback more than once per session.
51
+
52
+ if (firstNavigationMenu) {
53
+ hasCreatedFallback = true;
54
+ } // If there is no navigation menu found
55
+ // then trigger fallback algorithm to create one.
56
+
57
+
58
+ if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && !hasCreatedFallback) {
59
+ getNavigationFallbackId();
60
+ }
61
+
42
62
  const {
43
63
  handleSave,
44
64
  handleDelete,
@@ -64,7 +84,7 @@ export default function SidebarNavigationScreenNavigationMenus() {
64
84
  navigationMenu: firstNavigationMenu,
65
85
  handleDelete: () => handleDelete(firstNavigationMenu),
66
86
  handleDuplicate: () => handleDuplicate(firstNavigationMenu),
67
- handleSave: () => handleSave(firstNavigationMenu)
87
+ handleSave: edits => handleSave(firstNavigationMenu, edits)
68
88
  });
69
89
  }
70
90
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","sprintf","useEntityRecords","decodeEntities","__experimentalItemGroup","ItemGroup","Spinner","navigation","SidebarNavigationScreen","SidebarNavigationItem","PRELOADED_NAVIGATION_MENUS_QUERY","useLink","SingleNavigationMenu","useNavigationMenuHandlers","buildMenuLabel","title","id","status","rendered","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isLoading","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","hasNavigationMenus","length","map","index","SidebarNavigationScreenWrapper","children","actions","description","NavMenuItem","postId","props","linkInfo","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AAEA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,OAFD,QAGO,uBAHP;AAIA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,gCAAT,QAAiD,aAAjD;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,oBAAP,MAAiC,qEAAjC;AACA,OAAOC,yBAAP,MAAsC,2EAAtC,C,CAEA;;AACA,SAASC,cAAT,CAAyBC,KAAzB,EAAgCC,EAAhC,E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e,EAAG,MAAMG,eAAe,CAAEH,mBAAF,CAHxC;AAIC,MAAA,UAAU,EAAG,MAAMC,UAAU,CAAED,mBAAF;AAJ9B,MADD;AAQA;;AAED,SACC,cAAC,8BAAD,QACC,cAAC,SAAD,QACGH,eAAe,EAAES,GAAjB,CAAsB,CAAE;AAAEd,IAAAA,EAAF;AAAMD,IAAAA,KAAN;AAAaE,IAAAA;AAAb,GAAF,EAAyBc,KAAzB,KACvB,cAAC,WAAD;AACC,IAAA,MAAM,EAAGf,EADV;AAEC,IAAA,GAAG,EAAGA,EAFP;AAGC,IAAA,WAAW,MAHZ;AAIC,IAAA,IAAI,EAAGT;AAJR,KAMGO,cAAc,CAAEC,KAAF,EAASgB,KAAK,GAAG,CAAjB,EAAoBd,MAApB,CANjB,CADC,CADH,CADD,CADD;AAgBA;AAED,OAAO,SAASe,8BAAT,CAAyC;AAC/CC,EAAAA,QAD+C;AAE/CC,EAAAA,OAF+C;AAG/CnB,EAAAA,KAH+C;AAI/CoB,EAAAA;AAJ+C,CAAzC,EAKH;AACH,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGpB,KAAK,IAAIf,EAAE,CAAE,YAAF,CADpB;AAEC,IAAA,OAAO,EAAGkC,OAFX;AAGC,IAAA,WAAW,EAAGC,WAAW,IAAInC,EAAE,CAAE,+BAAF,CAHhC;AAIC,IAAA,OAAO,EAAGiC;AAJX,IADD;AAQA;;AAED,MAAMG,WAAW,GAAG,CAAE;AAAEC,EAAAA,MAAF;AAAU,KAAGC;AAAb,CAAF,KAA4B;AAC/C,QAAMC,QAAQ,GAAG5B,OAAO,CAAE;AACzB0B,IAAAA,MADyB;AAEzBG,IAAAA,QAAQ,EAAE;AAFe,GAAF,CAAxB;AAIA,SAAO,cAAC,qBAAD,OAA4BD,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title?.rendered ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title?.rendered );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title?.rendered ),\n\t\tstatus\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst { records: navigationMenus, isResolving: isLoading } =\n\t\tuseEntityRecords(\n\t\t\t'postType',\n\t\t\t`wp_navigation`,\n\t\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t\t);\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ () => handleSave( firstNavigationMenu ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation menus.' ) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","sprintf","useEntityRecords","store","coreStore","useSelect","decodeEntities","__experimentalItemGroup","ItemGroup","Spinner","navigation","SidebarNavigationScreen","SidebarNavigationItem","PRELOADED_NAVIGATION_MENUS_QUERY","useLink","SingleNavigationMenu","useNavigationMenuHandlers","unlock","buildMenuLabel","title","id","status","rendered","hasCreatedFallback","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","isLoading","getNavigationFallbackId","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","hasNavigationMenus","length","edits","map","index","SidebarNavigationScreenWrapper","children","actions","description","NavMenuItem","postId","props","linkInfo","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,gBAAT,EAA2BC,KAAK,IAAIC,SAApC,QAAqD,sBAArD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,OAFD,QAGO,uBAHP;AAIA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,gCAAT,QAAiD,aAAjD;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,oBAAP,MAAiC,qEAAjC;AACA,OAAOC,yBAAP,MAAsC,2EAAtC;AACA,SAASC,MAAT,QAAuB,mBAAvB,C,CAEA;;AACA,SAASC,cAAT,CAAyBC,KAAzB,EAAgCC,EAAhC,EAAoCC,MAApC,EAA6C;AAC5C,MAAK,CAAEF,KAAK,EAAEG,QAAd,EAAyB;AACxB;AACA,WAAOrB,OAAO,CAAED,EAAE,CAAE,eAAF,CAAJ,EAAyBoB,EAAzB,CAAd;AACA;;AAED,MAAKC,MAAM,KAAK,SAAhB,EAA4B;AAC3B,WAAOf,cAAc,CAAEa,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,GAAGnC,OAAO,CAAE;AACzBiC,IAAAA,MADyB;AAEzBG,IAAAA,QAAQ,EAAE;AAFe,GAAF,CAAxB;AAIA,SAAO,cAAC,qBAAD,OAA4BD,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\nimport { unlock } from '../../lock-unlock';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title?.rendered ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title?.rendered );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title?.rendered ),\n\t\tstatus\n\t);\n}\n\n// Save a boolean to prevent us creating a fallback more than once per session.\nlet hasCreatedFallback = false;\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst {\n\t\trecords: navigationMenus,\n\t\tisResolving: isResolvingNavigationMenus,\n\t\thasResolved: hasResolvedNavigationMenus,\n\t} = useEntityRecords(\n\t\t'postType',\n\t\t`wp_navigation`,\n\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t);\n\n\tconst isLoading =\n\t\tisResolvingNavigationMenus && ! hasResolvedNavigationMenus;\n\n\tconst { getNavigationFallbackId } = unlock( useSelect( coreStore ) );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\t// Save a boolean to prevent us creating a fallback more than once per session.\n\tif ( firstNavigationMenu ) {\n\t\thasCreatedFallback = true;\n\t}\n\n\t// If there is no navigation menu found\n\t// then trigger fallback algorithm to create one.\n\tif (\n\t\t! firstNavigationMenu &&\n\t\t! isResolvingNavigationMenus &&\n\t\thasResolvedNavigationMenus &&\n\t\t! hasCreatedFallback\n\t) {\n\t\tgetNavigationFallbackId();\n\t}\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ ( edits ) =>\n\t\t\t\t\thandleSave( firstNavigationMenu, edits )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation menus.' ) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"]}
@@ -65,7 +65,7 @@ function getPageDetails(page) {
65
65
  const wordsCounted = page?.content?.rendered ? wordCount(page.content.rendered, wordCountType) : 0;
66
66
  const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
67
67
 
68
- if (wordsCounted) {
68
+ if (wordsCounted && !page?.isPostsPage) {
69
69
  details.push({
70
70
  label: __('Words'),
71
71
  value: wordsCounted.toLocaleString() || __('Unknown')
@@ -88,7 +88,8 @@ export default function PageDetails({
88
88
  } = useEntityRecord('postType', 'page', id);
89
89
  const {
90
90
  parentTitle,
91
- templateTitle
91
+ templateTitle,
92
+ isPostsPage
92
93
  } = useSelect(select => {
93
94
  const {
94
95
  getEditedPostContext
@@ -109,17 +110,23 @@ export default function PageDetails({
109
110
  _fields: ['title']
110
111
  })?.title?.rendered : null;
111
112
 
113
+ const {
114
+ getEntityRecord
115
+ } = select(coreStore);
116
+ const siteSettings = getEntityRecord('root', 'site');
112
117
  return {
113
118
  parentTitle: _parentTitle,
114
- templateTitle: _templateTitle
119
+ templateTitle: _templateTitle,
120
+ isPostsPage: record?.id === siteSettings?.page_for_posts
115
121
  };
116
- }, [record?.parent]);
122
+ }, [record?.parent, record?.id]);
117
123
  return createElement(SidebarNavigationScreenDetailsPanel, {
118
124
  spacing: 5,
119
125
  title: __('Details')
120
126
  }, getPageDetails({
121
127
  parentTitle,
122
128
  templateTitle,
129
+ isPostsPage,
123
130
  ...record
124
131
  }).map(({
125
132
  label,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"names":["__","_x","sprintf","__experimentalTruncate","Truncate","count","wordCount","useSelect","decodeEntities","store","coreStore","useEntityRecord","safeDecodeURIComponent","StatusLabel","unlock","editSiteStore","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","AVERAGE_READING_RATE","getPageDetails","page","details","label","value","password","status","date","slug","templateTitle","push","parentTitle","wordCountType","wordsCounted","content","rendered","readingTime","Math","round","toLocaleString","PageDetails","id","record","select","getEditedPostContext","postContext","templates","getEntityRecords","per_page","templateSlug","postType","_templateTitle","find","template","title","_parentTitle","parent","getEntityRecord","_fields","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,sBAAsB,IAAIC,QAAnC,QAAmD,uBAAnD;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,eAA7B,QAAoD,sBAApD;AACA,SAASC,sBAAT,QAAuC,gBAA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CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent( page.slug ) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext } = unlock( select( editSiteStore ) );\n\t\t\tconst postContext = getEditedPostContext();\n\t\t\tconst templates = select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t);\n\t\t\t// Template title.\n\t\t\tconst templateSlug =\n\t\t\t\t// Checks that the post type matches the current theme's post type, otherwise\n\t\t\t\t// the templateSlug returns 'home'.\n\t\t\t\tpostContext?.postType === 'page'\n\t\t\t\t\t? postContext?.templateSlug\n\t\t\t\t\t: null;\n\t\t\tconst _templateTitle =\n\t\t\t\ttemplates && templateSlug\n\t\t\t\t\t? templates.find(\n\t\t\t\t\t\t\t( template ) => template.slug === templateSlug\n\t\t\t\t\t )?.title?.rendered\n\t\t\t\t\t: null;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"names":["__","_x","sprintf","__experimentalTruncate","Truncate","count","wordCount","useSelect","decodeEntities","store","coreStore","useEntityRecord","safeDecodeURIComponent","StatusLabel","unlock","editSiteStore","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","AVERAGE_READING_RATE","getPageDetails","page","details","label","value","password","status","date","slug","templateTitle","push","parentTitle","wordCountType","wordsCounted","content","rendered","readingTime","Math","round","isPostsPage","toLocaleString","PageDetails","id","record","select","getEditedPostContext","postContext","templates","getEntityRecords","per_page","templateSlug","postType","_templateTitle","find","template","title","_parentTitle","parent","getEntityRecord","_fields","siteSettings","page_for_posts","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,sBAAsB,IAAIC,QAAnC,QAAmD,uBAAnD;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,eAA7B,QAAoD,sBAApD;AACA,SAASC,sBAAT,QAAuC,gBAAvC;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,aAAvC;AACA,SACCC,mCADD,EAECC,sCAFD,EAGCC,wCAHD,EAICC,wCAJD,QAKO,4CALP,C,CAOA;;AACA,MAAMC,oBAAoB,GAAG,GAA7B;;AAEA,SAASC,cAAT,CAAyBC,IAAzB,EAAgC;AAC/B,MAAK,CAAEA,IAAP,EAAc;AACb,WAAO,EAAP;AACA;;AAED,QAAMC,OAAO,GAAG,CACf;AACCC,IAAAA,KAAK,EAAExB,EAAE,CAAE,QAAF,CADV;AAECyB,IAAAA,KAAK,EACJ,cAAC,WAAD;AACC,MAAA,MAAM,EAAGH,IAAI,EAAEI,QAAN,GAAiB,WAAjB,GAA+BJ,IAAI,CAACK,MAD9C;AAEC,MAAA,IAAI,EAAGL,IAAI,EAAEM,IAFd;AAGC,MAA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A,UADA,EAEA,MAFA,EAGAf,MAAM,CAACc,MAHP,EAIA;AACCE,MAAAA,OAAO,EAAE,CAAE,OAAF;AADV,KAJA,GAOGJ,KAPH,EAOUpB,QARQ,GASlB,IATH;;AAWA,UAAM;AAAEuB,MAAAA;AAAF,QAAsBd,MAAM,CAAEnC,SAAF,CAAlC;AACA,UAAMmD,YAAY,GAAGF,eAAe,CAAE,MAAF,EAAU,MAAV,CAApC;AAEA,WAAO;AACN3B,MAAAA,WAAW,EAAEyB,YADP;AAEN3B,MAAAA,aAAa,EAAEuB,cAFT;AAGNb,MAAAA,WAAW,EAAEI,MAAM,EAAED,EAAR,KAAekB,YAAY,EAAEC;AAHpC,KAAP;AAKA,GA3C2D,EA4C5D,CAAElB,MAAM,EAAEc,MAAV,EAAkBd,MAAM,EAAED,EAA1B,CA5C4D,CAA7D;AA8CA,SACC,cAAC,mCAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,KAAK,EAAG3C,EAAE,CAAE,SAAF;AAFX,KAIGqB,cAAc,CAAE;AACjBW,IAAAA,WADiB;AAEjBF,IAAAA,aAFiB;AAGjBU,IAAAA,WAHiB;AAIjB,OAAGI;AAJc,GAAF,CAAd,CAKEmB,GALF,CAKO,CAAE;AAAEvC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF,KACR,cAAC,sCAAD;AAAwC,IAAA,GAAG,EAAGD;AAA9C,KACC,cAAC,wCAAD,QACGA,KADH,CADD,EAIC,cAAC,wCAAD,QACGC,KADH,CAJD,CANC,CAJH,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent( page.slug ) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted && ! page?.isPostsPage ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle, isPostsPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext } = unlock( select( editSiteStore ) );\n\t\t\tconst postContext = getEditedPostContext();\n\t\t\tconst templates = select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t);\n\t\t\t// Template title.\n\t\t\tconst templateSlug =\n\t\t\t\t// Checks that the post type matches the current theme's post type, otherwise\n\t\t\t\t// the templateSlug returns 'home'.\n\t\t\t\tpostContext?.postType === 'page'\n\t\t\t\t\t? postContext?.templateSlug\n\t\t\t\t\t: null;\n\t\t\tconst _templateTitle =\n\t\t\t\ttemplates && templateSlug\n\t\t\t\t\t? templates.find(\n\t\t\t\t\t\t\t( template ) => template.slug === templateSlug\n\t\t\t\t\t )?.title?.rendered\n\t\t\t\t\t: null;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t\tisPostsPage: record?.id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent, record?.id ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\tisPostsPage,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"]}
@@ -45,7 +45,7 @@ export default function StatusLabel({
45
45
  short
46
46
  }) {
47
47
  const relateToNow = humanTimeDiff(date);
48
- let statusLabel = '';
48
+ let statusLabel = status;
49
49
  let statusIcon = pendingIcon;
50
50
 
51
51
  switch (status) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["classnames","__","sprintf","dateI18n","getDate","humanTimeDiff","createInterpolateElement","Path","SVG","publishedIcon","draftIcon","pendingIcon","StatusLabel","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OAQkBD,WARlB,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { Path, SVG } from '@wordpress/primitives';\n\nconst publishedIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm-1.067-5.6 4.2-5.667.8.6-4.8 6.467-3-2.267.6-.8 2.2 1.667Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst draftIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-8 4a4 4 0 0 0 0-8v8Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst pendingIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z\"\n\t\t/>\n\t</SVG>\n);\n\nexport default function StatusLabel( { status, date, short } ) {\n\tconst relateToNow = humanTimeDiff( date );\n\tlet statusLabel = '';\n\tlet statusIcon = pendingIcon;\n\tswitch ( status ) {\n\t\tcase 'publish':\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was published. */\n\t\t\t\t\t\t\t__( 'Published <time>%s</time>' ),\n\t\t\t\t\t\t\trelateToNow\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Published' );\n\t\t\tstatusIcon = publishedIcon;\n\t\t\tbreak;\n\t\tcase 'future':\n\t\t\tconst formattedDate = dateI18n(\n\t\t\t\tshort ? 'M j' : 'F j',\n\t\t\t\tgetDate( date )\n\t\t\t);\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the formatted date and time on which the post is scheduled to be published. */\n\t\t\t\t\t\t\t__( 'Scheduled: <time>%s</time>' ),\n\t\t\t\t\t\t\tformattedDate\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Scheduled' );\n\t\t\tbreak;\n\t\tcase 'draft':\n\t\t\tstatusLabel = __( 'Draft' );\n\t\t\tstatusIcon = draftIcon;\n\t\t\tbreak;\n\t\tcase 'pending':\n\t\t\tstatusLabel = __( 'Pending' );\n\t\t\tbreak;\n\t\tcase 'private':\n\t\t\tstatusLabel = __( 'Private' );\n\t\t\tbreak;\n\t\tcase 'protected':\n\t\t\tstatusLabel = __( 'Password protected' );\n\t\t\tbreak;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-screen-page__status',\n\t\t\t\t{\n\t\t\t\t\t[ `has-status has-${ status }-status` ]: !! status,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ statusIcon } { statusLabel }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["classnames","__","sprintf","dateI18n","getDate","humanTimeDiff","createInterpolateElement","Path","SVG","publishedIcon","draftIcon","pendingIcon","StatusLabel","status","date","short","relateToNow","statusLabel","statusIcon","time","formattedDate"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,aAA5B,QAAiD,iBAAjD;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,MAAMC,aAAa,GAClB,cAAC,GAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,cAAC,IAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,SAAS,GACd,cAAC,GAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,cAAC,IAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,WAAW,GAChB,cAAC,GAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,cAAC,IAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,eAAe,SAASC,WAAT,CAAsB;AAAE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6CA,SACC;AACC,IAAA,SAAS,EAAGD,UAAU,CACrB,kDADqB,EAErB;AACC,OAAG,kBAAkBa,MAAQ,SAA7B,GAAyC,CAAC,CAAEA;AAD7C,KAFqB;AADvB,KAQGK,UARH,OAQkBD,WARlB,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { Path, SVG } from '@wordpress/primitives';\n\nconst publishedIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm-1.067-5.6 4.2-5.667.8.6-4.8 6.467-3-2.267.6-.8 2.2 1.667Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst draftIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-8 4a4 4 0 0 0 0-8v8Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst pendingIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z\"\n\t\t/>\n\t</SVG>\n);\n\nexport default function StatusLabel( { status, date, short } ) {\n\tconst relateToNow = humanTimeDiff( date );\n\tlet statusLabel = status;\n\tlet statusIcon = pendingIcon;\n\tswitch ( status ) {\n\t\tcase 'publish':\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was published. */\n\t\t\t\t\t\t\t__( 'Published <time>%s</time>' ),\n\t\t\t\t\t\t\trelateToNow\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Published' );\n\t\t\tstatusIcon = publishedIcon;\n\t\t\tbreak;\n\t\tcase 'future':\n\t\t\tconst formattedDate = dateI18n(\n\t\t\t\tshort ? 'M j' : 'F j',\n\t\t\t\tgetDate( date )\n\t\t\t);\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the formatted date and time on which the post is scheduled to be published. */\n\t\t\t\t\t\t\t__( 'Scheduled: <time>%s</time>' ),\n\t\t\t\t\t\t\tformattedDate\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Scheduled' );\n\t\t\tbreak;\n\t\tcase 'draft':\n\t\t\tstatusLabel = __( 'Draft' );\n\t\t\tstatusIcon = draftIcon;\n\t\t\tbreak;\n\t\tcase 'pending':\n\t\t\tstatusLabel = __( 'Pending' );\n\t\t\tbreak;\n\t\tcase 'private':\n\t\t\tstatusLabel = __( 'Private' );\n\t\t\tbreak;\n\t\tcase 'protected':\n\t\t\tstatusLabel = __( 'Password protected' );\n\t\t\tbreak;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-screen-page__status',\n\t\t\t\t{\n\t\t\t\t\t[ `has-status has-${ status }-status` ]: !! status,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ statusIcon } { statusLabel }\n\t\t</div>\n\t);\n}\n"]}
@@ -9,7 +9,7 @@ import { __ } from '@wordpress/i18n';
9
9
  import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
10
10
  import { decodeEntities } from '@wordpress/html-entities';
11
11
  import { privateApis as routerPrivateApis } from '@wordpress/router';
12
- import { layout, page, home, loop, plus } from '@wordpress/icons';
12
+ import { layout, page, home, verse, plus } from '@wordpress/icons';
13
13
  import { useSelect } from '@wordpress/data';
14
14
  /**
15
15
  * Internal dependencies
@@ -127,7 +127,7 @@ export default function SidebarNavigationScreenPages() {
127
127
  break;
128
128
 
129
129
  case postsPage:
130
- itemIcon = loop;
130
+ itemIcon = verse;
131
131
  break;
132
132
 
133
133
  default: