@wordpress/editor 13.33.0 → 13.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +132 -20
  3. package/build/components/autosave-monitor/index.js +15 -12
  4. package/build/components/autosave-monitor/index.js.map +1 -1
  5. package/build/components/character-count/index.js +5 -0
  6. package/build/components/character-count/index.js.map +1 -1
  7. package/build/components/collapsible-block-toolbar/index.js +73 -0
  8. package/build/components/collapsible-block-toolbar/index.js.map +1 -0
  9. package/build/components/document-outline/check.js +8 -0
  10. package/build/components/document-outline/check.js.map +1 -1
  11. package/build/components/document-outline/index.js +11 -0
  12. package/build/components/document-outline/index.js.map +1 -1
  13. package/build/components/document-tools/index.js +0 -7
  14. package/build/components/document-tools/index.js.map +1 -1
  15. package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  16. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  17. package/build/components/editor-history/redo.js +11 -0
  18. package/build/components/editor-history/redo.js.map +1 -1
  19. package/build/components/editor-history/undo.js +11 -0
  20. package/build/components/editor-history/undo.js.map +1 -1
  21. package/build/components/editor-snackbars/index.js +6 -0
  22. package/build/components/editor-snackbars/index.js.map +1 -1
  23. package/build/components/global-keyboard-shortcuts/index.js +7 -0
  24. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  25. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +34 -0
  26. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  27. package/build/components/inserter-sidebar/index.js +1 -4
  28. package/build/components/inserter-sidebar/index.js.map +1 -1
  29. package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
  30. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  31. package/build/components/list-view-sidebar/index.js +1 -1
  32. package/build/components/list-view-sidebar/index.js.map +1 -1
  33. package/build/components/more-menu/copy-content-menu-item.js +59 -0
  34. package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
  35. package/build/components/more-menu/index.js +119 -0
  36. package/build/components/more-menu/index.js.map +1 -0
  37. package/build/components/more-menu/tools-more-menu-group.js +23 -0
  38. package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
  39. package/build/components/more-menu/view-more-menu-group.js +24 -0
  40. package/build/components/more-menu/view-more-menu-group.js.map +1 -0
  41. package/build/components/page-attributes/check.js +8 -0
  42. package/build/components/page-attributes/check.js.map +1 -1
  43. package/build/components/page-attributes/order.js +7 -0
  44. package/build/components/page-attributes/order.js.map +1 -1
  45. package/build/components/page-attributes/panel.js +14 -8
  46. package/build/components/page-attributes/panel.js.map +1 -1
  47. package/build/components/page-attributes/parent.js +7 -0
  48. package/build/components/page-attributes/parent.js.map +1 -1
  49. package/build/components/plugin-post-publish-panel/index.js +1 -1
  50. package/build/components/plugin-post-publish-panel/index.js.map +1 -1
  51. package/build/components/plugin-pre-publish-panel/index.js +1 -1
  52. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  53. package/build/components/plugin-sidebar/index.js +1 -1
  54. package/build/components/plugin-sidebar/index.js.map +1 -1
  55. package/build/components/post-actions/actions.js +100 -5
  56. package/build/components/post-actions/actions.js.map +1 -1
  57. package/build/components/post-actions/index.js +30 -7
  58. package/build/components/post-actions/index.js.map +1 -1
  59. package/build/components/post-author/check.js +9 -0
  60. package/build/components/post-author/check.js.map +1 -1
  61. package/build/components/post-author/index.js +6 -0
  62. package/build/components/post-author/index.js.map +1 -1
  63. package/build/components/post-author/panel.js +5 -0
  64. package/build/components/post-author/panel.js.map +1 -1
  65. package/build/components/post-card-panel/index.js +14 -49
  66. package/build/components/post-card-panel/index.js.map +1 -1
  67. package/build/components/post-content-information/index.js +72 -0
  68. package/build/components/post-content-information/index.js.map +1 -0
  69. package/build/components/post-discussion/panel.js +9 -7
  70. package/build/components/post-discussion/panel.js.map +1 -1
  71. package/build/components/post-excerpt/check.js +0 -19
  72. package/build/components/post-excerpt/check.js.map +1 -1
  73. package/build/components/post-excerpt/index.js +52 -12
  74. package/build/components/post-excerpt/index.js.map +1 -1
  75. package/build/components/post-excerpt/panel.js +118 -7
  76. package/build/components/post-excerpt/panel.js.map +1 -1
  77. package/build/components/post-excerpt/plugin.js +2 -2
  78. package/build/components/post-excerpt/plugin.js.map +1 -1
  79. package/build/components/post-featured-image/index.js +1 -1
  80. package/build/components/post-featured-image/index.js.map +1 -1
  81. package/build/components/post-last-edited-panel/index.js +33 -0
  82. package/build/components/post-last-edited-panel/index.js.map +1 -0
  83. package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
  84. package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  85. package/build/components/post-schedule/panel.js +1 -1
  86. package/build/components/post-schedule/panel.js.map +1 -1
  87. package/build/components/post-status/index.js +9 -9
  88. package/build/components/post-status/index.js.map +1 -1
  89. package/build/components/post-template/block-theme.js +2 -2
  90. package/build/components/post-template/block-theme.js.map +1 -1
  91. package/build/components/post-template/classic-theme.js +0 -1
  92. package/build/components/post-template/classic-theme.js.map +1 -1
  93. package/build/components/post-template/swap-template-button.js +2 -5
  94. package/build/components/post-template/swap-template-button.js.map +1 -1
  95. package/build/components/post-url/index.js +2 -1
  96. package/build/components/post-url/index.js.map +1 -1
  97. package/build/components/post-url/panel.js +1 -1
  98. package/build/components/post-url/panel.js.map +1 -1
  99. package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
  100. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  101. package/build/components/preferences-modal/index.js +8 -2
  102. package/build/components/preferences-modal/index.js.map +1 -1
  103. package/build/components/preview-dropdown/index.js +3 -1
  104. package/build/components/preview-dropdown/index.js.map +1 -1
  105. package/build/components/provider/disable-non-page-content-blocks.js +23 -16
  106. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  107. package/build/components/save-publish-panels/index.js +89 -0
  108. package/build/components/save-publish-panels/index.js.map +1 -0
  109. package/build/components/start-page-options/index.js +5 -1
  110. package/build/components/start-page-options/index.js.map +1 -1
  111. package/build/private-apis.js +18 -2
  112. package/build/private-apis.js.map +1 -1
  113. package/build/store/selectors.js +3 -1
  114. package/build/store/selectors.js.map +1 -1
  115. package/build-module/components/autosave-monitor/index.js +15 -13
  116. package/build-module/components/autosave-monitor/index.js.map +1 -1
  117. package/build-module/components/character-count/index.js +6 -0
  118. package/build-module/components/character-count/index.js.map +1 -1
  119. package/build-module/components/collapsible-block-toolbar/index.js +65 -0
  120. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
  121. package/build-module/components/document-outline/check.js +9 -0
  122. package/build-module/components/document-outline/check.js.map +1 -1
  123. package/build-module/components/document-outline/index.js +11 -0
  124. package/build-module/components/document-outline/index.js.map +1 -1
  125. package/build-module/components/document-tools/index.js +1 -8
  126. package/build-module/components/document-tools/index.js.map +1 -1
  127. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  128. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  129. package/build-module/components/editor-history/redo.js +11 -0
  130. package/build-module/components/editor-history/redo.js.map +1 -1
  131. package/build-module/components/editor-history/undo.js +11 -0
  132. package/build-module/components/editor-history/undo.js.map +1 -1
  133. package/build-module/components/editor-snackbars/index.js +6 -0
  134. package/build-module/components/editor-snackbars/index.js.map +1 -1
  135. package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
  136. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  137. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +35 -0
  138. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  139. package/build-module/components/inserter-sidebar/index.js +2 -5
  140. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  141. package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
  142. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  143. package/build-module/components/list-view-sidebar/index.js +1 -1
  144. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  145. package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
  146. package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
  147. package/build-module/components/more-menu/index.js +111 -0
  148. package/build-module/components/more-menu/index.js.map +1 -0
  149. package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
  150. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
  151. package/build-module/components/more-menu/view-more-menu-group.js +17 -0
  152. package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
  153. package/build-module/components/page-attributes/check.js +9 -0
  154. package/build-module/components/page-attributes/check.js.map +1 -1
  155. package/build-module/components/page-attributes/order.js +7 -0
  156. package/build-module/components/page-attributes/order.js.map +1 -1
  157. package/build-module/components/page-attributes/panel.js +13 -6
  158. package/build-module/components/page-attributes/panel.js.map +1 -1
  159. package/build-module/components/page-attributes/parent.js +7 -0
  160. package/build-module/components/page-attributes/parent.js.map +1 -1
  161. package/build-module/components/plugin-post-publish-panel/index.js +1 -1
  162. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
  163. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  164. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  165. package/build-module/components/plugin-sidebar/index.js +1 -1
  166. package/build-module/components/plugin-sidebar/index.js.map +1 -1
  167. package/build-module/components/post-actions/actions.js +100 -6
  168. package/build-module/components/post-actions/actions.js.map +1 -1
  169. package/build-module/components/post-actions/index.js +31 -8
  170. package/build-module/components/post-actions/index.js.map +1 -1
  171. package/build-module/components/post-author/check.js +10 -0
  172. package/build-module/components/post-author/check.js.map +1 -1
  173. package/build-module/components/post-author/index.js +6 -0
  174. package/build-module/components/post-author/index.js.map +1 -1
  175. package/build-module/components/post-author/panel.js +6 -0
  176. package/build-module/components/post-author/panel.js.map +1 -1
  177. package/build-module/components/post-card-panel/index.js +16 -51
  178. package/build-module/components/post-card-panel/index.js.map +1 -1
  179. package/build-module/components/post-content-information/index.js +66 -0
  180. package/build-module/components/post-content-information/index.js.map +1 -0
  181. package/build-module/components/post-discussion/panel.js +8 -6
  182. package/build-module/components/post-discussion/panel.js.map +1 -1
  183. package/build-module/components/post-excerpt/check.js +0 -19
  184. package/build-module/components/post-excerpt/check.js.map +1 -1
  185. package/build-module/components/post-excerpt/index.js +52 -11
  186. package/build-module/components/post-excerpt/index.js.map +1 -1
  187. package/build-module/components/post-excerpt/panel.js +118 -8
  188. package/build-module/components/post-excerpt/panel.js.map +1 -1
  189. package/build-module/components/post-excerpt/plugin.js +2 -2
  190. package/build-module/components/post-excerpt/plugin.js.map +1 -1
  191. package/build-module/components/post-featured-image/index.js +1 -1
  192. package/build-module/components/post-featured-image/index.js.map +1 -1
  193. package/build-module/components/post-last-edited-panel/index.js +26 -0
  194. package/build-module/components/post-last-edited-panel/index.js.map +1 -0
  195. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
  196. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  197. package/build-module/components/post-schedule/panel.js +1 -1
  198. package/build-module/components/post-schedule/panel.js.map +1 -1
  199. package/build-module/components/post-status/index.js +9 -9
  200. package/build-module/components/post-status/index.js.map +1 -1
  201. package/build-module/components/post-template/block-theme.js +2 -2
  202. package/build-module/components/post-template/block-theme.js.map +1 -1
  203. package/build-module/components/post-template/classic-theme.js +0 -1
  204. package/build-module/components/post-template/classic-theme.js.map +1 -1
  205. package/build-module/components/post-template/swap-template-button.js +3 -6
  206. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  207. package/build-module/components/post-url/index.js +2 -1
  208. package/build-module/components/post-url/index.js.map +1 -1
  209. package/build-module/components/post-url/panel.js +1 -1
  210. package/build-module/components/post-url/panel.js.map +1 -1
  211. package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
  212. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  213. package/build-module/components/preferences-modal/index.js +8 -2
  214. package/build-module/components/preferences-modal/index.js.map +1 -1
  215. package/build-module/components/preview-dropdown/index.js +3 -1
  216. package/build-module/components/preview-dropdown/index.js.map +1 -1
  217. package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
  218. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  219. package/build-module/components/save-publish-panels/index.js +80 -0
  220. package/build-module/components/save-publish-panels/index.js.map +1 -0
  221. package/build-module/components/start-page-options/index.js +5 -1
  222. package/build-module/components/start-page-options/index.js.map +1 -1
  223. package/build-module/private-apis.js +18 -2
  224. package/build-module/private-apis.js.map +1 -1
  225. package/build-module/store/selectors.js +3 -1
  226. package/build-module/store/selectors.js.map +1 -1
  227. package/build-style/style-rtl.css +207 -30
  228. package/build-style/style.css +207 -30
  229. package/package.json +35 -35
  230. package/src/components/autosave-monitor/index.js +15 -12
  231. package/src/components/character-count/index.js +5 -0
  232. package/src/components/collapsible-block-toolbar/index.js +77 -0
  233. package/src/components/collapsible-block-toolbar/style.scss +80 -0
  234. package/src/components/document-outline/check.js +8 -0
  235. package/src/components/document-outline/index.js +10 -0
  236. package/src/components/document-tools/index.js +0 -5
  237. package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  238. package/src/components/editor-history/redo.js +10 -0
  239. package/src/components/editor-history/undo.js +10 -0
  240. package/src/components/editor-snackbars/index.js +5 -0
  241. package/src/components/entities-saved-states/style.scss +7 -0
  242. package/src/components/global-keyboard-shortcuts/index.js +7 -0
  243. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +41 -0
  244. package/src/components/inserter-sidebar/index.js +2 -5
  245. package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
  246. package/src/components/list-view-sidebar/index.js +1 -1
  247. package/src/components/list-view-sidebar/style.scss +2 -2
  248. package/src/components/more-menu/copy-content-menu-item.js +51 -0
  249. package/src/components/more-menu/index.js +158 -0
  250. package/src/components/more-menu/tools-more-menu-group.js +11 -0
  251. package/src/components/more-menu/view-more-menu-group.js +13 -0
  252. package/src/components/page-attributes/check.js +8 -0
  253. package/src/components/page-attributes/order.js +6 -0
  254. package/src/components/page-attributes/panel.js +21 -17
  255. package/src/components/page-attributes/parent.js +6 -0
  256. package/src/components/plugin-post-publish-panel/index.js +1 -1
  257. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  258. package/src/components/plugin-sidebar/index.js +1 -1
  259. package/src/components/post-actions/actions.js +120 -5
  260. package/src/components/post-actions/index.js +41 -7
  261. package/src/components/post-author/check.js +9 -0
  262. package/src/components/post-author/index.js +5 -0
  263. package/src/components/post-author/panel.js +5 -0
  264. package/src/components/post-card-panel/index.js +27 -82
  265. package/src/components/post-card-panel/style.scss +2 -6
  266. package/src/components/post-content-information/index.js +83 -0
  267. package/src/components/post-content-information/style.scss +6 -0
  268. package/src/components/post-discussion/panel.js +24 -20
  269. package/src/components/post-excerpt/check.js +0 -18
  270. package/src/components/post-excerpt/index.js +66 -15
  271. package/src/components/post-excerpt/panel.js +196 -19
  272. package/src/components/post-excerpt/plugin.js +2 -2
  273. package/src/components/post-excerpt/style.scss +24 -0
  274. package/src/components/post-featured-image/index.js +1 -1
  275. package/src/components/post-featured-image/style.scss +2 -8
  276. package/src/components/post-last-edited-panel/index.js +35 -0
  277. package/src/components/post-last-edited-panel/style.scss +6 -0
  278. package/src/components/post-panel-row/style.scss +3 -3
  279. package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
  280. package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
  281. package/src/components/post-publish-panel/style.scss +43 -0
  282. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
  283. package/src/components/post-schedule/panel.js +1 -1
  284. package/src/components/post-schedule/style.scss +2 -4
  285. package/src/components/post-status/index.js +84 -76
  286. package/src/components/post-status/style.scss +0 -1
  287. package/src/components/post-template/block-theme.js +2 -2
  288. package/src/components/post-template/classic-theme.js +0 -1
  289. package/src/components/post-template/swap-template-button.js +3 -6
  290. package/src/components/post-text-editor/style.scss +1 -1
  291. package/src/components/post-title/style.scss +1 -1
  292. package/src/components/post-url/index.js +1 -0
  293. package/src/components/post-url/panel.js +1 -1
  294. package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
  295. package/src/components/preferences-modal/index.js +14 -0
  296. package/src/components/preview-dropdown/index.js +3 -1
  297. package/src/components/provider/disable-non-page-content-blocks.js +23 -21
  298. package/src/components/save-publish-panels/index.js +96 -0
  299. package/src/components/save-publish-panels/style.scss +36 -0
  300. package/src/components/start-page-options/index.js +6 -1
  301. package/src/private-apis.js +18 -2
  302. package/src/store/selectors.js +3 -1
  303. package/src/style.scss +4 -0
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","__","store","keyboardShortcutsStore","ComplementaryArea","editorStore","PluginSidebar","className","props","postTitle","shortcut","select","getEditedPostAttribute","getShortcutRepresentation","createElement","panelClassName","smallScreenTitle","scope","toggleShortcut"],"sources":["@wordpress/editor/src/components/plugin-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { ComplementaryArea } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = React.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editor.PluginSidebar;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/edit-post';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebar( { className, ...props } ) {\n\tconst { postTitle, shortcut } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostTitle: select( editorStore ).getEditedPostAttribute( 'title' ),\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"editor-sidebar\"\n\t\t\tsmallScreenTitle={ postTitle || __( '(no title)' ) }\n\t\t\tscope=\"core\"\n\t\t\ttoggleShortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASC,iBAAiB,QAAQ,sBAAsB;;AAExD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EAChE,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAGV,SAAS,CAAIW,MAAM,IAAM;IACxD,OAAO;MACNF,SAAS,EAAEE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,OAAQ,CAAC;MAClEF,QAAQ,EAAEC,MAAM,CACfR,sBACD,CAAC,CAACU,yBAAyB,CAAE,4BAA6B;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OACCC,aAAA,CAACV,iBAAiB;IACjBW,cAAc,EAAGR,SAAW;IAC5BA,SAAS,EAAC,gBAAgB;IAC1BS,gBAAgB,EAAGP,SAAS,IAAIR,EAAE,CAAE,YAAa,CAAG;IACpDgB,KAAK,EAAC,MAAM;IACZC,cAAc,EAAGR,QAAU;IAAA,GACtBF;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","__","store","keyboardShortcutsStore","ComplementaryArea","editorStore","PluginSidebar","className","props","postTitle","shortcut","select","getEditedPostAttribute","getShortcutRepresentation","createElement","panelClassName","smallScreenTitle","scope","toggleShortcut"],"sources":["@wordpress/editor/src/components/plugin-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { ComplementaryArea } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = React.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editor.PluginSidebar;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/editor';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebar( { className, ...props } ) {\n\tconst { postTitle, shortcut } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostTitle: select( editorStore ).getEditedPostAttribute( 'title' ),\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"editor-sidebar\"\n\t\t\tsmallScreenTitle={ postTitle || __( '(no title)' ) }\n\t\t\tscope=\"core\"\n\t\t\ttoggleShortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASC,iBAAiB,QAAQ,sBAAsB;;AAExD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EAChE,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAGV,SAAS,CAAIW,MAAM,IAAM;IACxD,OAAO;MACNF,SAAS,EAAEE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,OAAQ,CAAC;MAClEF,QAAQ,EAAEC,MAAM,CACfR,sBACD,CAAC,CAACU,yBAAyB,CAAE,4BAA6B;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OACCC,aAAA,CAACV,iBAAiB;IACjBW,cAAc,EAAGR,SAAW;IAC5BA,SAAS,EAAC,gBAAgB;IAC1BS,gBAAgB,EAAGP,SAAS,IAAIR,EAAE,CAAE,YAAa,CAAG;IACpDgB,KAAK,EAAC,MAAM;IACZC,cAAc,EAAGR,QAAU;IAAA,GACtBF;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
@@ -7,7 +7,7 @@ import { addQueryArgs } from '@wordpress/url';
7
7
  import { useDispatch } from '@wordpress/data';
8
8
  import { decodeEntities } from '@wordpress/html-entities';
9
9
  import { store as coreStore } from '@wordpress/core-data';
10
- import { __, _n, sprintf } from '@wordpress/i18n';
10
+ import { __, _n, sprintf, _x } from '@wordpress/i18n';
11
11
  import { store as noticesStore } from '@wordpress/notices';
12
12
  import { useMemo, useState } from '@wordpress/element';
13
13
  import { Button, TextControl, __experimentalText as Text, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
@@ -81,7 +81,7 @@ const trashPostAction = {
81
81
  }
82
82
  createSuccessNotice(successMessage, {
83
83
  type: 'snackbar',
84
- id: 'edit-site-page-trashed'
84
+ id: 'trash-post-action'
85
85
  });
86
86
  } else {
87
87
  // If there was at lease one failure.
@@ -164,7 +164,7 @@ function usePermanentlyDeletePostAction() {
164
164
  }
165
165
  createSuccessNotice(successMessage, {
166
166
  type: 'snackbar',
167
- id: 'edit-site-post-permanently-deleted'
167
+ id: 'permanently-delete-post-action'
168
168
  });
169
169
  if (onActionPerformed) {
170
170
  onActionPerformed(posts);
@@ -241,7 +241,7 @@ function useRestorePostAction() {
241
241
  __('%d posts have been restored.'), posts.length) : sprintf( /* translators: The number of posts. */
242
242
  __('"%s" has been restored.'), getItemTitle(posts[0])), {
243
243
  type: 'snackbar',
244
- id: 'edit-site-post-restored'
244
+ id: 'restore-post-action'
245
245
  });
246
246
  if (onActionPerformed) {
247
247
  onActionPerformed(posts);
@@ -390,6 +390,100 @@ const renamePostAction = {
390
390
  }, __('Save')))));
391
391
  }
392
392
  };
393
+ export const duplicatePostAction = {
394
+ id: 'duplicate-post',
395
+ label: _x('Duplicate', 'action label'),
396
+ isEligible({
397
+ status
398
+ }) {
399
+ return status !== 'trash';
400
+ },
401
+ RenderModal: ({
402
+ items,
403
+ closeModal,
404
+ onActionPerformed
405
+ }) => {
406
+ const [item] = items;
407
+ const [isCreatingPage, setIsCreatingPage] = useState(false);
408
+ const [title, setTitle] = useState(sprintf( /* translators: %s: Existing item title */
409
+ __('%s (Copy)'), getItemTitle(item)));
410
+ const {
411
+ saveEntityRecord
412
+ } = useDispatch(coreStore);
413
+ const {
414
+ createSuccessNotice,
415
+ createErrorNotice
416
+ } = useDispatch(noticesStore);
417
+ async function createPage(event) {
418
+ event.preventDefault();
419
+ if (isCreatingPage) {
420
+ return;
421
+ }
422
+ setIsCreatingPage(true);
423
+ try {
424
+ const newItem = await saveEntityRecord('postType', item.type, {
425
+ status: 'draft',
426
+ title,
427
+ slug: title || __('No title'),
428
+ author: item.author,
429
+ comment_status: item.comment_status,
430
+ content: typeof item.content === 'string' ? item.content : item.content.raw,
431
+ excerpt: item.excerpt.raw,
432
+ meta: item.meta,
433
+ parent: item.parent,
434
+ password: item.password,
435
+ template: item.template,
436
+ format: item.format,
437
+ featured_media: item.featured_media,
438
+ menu_order: item.menu_order,
439
+ ping_status: item.ping_status,
440
+ categories: item.categories,
441
+ tags: item.tags
442
+ }, {
443
+ throwOnError: true
444
+ });
445
+ createSuccessNotice(sprintf(
446
+ // translators: %s: Title of the created template e.g: "Category".
447
+ __('"%s" successfully created.'), newItem.title?.rendered || title), {
448
+ id: 'duplicate-post-action',
449
+ type: 'snackbar'
450
+ });
451
+ if (onActionPerformed) {
452
+ onActionPerformed([newItem]);
453
+ }
454
+ } catch (error) {
455
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while duplicating the page.');
456
+ createErrorNotice(errorMessage, {
457
+ type: 'snackbar'
458
+ });
459
+ } finally {
460
+ setIsCreatingPage(false);
461
+ closeModal();
462
+ }
463
+ }
464
+ return createElement("form", {
465
+ onSubmit: createPage
466
+ }, createElement(VStack, {
467
+ spacing: 3
468
+ }, createElement(TextControl, {
469
+ label: __('Title'),
470
+ onChange: setTitle,
471
+ placeholder: __('No title'),
472
+ value: title
473
+ }), createElement(HStack, {
474
+ spacing: 2,
475
+ justify: "end"
476
+ }, createElement(Button, {
477
+ variant: "tertiary",
478
+ onClick: closeModal
479
+ }, __('Cancel')), createElement(Button, {
480
+ variant: "primary",
481
+ type: "submit",
482
+ isBusy: isCreatingPage,
483
+ "aria-disabled": isCreatingPage
484
+ }, _x('Duplicate', 'action label')))));
485
+ }
486
+ };
393
487
  const resetTemplateAction = {
394
488
  id: 'reset-template',
395
489
  label: __('Reset'),
@@ -423,7 +517,7 @@ const resetTemplateAction = {
423
517
  __('%s items reset.'), items.length) : sprintf( /* translators: The template/part's name. */
424
518
  __('"%s" reset.'), decodeEntities(items[0].title.rendered)), {
425
519
  type: 'snackbar',
426
- id: 'edit-site-template-reverted'
520
+ id: 'revert-template-action'
427
521
  });
428
522
  } catch (error) {
429
523
  let fallbackErrorMessage;
@@ -589,7 +683,7 @@ export function usePostActions(onActionPerformed, actionIds = null) {
589
683
  const restorePostAction = useRestorePostAction();
590
684
  return useMemo(() => {
591
685
  // By default, return all actions...
592
- const defaultActions = [editPostAction, resetTemplateAction, viewPostAction, restorePostAction, deleteTemplateAction, permanentlyDeletePostAction, postRevisionsAction, renamePostAction, renameTemplateAction, trashPostAction];
686
+ const defaultActions = [editPostAction, resetTemplateAction, viewPostAction, restorePostAction, deleteTemplateAction, permanentlyDeletePostAction, postRevisionsAction, duplicatePostAction, renamePostAction, renameTemplateAction, trashPostAction];
593
687
 
594
688
  // ... unless `actionIds` was specified, in which case we find the
595
689
  // actions matching the given IDs.
@@ -1 +1 @@
1
- {"version":3,"names":["external","trash","edit","backup","addQueryArgs","useDispatch","decodeEntities","store","coreStore","__","_n","sprintf","noticesStore","useMemo","useState","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","TEMPLATE_ORIGINS","TEMPLATE_POST_TYPE","editorStore","unlock","isTemplateRevertable","getItemTitle","item","title","rendered","trashPostAction","id","label","isPrimary","icon","isEligible","status","supportsBulk","hideModalHeader","RenderModal","items","posts","closeModal","onActionPerformed","createSuccessNotice","createErrorNotice","deleteEntityRecord","createElement","spacing","length","justify","variant","onClick","promiseResult","Promise","allSettled","map","post","type","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","usePermanentlyDeletePostAction","callback","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","error","code","viewPostAction","window","open","link","editPostAction","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","href","revision","document","location","renamePostAction","originalTitle","setTitle","onRename","event","preventDefault","onSubmit","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","resetTemplateAction","revertTemplate","onConfirm","template","allowUndo","fallbackErrorMessage","isTemplateRemovable","source","custom","has_theme_file","deleteTemplateAction","templates","removeTemplates","renameTemplateAction","is_custom","editedTitle","setEditedTitle","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","onTemplateRename","usePostActions","actionIds","permanentlyDeletePostAction","restorePostAction","defaultActions","actions","actionId","find","i","existingCallback","_onActionPerformed","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, edit, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState } from '@wordpress/element';\n\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS, TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport isTemplateRevertable from '../../store/utils/is-template-revertable';\n\nfunction getItemTitle( item ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\treturn decodeEntities( item.title?.rendered || '' );\n}\n\nconst trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items: posts, closeModal, onActionPerformed } ) => {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ posts.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The page's title.\n\t\t\t\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of pages (2 or more).\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete %d page?',\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete %d pages?',\n\t\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\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\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\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\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t\t\t\t'Pages moved to the Trash.'\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\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the post to the trash.'\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\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t\t\t\t);\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'Some errors occurred while moving the pages to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\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\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t\t\t}\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{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nfunction usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'edit-site-post-permanently-deleted',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nfunction useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\ttry {\n\t\t\t\t\tfor ( const post of posts ) {\n\t\t\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tposts.length > 1\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-restored',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\tif (\n\t\t\t\t\t\terror.message &&\n\t\t\t\t\t\terror.code !== 'unknown_error' &&\n\t\t\t\t\t\terror.message\n\t\t\t\t\t) {\n\t\t\t\t\t\terrorMessage = error.message;\n\t\t\t\t\t} else if ( posts.length > 1 ) {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\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 editPostAction = {\n\tid: 'edit-post',\n\tlabel: __( 'Edit' ),\n\tisPrimary: true,\n\ticon: edit,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tcallback( posts, onActionPerformed ) {\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\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\treturn post.status !== 'trash';\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst originalTitle = decodeEntities(\n\t\t\ttypeof item.title === 'string' ? item.title : item.title.rendered\n\t\t);\n\t\tconst [ title, setTitle ] = useState( () => originalTitle );\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\nconst resetTemplateAction = {\n\tid: 'reset-template',\n\tlabel: __( 'Reset' ),\n\tisEligible: isTemplateRevertable,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst { revertTemplate } = unlock( useDispatch( editorStore ) );\n\t\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst onConfirm = async () => {\n\t\t\ttry {\n\t\t\t\tfor ( const template of items ) {\n\t\t\t\t\tawait revertTemplate( template, {\n\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t} );\n\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\ttemplate.id\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\titems.length > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t__( '%s items reset.' ),\n\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( items[ 0 ].title.rendered )\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tlet fallbackErrorMessage;\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the templates.'\n\t\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template parts.'\n\t\t\t\t\t\t\t );\n\t\t\t\t}\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t};\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tawait onConfirm( items );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\n/**\n * Check if a template is removable.\n * Copy from packages/edit-site/src/utils/is-template-removable.js.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplate.source === TEMPLATE_ORIGINS.custom && ! template.has_theme_file\n\t);\n}\n\nconst deleteTemplateAction = {\n\tid: 'delete-template',\n\tlabel: __( 'Delete' ),\n\tisEligible: isTemplateRemovable,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items: templates, closeModal, onActionPerformed } ) => {\n\t\tconst { removeTemplates } = unlock( useDispatch( editorStore ) );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ templates.length > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: number of items to delete.\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Delete %d item?',\n\t\t\t\t\t\t\t\t\t'Delete %d items?',\n\t\t\t\t\t\t\t\t\ttemplates.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\ttemplates.length\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The template or template part's titles\n\t\t\t\t\t\t\t\t__( 'Delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\ttemplates?.[ 0 ]?.title?.rendered\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tawait removeTemplates( templates, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonActionPerformed?.( templates );\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{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nconst renameTemplateAction = {\n\tid: 'rename-template',\n\tlabel: __( 'Rename' ),\n\tisEligible: ( template ) => {\n\t\t// We can only remove templates or template parts that can be removed.\n\t\t// Additionally in the case of templates, we can only remove custom templates.\n\t\tif (\n\t\t\t! isTemplateRemovable( template ) ||\n\t\t\t( template.type === TEMPLATE_POST_TYPE && ! template.is_custom )\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\tRenderModal: ( { items: templates, closeModal, onActionPerformed } ) => {\n\t\tconst template = templates[ 0 ];\n\t\tconst title = decodeEntities( template.title.rendered );\n\t\tconst [ editedTitle, setEditedTitle ] = useState( title );\n\t\tconst {\n\t\t\teditEntityRecord,\n\t\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t\t} = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tasync function onTemplateRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id,\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: editedTitle,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetEditedTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id,\n\t\t\t\t\t[ 'title' ], // Only save title to avoid persisting other edits.\n\t\t\t\t\t{\n\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? __( 'Template renamed.' )\n\t\t\t\t\t\t: __( 'Template part renamed.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tonActionPerformed?.( templates );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst fallbackErrorMessage =\n\t\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? __( 'An error occurred while renaming the template.' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while renaming the template part.'\n\t\t\t\t\t\t );\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ onTemplateRename }>\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={ editedTitle }\n\t\t\t\t\t\tonChange={ setEditedTitle }\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\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\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\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\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\nexport function usePostActions( onActionPerformed, actionIds = null ) {\n\tconst permanentlyDeletePostAction = usePermanentlyDeletePostAction();\n\tconst restorePostAction = useRestorePostAction();\n\treturn useMemo(\n\t\t() => {\n\t\t\t// By default, return all actions...\n\t\t\tconst defaultActions = [\n\t\t\t\teditPostAction,\n\t\t\t\tresetTemplateAction,\n\t\t\t\tviewPostAction,\n\t\t\t\trestorePostAction,\n\t\t\t\tdeleteTemplateAction,\n\t\t\t\tpermanentlyDeletePostAction,\n\t\t\t\tpostRevisionsAction,\n\t\t\t\trenamePostAction,\n\t\t\t\trenameTemplateAction,\n\t\t\t\ttrashPostAction,\n\t\t\t];\n\n\t\t\t// ... unless `actionIds` was specified, in which case we find the\n\t\t\t// actions matching the given IDs.\n\t\t\tconst actions = actionIds\n\t\t\t\t? actionIds.map( ( actionId ) =>\n\t\t\t\t\t\tdefaultActions.find( ( { id } ) => actionId === id )\n\t\t\t\t )\n\t\t\t\t: defaultActions;\n\n\t\t\tif ( onActionPerformed ) {\n\t\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\t\tcallback: ( items, _onActionPerformed ) => {\n\t\t\t\t\t\t\t\texistingCallback( items, ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( _onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t_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\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t\titems={ props.items }\n\t\t\t\t\t\t\t\t\t\tcloseModal={ props.closeModal }\n\t\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\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\t_items\n\t\t\t\t\t\t\t\t\t\t\t);\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\treturn actions;\n\t\t},\n\n\t\t// Disable reason: if provided, `actionIds` is a shallow array of\n\t\t// strings, and the strings themselves should be part of the useMemo\n\t\t// dependencies. Two different disable statements are needed, as the\n\t\t// first flags what it thinks are missing dependencies, and the second\n\t\t// flags the array spread operation.\n\t\t//\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\t...( actionIds || [] ),\n\t\t\tpermanentlyDeletePostAction,\n\t\t\trestorePostAction,\n\t\t\tonActionPerformed,\n\t\t]\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;AAChE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASJ,KAAK,IAAIK,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AAEtD,SACCC,MAAM,EACNC,WAAW,EACXC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,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,CAAE,CAAClG,WAAW,EAAG;UAC/B,MAAMsG,mBAAmB,GAAGP,OAAO,CAAEG,CAAC,CAAE,CAAClG,WAAW;UACpD+F,OAAO,CAAEG,CAAC,CAAE,GAAG;YACd,GAAGH,OAAO,CAAEG,CAAC,CAAE;YACflG,WAAW,EAAIuG,KAAK,IAAM;cACzB,OACC/F,aAAA,CAAC8F,mBAAmB;gBACnBrG,KAAK,EAAGsG,KAAK,CAACtG,KAAO;gBACrBE,UAAU,EAAGoG,KAAK,CAACpG,UAAY;gBAC/BC,iBAAiB,EAAKiG,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAACnG,iBAAiB,EAAG;oBAC9BmG,KAAK,CAACnG,iBAAiB,CACtBiG,MACD,CAAC;kBACF;kBACAjG,iBAAiB,CAChB2F,OAAO,CAAEG,CAAC,CAAE,CAAC1G,EAAE,EACf6G,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IACA,OAAON,OAAO;EACf,CAAC;EAED;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACC;EACA,IAAKJ,SAAS,IAAI,EAAE,CAAE,EACtBC,2BAA2B,EAC3BC,iBAAiB,EACjBzF,iBAAiB,CAEnB,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["external","trash","edit","backup","addQueryArgs","useDispatch","decodeEntities","store","coreStore","__","_n","sprintf","_x","noticesStore","useMemo","useState","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","TEMPLATE_ORIGINS","TEMPLATE_POST_TYPE","editorStore","unlock","isTemplateRevertable","getItemTitle","item","title","rendered","trashPostAction","id","label","isPrimary","icon","isEligible","status","supportsBulk","hideModalHeader","RenderModal","items","posts","closeModal","onActionPerformed","createSuccessNotice","createErrorNotice","deleteEntityRecord","createElement","spacing","length","justify","variant","onClick","promiseResult","Promise","allSettled","map","post","type","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","usePermanentlyDeletePostAction","callback","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","error","code","viewPostAction","window","open","link","editPostAction","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","href","revision","document","location","renamePostAction","originalTitle","setTitle","onRename","event","preventDefault","onSubmit","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","duplicatePostAction","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItem","slug","author","comment_status","content","raw","excerpt","meta","parent","password","template","format","featured_media","menu_order","ping_status","categories","tags","placeholder","isBusy","resetTemplateAction","revertTemplate","onConfirm","allowUndo","fallbackErrorMessage","isTemplateRemovable","source","custom","has_theme_file","deleteTemplateAction","templates","removeTemplates","renameTemplateAction","is_custom","editedTitle","setEditedTitle","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","onTemplateRename","usePostActions","actionIds","permanentlyDeletePostAction","restorePostAction","defaultActions","actions","actionId","find","i","existingCallback","_onActionPerformed","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, edit, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState } from '@wordpress/element';\n\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS, TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport isTemplateRevertable from '../../store/utils/is-template-revertable';\n\nfunction getItemTitle( item ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\treturn decodeEntities( item.title?.rendered || '' );\n}\n\nconst trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items: posts, closeModal, onActionPerformed } ) => {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ posts.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The page's title.\n\t\t\t\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of pages (2 or more).\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete %d page?',\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete %d pages?',\n\t\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\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\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\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\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t\t\t\t'Pages moved to the Trash.'\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\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'trash-post-action',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the post to the trash.'\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\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t\t\t\t);\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'Some errors occurred while moving the pages to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\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\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t\t\t}\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{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nfunction usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nfunction useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\ttry {\n\t\t\t\t\tfor ( const post of posts ) {\n\t\t\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tposts.length > 1\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'restore-post-action',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\tif (\n\t\t\t\t\t\terror.message &&\n\t\t\t\t\t\terror.code !== 'unknown_error' &&\n\t\t\t\t\t\terror.message\n\t\t\t\t\t) {\n\t\t\t\t\t\terrorMessage = error.message;\n\t\t\t\t\t} else if ( posts.length > 1 ) {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\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 editPostAction = {\n\tid: 'edit-post',\n\tlabel: __( 'Edit' ),\n\tisPrimary: true,\n\ticon: edit,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tcallback( posts, onActionPerformed ) {\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\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\treturn post.status !== 'trash';\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst originalTitle = decodeEntities(\n\t\t\ttypeof item.title === 'string' ? item.title : item.title.rendered\n\t\t);\n\t\tconst [ title, setTitle ] = useState( () => originalTitle );\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\nexport const duplicatePostAction = {\n\tid: 'duplicate-post',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\t\tconst [ title, setTitle ] = useState(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: Existing item title */\n\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\tgetItemTitle( item )\n\t\t\t)\n\t\t);\n\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function createPage( event ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( isCreatingPage ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsCreatingPage( true );\n\t\t\ttry {\n\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\titem.type,\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\t\tauthor: item.author,\n\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\tcategories: item.categories,\n\t\t\t\t\t\ttags: item.tags,\n\t\t\t\t\t},\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\tnewItem.title?.rendered || title\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t}\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 duplicating the page.' );\n\n\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t} finally {\n\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\tcloseModal();\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\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\nconst resetTemplateAction = {\n\tid: 'reset-template',\n\tlabel: __( 'Reset' ),\n\tisEligible: isTemplateRevertable,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst { revertTemplate } = unlock( useDispatch( editorStore ) );\n\t\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst onConfirm = async () => {\n\t\t\ttry {\n\t\t\t\tfor ( const template of items ) {\n\t\t\t\t\tawait revertTemplate( template, {\n\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t} );\n\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\ttemplate.id\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\titems.length > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t__( '%s items reset.' ),\n\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( items[ 0 ].title.rendered )\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'revert-template-action',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tlet fallbackErrorMessage;\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the templates.'\n\t\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template parts.'\n\t\t\t\t\t\t\t );\n\t\t\t\t}\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t};\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tawait onConfirm( items );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\n/**\n * Check if a template is removable.\n * Copy from packages/edit-site/src/utils/is-template-removable.js.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplate.source === TEMPLATE_ORIGINS.custom && ! template.has_theme_file\n\t);\n}\n\nconst deleteTemplateAction = {\n\tid: 'delete-template',\n\tlabel: __( 'Delete' ),\n\tisEligible: isTemplateRemovable,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items: templates, closeModal, onActionPerformed } ) => {\n\t\tconst { removeTemplates } = unlock( useDispatch( editorStore ) );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ templates.length > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: number of items to delete.\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Delete %d item?',\n\t\t\t\t\t\t\t\t\t'Delete %d items?',\n\t\t\t\t\t\t\t\t\ttemplates.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\ttemplates.length\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The template or template part's titles\n\t\t\t\t\t\t\t\t__( 'Delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\ttemplates?.[ 0 ]?.title?.rendered\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tawait removeTemplates( templates, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonActionPerformed?.( templates );\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{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nconst renameTemplateAction = {\n\tid: 'rename-template',\n\tlabel: __( 'Rename' ),\n\tisEligible: ( template ) => {\n\t\t// We can only remove templates or template parts that can be removed.\n\t\t// Additionally in the case of templates, we can only remove custom templates.\n\t\tif (\n\t\t\t! isTemplateRemovable( template ) ||\n\t\t\t( template.type === TEMPLATE_POST_TYPE && ! template.is_custom )\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\tRenderModal: ( { items: templates, closeModal, onActionPerformed } ) => {\n\t\tconst template = templates[ 0 ];\n\t\tconst title = decodeEntities( template.title.rendered );\n\t\tconst [ editedTitle, setEditedTitle ] = useState( title );\n\t\tconst {\n\t\t\teditEntityRecord,\n\t\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t\t} = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tasync function onTemplateRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id,\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: editedTitle,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetEditedTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id,\n\t\t\t\t\t[ 'title' ], // Only save title to avoid persisting other edits.\n\t\t\t\t\t{\n\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? __( 'Template renamed.' )\n\t\t\t\t\t\t: __( 'Template part renamed.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tonActionPerformed?.( templates );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst fallbackErrorMessage =\n\t\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? __( 'An error occurred while renaming the template.' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while renaming the template part.'\n\t\t\t\t\t\t );\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ onTemplateRename }>\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={ editedTitle }\n\t\t\t\t\t\tonChange={ setEditedTitle }\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\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\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\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\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\nexport function usePostActions( onActionPerformed, actionIds = null ) {\n\tconst permanentlyDeletePostAction = usePermanentlyDeletePostAction();\n\tconst restorePostAction = useRestorePostAction();\n\treturn useMemo(\n\t\t() => {\n\t\t\t// By default, return all actions...\n\t\t\tconst defaultActions = [\n\t\t\t\teditPostAction,\n\t\t\t\tresetTemplateAction,\n\t\t\t\tviewPostAction,\n\t\t\t\trestorePostAction,\n\t\t\t\tdeleteTemplateAction,\n\t\t\t\tpermanentlyDeletePostAction,\n\t\t\t\tpostRevisionsAction,\n\t\t\t\tduplicatePostAction,\n\t\t\t\trenamePostAction,\n\t\t\t\trenameTemplateAction,\n\t\t\t\ttrashPostAction,\n\t\t\t];\n\n\t\t\t// ... unless `actionIds` was specified, in which case we find the\n\t\t\t// actions matching the given IDs.\n\t\t\tconst actions = actionIds\n\t\t\t\t? actionIds.map( ( actionId ) =>\n\t\t\t\t\t\tdefaultActions.find( ( { id } ) => actionId === id )\n\t\t\t\t )\n\t\t\t\t: defaultActions;\n\n\t\t\tif ( onActionPerformed ) {\n\t\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\t\tcallback: ( items, _onActionPerformed ) => {\n\t\t\t\t\t\t\t\texistingCallback( items, ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( _onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t_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\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t\titems={ props.items }\n\t\t\t\t\t\t\t\t\t\tcloseModal={ props.closeModal }\n\t\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\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\t_items\n\t\t\t\t\t\t\t\t\t\t\t);\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\treturn actions;\n\t\t},\n\n\t\t// Disable reason: if provided, `actionIds` is a shallow array of\n\t\t// strings, and the strings themselves should be part of the useMemo\n\t\t// dependencies. Two different disable statements are needed, as the\n\t\t// first flags what it thinks are missing dependencies, and the second\n\t\t// flags the array spread operation.\n\t\t//\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\t...( actionIds || [] ),\n\t\t\tpermanentlyDeletePostAction,\n\t\t\trestorePostAction,\n\t\t\tonActionPerformed,\n\t\t]\n\t);\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KN,OAAO,CAAEG,CAAC,CAAE,CAACzH,WAAW,EAAG;UAC/B,MAAM6H,mBAAmB,GAAGP,OAAO,CAAEG,CAAC,CAAE,CAACzH,WAAW;UACpDsH,OAAO,CAAEG,CAAC,CAAE,GAAG;YACd,GAAGH,OAAO,CAAEG,CAAC,CAAE;YACfzH,WAAW,EAAI8H,KAAK,IAAM;cACzB,OACCtH,aAAA,CAACqH,mBAAmB;gBACnB5H,KAAK,EAAG6H,KAAK,CAAC7H,KAAO;gBACrBE,UAAU,EAAG2H,KAAK,CAAC3H,UAAY;gBAC/BC,iBAAiB,EAAKwH,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAAC1H,iBAAiB,EAAG;oBAC9B0H,KAAK,CAAC1H,iBAAiB,CACtBwH,MACD,CAAC;kBACF;kBACAxH,iBAAiB,CAChBkH,OAAO,CAAEG,CAAC,CAAE,CAACjI,EAAE,EACfoI,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IACA,OAAON,OAAO;EACf,CAAC;EAED;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACC;EACA,IAAKJ,SAAS,IAAI,EAAE,CAAE,EACtBC,2BAA2B,EAC3BC,iBAAiB,EACjBhH,iBAAiB,CAEnB,CAAC;AACF","ignoreList":[]}
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "react";
3
3
  * WordPress dependencies
4
4
  */
5
5
  import { useSelect } from '@wordpress/data';
6
- import { useState } from '@wordpress/element';
6
+ import { useState, useMemo } from '@wordpress/element';
7
7
  import { __ } from '@wordpress/i18n';
8
8
  import { privateApis as componentsPrivateApis, Button, Modal } from '@wordpress/components';
9
9
  import { moreVertical } from '@wordpress/icons';
@@ -22,11 +22,15 @@ const {
22
22
  DropdownMenuItemLabelV2: DropdownMenuItemLabel,
23
23
  kebabCase
24
24
  } = unlock(componentsPrivateApis);
25
- const POST_ACTIONS_WHILE_EDITING = ['view-post', 'view-post-revisions', 'rename-post', 'move-to-trash'];
25
+ let POST_ACTIONS_WHILE_EDITING = ['view-post', 'view-post-revisions', 'rename-post', 'move-to-trash'];
26
+ if (process.env.IS_GUTENBERG_PLUGIN) {
27
+ POST_ACTIONS_WHILE_EDITING = ['view-post', 'view-post-revisions', 'duplicate-post', 'rename-post', 'move-to-trash'];
28
+ }
26
29
  export default function PostActions({
27
30
  onActionPerformed,
28
31
  buttonProps
29
32
  }) {
33
+ const [isActionsMenuOpen, setIsActionsMenuOpen] = useState(false);
30
34
  const {
31
35
  postType,
32
36
  item
@@ -40,23 +44,34 @@ export default function PostActions({
40
44
  item: getCurrentPost()
41
45
  };
42
46
  });
43
- const actions = usePostActions(onActionPerformed, POST_ACTIONS_WHILE_EDITING);
47
+ const allActions = usePostActions(onActionPerformed, POST_ACTIONS_WHILE_EDITING);
48
+ const actions = useMemo(() => {
49
+ return allActions.filter(action => {
50
+ return !action.isEligible || action.isEligible(item);
51
+ });
52
+ }, [allActions, item]);
44
53
  if ([TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(postType)) {
45
54
  return null;
46
55
  }
47
56
  return createElement(DropdownMenu, {
57
+ open: isActionsMenuOpen,
48
58
  trigger: createElement(Button, {
49
59
  size: "small",
50
60
  icon: moreVertical,
51
61
  label: __('Actions'),
52
62
  disabled: !actions.length,
53
63
  className: "editor-all-actions-button",
64
+ onClick: () => setIsActionsMenuOpen(!isActionsMenuOpen),
54
65
  ...buttonProps
55
66
  }),
67
+ onOpenChange: setIsActionsMenuOpen,
56
68
  placement: "bottom-end"
57
69
  }, createElement(ActionsDropdownMenuGroup, {
58
70
  actions: actions,
59
- item: item
71
+ item: item,
72
+ onClose: () => {
73
+ setIsActionsMenuOpen(false);
74
+ }
60
75
  }));
61
76
  }
62
77
 
@@ -77,10 +92,12 @@ function DropdownMenuItemTrigger({
77
92
  }
78
93
 
79
94
  // Copied as is from packages/dataviews/src/item-actions.js
95
+ // With an added onClose prop.
80
96
  function ActionWithModal({
81
97
  action,
82
98
  item,
83
- ActionTrigger
99
+ ActionTrigger,
100
+ onClose
84
101
  }) {
85
102
  const [isModalOpen, setIsModalOpen] = useState(false);
86
103
  const actionTriggerProps = {
@@ -102,14 +119,19 @@ function ActionWithModal({
102
119
  overlayClassName: `editor-action-modal editor-action-modal__${kebabCase(action.id)}`
103
120
  }, createElement(RenderModal, {
104
121
  items: [item],
105
- closeModal: () => setIsModalOpen(false)
122
+ closeModal: () => {
123
+ setIsModalOpen(false);
124
+ onClose();
125
+ }
106
126
  })));
107
127
  }
108
128
 
109
129
  // Copied as is from packages/dataviews/src/item-actions.js
130
+ // With an added onClose prop.
110
131
  function ActionsDropdownMenuGroup({
111
132
  actions,
112
- item
133
+ item,
134
+ onClose
113
135
  }) {
114
136
  return createElement(DropdownMenuGroup, null, actions.map(action => {
115
137
  if (action.RenderModal) {
@@ -117,7 +139,8 @@ function ActionsDropdownMenuGroup({
117
139
  key: action.id,
118
140
  action: action,
119
141
  item: item,
120
- ActionTrigger: DropdownMenuItemTrigger
142
+ ActionTrigger: DropdownMenuItemTrigger,
143
+ onClose: onClose
121
144
  });
122
145
  }
123
146
  return createElement(DropdownMenuItemTrigger, {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useState","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","unlock","usePostActions","store","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","POST_ACTIONS_WHILE_EDITING","PostActions","onActionPerformed","buttonProps","postType","item","select","getCurrentPostType","getCurrentPost","actions","includes","createElement","trigger","size","icon","label","disabled","length","className","placement","ActionsDropdownMenuGroup","DropdownMenuItemTrigger","action","onClick","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","Fragment","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","items","closeModal","map","key","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuItemV2: DropdownMenuItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tkebabCase,\n} = unlock( componentsPrivateApis );\n\nconst POST_ACTIONS_WHILE_EDITING = [\n\t'view-post',\n\t'view-post-revisions',\n\t'rename-post',\n\t'move-to-trash',\n];\n\nexport default function PostActions( { onActionPerformed, buttonProps } ) {\n\tconst { postType, item } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPost } = select( editorStore );\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\titem: getCurrentPost(),\n\t\t};\n\t} );\n\tconst actions = usePostActions(\n\t\tonActionPerformed,\n\t\tPOST_ACTIONS_WHILE_EDITING\n\t);\n\n\tif (\n\t\t[\n\t\t\tTEMPLATE_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType )\n\t) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<DropdownMenu\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup actions={ actions } item={ item } />\n\t\t</DropdownMenu>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick } ) {\n\treturn (\n\t\t<DropdownMenuItem\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuItemLabel>{ action.label }</DropdownMenuItemLabel>\n\t\t</DropdownMenuItem>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction ActionWithModal( { action, item, ActionTrigger } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction ActionsDropdownMenuGroup( { actions, item } ) {\n\treturn (\n\t\t<DropdownMenuGroup>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,IAAIC,qBAAqB,EACpCC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,QACX,uBAAuB;AAE9B,MAAM;EACLC,cAAc,EAAEC,YAAY;EAC5BC,mBAAmB,EAAEC,iBAAiB;EACtCC,kBAAkB,EAAEC,gBAAgB;EACpCC,uBAAuB,EAAE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AA,CAACe,eAAe;QACfgB,GAAG,EAAGpB,MAAM,CAACgB,EAAI;QACjBhB,MAAM,EAAGA,MAAQ;QACjBjB,IAAI,EAAGA,IAAM;QACbsB,aAAa,EAAGN;MAAyB,CACzC,CAAC;IAEJ;IACA,OACCV,aAAA,CAACU,uBAAuB;MACvBqB,GAAG,EAAGpB,MAAM,CAACgB,EAAI;MACjBhB,MAAM,EAAGA,MAAQ;MACjBC,OAAO,EAAGA,CAAA,KAAMD,MAAM,CAACqB,QAAQ,CAAE,CAAEtC,IAAI,CAAG;IAAG,CAC7C,CAAC;EAEJ,CAAE,CACgB,CAAC;AAEtB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useState","useMemo","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","unlock","usePostActions","store","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","POST_ACTIONS_WHILE_EDITING","process","env","IS_GUTENBERG_PLUGIN","PostActions","onActionPerformed","buttonProps","isActionsMenuOpen","setIsActionsMenuOpen","postType","item","select","getCurrentPostType","getCurrentPost","allActions","actions","filter","action","isEligible","includes","createElement","open","trigger","size","icon","label","disabled","length","className","onClick","onOpenChange","placement","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","Fragment","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","items","closeModal","map","key","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuItemV2: DropdownMenuItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tkebabCase,\n} = unlock( componentsPrivateApis );\n\nlet POST_ACTIONS_WHILE_EDITING = [\n\t'view-post',\n\t'view-post-revisions',\n\t'rename-post',\n\t'move-to-trash',\n];\n\nif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\tPOST_ACTIONS_WHILE_EDITING = [\n\t\t'view-post',\n\t\t'view-post-revisions',\n\t\t'duplicate-post',\n\t\t'rename-post',\n\t\t'move-to-trash',\n\t];\n}\n\nexport default function PostActions( { onActionPerformed, buttonProps } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { postType, item } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPost } = select( editorStore );\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\titem: getCurrentPost(),\n\t\t};\n\t} );\n\tconst allActions = usePostActions(\n\t\tonActionPerformed,\n\t\tPOST_ACTIONS_WHILE_EDITING\n\t);\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn ! action.isEligible || action.isEligible( item );\n\t\t} );\n\t}, [ allActions, item ] );\n\n\tif (\n\t\t[\n\t\t\tTEMPLATE_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType )\n\t) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<DropdownMenu\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ item }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenu>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick } ) {\n\treturn (\n\t\t<DropdownMenuItem\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuItemLabel>{ action.label }</DropdownMenuItemLabel>\n\t\t</DropdownMenuItem>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuGroup>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ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W,EAAG;MACzB,OACChB,aAAA,CAACiB,eAAe;QACfgB,GAAG,EAAGpC,MAAM,CAACgC,EAAI;QACjBhC,MAAM,EAAGA,MAAQ;QACjBP,IAAI,EAAGA,IAAM;QACb4B,aAAa,EAAGJ,uBAAyB;QACzCD,OAAO,EAAGA;MAAS,CACnB,CAAC;IAEJ;IACA,OACCb,aAAA,CAACc,uBAAuB;MACvBmB,GAAG,EAAGpC,MAAM,CAACgC,EAAI;MACjBhC,MAAM,EAAGA,MAAQ;MACjBY,OAAO,EAAGA,CAAA,KAAMZ,MAAM,CAACqC,QAAQ,CAAE,CAAE5C,IAAI,CAAG;IAAG,CAC7C,CAAC;EAEJ,CAAE,CACgB,CAAC;AAEtB","ignoreList":[]}
@@ -11,6 +11,16 @@ import { store as coreStore } from '@wordpress/core-data';
11
11
  import PostTypeSupportCheck from '../post-type-support-check';
12
12
  import { store as editorStore } from '../../store';
13
13
  import { AUTHORS_QUERY } from './constants';
14
+
15
+ /**
16
+ * Wrapper component that renders its children only if the post type supports the author.
17
+ *
18
+ * @param {Object} props The component props.
19
+ * @param {Element} props.children Children to be rendered.
20
+ *
21
+ * @return {Component|null} The component to be rendered. Return `null` if the post type doesn't
22
+ * supports the author or if there are no authors available.
23
+ */
14
24
  export default function PostAuthorCheck({
15
25
  children
16
26
  }) {