@wordpress/editor 14.5.0 → 14.7.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 (415) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +37 -0
  3. package/build/bindings/post-meta.js +12 -10
  4. package/build/bindings/post-meta.js.map +1 -1
  5. package/build/components/block-manager/index.js +4 -1
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
  8. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  9. package/build/components/create-template-part-modal/index.js +1 -0
  10. package/build/components/create-template-part-modal/index.js.map +1 -1
  11. package/build/components/document-bar/index.js +4 -4
  12. package/build/components/document-bar/index.js.map +1 -1
  13. package/build/components/editor-history/redo.js +4 -1
  14. package/build/components/editor-history/redo.js.map +1 -1
  15. package/build/components/editor-history/undo.js +4 -1
  16. package/build/components/editor-history/undo.js.map +1 -1
  17. package/build/components/editor-interface/index.js +2 -3
  18. package/build/components/editor-interface/index.js.map +1 -1
  19. package/build/components/error-boundary/index.js +4 -1
  20. package/build/components/error-boundary/index.js.map +1 -1
  21. package/build/components/global-styles-provider/index.js +17 -4
  22. package/build/components/global-styles-provider/index.js.map +1 -1
  23. package/build/components/index.js +8 -0
  24. package/build/components/index.js.map +1 -1
  25. package/build/components/inserter-sidebar/index.js +8 -7
  26. package/build/components/inserter-sidebar/index.js.map +1 -1
  27. package/build/components/local-autosave-monitor/index.js +5 -5
  28. package/build/components/local-autosave-monitor/index.js.map +1 -1
  29. package/build/components/page-attributes/parent.js +10 -6
  30. package/build/components/page-attributes/parent.js.map +1 -1
  31. package/build/components/plugin-preview-menu-item/index.js +57 -0
  32. package/build/components/plugin-preview-menu-item/index.js.map +1 -0
  33. package/build/components/post-actions/actions.js +4 -499
  34. package/build/components/post-actions/actions.js.map +1 -1
  35. package/build/components/post-actions/index.js +13 -25
  36. package/build/components/post-actions/index.js.map +1 -1
  37. package/build/components/post-card-panel/index.js +20 -20
  38. package/build/components/post-card-panel/index.js.map +1 -1
  39. package/build/components/post-excerpt/panel.js +4 -1
  40. package/build/components/post-excerpt/panel.js.map +1 -1
  41. package/build/components/post-featured-image/index.js +14 -3
  42. package/build/components/post-featured-image/index.js.map +1 -1
  43. package/build/components/post-format/index.js +4 -1
  44. package/build/components/post-format/index.js.map +1 -1
  45. package/build/components/post-last-revision/index.js +4 -1
  46. package/build/components/post-last-revision/index.js.map +1 -1
  47. package/build/components/post-locked-modal/index.js +12 -3
  48. package/build/components/post-locked-modal/index.js.map +1 -1
  49. package/build/components/post-publish-panel/index.js +4 -1
  50. package/build/components/post-publish-panel/index.js.map +1 -1
  51. package/build/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  52. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  53. package/build/components/post-publish-panel/maybe-upload-media.js +14 -8
  54. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  55. package/build/components/post-publish-panel/postpublish.js +4 -0
  56. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  57. package/build/components/post-slug/index.js +1 -0
  58. package/build/components/post-slug/index.js.map +1 -1
  59. package/build/components/post-status/index.js +4 -2
  60. package/build/components/post-status/index.js.map +1 -1
  61. package/build/components/post-taxonomies/hierarchical-term-selector.js +6 -2
  62. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  63. package/build/components/post-taxonomies/most-used-terms.js +4 -1
  64. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  65. package/build/components/post-template/block-theme.js +13 -4
  66. package/build/components/post-template/block-theme.js.map +1 -1
  67. package/build/components/post-template/classic-theme.js +4 -1
  68. package/build/components/post-template/classic-theme.js.map +1 -1
  69. package/build/components/post-title/index.js +32 -46
  70. package/build/components/post-title/index.js.map +1 -1
  71. package/build/components/post-url/index.js +10 -6
  72. package/build/components/post-url/index.js.map +1 -1
  73. package/build/components/preview-dropdown/index.js +26 -14
  74. package/build/components/preview-dropdown/index.js.map +1 -1
  75. package/build/components/provider/use-block-editor-settings.js +5 -6
  76. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  77. package/build/components/save-publish-panels/index.js +8 -2
  78. package/build/components/save-publish-panels/index.js.map +1 -1
  79. package/build/components/sidebar/post-summary.js +10 -7
  80. package/build/components/sidebar/post-summary.js.map +1 -1
  81. package/build/components/start-template-options/index.js +4 -1
  82. package/build/components/start-template-options/index.js.map +1 -1
  83. package/build/components/table-of-contents/index.js +4 -1
  84. package/build/components/table-of-contents/index.js.map +1 -1
  85. package/build/components/template-content-panel/index.js +1 -1
  86. package/build/components/template-content-panel/index.js.map +1 -1
  87. package/build/components/text-editor/index.js +4 -1
  88. package/build/components/text-editor/index.js.map +1 -1
  89. package/build/components/visual-editor/index.js +1 -6
  90. package/build/components/visual-editor/index.js.map +1 -1
  91. package/build/dataviews/actions/duplicate-pattern.js +48 -0
  92. package/build/dataviews/actions/duplicate-pattern.js.map +1 -0
  93. package/build/dataviews/actions/duplicate-post.js +146 -0
  94. package/build/dataviews/actions/duplicate-post.js.map +1 -0
  95. package/build/dataviews/actions/duplicate-post.native.js +9 -0
  96. package/build/dataviews/actions/duplicate-post.native.js.map +1 -0
  97. package/build/dataviews/actions/duplicate-template-part.js +67 -0
  98. package/build/dataviews/actions/duplicate-template-part.js.map +1 -0
  99. package/build/dataviews/actions/export-pattern.js +2 -0
  100. package/build/dataviews/actions/export-pattern.js.map +1 -1
  101. package/build/dataviews/actions/permanently-delete-post.js +2 -0
  102. package/build/dataviews/actions/permanently-delete-post.js.map +1 -1
  103. package/build/dataviews/actions/rename-post.js +125 -0
  104. package/build/dataviews/actions/rename-post.js.map +1 -0
  105. package/build/dataviews/actions/reorder-page.js +116 -0
  106. package/build/dataviews/actions/reorder-page.js.map +1 -0
  107. package/build/dataviews/actions/reorder-page.native.js +9 -0
  108. package/build/dataviews/actions/reorder-page.native.js.map +1 -0
  109. package/build/dataviews/actions/reset-post.js +9 -3
  110. package/build/dataviews/actions/reset-post.js.map +1 -1
  111. package/build/dataviews/actions/trash-post.js +8 -2
  112. package/build/dataviews/actions/trash-post.js.map +1 -1
  113. package/build/dataviews/actions/utils.js +9 -1
  114. package/build/dataviews/actions/utils.js.map +1 -1
  115. package/build/dataviews/actions/view-post-revisions.js +49 -0
  116. package/build/dataviews/actions/view-post-revisions.js.map +1 -0
  117. package/build/dataviews/actions/view-post.js +36 -0
  118. package/build/dataviews/actions/view-post.js.map +1 -0
  119. package/build/dataviews/fields/index.js +32 -0
  120. package/build/dataviews/fields/index.js.map +1 -0
  121. package/build/dataviews/store/private-actions.js +16 -2
  122. package/build/dataviews/store/private-actions.js.map +1 -1
  123. package/build/dataviews/types.js.map +1 -1
  124. package/build/private-apis.js +2 -2
  125. package/build/private-apis.js.map +1 -1
  126. package/build/store/private-actions.js +2 -2
  127. package/build/store/private-actions.js.map +1 -1
  128. package/build/store/utils/is-template-revertable.js +1 -1
  129. package/build/store/utils/is-template-revertable.js.map +1 -1
  130. package/build-module/bindings/post-meta.js +12 -10
  131. package/build-module/bindings/post-meta.js.map +1 -1
  132. package/build-module/components/block-manager/index.js +4 -1
  133. package/build-module/components/block-manager/index.js.map +1 -1
  134. package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
  135. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  136. package/build-module/components/create-template-part-modal/index.js +1 -0
  137. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  138. package/build-module/components/document-bar/index.js +4 -4
  139. package/build-module/components/document-bar/index.js.map +1 -1
  140. package/build-module/components/editor-history/redo.js +4 -1
  141. package/build-module/components/editor-history/redo.js.map +1 -1
  142. package/build-module/components/editor-history/undo.js +4 -1
  143. package/build-module/components/editor-history/undo.js.map +1 -1
  144. package/build-module/components/editor-interface/index.js +2 -3
  145. package/build-module/components/editor-interface/index.js.map +1 -1
  146. package/build-module/components/error-boundary/index.js +4 -1
  147. package/build-module/components/error-boundary/index.js.map +1 -1
  148. package/build-module/components/global-styles-provider/index.js +17 -4
  149. package/build-module/components/global-styles-provider/index.js.map +1 -1
  150. package/build-module/components/index.js +1 -0
  151. package/build-module/components/index.js.map +1 -1
  152. package/build-module/components/inserter-sidebar/index.js +8 -7
  153. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  154. package/build-module/components/local-autosave-monitor/index.js +5 -5
  155. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  156. package/build-module/components/page-attributes/parent.js +10 -6
  157. package/build-module/components/page-attributes/parent.js.map +1 -1
  158. package/build-module/components/plugin-preview-menu-item/index.js +52 -0
  159. package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
  160. package/build-module/components/post-actions/actions.js +5 -501
  161. package/build-module/components/post-actions/actions.js.map +1 -1
  162. package/build-module/components/post-actions/index.js +13 -25
  163. package/build-module/components/post-actions/index.js.map +1 -1
  164. package/build-module/components/post-card-panel/index.js +20 -20
  165. package/build-module/components/post-card-panel/index.js.map +1 -1
  166. package/build-module/components/post-excerpt/panel.js +4 -1
  167. package/build-module/components/post-excerpt/panel.js.map +1 -1
  168. package/build-module/components/post-featured-image/index.js +14 -3
  169. package/build-module/components/post-featured-image/index.js.map +1 -1
  170. package/build-module/components/post-format/index.js +4 -1
  171. package/build-module/components/post-format/index.js.map +1 -1
  172. package/build-module/components/post-last-revision/index.js +4 -1
  173. package/build-module/components/post-last-revision/index.js.map +1 -1
  174. package/build-module/components/post-locked-modal/index.js +12 -3
  175. package/build-module/components/post-locked-modal/index.js.map +1 -1
  176. package/build-module/components/post-publish-panel/index.js +4 -1
  177. package/build-module/components/post-publish-panel/index.js.map +1 -1
  178. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  179. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  180. package/build-module/components/post-publish-panel/maybe-upload-media.js +14 -8
  181. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  182. package/build-module/components/post-publish-panel/postpublish.js +4 -0
  183. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  184. package/build-module/components/post-slug/index.js +1 -0
  185. package/build-module/components/post-slug/index.js.map +1 -1
  186. package/build-module/components/post-status/index.js +4 -2
  187. package/build-module/components/post-status/index.js.map +1 -1
  188. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +7 -3
  189. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  190. package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
  191. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  192. package/build-module/components/post-template/block-theme.js +13 -4
  193. package/build-module/components/post-template/block-theme.js.map +1 -1
  194. package/build-module/components/post-template/classic-theme.js +4 -1
  195. package/build-module/components/post-template/classic-theme.js.map +1 -1
  196. package/build-module/components/post-title/index.js +33 -47
  197. package/build-module/components/post-title/index.js.map +1 -1
  198. package/build-module/components/post-url/index.js +11 -7
  199. package/build-module/components/post-url/index.js.map +1 -1
  200. package/build-module/components/preview-dropdown/index.js +26 -14
  201. package/build-module/components/preview-dropdown/index.js.map +1 -1
  202. package/build-module/components/provider/use-block-editor-settings.js +6 -7
  203. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  204. package/build-module/components/save-publish-panels/index.js +8 -2
  205. package/build-module/components/save-publish-panels/index.js.map +1 -1
  206. package/build-module/components/sidebar/post-summary.js +10 -7
  207. package/build-module/components/sidebar/post-summary.js.map +1 -1
  208. package/build-module/components/start-template-options/index.js +4 -1
  209. package/build-module/components/start-template-options/index.js.map +1 -1
  210. package/build-module/components/table-of-contents/index.js +4 -1
  211. package/build-module/components/table-of-contents/index.js.map +1 -1
  212. package/build-module/components/template-content-panel/index.js +1 -1
  213. package/build-module/components/template-content-panel/index.js.map +1 -1
  214. package/build-module/components/text-editor/index.js +4 -1
  215. package/build-module/components/text-editor/index.js.map +1 -1
  216. package/build-module/components/visual-editor/index.js +1 -6
  217. package/build-module/components/visual-editor/index.js.map +1 -1
  218. package/build-module/dataviews/actions/duplicate-pattern.js +39 -0
  219. package/build-module/dataviews/actions/duplicate-pattern.js.map +1 -0
  220. package/build-module/dataviews/actions/duplicate-post.js +139 -0
  221. package/build-module/dataviews/actions/duplicate-post.js.map +1 -0
  222. package/build-module/dataviews/actions/duplicate-post.native.js +3 -0
  223. package/build-module/dataviews/actions/duplicate-post.native.js.map +1 -0
  224. package/build-module/dataviews/actions/duplicate-template-part.js +58 -0
  225. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -0
  226. package/build-module/dataviews/actions/export-pattern.js +2 -0
  227. package/build-module/dataviews/actions/export-pattern.js.map +1 -1
  228. package/build-module/dataviews/actions/permanently-delete-post.js +3 -0
  229. package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -1
  230. package/build-module/dataviews/actions/rename-post.js +118 -0
  231. package/build-module/dataviews/actions/rename-post.js.map +1 -0
  232. package/build-module/dataviews/actions/reorder-page.js +111 -0
  233. package/build-module/dataviews/actions/reorder-page.js.map +1 -0
  234. package/build-module/dataviews/actions/reorder-page.native.js +3 -0
  235. package/build-module/dataviews/actions/reorder-page.native.js.map +1 -0
  236. package/build-module/dataviews/actions/reset-post.js +9 -3
  237. package/build-module/dataviews/actions/reset-post.js.map +1 -1
  238. package/build-module/dataviews/actions/trash-post.js +8 -2
  239. package/build-module/dataviews/actions/trash-post.js.map +1 -1
  240. package/build-module/dataviews/actions/utils.js +7 -1
  241. package/build-module/dataviews/actions/utils.js.map +1 -1
  242. package/build-module/dataviews/actions/view-post-revisions.js +43 -0
  243. package/build-module/dataviews/actions/view-post-revisions.js.map +1 -0
  244. package/build-module/dataviews/actions/view-post.js +30 -0
  245. package/build-module/dataviews/actions/view-post.js.map +1 -0
  246. package/build-module/dataviews/fields/index.js +26 -0
  247. package/build-module/dataviews/fields/index.js.map +1 -0
  248. package/build-module/dataviews/store/private-actions.js +16 -2
  249. package/build-module/dataviews/store/private-actions.js.map +1 -1
  250. package/build-module/dataviews/types.js.map +1 -1
  251. package/build-module/private-apis.js +2 -2
  252. package/build-module/private-apis.js.map +1 -1
  253. package/build-module/store/private-actions.js +2 -2
  254. package/build-module/store/private-actions.js.map +1 -1
  255. package/build-module/store/utils/is-template-revertable.js +1 -1
  256. package/build-module/store/utils/is-template-revertable.js.map +1 -1
  257. package/build-style/style-rtl.css +14 -38
  258. package/build-style/style.css +14 -38
  259. package/build-types/bindings/post-meta.d.ts +0 -3
  260. package/build-types/bindings/post-meta.d.ts.map +1 -1
  261. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
  262. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
  263. package/build-types/components/editor-history/redo.d.ts.map +1 -1
  264. package/build-types/components/editor-history/undo.d.ts.map +1 -1
  265. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  266. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  267. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  268. package/build-types/components/index.d.ts +1 -0
  269. package/build-types/components/index.d.ts.map +1 -1
  270. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  271. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  272. package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
  273. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
  274. package/build-types/components/post-actions/actions.d.ts +1 -26
  275. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  276. package/build-types/components/post-actions/index.d.ts +3 -2
  277. package/build-types/components/post-actions/index.d.ts.map +1 -1
  278. package/build-types/components/post-card-panel/index.d.ts +4 -2
  279. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  280. package/build-types/components/post-format/index.d.ts.map +1 -1
  281. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  282. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  283. package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
  284. package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
  285. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
  286. package/build-types/components/post-slug/index.d.ts.map +1 -1
  287. package/build-types/components/post-status/index.d.ts.map +1 -1
  288. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +1 -17
  289. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  290. package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
  291. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  292. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  293. package/build-types/components/post-url/index.d.ts.map +1 -1
  294. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  295. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  296. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  297. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  298. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  299. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  300. package/build-types/components/text-editor/index.d.ts.map +1 -1
  301. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  302. package/build-types/dataviews/actions/duplicate-pattern.d.ts +5 -0
  303. package/build-types/dataviews/actions/duplicate-pattern.d.ts.map +1 -0
  304. package/build-types/dataviews/actions/duplicate-post.d.ts +5 -0
  305. package/build-types/dataviews/actions/duplicate-post.d.ts.map +1 -0
  306. package/build-types/dataviews/actions/duplicate-post.native.d.ts +3 -0
  307. package/build-types/dataviews/actions/duplicate-post.native.d.ts.map +1 -0
  308. package/build-types/dataviews/actions/duplicate-template-part.d.ts +5 -0
  309. package/build-types/dataviews/actions/duplicate-template-part.d.ts.map +1 -0
  310. package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -1
  311. package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -1
  312. package/build-types/dataviews/actions/rename-post.d.ts +5 -0
  313. package/build-types/dataviews/actions/rename-post.d.ts.map +1 -0
  314. package/build-types/dataviews/actions/reorder-page.d.ts +8 -0
  315. package/build-types/dataviews/actions/reorder-page.d.ts.map +1 -0
  316. package/build-types/dataviews/actions/reorder-page.native.d.ts +3 -0
  317. package/build-types/dataviews/actions/reorder-page.native.d.ts.map +1 -0
  318. package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
  319. package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
  320. package/build-types/dataviews/actions/utils.d.ts +5 -3
  321. package/build-types/dataviews/actions/utils.d.ts.map +1 -1
  322. package/build-types/dataviews/actions/view-post-revisions.d.ts +8 -0
  323. package/build-types/dataviews/actions/view-post-revisions.d.ts.map +1 -0
  324. package/build-types/dataviews/actions/view-post.d.ts +8 -0
  325. package/build-types/dataviews/actions/view-post.d.ts.map +1 -0
  326. package/build-types/dataviews/fields/index.d.ts +8 -0
  327. package/build-types/dataviews/fields/index.d.ts.map +1 -0
  328. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  329. package/build-types/dataviews/types.d.ts +57 -8
  330. package/build-types/dataviews/types.d.ts.map +1 -1
  331. package/build-types/store/private-actions.d.ts.map +1 -1
  332. package/build-types/store/utils/is-template-revertable.d.ts.map +1 -1
  333. package/package.json +36 -36
  334. package/src/bindings/post-meta.js +14 -8
  335. package/src/components/block-manager/index.js +2 -0
  336. package/src/components/block-manager/style.scss +2 -2
  337. package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
  338. package/src/components/create-template-part-modal/index.js +1 -0
  339. package/src/components/create-template-part-modal/style.scss +1 -1
  340. package/src/components/document-bar/index.js +4 -4
  341. package/src/components/document-outline/style.scss +1 -1
  342. package/src/components/editor-history/redo.js +2 -0
  343. package/src/components/editor-history/undo.js +2 -0
  344. package/src/components/editor-interface/index.js +2 -4
  345. package/src/components/error-boundary/index.js +6 -1
  346. package/src/components/error-boundary/style.native.scss +1 -1
  347. package/src/components/error-boundary/style.scss +1 -1
  348. package/src/components/global-styles-provider/index.js +16 -3
  349. package/src/components/header/style.scss +6 -3
  350. package/src/components/index.js +1 -0
  351. package/src/components/inserter-sidebar/index.js +12 -5
  352. package/src/components/local-autosave-monitor/index.js +6 -6
  353. package/src/components/page-attributes/parent.js +18 -13
  354. package/src/components/plugin-preview-menu-item/index.js +52 -0
  355. package/src/components/post-actions/actions.js +5 -616
  356. package/src/components/post-actions/index.js +24 -34
  357. package/src/components/post-card-panel/index.js +28 -27
  358. package/src/components/post-card-panel/style.scss +1 -1
  359. package/src/components/post-discussion/style.scss +0 -9
  360. package/src/components/post-excerpt/panel.js +2 -0
  361. package/src/components/post-featured-image/index.js +8 -0
  362. package/src/components/post-featured-image/style.scss +1 -2
  363. package/src/components/post-format/index.js +2 -0
  364. package/src/components/post-format/style.scss +0 -6
  365. package/src/components/post-last-revision/index.js +2 -0
  366. package/src/components/post-locked-modal/index.js +14 -2
  367. package/src/components/post-locked-modal/style.scss +1 -1
  368. package/src/components/post-publish-panel/index.js +2 -0
  369. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -0
  370. package/src/components/post-publish-panel/maybe-upload-media.js +37 -29
  371. package/src/components/post-publish-panel/postpublish.js +8 -2
  372. package/src/components/post-publish-panel/style.scss +3 -1
  373. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +8 -8
  374. package/src/components/post-slug/index.js +1 -0
  375. package/src/components/post-status/index.js +3 -2
  376. package/src/components/post-status/style.scss +0 -19
  377. package/src/components/post-taxonomies/hierarchical-term-selector.js +5 -1
  378. package/src/components/post-taxonomies/most-used-terms.js +2 -0
  379. package/src/components/post-template/block-theme.js +15 -9
  380. package/src/components/post-template/classic-theme.js +2 -0
  381. package/src/components/post-title/index.js +30 -41
  382. package/src/components/post-url/index.js +17 -9
  383. package/src/components/preview-dropdown/index.js +28 -20
  384. package/src/components/provider/use-block-editor-settings.js +5 -5
  385. package/src/components/resizable-editor/style.scss +2 -2
  386. package/src/components/save-publish-panels/index.js +4 -0
  387. package/src/components/save-publish-panels/style.scss +3 -3
  388. package/src/components/sidebar/post-summary.js +20 -16
  389. package/src/components/site-discussion/style.scss +0 -14
  390. package/src/components/start-template-options/index.js +6 -1
  391. package/src/components/table-of-contents/index.js +2 -0
  392. package/src/components/template-content-panel/index.js +4 -1
  393. package/src/components/text-editor/index.js +2 -0
  394. package/src/components/visual-editor/index.js +2 -9
  395. package/src/dataviews/actions/duplicate-pattern.tsx +40 -0
  396. package/src/dataviews/actions/duplicate-post.native.tsx +3 -0
  397. package/src/dataviews/actions/duplicate-post.tsx +174 -0
  398. package/src/dataviews/actions/duplicate-template-part.tsx +70 -0
  399. package/src/dataviews/actions/export-pattern.tsx +2 -0
  400. package/src/dataviews/actions/permanently-delete-post.tsx +2 -0
  401. package/src/dataviews/actions/rename-post.tsx +146 -0
  402. package/src/dataviews/actions/reorder-page.native.tsx +3 -0
  403. package/src/dataviews/actions/reorder-page.tsx +125 -0
  404. package/src/dataviews/actions/reset-post.tsx +6 -1
  405. package/src/dataviews/actions/trash-post.tsx +4 -0
  406. package/src/dataviews/actions/utils.ts +14 -4
  407. package/src/dataviews/actions/view-post-revisions.tsx +47 -0
  408. package/src/dataviews/actions/view-post.tsx +30 -0
  409. package/src/dataviews/fields/index.ts +26 -0
  410. package/src/dataviews/store/private-actions.ts +42 -1
  411. package/src/dataviews/types.ts +47 -6
  412. package/src/private-apis.js +2 -2
  413. package/src/store/private-actions.js +4 -2
  414. package/src/store/utils/is-template-revertable.js +2 -1
  415. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,40 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { _x } from '@wordpress/i18n';
5
+ // @ts-ignore
6
+ import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
7
+ import type { Action } from '@wordpress/dataviews';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { unlock } from '../../lock-unlock';
13
+ import type { Pattern } from '../types';
14
+
15
+ // Patterns.
16
+ const { CreatePatternModalContents, useDuplicatePatternProps } =
17
+ unlock( patternsPrivateApis );
18
+
19
+ const duplicatePattern: Action< Pattern > = {
20
+ id: 'duplicate-pattern',
21
+ label: _x( 'Duplicate', 'action label' ),
22
+ isEligible: ( item ) => item.type !== 'wp_template_part',
23
+ modalHeader: _x( 'Duplicate pattern', 'action label' ),
24
+ RenderModal: ( { items, closeModal } ) => {
25
+ const [ item ] = items;
26
+ const duplicatedProps = useDuplicatePatternProps( {
27
+ pattern: item,
28
+ onSuccess: () => closeModal?.(),
29
+ } );
30
+ return (
31
+ <CreatePatternModalContents
32
+ onClose={ closeModal }
33
+ confirmLabel={ _x( 'Duplicate', 'action label' ) }
34
+ { ...duplicatedProps }
35
+ />
36
+ );
37
+ },
38
+ };
39
+
40
+ export default duplicatePattern;
@@ -0,0 +1,3 @@
1
+ const duplicatePost = undefined;
2
+
3
+ export default duplicatePost;
@@ -0,0 +1,174 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useDispatch } from '@wordpress/data';
5
+ import { decodeEntities } from '@wordpress/html-entities';
6
+ import { store as coreStore } from '@wordpress/core-data';
7
+ import { __, sprintf, _x } from '@wordpress/i18n';
8
+ import { store as noticesStore } from '@wordpress/notices';
9
+ import { useState } from '@wordpress/element';
10
+ import { DataForm } from '@wordpress/dataviews';
11
+ import {
12
+ Button,
13
+ __experimentalHStack as HStack,
14
+ __experimentalVStack as VStack,
15
+ } from '@wordpress/components';
16
+ import type { Action } from '@wordpress/dataviews';
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+ import { getItemTitle } from '../../dataviews/actions/utils';
22
+ import type { CoreDataError, BasePost } from '../types';
23
+ import { titleField } from '../fields';
24
+
25
+ const fields = [ titleField ];
26
+ const formDuplicateAction = {
27
+ fields: [ 'title' ],
28
+ };
29
+
30
+ const duplicatePost: Action< BasePost > = {
31
+ id: 'duplicate-post',
32
+ label: _x( 'Duplicate', 'action label' ),
33
+ isEligible( { status } ) {
34
+ return status !== 'trash';
35
+ },
36
+ RenderModal: ( { items, closeModal, onActionPerformed } ) => {
37
+ const [ item, setItem ] = useState< BasePost >( {
38
+ ...items[ 0 ],
39
+ title: sprintf(
40
+ /* translators: %s: Existing template title */
41
+ __( '%s (Copy)' ),
42
+ getItemTitle( items[ 0 ] )
43
+ ),
44
+ } );
45
+
46
+ const [ isCreatingPage, setIsCreatingPage ] = useState( false );
47
+ const { saveEntityRecord } = useDispatch( coreStore );
48
+ const { createSuccessNotice, createErrorNotice } =
49
+ useDispatch( noticesStore );
50
+
51
+ async function createPage( event: React.FormEvent ) {
52
+ event.preventDefault();
53
+
54
+ if ( isCreatingPage ) {
55
+ return;
56
+ }
57
+
58
+ const newItemOject = {
59
+ status: 'draft',
60
+ title: item.title,
61
+ slug: item.title || __( 'No title' ),
62
+ comment_status: item.comment_status,
63
+ content:
64
+ typeof item.content === 'string'
65
+ ? item.content
66
+ : item.content.raw,
67
+ excerpt:
68
+ typeof item.excerpt === 'string'
69
+ ? item.excerpt
70
+ : item.excerpt?.raw,
71
+ meta: item.meta,
72
+ parent: item.parent,
73
+ password: item.password,
74
+ template: item.template,
75
+ format: item.format,
76
+ featured_media: item.featured_media,
77
+ menu_order: item.menu_order,
78
+ ping_status: item.ping_status,
79
+ };
80
+ const assignablePropertiesPrefix = 'wp:action-assign-';
81
+ // Get all the properties that the current user is able to assign normally author, categories, tags,
82
+ // and custom taxonomies.
83
+ const assignableProperties = Object.keys( item?._links || {} )
84
+ .filter( ( property ) =>
85
+ property.startsWith( assignablePropertiesPrefix )
86
+ )
87
+ .map( ( property ) =>
88
+ property.slice( assignablePropertiesPrefix.length )
89
+ );
90
+ assignableProperties.forEach( ( property ) => {
91
+ if ( item.hasOwnProperty( property ) ) {
92
+ // @ts-ignore
93
+ newItemOject[ property ] = item[ property ];
94
+ }
95
+ } );
96
+ setIsCreatingPage( true );
97
+ try {
98
+ const newItem = await saveEntityRecord(
99
+ 'postType',
100
+ item.type,
101
+ newItemOject,
102
+ { throwOnError: true }
103
+ );
104
+
105
+ createSuccessNotice(
106
+ sprintf(
107
+ // translators: %s: Title of the created template e.g: "Category".
108
+ __( '"%s" successfully created.' ),
109
+ decodeEntities( newItem.title?.rendered || item.title )
110
+ ),
111
+ {
112
+ id: 'duplicate-post-action',
113
+ type: 'snackbar',
114
+ }
115
+ );
116
+
117
+ if ( onActionPerformed ) {
118
+ onActionPerformed( [ newItem ] );
119
+ }
120
+ } catch ( error ) {
121
+ const typedError = error as CoreDataError;
122
+ const errorMessage =
123
+ typedError.message && typedError.code !== 'unknown_error'
124
+ ? typedError.message
125
+ : __( 'An error occurred while duplicating the page.' );
126
+
127
+ createErrorNotice( errorMessage, {
128
+ type: 'snackbar',
129
+ } );
130
+ } finally {
131
+ setIsCreatingPage( false );
132
+ closeModal?.();
133
+ }
134
+ }
135
+
136
+ return (
137
+ <form onSubmit={ createPage }>
138
+ <VStack spacing={ 3 }>
139
+ <DataForm
140
+ data={ item }
141
+ fields={ fields }
142
+ form={ formDuplicateAction }
143
+ onChange={ ( changes ) =>
144
+ setItem( ( prev ) => ( {
145
+ ...prev,
146
+ ...changes,
147
+ } ) )
148
+ }
149
+ />
150
+ <HStack spacing={ 2 } justify="end">
151
+ <Button
152
+ variant="tertiary"
153
+ onClick={ closeModal }
154
+ __next40pxDefaultSize
155
+ >
156
+ { __( 'Cancel' ) }
157
+ </Button>
158
+ <Button
159
+ variant="primary"
160
+ type="submit"
161
+ isBusy={ isCreatingPage }
162
+ aria-disabled={ isCreatingPage }
163
+ __next40pxDefaultSize
164
+ >
165
+ { _x( 'Duplicate', 'action label' ) }
166
+ </Button>
167
+ </HStack>
168
+ </VStack>
169
+ </form>
170
+ );
171
+ },
172
+ };
173
+
174
+ export default duplicatePost;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useDispatch } from '@wordpress/data';
5
+ import { __, sprintf, _x } from '@wordpress/i18n';
6
+ import { store as noticesStore } from '@wordpress/notices';
7
+ import { useMemo } from '@wordpress/element';
8
+ // @ts-ignore
9
+ import { parse } from '@wordpress/blocks';
10
+ import type { Action } from '@wordpress/dataviews';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { TEMPLATE_PART_POST_TYPE } from '../../store/constants';
16
+ import { CreateTemplatePartModalContents } from '../../components/create-template-part-modal';
17
+ import { getItemTitle } from './utils';
18
+ import type { TemplatePart } from '../types';
19
+
20
+ const duplicateTemplatePart: Action< TemplatePart > = {
21
+ id: 'duplicate-template-part',
22
+ label: _x( 'Duplicate', 'action label' ),
23
+ isEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,
24
+ modalHeader: _x( 'Duplicate template part', 'action label' ),
25
+ RenderModal: ( { items, closeModal } ) => {
26
+ const [ item ] = items;
27
+ const blocks = useMemo( () => {
28
+ return (
29
+ item.blocks ??
30
+ parse(
31
+ typeof item.content === 'string'
32
+ ? item.content
33
+ : item.content.raw,
34
+ {
35
+ __unstableSkipMigrationLogs: true,
36
+ }
37
+ )
38
+ );
39
+ }, [ item.content, item.blocks ] );
40
+ const { createSuccessNotice } = useDispatch( noticesStore );
41
+ function onTemplatePartSuccess() {
42
+ createSuccessNotice(
43
+ sprintf(
44
+ // translators: %s: The new template part's title e.g. 'Call to action (copy)'.
45
+ __( '"%s" duplicated.' ),
46
+ getItemTitle( item )
47
+ ),
48
+ { type: 'snackbar', id: 'edit-site-patterns-success' }
49
+ );
50
+ closeModal?.();
51
+ }
52
+ return (
53
+ <CreateTemplatePartModalContents
54
+ blocks={ blocks }
55
+ defaultArea={ item.area }
56
+ defaultTitle={ sprintf(
57
+ /* translators: %s: Existing template part title */
58
+ __( '%s (Copy)' ),
59
+ getItemTitle( item )
60
+ ) }
61
+ onCreate={ onTemplatePartSuccess }
62
+ onError={ closeModal }
63
+ confirmLabel={ _x( 'Duplicate', 'action label' ) }
64
+ closeModal={ closeModal }
65
+ />
66
+ );
67
+ },
68
+ };
69
+
70
+ export default duplicateTemplatePart;
@@ -9,6 +9,7 @@ import { downloadZip } from 'client-zip';
9
9
  */
10
10
  import { downloadBlob } from '@wordpress/blob';
11
11
  import { __ } from '@wordpress/i18n';
12
+ import { download } from '@wordpress/icons';
12
13
  import type { Action } from '@wordpress/dataviews';
13
14
 
14
15
  /**
@@ -36,6 +37,7 @@ function getJsonFromItem( item: Pattern ) {
36
37
  const exportPattern: Action< Pattern > = {
37
38
  id: 'export-pattern',
38
39
  label: __( 'Export as JSON' ),
40
+ icon: download,
39
41
  supportsBulk: true,
40
42
  isEligible: ( item ) => item.type === 'wp_block',
41
43
  callback: async ( items ) => {
@@ -5,6 +5,7 @@ import { store as coreStore } from '@wordpress/core-data';
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
6
  import { store as noticesStore } from '@wordpress/notices';
7
7
  import type { Action } from '@wordpress/dataviews';
8
+ import { trash } from '@wordpress/icons';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
@@ -16,6 +17,7 @@ const permanentlyDeletePost: Action< PostWithPermissions > = {
16
17
  id: 'permanently-delete',
17
18
  label: __( 'Permanently delete' ),
18
19
  supportsBulk: true,
20
+ icon: trash,
19
21
  isEligible( item ) {
20
22
  if ( isTemplateOrTemplatePart( item ) || item.type === 'wp_block' ) {
21
23
  return false;
@@ -0,0 +1,146 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useDispatch } from '@wordpress/data';
5
+ import { store as coreStore } from '@wordpress/core-data';
6
+ import { __ } from '@wordpress/i18n';
7
+ import { useState } from '@wordpress/element';
8
+ // @ts-ignore
9
+ import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
10
+ import {
11
+ Button,
12
+ TextControl,
13
+ __experimentalHStack as HStack,
14
+ __experimentalVStack as VStack,
15
+ } from '@wordpress/components';
16
+ import type { Action } from '@wordpress/dataviews';
17
+ import { store as noticesStore } from '@wordpress/notices';
18
+
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+ import {
23
+ TEMPLATE_ORIGINS,
24
+ TEMPLATE_PART_POST_TYPE,
25
+ TEMPLATE_POST_TYPE,
26
+ } from '../../store/constants';
27
+ import { unlock } from '../../lock-unlock';
28
+ import {
29
+ getItemTitle,
30
+ isTemplateRemovable,
31
+ isTemplate,
32
+ isTemplatePart,
33
+ } from './utils';
34
+ import type { CoreDataError, PostWithPermissions } from '../types';
35
+
36
+ // Patterns.
37
+ const { PATTERN_TYPES } = unlock( patternsPrivateApis );
38
+
39
+ const renamePost: Action< PostWithPermissions > = {
40
+ id: 'rename-post',
41
+ label: __( 'Rename' ),
42
+ isEligible( post ) {
43
+ if ( post.status === 'trash' ) {
44
+ return false;
45
+ }
46
+ // Templates, template parts and patterns have special checks for renaming.
47
+ if (
48
+ ! [
49
+ TEMPLATE_POST_TYPE,
50
+ TEMPLATE_PART_POST_TYPE,
51
+ ...Object.values( PATTERN_TYPES ),
52
+ ].includes( post.type )
53
+ ) {
54
+ return post.permissions?.update;
55
+ }
56
+
57
+ // In the case of templates, we can only rename custom templates.
58
+ if ( isTemplate( post ) ) {
59
+ return (
60
+ isTemplateRemovable( post ) &&
61
+ post.is_custom &&
62
+ post.permissions?.update
63
+ );
64
+ }
65
+
66
+ if ( isTemplatePart( post ) ) {
67
+ return (
68
+ post.source === TEMPLATE_ORIGINS.custom &&
69
+ ! post?.has_theme_file &&
70
+ post.permissions?.update
71
+ );
72
+ }
73
+
74
+ return post.type === PATTERN_TYPES.user && post.permissions?.update;
75
+ },
76
+ RenderModal: ( { items, closeModal, onActionPerformed } ) => {
77
+ const [ item ] = items;
78
+ const [ title, setTitle ] = useState( () => getItemTitle( item ) );
79
+ const { editEntityRecord, saveEditedEntityRecord } =
80
+ useDispatch( coreStore );
81
+ const { createSuccessNotice, createErrorNotice } =
82
+ useDispatch( noticesStore );
83
+
84
+ async function onRename( event: React.FormEvent ) {
85
+ event.preventDefault();
86
+ try {
87
+ await editEntityRecord( 'postType', item.type, item.id, {
88
+ title,
89
+ } );
90
+ // Update state before saving rerenders the list.
91
+ setTitle( '' );
92
+ closeModal?.();
93
+ // Persist edited entity.
94
+ await saveEditedEntityRecord( 'postType', item.type, item.id, {
95
+ throwOnError: true,
96
+ } );
97
+ createSuccessNotice( __( 'Name updated' ), {
98
+ type: 'snackbar',
99
+ } );
100
+ onActionPerformed?.( items );
101
+ } catch ( error ) {
102
+ const typedError = error as CoreDataError;
103
+ const errorMessage =
104
+ typedError.message && typedError.code !== 'unknown_error'
105
+ ? typedError.message
106
+ : __( 'An error occurred while updating the name' );
107
+ createErrorNotice( errorMessage, { type: 'snackbar' } );
108
+ }
109
+ }
110
+
111
+ return (
112
+ <form onSubmit={ onRename }>
113
+ <VStack spacing="5">
114
+ <TextControl
115
+ __nextHasNoMarginBottom
116
+ __next40pxDefaultSize
117
+ label={ __( 'Name' ) }
118
+ value={ title }
119
+ onChange={ setTitle }
120
+ required
121
+ />
122
+ <HStack justify="right">
123
+ <Button
124
+ __next40pxDefaultSize
125
+ variant="tertiary"
126
+ onClick={ () => {
127
+ closeModal?.();
128
+ } }
129
+ >
130
+ { __( 'Cancel' ) }
131
+ </Button>
132
+ <Button
133
+ __next40pxDefaultSize
134
+ variant="primary"
135
+ type="submit"
136
+ >
137
+ { __( 'Save' ) }
138
+ </Button>
139
+ </HStack>
140
+ </VStack>
141
+ </form>
142
+ );
143
+ },
144
+ };
145
+
146
+ export default renamePost;
@@ -0,0 +1,3 @@
1
+ const reorderPage = undefined;
2
+
3
+ export default reorderPage;
@@ -0,0 +1,125 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useDispatch } from '@wordpress/data';
5
+ import { store as coreStore } from '@wordpress/core-data';
6
+ import { __ } from '@wordpress/i18n';
7
+ import { store as noticesStore } from '@wordpress/notices';
8
+ import { useState } from '@wordpress/element';
9
+ import { DataForm, isItemValid } from '@wordpress/dataviews';
10
+ import {
11
+ Button,
12
+ __experimentalHStack as HStack,
13
+ __experimentalVStack as VStack,
14
+ } from '@wordpress/components';
15
+ import type { Action, RenderModalProps } from '@wordpress/dataviews';
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+ import type { CoreDataError, BasePost } from '../types';
21
+ import { orderField } from '../fields';
22
+
23
+ const fields = [ orderField ];
24
+ const formOrderAction = {
25
+ fields: [ 'menu_order' ],
26
+ };
27
+
28
+ function ReorderModal( {
29
+ items,
30
+ closeModal,
31
+ onActionPerformed,
32
+ }: RenderModalProps< BasePost > ) {
33
+ const [ item, setItem ] = useState( items[ 0 ] );
34
+ const orderInput = item.menu_order;
35
+ const { editEntityRecord, saveEditedEntityRecord } =
36
+ useDispatch( coreStore );
37
+ const { createSuccessNotice, createErrorNotice } =
38
+ useDispatch( noticesStore );
39
+
40
+ async function onOrder( event: React.FormEvent ) {
41
+ event.preventDefault();
42
+
43
+ if ( ! isItemValid( item, fields, formOrderAction ) ) {
44
+ return;
45
+ }
46
+
47
+ try {
48
+ await editEntityRecord( 'postType', item.type, item.id, {
49
+ menu_order: orderInput,
50
+ } );
51
+ closeModal?.();
52
+ // Persist edited entity.
53
+ await saveEditedEntityRecord( 'postType', item.type, item.id, {
54
+ throwOnError: true,
55
+ } );
56
+ createSuccessNotice( __( 'Order updated.' ), {
57
+ type: 'snackbar',
58
+ } );
59
+ onActionPerformed?.( items );
60
+ } catch ( error ) {
61
+ const typedError = error as CoreDataError;
62
+ const errorMessage =
63
+ typedError.message && typedError.code !== 'unknown_error'
64
+ ? typedError.message
65
+ : __( 'An error occurred while updating the order' );
66
+ createErrorNotice( errorMessage, {
67
+ type: 'snackbar',
68
+ } );
69
+ }
70
+ }
71
+ const isSaveDisabled = ! isItemValid( item, fields, formOrderAction );
72
+ return (
73
+ <form onSubmit={ onOrder }>
74
+ <VStack spacing="5">
75
+ <div>
76
+ { __(
77
+ 'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'
78
+ ) }
79
+ </div>
80
+ <DataForm
81
+ data={ item }
82
+ fields={ fields }
83
+ form={ formOrderAction }
84
+ onChange={ ( changes ) =>
85
+ setItem( {
86
+ ...item,
87
+ ...changes,
88
+ } )
89
+ }
90
+ />
91
+ <HStack justify="right">
92
+ <Button
93
+ __next40pxDefaultSize
94
+ variant="tertiary"
95
+ onClick={ () => {
96
+ closeModal?.();
97
+ } }
98
+ >
99
+ { __( 'Cancel' ) }
100
+ </Button>
101
+ <Button
102
+ __next40pxDefaultSize
103
+ variant="primary"
104
+ type="submit"
105
+ accessibleWhenDisabled
106
+ disabled={ isSaveDisabled }
107
+ >
108
+ { __( 'Save' ) }
109
+ </Button>
110
+ </HStack>
111
+ </VStack>
112
+ </form>
113
+ );
114
+ }
115
+
116
+ const reorderPage: Action< BasePost > = {
117
+ id: 'order-pages',
118
+ label: __( 'Order' ),
119
+ isEligible( { status } ) {
120
+ return status !== 'trash';
121
+ },
122
+ RenderModal: ReorderModal,
123
+ };
124
+
125
+ export default reorderPage;
@@ -32,7 +32,8 @@ const resetPost: Action< Post > = {
32
32
  return (
33
33
  isTemplateOrTemplatePart( item ) &&
34
34
  item?.source === TEMPLATE_ORIGINS.custom &&
35
- item?.has_theme_file
35
+ ( Boolean( item.type === 'wp_template' && item?.plugin ) ||
36
+ item?.has_theme_file )
36
37
  );
37
38
  },
38
39
  icon: backup,
@@ -113,6 +114,8 @@ const resetPost: Action< Post > = {
113
114
  </Text>
114
115
  <HStack justify="right">
115
116
  <Button
117
+ // TODO: Switch to `true` (40px size) if possible
118
+ __next40pxDefaultSize={ false }
116
119
  variant="tertiary"
117
120
  onClick={ closeModal }
118
121
  disabled={ isBusy }
@@ -121,6 +124,8 @@ const resetPost: Action< Post > = {
121
124
  { __( 'Cancel' ) }
122
125
  </Button>
123
126
  <Button
127
+ // TODO: Switch to `true` (40px size) if possible
128
+ __next40pxDefaultSize={ false }
124
129
  variant="primary"
125
130
  onClick={ async () => {
126
131
  setIsBusy( true );
@@ -67,6 +67,8 @@ const trashPost: Action< PostWithPermissions > = {
67
67
  </Text>
68
68
  <HStack justify="right">
69
69
  <Button
70
+ // TODO: Switch to `true` (40px size) if possible
71
+ __next40pxDefaultSize={ false }
70
72
  variant="tertiary"
71
73
  onClick={ closeModal }
72
74
  disabled={ isBusy }
@@ -75,6 +77,8 @@ const trashPost: Action< PostWithPermissions > = {
75
77
  { __( 'Cancel' ) }
76
78
  </Button>
77
79
  <Button
80
+ // TODO: Switch to `true` (40px size) if possible
81
+ __next40pxDefaultSize={ false }
78
82
  variant="primary"
79
83
  onClick={ async () => {
80
84
  setIsBusy( true );
@@ -12,11 +12,19 @@ import {
12
12
  TEMPLATE_POST_TYPE,
13
13
  } from '../../store/constants';
14
14
 
15
- import type { Post, TemplateOrTemplatePart } from '../types';
15
+ import type { Post, TemplatePart, Template } from '../types';
16
+
17
+ export function isTemplate( post: Post ): post is Template {
18
+ return post.type === TEMPLATE_POST_TYPE;
19
+ }
20
+
21
+ export function isTemplatePart( post: Post ): post is TemplatePart {
22
+ return post.type === TEMPLATE_PART_POST_TYPE;
23
+ }
16
24
 
17
25
  export function isTemplateOrTemplatePart(
18
26
  p: Post
19
- ): p is TemplateOrTemplatePart {
27
+ ): p is Template | TemplatePart {
20
28
  return p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;
21
29
  }
22
30
 
@@ -39,7 +47,7 @@ export function getItemTitle( item: Post ) {
39
47
  * @param template The template entity to check.
40
48
  * @return Whether the template is removable.
41
49
  */
42
- export function isTemplateRemovable( template: TemplateOrTemplatePart ) {
50
+ export function isTemplateRemovable( template: Template | TemplatePart ) {
43
51
  if ( ! template ) {
44
52
  return false;
45
53
  }
@@ -49,6 +57,8 @@ export function isTemplateRemovable( template: TemplateOrTemplatePart ) {
49
57
  return (
50
58
  [ template.source, template.source ].includes(
51
59
  TEMPLATE_ORIGINS.custom
52
- ) && ! template.has_theme_file
60
+ ) &&
61
+ ! Boolean( template.type === 'wp_template' && template?.plugin ) &&
62
+ ! template.has_theme_file
53
63
  );
54
64
  }