@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
@@ -1,513 +1,28 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { external } from '@wordpress/icons';
5
- import { addQueryArgs } from '@wordpress/url';
6
4
  import { useDispatch, useSelect } from '@wordpress/data';
7
- import { decodeEntities } from '@wordpress/html-entities';
8
- import { store as coreStore } from '@wordpress/core-data';
9
- import { __, sprintf, _x } from '@wordpress/i18n';
10
- import { store as noticesStore } from '@wordpress/notices';
11
- import { useMemo, useState, useEffect } from '@wordpress/element';
12
- import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
13
- import { parse } from '@wordpress/blocks';
14
- import { DataForm, isItemValid } from '@wordpress/dataviews';
15
- import { Button, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
5
+ import { useMemo, useEffect } from '@wordpress/element';
16
6
 
17
7
  /**
18
8
  * Internal dependencies
19
9
  */
20
- import { TEMPLATE_ORIGINS, TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE, PATTERN_POST_TYPE } from '../../store/constants';
21
10
  import { store as editorStore } from '../../store';
22
11
  import { unlock } from '../../lock-unlock';
23
- import { CreateTemplatePartModalContents } from '../create-template-part-modal';
24
- import { getItemTitle } from '../../dataviews/actions/utils';
25
-
26
- // Patterns.
27
12
  import { jsx as _jsx } from "react/jsx-runtime";
28
- import { jsxs as _jsxs } from "react/jsx-runtime";
29
- const {
30
- PATTERN_TYPES,
31
- CreatePatternModalContents,
32
- useDuplicatePatternProps
33
- } = unlock(patternsPrivateApis);
34
-
35
- // TODO: this should be shared with other components (see post-fields in edit-site).
36
- const fields = [{
37
- type: 'text',
38
- id: 'title',
39
- label: __('Title'),
40
- placeholder: __('No title'),
41
- getValue: ({
42
- item
43
- }) => item.title
44
- }, {
45
- type: 'integer',
46
- id: 'menu_order',
47
- label: __('Order'),
48
- description: __('Determines the order of pages.')
49
- }];
50
- const formDuplicateAction = {
51
- fields: ['title']
52
- };
53
- const formOrderAction = {
54
- fields: ['menu_order']
55
- };
56
-
57
- /**
58
- * Check if a template is removable.
59
- *
60
- * @param {Object} template The template entity to check.
61
- * @return {boolean} Whether the template is removable.
62
- */
63
- function isTemplateRemovable(template) {
64
- if (!template) {
65
- return false;
66
- }
67
- // In patterns list page we map the templates parts to a different object
68
- // than the one returned from the endpoint. This is why we need to check for
69
- // two props whether is custom or has a theme file.
70
- return template?.source === TEMPLATE_ORIGINS.custom && !template?.has_theme_file;
71
- }
72
- const viewPostAction = {
73
- id: 'view-post',
74
- label: __('View'),
75
- isPrimary: true,
76
- icon: external,
77
- isEligible(post) {
78
- return post.status !== 'trash';
79
- },
80
- callback(posts, {
81
- onActionPerformed
82
- }) {
83
- const post = posts[0];
84
- window.open(post.link, '_blank');
85
- if (onActionPerformed) {
86
- onActionPerformed(posts);
87
- }
88
- }
89
- };
90
- const postRevisionsAction = {
91
- id: 'view-post-revisions',
92
- context: 'list',
93
- label(items) {
94
- var _items$0$_links$versi;
95
- const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0;
96
- return sprintf( /* translators: %s: number of revisions */
97
- __('View revisions (%s)'), revisionsCount);
98
- },
99
- isEligible: post => {
100
- var _post$_links$predeces, _post$_links$version;
101
- if (post.status === 'trash') {
102
- return false;
103
- }
104
- const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null;
105
- const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
106
- return lastRevisionId && revisionsCount > 1;
107
- },
108
- callback(posts, {
109
- onActionPerformed
110
- }) {
111
- const post = posts[0];
112
- const href = addQueryArgs('revision.php', {
113
- revision: post?._links?.['predecessor-version']?.[0]?.id
114
- });
115
- document.location.href = href;
116
- if (onActionPerformed) {
117
- onActionPerformed(posts);
118
- }
119
- }
120
- };
121
- const renamePostAction = {
122
- id: 'rename-post',
123
- label: __('Rename'),
124
- isEligible(post) {
125
- if (post.status === 'trash') {
126
- return false;
127
- }
128
- // Templates, template parts and patterns have special checks for renaming.
129
- if (![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, ...Object.values(PATTERN_TYPES)].includes(post.type)) {
130
- return post.permissions?.update;
131
- }
132
- // In the case of templates, we can only rename custom templates.
133
- if (post.type === TEMPLATE_POST_TYPE) {
134
- return isTemplateRemovable(post) && post.is_custom && post.permissions?.update;
135
- }
136
- // Make necessary checks for template parts and patterns.
137
- const isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;
138
- const isUserPattern = post.type === PATTERN_TYPES.user;
139
- // In patterns list page we map the templates parts to a different object
140
- // than the one returned from the endpoint. This is why we need to check for
141
- // two props whether is custom or has a theme file.
142
- const isCustomPattern = isUserPattern || isTemplatePart && post.source === TEMPLATE_ORIGINS.custom;
143
- const hasThemeFile = post?.has_theme_file;
144
- return isCustomPattern && !hasThemeFile && post.permissions?.update;
145
- },
146
- RenderModal: ({
147
- items,
148
- closeModal,
149
- onActionPerformed
150
- }) => {
151
- const [item] = items;
152
- const [title, setTitle] = useState(() => getItemTitle(item));
153
- const {
154
- editEntityRecord,
155
- saveEditedEntityRecord
156
- } = useDispatch(coreStore);
157
- const {
158
- createSuccessNotice,
159
- createErrorNotice
160
- } = useDispatch(noticesStore);
161
- async function onRename(event) {
162
- event.preventDefault();
163
- try {
164
- await editEntityRecord('postType', item.type, item.id, {
165
- title
166
- });
167
- // Update state before saving rerenders the list.
168
- setTitle('');
169
- closeModal();
170
- // Persist edited entity.
171
- await saveEditedEntityRecord('postType', item.type, item.id, {
172
- throwOnError: true
173
- });
174
- createSuccessNotice(__('Name updated'), {
175
- type: 'snackbar'
176
- });
177
- onActionPerformed?.(items);
178
- } catch (error) {
179
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while updating the name');
180
- createErrorNotice(errorMessage, {
181
- type: 'snackbar'
182
- });
183
- }
184
- }
185
- return /*#__PURE__*/_jsx("form", {
186
- onSubmit: onRename,
187
- children: /*#__PURE__*/_jsxs(VStack, {
188
- spacing: "5",
189
- children: [/*#__PURE__*/_jsx(TextControl, {
190
- __nextHasNoMarginBottom: true,
191
- __next40pxDefaultSize: true,
192
- label: __('Name'),
193
- value: title,
194
- onChange: setTitle,
195
- required: true
196
- }), /*#__PURE__*/_jsxs(HStack, {
197
- justify: "right",
198
- children: [/*#__PURE__*/_jsx(Button, {
199
- __next40pxDefaultSize: true,
200
- variant: "tertiary",
201
- onClick: () => {
202
- closeModal();
203
- },
204
- children: __('Cancel')
205
- }), /*#__PURE__*/_jsx(Button, {
206
- __next40pxDefaultSize: true,
207
- variant: "primary",
208
- type: "submit",
209
- children: __('Save')
210
- })]
211
- })]
212
- })
213
- });
214
- }
215
- };
216
- function ReorderModal({
217
- items,
218
- closeModal,
219
- onActionPerformed
220
- }) {
221
- const [item, setItem] = useState(items[0]);
222
- const orderInput = item.menu_order;
223
- const {
224
- editEntityRecord,
225
- saveEditedEntityRecord
226
- } = useDispatch(coreStore);
227
- const {
228
- createSuccessNotice,
229
- createErrorNotice
230
- } = useDispatch(noticesStore);
231
- async function onOrder(event) {
232
- event.preventDefault();
233
- if (!isItemValid(item, fields, formOrderAction)) {
234
- return;
235
- }
236
- try {
237
- await editEntityRecord('postType', item.type, item.id, {
238
- menu_order: orderInput
239
- });
240
- closeModal();
241
- // Persist edited entity.
242
- await saveEditedEntityRecord('postType', item.type, item.id, {
243
- throwOnError: true
244
- });
245
- createSuccessNotice(__('Order updated'), {
246
- type: 'snackbar'
247
- });
248
- onActionPerformed?.(items);
249
- } catch (error) {
250
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while updating the order');
251
- createErrorNotice(errorMessage, {
252
- type: 'snackbar'
253
- });
254
- }
255
- }
256
- const isSaveDisabled = !isItemValid(item, fields, formOrderAction);
257
- return /*#__PURE__*/_jsx("form", {
258
- onSubmit: onOrder,
259
- children: /*#__PURE__*/_jsxs(VStack, {
260
- spacing: "5",
261
- children: [/*#__PURE__*/_jsx("div", {
262
- children: __('Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.')
263
- }), /*#__PURE__*/_jsx(DataForm, {
264
- data: item,
265
- fields: fields,
266
- form: formOrderAction,
267
- onChange: setItem
268
- }), /*#__PURE__*/_jsxs(HStack, {
269
- justify: "right",
270
- children: [/*#__PURE__*/_jsx(Button, {
271
- __next40pxDefaultSize: true,
272
- variant: "tertiary",
273
- onClick: () => {
274
- closeModal();
275
- },
276
- children: __('Cancel')
277
- }), /*#__PURE__*/_jsx(Button, {
278
- __next40pxDefaultSize: true,
279
- variant: "primary",
280
- type: "submit",
281
- accessibleWhenDisabled: true,
282
- disabled: isSaveDisabled,
283
- __experimentalIsFocusable: true,
284
- children: __('Save')
285
- })]
286
- })]
287
- })
288
- });
289
- }
290
- function useReorderPagesAction(postType) {
291
- const supportsPageAttributes = useSelect(select => {
292
- const {
293
- getPostType
294
- } = select(coreStore);
295
- const postTypeObject = getPostType(postType);
296
- return !!postTypeObject?.supports?.['page-attributes'];
297
- }, [postType]);
298
- return useMemo(() => supportsPageAttributes && {
299
- id: 'order-pages',
300
- label: __('Order'),
301
- isEligible({
302
- status
303
- }) {
304
- return status !== 'trash';
305
- },
306
- RenderModal: ReorderModal
307
- }, [supportsPageAttributes]);
308
- }
309
- const useDuplicatePostAction = postType => {
310
- const userCanCreatePost = useSelect(select => {
311
- return select(coreStore).canUser('create', {
312
- kind: 'postType',
313
- name: postType
314
- });
315
- }, [postType]);
316
- return useMemo(() => userCanCreatePost && {
317
- id: 'duplicate-post',
318
- label: _x('Duplicate', 'action label'),
319
- isEligible({
320
- status
321
- }) {
322
- return status !== 'trash';
323
- },
324
- RenderModal: ({
325
- items,
326
- closeModal,
327
- onActionPerformed
328
- }) => {
329
- const [item, setItem] = useState({
330
- ...items[0],
331
- title: sprintf( /* translators: %s: Existing template title */
332
- __('%s (Copy)'), getItemTitle(items[0]))
333
- });
334
- const [isCreatingPage, setIsCreatingPage] = useState(false);
335
- const {
336
- saveEntityRecord
337
- } = useDispatch(coreStore);
338
- const {
339
- createSuccessNotice,
340
- createErrorNotice
341
- } = useDispatch(noticesStore);
342
- async function createPage(event) {
343
- event.preventDefault();
344
- if (isCreatingPage) {
345
- return;
346
- }
347
- const newItemOject = {
348
- status: 'draft',
349
- title: item.title,
350
- slug: item.title || __('No title'),
351
- comment_status: item.comment_status,
352
- content: typeof item.content === 'string' ? item.content : item.content.raw,
353
- excerpt: item.excerpt.raw,
354
- meta: item.meta,
355
- parent: item.parent,
356
- password: item.password,
357
- template: item.template,
358
- format: item.format,
359
- featured_media: item.featured_media,
360
- menu_order: item.menu_order,
361
- ping_status: item.ping_status
362
- };
363
- const assignablePropertiesPrefix = 'wp:action-assign-';
364
- // Get all the properties that the current user is able to assign normally author, categories, tags,
365
- // and custom taxonomies.
366
- const assignableProperties = Object.keys(item?._links || {}).filter(property => property.startsWith(assignablePropertiesPrefix)).map(property => property.slice(assignablePropertiesPrefix.length));
367
- assignableProperties.forEach(property => {
368
- if (item[property]) {
369
- newItemOject[property] = item[property];
370
- }
371
- });
372
- setIsCreatingPage(true);
373
- try {
374
- const newItem = await saveEntityRecord('postType', item.type, newItemOject, {
375
- throwOnError: true
376
- });
377
- createSuccessNotice(sprintf(
378
- // translators: %s: Title of the created template e.g: "Category".
379
- __('"%s" successfully created.'), decodeEntities(newItem.title?.rendered || item.title)), {
380
- id: 'duplicate-post-action',
381
- type: 'snackbar'
382
- });
383
- if (onActionPerformed) {
384
- onActionPerformed([newItem]);
385
- }
386
- } catch (error) {
387
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while duplicating the page.');
388
- createErrorNotice(errorMessage, {
389
- type: 'snackbar'
390
- });
391
- } finally {
392
- setIsCreatingPage(false);
393
- closeModal();
394
- }
395
- }
396
- return /*#__PURE__*/_jsx("form", {
397
- onSubmit: createPage,
398
- children: /*#__PURE__*/_jsxs(VStack, {
399
- spacing: 3,
400
- children: [/*#__PURE__*/_jsx(DataForm, {
401
- data: item,
402
- fields: fields,
403
- form: formDuplicateAction,
404
- onChange: setItem
405
- }), /*#__PURE__*/_jsxs(HStack, {
406
- spacing: 2,
407
- justify: "end",
408
- children: [/*#__PURE__*/_jsx(Button, {
409
- variant: "tertiary",
410
- onClick: closeModal,
411
- __next40pxDefaultSize: true,
412
- children: __('Cancel')
413
- }), /*#__PURE__*/_jsx(Button, {
414
- variant: "primary",
415
- type: "submit",
416
- isBusy: isCreatingPage,
417
- "aria-disabled": isCreatingPage,
418
- __next40pxDefaultSize: true,
419
- children: _x('Duplicate', 'action label')
420
- })]
421
- })]
422
- })
423
- });
424
- }
425
- }, [userCanCreatePost]);
426
- };
427
- export const duplicatePatternAction = {
428
- id: 'duplicate-pattern',
429
- label: _x('Duplicate', 'action label'),
430
- isEligible: item => item.type !== TEMPLATE_PART_POST_TYPE,
431
- modalHeader: _x('Duplicate pattern', 'action label'),
432
- RenderModal: ({
433
- items,
434
- closeModal
435
- }) => {
436
- const [item] = items;
437
- const duplicatedProps = useDuplicatePatternProps({
438
- pattern: item,
439
- onSuccess: () => closeModal()
440
- });
441
- return /*#__PURE__*/_jsx(CreatePatternModalContents, {
442
- onClose: closeModal,
443
- confirmLabel: _x('Duplicate', 'action label'),
444
- ...duplicatedProps
445
- });
446
- }
447
- };
448
- export const duplicateTemplatePartAction = {
449
- id: 'duplicate-template-part',
450
- label: _x('Duplicate', 'action label'),
451
- isEligible: item => item.type === TEMPLATE_PART_POST_TYPE,
452
- modalHeader: _x('Duplicate template part', 'action label'),
453
- RenderModal: ({
454
- items,
455
- closeModal
456
- }) => {
457
- const [item] = items;
458
- const blocks = useMemo(() => {
459
- var _item$blocks;
460
- return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : parse(typeof item.content === 'string' ? item.content : item.content.raw, {
461
- __unstableSkipMigrationLogs: true
462
- });
463
- }, [item.content, item.blocks]);
464
- const {
465
- createSuccessNotice
466
- } = useDispatch(noticesStore);
467
- function onTemplatePartSuccess() {
468
- createSuccessNotice(sprintf(
469
- // translators: %s: The new template part's title e.g. 'Call to action (copy)'.
470
- __('"%s" duplicated.'), getItemTitle(item)), {
471
- type: 'snackbar',
472
- id: 'edit-site-patterns-success'
473
- });
474
- closeModal();
475
- }
476
- return /*#__PURE__*/_jsx(CreateTemplatePartModalContents, {
477
- blocks: blocks,
478
- defaultArea: item.area,
479
- defaultTitle: sprintf( /* translators: %s: Existing template part title */
480
- __('%s (Copy)'), getItemTitle(item)),
481
- onCreate: onTemplatePartSuccess,
482
- onError: closeModal,
483
- confirmLabel: _x('Duplicate', 'action label')
484
- });
485
- }
486
- };
487
13
  export function usePostActions({
488
14
  postType,
489
15
  onActionPerformed,
490
16
  context
491
17
  }) {
492
18
  const {
493
- defaultActions,
494
- postTypeObject,
495
- userCanCreatePostType
19
+ defaultActions
496
20
  } = useSelect(select => {
497
- const {
498
- getPostType,
499
- canUser
500
- } = select(coreStore);
501
21
  const {
502
22
  getEntityActions
503
23
  } = unlock(select(editorStore));
504
24
  return {
505
- postTypeObject: getPostType(postType),
506
- defaultActions: getEntityActions('postType', postType),
507
- userCanCreatePostType: canUser('create', {
508
- kind: 'postType',
509
- name: postType
510
- })
25
+ defaultActions: getEntityActions('postType', postType)
511
26
  };
512
27
  }, [postType]);
513
28
  const {
@@ -516,25 +31,14 @@ export function usePostActions({
516
31
  useEffect(() => {
517
32
  registerPostTypeActions(postType);
518
33
  }, [registerPostTypeActions, postType]);
519
- const duplicatePostAction = useDuplicatePostAction(postType);
520
- const reorderPagesAction = useReorderPagesAction(postType);
521
- const isTemplateOrTemplatePart = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType);
522
- const isPattern = postType === PATTERN_POST_TYPE;
523
- const isLoaded = !!postTypeObject;
524
- const supportsRevisions = !!postTypeObject?.supports?.revisions;
525
- const supportsTitle = !!postTypeObject?.supports?.title;
526
34
  return useMemo(() => {
527
- if (!isLoaded) {
528
- return [];
529
- }
530
- let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && userCanCreatePostType && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostAction, reorderPagesAction, ...defaultActions].filter(Boolean);
531
35
  // Filter actions based on provided context. If not provided
532
36
  // all actions are returned. We'll have a single entry for getting the actions
533
37
  // and the consumer should provide the context to filter the actions, if needed.
534
38
  // Actions should also provide the `context` they support, if it's specific, to
535
39
  // compare with the provided context to get all the actions.
536
40
  // Right now the only supported context is `list`.
537
- actions = actions.filter(action => {
41
+ const actions = defaultActions.filter(action => {
538
42
  if (!action.context) {
539
43
  return true;
540
44
  }
@@ -579,6 +83,6 @@ export function usePostActions({
579
83
  }
580
84
  }
581
85
  return actions;
582
- }, [defaultActions, userCanCreatePostType, isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, duplicatePostAction, reorderPagesAction, onActionPerformed, isLoaded, supportsRevisions, supportsTitle, context]);
86
+ }, [defaultActions, onActionPerformed, context]);
583
87
  }
584
88
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["external","addQueryArgs","useDispatch","useSelect","decodeEntities","store","coreStore","__","sprintf","_x","noticesStore","useMemo","useState","useEffect","privateApis","patternsPrivateApis","parse","DataForm","isItemValid","Button","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","TEMPLATE_ORIGINS","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_POST_TYPE","editorStore","unlock","CreateTemplatePartModalContents","getItemTitle","jsx","_jsx","jsxs","_jsxs","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","fields","type","id","label","placeholder","getValue","item","title","description","formDuplicateAction","formOrderAction","isTemplateRemovable","template","source","custom","has_theme_file","viewPostAction","isPrimary","icon","isEligible","post","status","callback","posts","onActionPerformed","window","open","link","postRevisionsAction","context","items","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","revision","document","location","renamePostAction","Object","values","includes","permissions","update","is_custom","isTemplatePart","isUserPattern","user","isCustomPattern","hasThemeFile","RenderModal","closeModal","setTitle","editEntityRecord","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","onRename","event","preventDefault","throwOnError","error","errorMessage","message","code","onSubmit","children","spacing","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","justify","variant","onClick","ReorderModal","setItem","orderInput","menu_order","onOrder","isSaveDisabled","data","form","accessibleWhenDisabled","disabled","__experimentalIsFocusable","useReorderPagesAction","postType","supportsPageAttributes","select","getPostType","postTypeObject","supports","useDuplicatePostAction","userCanCreatePost","canUser","kind","name","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItemOject","slug","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","ping_status","assignablePropertiesPrefix","assignableProperties","keys","filter","property","startsWith","map","slice","length","forEach","newItem","rendered","isBusy","duplicatePatternAction","modalHeader","duplicatedProps","pattern","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","blocks","_item$blocks","__unstableSkipMigrationLogs","onTemplatePartSuccess","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","defaultActions","userCanCreatePostType","getEntityActions","registerPostTypeActions","duplicatePostAction","reorderPagesAction","isTemplateOrTemplatePart","isPattern","isLoaded","supportsRevisions","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","action","i","existingCallback","argsObject","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState, useEffect } from '@wordpress/element';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { parse } from '@wordpress/blocks';\nimport { DataForm, isItemValid } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_ORIGINS,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\nimport { getItemTitle } from '../../dataviews/actions/utils';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\n\n// TODO: this should be shared with other components (see post-fields in edit-site).\nconst fields = [\n\t{\n\t\ttype: 'text',\n\t\tid: 'title',\n\t\tlabel: __( 'Title' ),\n\t\tplaceholder: __( 'No title' ),\n\t\tgetValue: ( { item } ) => item.title,\n\t},\n\t{\n\t\ttype: 'integer',\n\t\tid: 'menu_order',\n\t\tlabel: __( 'Order' ),\n\t\tdescription: __( 'Determines the order of pages.' ),\n\t},\n];\n\nconst formDuplicateAction = {\n\tfields: [ 'title' ],\n};\n\nconst formOrderAction = {\n\tfields: [ 'menu_order' ],\n};\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is removable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom &&\n\t\t! template?.has_theme_file\n\t);\n}\n\nconst viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\twindow.open( post.link, '_blank' );\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tcontext: 'list',\n\tlabel( items ) {\n\t\tconst revisionsCount =\n\t\t\titems[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn sprintf(\n\t\t\t/* translators: %s: number of revisions */\n\t\t\t__( 'View revisions (%s)' ),\n\t\t\trevisionsCount\n\t\t);\n\t},\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst renamePostAction = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif (\n\t\t\t! [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t...Object.values( PATTERN_TYPES ),\n\t\t\t].includes( post.type )\n\t\t) {\n\t\t\treturn post.permissions?.update;\n\t\t}\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( post.type === TEMPLATE_POST_TYPE ) {\n\t\t\treturn (\n\t\t\t\tisTemplateRemovable( post ) &&\n\t\t\t\tpost.is_custom &&\n\t\t\t\tpost.permissions?.update\n\t\t\t);\n\t\t}\n\t\t// Make necessary checks for template parts and patterns.\n\t\tconst isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;\n\t\tconst isUserPattern = post.type === PATTERN_TYPES.user;\n\t\t// In patterns list page we map the templates parts to a different object\n\t\t// than the one returned from the endpoint. This is why we need to check for\n\t\t// two props whether is custom or has a theme file.\n\t\tconst isCustomPattern =\n\t\t\tisUserPattern ||\n\t\t\t( isTemplatePart && post.source === TEMPLATE_ORIGINS.custom );\n\t\tconst hasThemeFile = post?.has_theme_file;\n\t\treturn isCustomPattern && ! hasThemeFile && post.permissions?.update;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst errorMessage =\n\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t);\n\t},\n};\n\nfunction ReorderModal( { items, closeModal, onActionPerformed } ) {\n\tconst [ item, setItem ] = useState( items[ 0 ] );\n\tconst orderInput = item.menu_order;\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function onOrder( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( ! isItemValid( item, fields, formOrderAction ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tmenu_order: orderInput,\n\t\t\t} );\n\t\t\tcloseModal();\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Order updated' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tonActionPerformed?.( items );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while updating the order' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\tconst isSaveDisabled = ! isItemValid( item, fields, formOrderAction );\n\treturn (\n\t\t<form onSubmit={ onOrder }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<div>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ item }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ formOrderAction }\n\t\t\t\t\tonChange={ setItem }\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ isSaveDisabled }\n\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nfunction useReorderPagesAction( postType ) {\n\tconst supportsPageAttributes = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postTypeObject = getPostType( postType );\n\n\t\t\treturn !! postTypeObject?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupportsPageAttributes && {\n\t\t\t\tid: 'order-pages',\n\t\t\t\tlabel: __( 'Order' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ReorderModal,\n\t\t\t},\n\t\t[ supportsPageAttributes ]\n\t);\n}\n\nconst useDuplicatePostAction = ( postType ) => {\n\tconst userCanCreatePost = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tuserCanCreatePost && {\n\t\t\t\tid: 'duplicate-post',\n\t\t\t\tlabel: _x( 'Duplicate', 'action label' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\t\t\t\tconst [ item, setItem ] = useState( {\n\t\t\t\t\t\t...items[ 0 ],\n\t\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Existing template title */\n\t\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst [ isCreatingPage, setIsCreatingPage ] =\n\t\t\t\t\t\tuseState( false );\n\n\t\t\t\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\t\t\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\t\t\t\tuseDispatch( noticesStore );\n\n\t\t\t\t\tasync function createPage( event ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tif ( isCreatingPage ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newItemOject = {\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\tslug: item.title || __( 'No title' ),\n\t\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst assignablePropertiesPrefix = 'wp:action-assign-';\n\t\t\t\t\t\t// Get all the properties that the current user is able to assign normally author, categories, tags,\n\t\t\t\t\t\t// and custom taxonomies.\n\t\t\t\t\t\tconst assignableProperties = Object.keys(\n\t\t\t\t\t\t\titem?._links || {}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.startsWith(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.slice(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tassignableProperties.forEach( ( property ) => {\n\t\t\t\t\t\t\tif ( item[ property ] ) {\n\t\t\t\t\t\t\t\tnewItemOject[ property ] = item[ property ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsCreatingPage( true );\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\tnewItemOject,\n\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\tnewItem.title?.rendered || item.title\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while duplicating the page.'\n\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t\t\t<DataForm\n\t\t\t\t\t\t\t\t\tdata={ item }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tform={ formDuplicateAction }\n\t\t\t\t\t\t\t\t\tonChange={ setItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t[ userCanCreatePost ]\n\t);\n};\n\nexport const duplicatePatternAction = {\n\tid: 'duplicate-pattern',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate pattern', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern: item,\n\t\t\tonSuccess: () => closeModal(),\n\t\t} );\n\t\treturn (\n\t\t\t<CreatePatternModalContents\n\t\t\t\tonClose={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t{ ...duplicatedProps }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport const duplicateTemplatePartAction = {\n\tid: 'duplicate-template-part',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate template part', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst blocks = useMemo( () => {\n\t\t\treturn (\n\t\t\t\titem.blocks ??\n\t\t\t\tparse(\n\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t{\n\t\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t);\n\t\t}, [ item.content, item.blocks ] );\n\t\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\t\tfunction onTemplatePartSuccess() {\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The new template part's title e.g. 'Call to action (copy)'.\n\t\t\t\t\t__( '\"%s\" duplicated.' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t\tcloseModal();\n\t\t}\n\t\treturn (\n\t\t\t<CreateTemplatePartModalContents\n\t\t\t\tblocks={ blocks }\n\t\t\t\tdefaultArea={ item.area }\n\t\t\t\tdefaultTitle={ sprintf(\n\t\t\t\t\t/* translators: %s: Existing template part title */\n\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t) }\n\t\t\t\tonCreate={ onTemplatePartSuccess }\n\t\t\t\tonError={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions, postTypeObject, userCanCreatePostType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tpostTypeObject: getPostType( postType ),\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t\tuserCanCreatePostType: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst { registerPostTypeActions } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeActions( postType );\n\t}, [ registerPostTypeActions, postType ] );\n\n\tconst duplicatePostAction = useDuplicatePostAction( postType );\n\tconst reorderPagesAction = useReorderPagesAction( postType );\n\tconst isTemplateOrTemplatePart = [\n\t\tTEMPLATE_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t].includes( postType );\n\tconst isPattern = postType === PATTERN_POST_TYPE;\n\tconst isLoaded = !! postTypeObject;\n\tconst supportsRevisions = !! postTypeObject?.supports?.revisions;\n\tconst supportsTitle = !! postTypeObject?.supports?.title;\n\treturn useMemo( () => {\n\t\tif ( ! isLoaded ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet actions = [\n\t\t\tpostTypeObject?.viewable && viewPostAction,\n\t\t\tsupportsRevisions && postRevisionsAction,\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! isTemplateOrTemplatePart &&\n\t\t\t\t ! isPattern &&\n\t\t\t\t duplicatePostAction\n\t\t\t\t: false,\n\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tuserCanCreatePostType &&\n\t\t\t\tduplicateTemplatePartAction,\n\t\t\tisPattern && userCanCreatePostType && duplicatePatternAction,\n\t\t\tsupportsTitle && renamePostAction,\n\t\t\treorderPagesAction,\n\t\t\t...defaultActions,\n\t\t].filter( Boolean );\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [\n\t\tdefaultActions,\n\t\tuserCanCreatePostType,\n\t\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tduplicatePostAction,\n\t\treorderPagesAction,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACjD,SAASJ,KAAK,IAAIK,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dC,KAAK;gBACVrJ,iBAAiB,EAAKmJ,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAACrJ,iBAAiB,EAAG;oBAC9BqJ,KAAK,CAACrJ,iBAAiB,CAAEmJ,MAAO,CAAC;kBAClC;kBACAnJ,iBAAiB,CAChB0I,OAAO,CAAEM,CAAC,CAAE,CAACtK,EAAE,EACfyK,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOT,OAAO;EACf,CAAC,EAAE,CACFZ,cAAc,EACdC,qBAAqB,EACrBK,wBAAwB,EACxBC,SAAS,EACT7D,cAAc,EAAEmE,QAAQ,EACxBT,mBAAmB,EACnBC,kBAAkB,EAClBnI,iBAAiB,EACjBsI,QAAQ,EACRC,iBAAiB,EACjBE,aAAa,EACbpI,OAAO,CACN,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["useDispatch","useSelect","useMemo","useEffect","store","editorStore","unlock","jsx","_jsx","usePostActions","postType","onActionPerformed","context","defaultActions","select","getEntityActions","registerPostTypeActions","actions","filter","action","i","length","callback","existingCallback","items","argsObject","_items","id","RenderModal","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst { registerPostTypeActions } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeActions( postType );\n\t}, [ registerPostTypeActions, postType ] );\n\n\treturn useMemo( () => {\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tconst actions = defaultActions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [ defaultActions, onActionPerformed, context ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,SAASC,cAAcA,CAAE;EAAEC,QAAQ;EAAEC,iBAAiB;EAAEC;AAAQ,CAAC,EAAG;EAC1E,MAAM;IAAEC;EAAe,CAAC,GAAGZ,SAAS,CACjCa,MAAM,IAAM;IACb,MAAM;MAAEC;IAAiB,CAAC,GAAGT,MAAM,CAAEQ,MAAM,CAAET,WAAY,CAAE,CAAC;IAC5D,OAAO;MACNQ,cAAc,EAAEE,gBAAgB,CAAE,UAAU,EAAEL,QAAS;IACxD,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EAED,MAAM;IAAEM;EAAwB,CAAC,GAAGV,MAAM,CAAEN,WAAW,CAAEK,WAAY,CAAE,CAAC;EACxEF,SAAS,CAAE,MAAM;IAChBa,uBAAuB,CAAEN,QAAS,CAAC;EACpC,CAAC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