@wordpress/edit-site 5.33.0 → 5.34.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 (272) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +3 -0
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +8 -7
  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 +3 -0
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
  9. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  10. package/build/components/block-editor/resize-handle.js +20 -5
  11. package/build/components/block-editor/resize-handle.js.map +1 -1
  12. package/build/components/create-template-part-modal/index.js +3 -0
  13. package/build/components/create-template-part-modal/index.js.map +1 -1
  14. package/build/components/editor/index.js +28 -5
  15. package/build/components/editor/index.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/context.js +9 -3
  17. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
  19. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  21. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  23. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  24. package/build/components/global-styles/style-variations-container.js +8 -2
  25. package/build/components/global-styles/style-variations-container.js.map +1 -1
  26. package/build/components/header-edit-mode/index.js +33 -49
  27. package/build/components/header-edit-mode/index.js.map +1 -1
  28. package/build/components/header-edit-mode/more-menu/index.js +3 -97
  29. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  30. package/build/components/keyboard-shortcuts/register.js +0 -49
  31. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  32. package/build/components/layout/index.js +7 -4
  33. package/build/components/layout/index.js.map +1 -1
  34. package/build/components/layout/router.js +9 -38
  35. package/build/components/layout/router.js.map +1 -1
  36. package/build/components/page-pages/index.js +4 -3
  37. package/build/components/page-pages/index.js.map +1 -1
  38. package/build/components/page-patterns/dataviews-pattern-actions.js +11 -7
  39. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  40. package/build/components/page-patterns/header.js +3 -1
  41. package/build/components/page-patterns/header.js.map +1 -1
  42. package/build/components/page-patterns/index.js +20 -49
  43. package/build/components/page-patterns/index.js.map +1 -1
  44. package/build/components/page-patterns/use-patterns.js +1 -0
  45. package/build/components/page-patterns/use-patterns.js.map +1 -1
  46. package/build/components/page-templates/hooks.js.map +1 -0
  47. package/build/components/{page-templates-template-parts → page-templates}/index.js +67 -80
  48. package/build/components/page-templates/index.js.map +1 -0
  49. package/build/components/pattern-modal/duplicate.js +7 -5
  50. package/build/components/pattern-modal/duplicate.js.map +1 -1
  51. package/build/components/plugin-template-setting-panel/index.js +9 -0
  52. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  53. package/build/components/resizable-frame/index.js +9 -6
  54. package/build/components/resizable-frame/index.js.map +1 -1
  55. package/build/components/sidebar-edit-mode/index.js +3 -2
  56. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  57. package/build/components/sidebar-edit-mode/page-panels/index.js +40 -9
  58. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  59. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +24 -17
  60. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  61. package/build/components/sidebar-edit-mode/template-panel/index.js +2 -5
  62. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  63. package/build/components/sidebar-navigation-screen-page/index.js +39 -8
  64. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  65. package/build/components/sidebar-navigation-screen-pattern/index.js +6 -13
  66. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  67. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  68. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  69. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  70. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  71. package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  72. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  73. package/build/components/sidebar-navigation-screen-patterns/index.js +34 -28
  74. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  75. package/build/components/sidebar-navigation-screen-template/index.js +1 -1
  76. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  77. package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  78. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  79. package/build/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
  80. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  81. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  82. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  83. package/build/components/template-actions/index.js +1 -1
  84. package/build/components/template-actions/index.js.map +1 -1
  85. package/build/deprecated.js +55 -0
  86. package/build/deprecated.js.map +1 -0
  87. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +35 -4
  88. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  89. package/build/index.js +18 -18
  90. package/build/index.js.map +1 -1
  91. package/build/utils/constants.js +1 -2
  92. package/build/utils/constants.js.map +1 -1
  93. package/build-module/components/add-new-page/index.js +3 -0
  94. package/build-module/components/add-new-page/index.js.map +1 -1
  95. package/build-module/components/add-new-pattern/index.js +8 -7
  96. package/build-module/components/add-new-pattern/index.js.map +1 -1
  97. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  98. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  99. package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
  100. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  101. package/build-module/components/block-editor/resize-handle.js +21 -6
  102. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  103. package/build-module/components/create-template-part-modal/index.js +3 -0
  104. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  105. package/build-module/components/editor/index.js +28 -5
  106. package/build-module/components/editor/index.js.map +1 -1
  107. package/build-module/components/global-styles/font-library-modal/context.js +9 -3
  108. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  109. package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
  110. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  111. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  112. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  113. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  114. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  115. package/build-module/components/global-styles/style-variations-container.js +8 -2
  116. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  117. package/build-module/components/header-edit-mode/index.js +39 -55
  118. package/build-module/components/header-edit-mode/index.js.map +1 -1
  119. package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
  120. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  121. package/build-module/components/keyboard-shortcuts/register.js +0 -49
  122. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  123. package/build-module/components/layout/index.js +7 -4
  124. package/build-module/components/layout/index.js.map +1 -1
  125. package/build-module/components/layout/router.js +9 -38
  126. package/build-module/components/layout/router.js.map +1 -1
  127. package/build-module/components/page-pages/index.js +5 -4
  128. package/build-module/components/page-pages/index.js.map +1 -1
  129. package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -7
  130. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  131. package/build-module/components/page-patterns/header.js +3 -1
  132. package/build-module/components/page-patterns/header.js.map +1 -1
  133. package/build-module/components/page-patterns/index.js +22 -51
  134. package/build-module/components/page-patterns/index.js.map +1 -1
  135. package/build-module/components/page-patterns/use-patterns.js +1 -0
  136. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  137. package/build-module/components/page-templates/hooks.js.map +1 -0
  138. package/build-module/components/{page-templates-template-parts → page-templates}/index.js +67 -80
  139. package/build-module/components/page-templates/index.js.map +1 -0
  140. package/build-module/components/pattern-modal/duplicate.js +7 -5
  141. package/build-module/components/pattern-modal/duplicate.js.map +1 -1
  142. package/build-module/components/plugin-template-setting-panel/index.js +8 -0
  143. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  144. package/build-module/components/resizable-frame/index.js +9 -6
  145. package/build-module/components/resizable-frame/index.js.map +1 -1
  146. package/build-module/components/sidebar-edit-mode/index.js +4 -3
  147. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  148. package/build-module/components/sidebar-edit-mode/page-panels/index.js +43 -12
  149. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  150. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +25 -17
  151. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  152. package/build-module/components/sidebar-edit-mode/template-panel/index.js +3 -6
  153. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  154. package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
  155. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  156. package/build-module/components/sidebar-navigation-screen-pattern/index.js +6 -13
  157. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  159. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  160. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  161. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  162. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  163. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  164. package/build-module/components/sidebar-navigation-screen-patterns/index.js +35 -29
  165. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  166. package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
  167. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  168. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  169. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  170. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
  171. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  172. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  173. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  174. package/build-module/components/template-actions/index.js +1 -1
  175. package/build-module/components/template-actions/index.js.map +1 -1
  176. package/build-module/deprecated.js +45 -0
  177. package/build-module/deprecated.js.map +1 -0
  178. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +34 -4
  179. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  180. package/build-module/index.js +2 -4
  181. package/build-module/index.js.map +1 -1
  182. package/build-module/utils/constants.js +0 -1
  183. package/build-module/utils/constants.js.map +1 -1
  184. package/build-style/style-rtl.css +79 -125
  185. package/build-style/style.css +79 -125
  186. package/package.json +42 -42
  187. package/src/components/add-new-page/index.js +7 -1
  188. package/src/components/add-new-pattern/index.js +15 -12
  189. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  190. package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
  191. package/src/components/block-editor/resize-handle.js +30 -11
  192. package/src/components/block-editor/style.scss +10 -15
  193. package/src/components/create-template-part-modal/index.js +3 -0
  194. package/src/components/editor/index.js +42 -3
  195. package/src/components/editor/style.scss +6 -1
  196. package/src/components/global-styles/font-library-modal/context.js +9 -3
  197. package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
  198. package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
  199. package/src/components/global-styles/font-library-modal/style.scss +17 -0
  200. package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  201. package/src/components/global-styles/style-variations-container.js +11 -2
  202. package/src/components/header-edit-mode/index.js +56 -76
  203. package/src/components/header-edit-mode/more-menu/index.js +8 -145
  204. package/src/components/header-edit-mode/style.scss +13 -85
  205. package/src/components/keyboard-shortcuts/register.js +0 -58
  206. package/src/components/layout/index.js +11 -2
  207. package/src/components/layout/router.js +9 -49
  208. package/src/components/page-pages/index.js +14 -4
  209. package/src/components/page-pages/style.scss +11 -0
  210. package/src/components/page-patterns/dataviews-pattern-actions.js +8 -9
  211. package/src/components/page-patterns/header.js +3 -1
  212. package/src/components/page-patterns/index.js +17 -76
  213. package/src/components/page-patterns/style.scss +14 -1
  214. package/src/components/page-patterns/use-patterns.js +1 -0
  215. package/src/components/{page-templates-template-parts → page-templates}/index.js +23 -46
  216. package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
  217. package/src/components/pattern-modal/duplicate.js +4 -3
  218. package/src/components/plugin-template-setting-panel/index.js +8 -0
  219. package/src/components/resizable-frame/index.js +4 -3
  220. package/src/components/sidebar-edit-mode/index.js +13 -2
  221. package/src/components/sidebar-edit-mode/page-panels/index.js +49 -21
  222. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +31 -19
  223. package/src/components/sidebar-edit-mode/template-panel/index.js +2 -12
  224. package/src/components/sidebar-navigation-screen-page/index.js +48 -9
  225. package/src/components/sidebar-navigation-screen-pattern/index.js +6 -11
  226. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  227. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  228. package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
  229. package/src/components/sidebar-navigation-screen-patterns/index.js +30 -38
  230. package/src/components/sidebar-navigation-screen-template/index.js +1 -1
  231. package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  232. package/src/components/sidebar-navigation-screen-templates-browse/index.js +7 -39
  233. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
  234. package/src/components/template-actions/index.js +1 -1
  235. package/src/deprecated.js +42 -0
  236. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +69 -16
  237. package/src/index.js +2 -9
  238. package/src/style.scss +1 -5
  239. package/src/utils/constants.js +1 -1
  240. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
  241. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  242. package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
  243. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  244. package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
  245. package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  246. package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
  247. package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  248. package/build/components/page-templates-template-parts/hooks.js.map +0 -1
  249. package/build/components/page-templates-template-parts/index.js.map +0 -1
  250. package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
  251. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  252. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
  253. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  254. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  255. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  256. package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
  257. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  258. package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
  259. package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  260. package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
  261. package/build-module/components/page-templates-template-parts/index.js.map +0 -1
  262. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
  263. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  264. package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
  265. package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  266. package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
  267. package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
  268. package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
  269. package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
  270. /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  271. /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  272. /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
@@ -2,21 +2,17 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { PanelBody } from '@wordpress/components';
5
- import { __ } from '@wordpress/i18n';
6
- import { useSelect } from '@wordpress/data';
5
+ import { __, sprintf } from '@wordpress/i18n';
6
+ import { useSelect, useDispatch } from '@wordpress/data';
7
7
  import { store as coreStore } from '@wordpress/core-data';
8
8
  import {
9
- PageAttributesPanel,
10
9
  PluginDocumentSettingPanel,
11
- PostDiscussionPanel,
12
- PostExcerptPanel,
13
- PostLastRevisionPanel,
14
- PostTaxonomiesPanel,
15
10
  store as editorStore,
16
11
  privateApis as editorPrivateApis,
17
12
  } from '@wordpress/editor';
18
13
  import { privateApis as routerPrivateApis } from '@wordpress/router';
19
14
  import { useCallback } from '@wordpress/element';
15
+ import { store as noticesStore } from '@wordpress/notices';
20
16
 
21
17
  /**
22
18
  * Internal dependencies
@@ -53,20 +49,57 @@ export default function PagePanels() {
53
49
  renderingMode: getRenderingMode(),
54
50
  };
55
51
  }, [] );
56
-
52
+ const { createSuccessNotice } = useDispatch( noticesStore );
57
53
  const history = useHistory();
58
54
  const onActionPerformed = useCallback(
59
55
  ( actionId, items ) => {
60
- if ( actionId === 'move-to-trash' ) {
61
- history.push( {
62
- path: '/' + items[ 0 ].type,
63
- postId: undefined,
64
- postType: undefined,
65
- canvas: 'view',
66
- } );
56
+ switch ( actionId ) {
57
+ case 'move-to-trash':
58
+ {
59
+ history.push( {
60
+ path: '/' + items[ 0 ].type,
61
+ postId: undefined,
62
+ postType: undefined,
63
+ canvas: 'view',
64
+ } );
65
+ }
66
+ break;
67
+ case 'duplicate-post':
68
+ {
69
+ const newItem = items[ 0 ];
70
+ const title =
71
+ typeof newItem.title === 'string'
72
+ ? newItem.title
73
+ : newItem.title?.rendered;
74
+ createSuccessNotice(
75
+ sprintf(
76
+ // translators: %s: Title of the created post e.g: "Post 1".
77
+ __( '"%s" successfully created.' ),
78
+ title
79
+ ),
80
+ {
81
+ type: 'snackbar',
82
+ id: 'duplicate-post-action',
83
+ actions: [
84
+ {
85
+ label: __( 'Edit' ),
86
+ onClick: () => {
87
+ history.push( {
88
+ path: undefined,
89
+ postId: newItem.id,
90
+ postType: newItem.type,
91
+ canvas: 'edit',
92
+ } );
93
+ },
94
+ },
95
+ ],
96
+ }
97
+ );
98
+ }
99
+ break;
67
100
  }
68
101
  },
69
- [ history ]
102
+ [ history, createSuccessNotice ]
70
103
  );
71
104
 
72
105
  if ( ! hasResolved ) {
@@ -95,11 +128,6 @@ export default function PagePanels() {
95
128
  <PageContent />
96
129
  </PanelBody>
97
130
  ) }
98
- <PostLastRevisionPanel />
99
- <PostTaxonomiesPanel />
100
- <PostExcerptPanel />
101
- <PostDiscussionPanel />
102
- <PageAttributesPanel />
103
131
  </>
104
132
  );
105
133
  }
@@ -9,36 +9,48 @@ import {
9
9
  PostSchedulePanel,
10
10
  PostTemplatePanel,
11
11
  PostFeaturedImagePanel,
12
+ privateApis as editorPrivateApis,
12
13
  } from '@wordpress/editor';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
- import PageStatus from './page-status';
18
+ import { unlock } from '../../../lock-unlock';
18
19
 
19
- export default function PageSummary( {
20
- status,
21
- date,
22
- password,
23
- postId,
24
- postType,
25
- } ) {
20
+ const {
21
+ PrivatePostExcerptPanel,
22
+ PostStatus,
23
+ PostContentInformation,
24
+ PostLastEditedPanel,
25
+ } = unlock( editorPrivateApis );
26
+
27
+ export default function PageSummary() {
26
28
  return (
27
29
  <VStack spacing={ 0 }>
28
30
  <PluginPostStatusInfo.Slot>
29
31
  { ( fills ) => (
30
32
  <>
31
- <PostFeaturedImagePanel withPanelBody={ false } />
32
- <PageStatus
33
- status={ status }
34
- date={ date }
35
- password={ password }
36
- postId={ postId }
37
- postType={ postType }
38
- />
39
- <PostSchedulePanel />
40
- <PostTemplatePanel />
41
- <PostURLPanel />
33
+ <VStack
34
+ spacing={ 3 }
35
+ // TODO: this needs to be consolidated with the panel in post editor, when we unify them.
36
+ style={ { marginBlockEnd: '24px' } }
37
+ >
38
+ <PostFeaturedImagePanel withPanelBody={ false } />
39
+ <PrivatePostExcerptPanel />
40
+ <VStack spacing={ 1 }>
41
+ <PostContentInformation />
42
+ <PostLastEditedPanel />
43
+ </VStack>
44
+ </VStack>
45
+ <VStack
46
+ spacing={ 1 }
47
+ style={ { marginBlockEnd: '12px' } }
48
+ >
49
+ <PostStatus />
50
+ <PostSchedulePanel />
51
+ <PostTemplatePanel />
52
+ <PostURLPanel />
53
+ </VStack>
42
54
  <PostAuthorPanel />
43
55
  { fills }
44
56
  </>
@@ -4,11 +4,7 @@
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { PanelBody, PanelRow } from '@wordpress/components';
6
6
  import {
7
- PageAttributesPanel,
8
- PostDiscussionPanel,
9
- PostExcerptPanel,
10
- PostLastRevisionPanel,
11
- PostTaxonomiesPanel,
7
+ PluginDocumentSettingPanel,
12
8
  privateApis as editorPrivateApis,
13
9
  store as editorStore,
14
10
  } from '@wordpress/editor';
@@ -30,7 +26,6 @@ import { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';
30
26
  import { unlock } from '../../../lock-unlock';
31
27
 
32
28
  const { PostCardPanel } = unlock( editorPrivateApis );
33
- const { PatternOverridesPanel } = unlock( editorPrivateApis );
34
29
  const { useHistory } = unlock( routerPrivateApis );
35
30
 
36
31
  function TemplatesList( { availableTemplates, onSelect } ) {
@@ -114,6 +109,7 @@ export default function TemplatePanel() {
114
109
  }
115
110
  />
116
111
  <PluginTemplateSettingPanel.Slot />
112
+ <PluginDocumentSettingPanel.Slot />
117
113
  { availablePatterns?.length > 0 && (
118
114
  <PanelBody
119
115
  title={ __( 'Transform into:' ) }
@@ -133,12 +129,6 @@ export default function TemplatePanel() {
133
129
  />
134
130
  </PanelBody>
135
131
  ) }
136
- <PostLastRevisionPanel />
137
- <PostTaxonomiesPanel />
138
- <PostExcerptPanel />
139
- <PostDiscussionPanel />
140
- <PageAttributesPanel />
141
- <PatternOverridesPanel />
142
132
  </>
143
133
  );
144
134
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __ } from '@wordpress/i18n';
4
+ import { __, sprintf } from '@wordpress/i18n';
5
5
  import { useDispatch, useSelect } from '@wordpress/data';
6
6
  import {
7
7
  __experimentalVStack as VStack,
@@ -17,6 +17,7 @@ import { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';
17
17
  import { useEffect, useCallback } from '@wordpress/element';
18
18
  import { privateApis as routerPrivateApis } from '@wordpress/router';
19
19
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
20
+ import { store as noticesStore } from '@wordpress/notices';
20
21
 
21
22
  /**
22
23
  * Internal dependencies
@@ -34,6 +35,7 @@ const { PostActions } = unlock( editorPrivateApis );
34
35
  export default function SidebarNavigationScreenPage( { backPath } ) {
35
36
  const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
36
37
  const history = useHistory();
38
+ const { createSuccessNotice } = useDispatch( noticesStore );
37
39
  const {
38
40
  params: { postId },
39
41
  } = useLocation();
@@ -83,16 +85,53 @@ export default function SidebarNavigationScreenPage( { backPath } ) {
83
85
 
84
86
  const onActionPerformed = useCallback(
85
87
  ( actionId, items ) => {
86
- if ( actionId === 'move-to-trash' ) {
87
- history.push( {
88
- path: '/' + items[ 0 ].type,
89
- postId: undefined,
90
- postType: undefined,
91
- canvas: 'view',
92
- } );
88
+ switch ( actionId ) {
89
+ case 'move-to-trash':
90
+ {
91
+ history.push( {
92
+ path: '/' + items[ 0 ].type,
93
+ postId: undefined,
94
+ postType: undefined,
95
+ canvas: 'view',
96
+ } );
97
+ }
98
+ break;
99
+ case 'duplicate-post':
100
+ {
101
+ const newItem = items[ 0 ];
102
+ const title =
103
+ typeof newItem.title === 'string'
104
+ ? newItem.title
105
+ : newItem.title?.rendered;
106
+ createSuccessNotice(
107
+ sprintf(
108
+ // translators: %s: Title of the created post e.g: "Post 1".
109
+ __( '"%s" successfully created.' ),
110
+ title
111
+ ),
112
+ {
113
+ type: 'snackbar',
114
+ id: 'duplicate-post-action',
115
+ actions: [
116
+ {
117
+ label: __( 'Edit' ),
118
+ onClick: () => {
119
+ history.push( {
120
+ path: undefined,
121
+ postId: newItem.id,
122
+ postType: newItem.type,
123
+ canvas: 'edit',
124
+ } );
125
+ },
126
+ },
127
+ ],
128
+ }
129
+ );
130
+ }
131
+ break;
93
132
  }
94
133
  },
95
- [ history ]
134
+ [ history, createSuccessNotice ]
96
135
  );
97
136
 
98
137
  const featureImageAltText = featuredMediaAltText
@@ -4,7 +4,6 @@
4
4
  import { useDispatch } from '@wordpress/data';
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import { pencil } from '@wordpress/icons';
7
- import { getQueryArgs } from '@wordpress/url';
8
7
  import { privateApis as routerPrivateApis } from '@wordpress/router';
9
8
 
10
9
  /**
@@ -17,7 +16,6 @@ import usePatternDetails from './use-pattern-details';
17
16
  import { store as editSiteStore } from '../../store';
18
17
  import { unlock } from '../../lock-unlock';
19
18
  import TemplateActions from '../template-actions';
20
- import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
21
19
 
22
20
  const { useLocation, useHistory } = unlock( routerPrivateApis );
23
21
 
@@ -25,22 +23,19 @@ export default function SidebarNavigationScreenPattern() {
25
23
  const history = useHistory();
26
24
  const location = useLocation();
27
25
  const {
28
- params: { postType, postId },
26
+ params: { postType, postId, categoryId, categoryType },
29
27
  } = location;
30
- const { categoryType } = getQueryArgs( window.location.href );
31
28
  const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
32
29
 
33
30
  useInitEditedEntityFromURL();
34
31
 
35
32
  const patternDetails = usePatternDetails( postType, postId );
36
33
 
37
- // The absence of a category type in the query params for template parts
38
- // indicates the user has arrived at the template part via the "manage all"
39
- // page and the back button should return them to that list page.
40
- const backPath =
41
- ! categoryType && postType === TEMPLATE_PART_POST_TYPE
42
- ? { path: '/wp_template_part/all' }
43
- : { path: '/patterns' };
34
+ const backPath = {
35
+ categoryId,
36
+ categoryType,
37
+ path: '/patterns',
38
+ };
44
39
 
45
40
  return (
46
41
  <SidebarNavigationScreen
@@ -10,7 +10,9 @@ import TemplatePartNavigationMenu from './template-part-navigation-menu';
10
10
  import TemplatePartNavigationMenuList from './template-part-navigation-menu-list';
11
11
 
12
12
  export default function TemplatePartNavigationMenus( { menus } ) {
13
- if ( ! menus.length ) return null;
13
+ if ( ! menus.length ) {
14
+ return null;
15
+ }
14
16
 
15
17
  // if there is a single menu then render TemplatePartNavigationMenu
16
18
  if ( menus.length === 1 ) {
@@ -14,7 +14,7 @@ import { useSelect } from '@wordpress/data';
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
- import { useAddedBy } from '../page-templates-template-parts/hooks';
17
+ import { useAddedBy } from '../page-templates/hooks';
18
18
  import useEditedEntityRecord from '../use-edited-entity-record';
19
19
  import useNavigationMenuContent from './use-navigation-menu-content';
20
20
  import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
@@ -11,9 +11,10 @@ export default function CategoryItem( {
11
11
  isActive,
12
12
  label,
13
13
  type,
14
+ path = '/patterns',
14
15
  } ) {
15
16
  const linkInfo = useLink( {
16
- path: '/patterns',
17
+ path,
17
18
  categoryType: type,
18
19
  categoryId: id,
19
20
  } );
@@ -5,32 +5,33 @@ import {
5
5
  __experimentalItemGroup as ItemGroup,
6
6
  __experimentalItem as Item,
7
7
  } from '@wordpress/components';
8
- import { useViewportMatch } from '@wordpress/compose';
9
8
  import { getTemplatePartIcon } from '@wordpress/editor';
10
9
  import { __ } from '@wordpress/i18n';
11
- import { getQueryArgs } from '@wordpress/url';
12
10
  import { store as coreStore } from '@wordpress/core-data';
13
11
  import { useSelect } from '@wordpress/data';
14
12
  import { file } from '@wordpress/icons';
13
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
15
14
 
16
15
  /**
17
16
  * Internal dependencies
18
17
  */
19
18
  import AddNewPattern from '../add-new-pattern';
20
- import SidebarNavigationItem from '../sidebar-navigation-item';
21
19
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
22
20
  import CategoryItem from './category-item';
23
21
  import {
24
22
  PATTERN_DEFAULT_CATEGORY,
25
23
  PATTERN_TYPES,
26
24
  TEMPLATE_PART_POST_TYPE,
25
+ TEMPLATE_PART_ALL_AREAS_CATEGORY,
27
26
  } from '../../utils/constants';
28
- import { useLink } from '../routes/link';
29
27
  import usePatternCategories from './use-pattern-categories';
30
28
  import useTemplatePartAreas from './use-template-part-areas';
31
- import { store as editSiteStore } from '../../store';
29
+ import { unlock } from '../../lock-unlock';
30
+
31
+ const { useLocation } = unlock( routerPrivateApis );
32
32
 
33
33
  function CategoriesGroup( {
34
+ path,
34
35
  templatePartAreas,
35
36
  patternCategories,
36
37
  currentCategory,
@@ -42,15 +43,16 @@ function CategoriesGroup( {
42
43
  <ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
43
44
  <CategoryItem
44
45
  key="all"
46
+ path={ path }
45
47
  count={ Object.values( templatePartAreas )
46
48
  .map( ( { templateParts } ) => templateParts?.length || 0 )
47
49
  .reduce( ( acc, val ) => acc + val, 0 ) }
48
50
  icon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */
49
51
  label={ __( 'All template parts' ) }
50
- id={ 'all-parts' }
52
+ id={ TEMPLATE_PART_ALL_AREAS_CATEGORY }
51
53
  type={ TEMPLATE_PART_POST_TYPE }
52
54
  isActive={
53
- currentCategory === 'all-parts' &&
55
+ currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY &&
54
56
  currentType === TEMPLATE_PART_POST_TYPE
55
57
  }
56
58
  />
@@ -58,6 +60,7 @@ function CategoriesGroup( {
58
60
  ( [ area, { label, templateParts } ] ) => (
59
61
  <CategoryItem
60
62
  key={ area }
63
+ path={ path }
61
64
  count={ templateParts?.length }
62
65
  icon={ getTemplatePartIcon( area ) }
63
66
  label={ label }
@@ -74,6 +77,7 @@ function CategoriesGroup( {
74
77
  { allPatterns && (
75
78
  <CategoryItem
76
79
  key={ allPatterns.name }
80
+ path={ path }
77
81
  count={ allPatterns.count }
78
82
  label={ allPatterns.label }
79
83
  icon={ file }
@@ -89,6 +93,7 @@ function CategoriesGroup( {
89
93
  { otherPatterns.map( ( category ) => (
90
94
  <CategoryItem
91
95
  key={ category.name }
96
+ path={ path }
92
97
  count={ category.count }
93
98
  label={ category.label }
94
99
  icon={ file }
@@ -106,8 +111,9 @@ function CategoriesGroup( {
106
111
  }
107
112
 
108
113
  export default function SidebarNavigationScreenPatterns() {
109
- const isMobileViewport = useViewportMatch( 'medium', '<' );
110
- const { categoryType, categoryId } = getQueryArgs( window.location.href );
114
+ const {
115
+ params: { categoryType, categoryId, path },
116
+ } = useLocation();
111
117
  const currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;
112
118
  const currentType = categoryType || PATTERN_TYPES.theme;
113
119
 
@@ -118,29 +124,19 @@ export default function SidebarNavigationScreenPatterns() {
118
124
  ( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,
119
125
  []
120
126
  );
121
- const isTemplatePartsMode = useSelect( ( select ) => {
122
- const settings = select( editSiteStore ).getSettings();
123
- return !! settings.supportsTemplatePartsMode;
124
- }, [] );
125
-
126
- const templatePartsLink = useLink( {
127
- path: '/wp_template_part/all',
128
- // If a classic theme that supports template parts accessed
129
- // the Patterns page directly, preserve that state in the URL.
130
- didAccessPatternsPage:
131
- ! isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined,
132
- } );
133
-
134
- const footer = ! isMobileViewport ? (
135
- <ItemGroup>
136
- { ( isBlockBasedTheme || isTemplatePartsMode ) && (
137
- <SidebarNavigationItem withChevron { ...templatePartsLink }>
138
- { __( 'Manage all template parts' ) }
139
- </SidebarNavigationItem>
140
- ) }
141
- </ItemGroup>
142
- ) : undefined;
143
127
 
128
+ /**
129
+ * This sidebar needs to temporarily accomodate two different "URLs":
130
+ *
131
+ * 1. path = /patterns
132
+ * Block based themes. Also classic themes can access this URL, though it's not linked anywhere.
133
+ *
134
+ * 2. path = /wp_template_part/all
135
+ * Classic themes with support for block-template-parts. We need to list only Template Parts in this case.
136
+ * The URL is accessible from the Appearance > Template Parts menu.
137
+ *
138
+ * This is temporary. We aim to consolidate to /patterns.
139
+ */
144
140
  return (
145
141
  <SidebarNavigationScreen
146
142
  isRoot={ ! isBlockBasedTheme }
@@ -149,22 +145,18 @@ export default function SidebarNavigationScreenPatterns() {
149
145
  'Manage what patterns are available when editing the site.'
150
146
  ) }
151
147
  actions={ <AddNewPattern /> }
152
- footer={ footer }
153
148
  content={
154
149
  <>
155
- { isLoading && __( 'Loading patterns…' ) }
150
+ { isLoading && __( 'Loading items…' ) }
156
151
  { ! isLoading && (
157
152
  <>
158
153
  { ! hasTemplateParts && ! hasPatterns && (
159
154
  <ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
160
- <Item>
161
- { __(
162
- 'No template parts or patterns found'
163
- ) }
164
- </Item>
155
+ <Item>{ __( 'No items found' ) }</Item>
165
156
  </ItemGroup>
166
157
  ) }
167
158
  <CategoriesGroup
159
+ path={ path }
168
160
  templatePartAreas={ templatePartAreas }
169
161
  patternCategories={ patternCategories }
170
162
  currentCategory={ currentCategory }
@@ -17,7 +17,7 @@ import useEditedEntityRecord from '../use-edited-entity-record';
17
17
  import { unlock } from '../../lock-unlock';
18
18
  import { store as editSiteStore } from '../../store';
19
19
  import SidebarButton from '../sidebar-button';
20
- import { useAddedBy } from '../page-templates-template-parts/hooks';
20
+ import { useAddedBy } from '../page-templates/hooks';
21
21
  import TemplateActions from '../template-actions';
22
22
  import HomeTemplateDetails from './home-template-details';
23
23
  import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
@@ -9,8 +9,9 @@ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
9
9
  * Internal dependencies
10
10
  */
11
11
  import DataViewItem from '../sidebar-dataviews/dataview-item';
12
- import { useAddedBy } from '../page-templates-template-parts/hooks';
12
+ import { useAddedBy } from '../page-templates/hooks';
13
13
  import { layout } from '@wordpress/icons';
14
+ import { TEMPLATE_POST_TYPE } from '../../utils/constants';
14
15
 
15
16
  const EMPTY_ARRAY = [];
16
17
 
@@ -30,10 +31,9 @@ function TemplateDataviewItem( { template, isActive } ) {
30
31
 
31
32
  export default function DataviewsTemplatesSidebarContent( {
32
33
  activeView,
33
- postType,
34
34
  title,
35
35
  } ) {
36
- const { records } = useEntityRecords( 'postType', postType, {
36
+ const { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {
37
37
  per_page: -1,
38
38
  } );
39
39
  const firstItemPerAuthorText = useMemo( () => {
@@ -2,64 +2,32 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { useSelect } from '@wordpress/data';
6
5
  import { privateApis as routerPrivateApis } from '@wordpress/router';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
10
9
  */
11
10
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
- import { store as editSiteStore } from '../../store';
13
- import {
14
- TEMPLATE_POST_TYPE,
15
- TEMPLATE_PART_POST_TYPE,
16
- } from '../../utils/constants';
17
11
  import { unlock } from '../../lock-unlock';
18
12
  import DataviewsTemplatesSidebarContent from './content';
19
13
 
20
- const config = {
21
- [ TEMPLATE_POST_TYPE ]: {
22
- title: __( 'Manage templates' ),
23
- description: __(
24
- 'Create new templates, or reset any customizations made to the templates supplied by your theme.'
25
- ),
26
- contentTitle: __( 'All templates' ),
27
- },
28
- [ TEMPLATE_PART_POST_TYPE ]: {
29
- title: __( 'Manage template parts' ),
30
- description: __(
31
- 'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'
32
- ),
33
- backPath: { path: '/patterns' },
34
- contentTitle: __( 'All template parts' ),
35
- },
36
- };
37
-
38
14
  const { useLocation } = unlock( routerPrivateApis );
39
15
 
40
- export default function SidebarNavigationScreenTemplatesBrowse( { postType } ) {
16
+ export default function SidebarNavigationScreenTemplatesBrowse() {
41
17
  const {
42
- params: { didAccessPatternsPage, activeView = 'all' },
18
+ params: { activeView = 'all' },
43
19
  } = useLocation();
44
20
 
45
- const isTemplatePartsMode = useSelect( ( select ) => {
46
- return !! select( editSiteStore ).getSettings()
47
- .supportsTemplatePartsMode;
48
- }, [] );
49
-
50
21
  return (
51
22
  <SidebarNavigationScreen
52
- // If a classic theme that supports template parts has never
53
- // accessed the Patterns page, return to the dashboard.
54
- isRoot={ isTemplatePartsMode && ! didAccessPatternsPage }
55
- title={ config[ postType ].title }
56
- description={ config[ postType ].description }
57
- backPath={ config[ postType ].backPath }
23
+ title={ __( 'Manage templates' ) }
24
+ description={ __(
25
+ 'Create new templates, or reset any customizations made to the templates supplied by your theme.'
26
+ ) }
58
27
  content={
59
28
  <DataviewsTemplatesSidebarContent
60
29
  activeView={ activeView }
61
- postType={ postType }
62
- title={ config[ postType ].contentTitle }
30
+ title={ __( 'All templates' ) }
63
31
  />
64
32
  }
65
33
  />
@@ -226,10 +226,6 @@ function useResolveEditedEntityAndContext( { path, postId, postType } ) {
226
226
  return { isReady: true, postType: 'wp_template', postId, context };
227
227
  }
228
228
 
229
- if ( path === '/wp_template_part/all' && postId ) {
230
- return { isReady: true, postType: 'wp_template_part', postId, context };
231
- }
232
-
233
229
  if ( postTypesWithoutParentTemplate.includes( postType ) ) {
234
230
  return { isReady: true, postType, postId, context };
235
231
  }
@@ -135,7 +135,7 @@ function ResetMenuItem( { template, onClose } ) {
135
135
  onCancel={ () => setIsModalOpen( false ) }
136
136
  confirmButtonText={ __( 'Reset' ) }
137
137
  >
138
- { __( 'Rese to default and clear all customizations?' ) }
138
+ { __( 'Reset to default and clear all customizations?' ) }
139
139
  </ConfirmDialog>
140
140
  </>
141
141
  );