@wordpress/editor 14.6.0 → 14.7.1-next.5368f64a9.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 (354) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +41 -0
  3. package/build/bindings/post-meta.js +11 -8
  4. package/build/bindings/post-meta.js.map +1 -1
  5. package/build/components/block-manager/index.js +4 -1
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
  8. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  9. package/build/components/document-bar/index.js +4 -4
  10. package/build/components/document-bar/index.js.map +1 -1
  11. package/build/components/editor/index.js +2 -2
  12. package/build/components/editor/index.js.map +1 -1
  13. package/build/components/editor-history/redo.js +4 -1
  14. package/build/components/editor-history/redo.js.map +1 -1
  15. package/build/components/editor-history/undo.js +4 -1
  16. package/build/components/editor-history/undo.js.map +1 -1
  17. package/build/components/editor-interface/index.js +2 -3
  18. package/build/components/editor-interface/index.js.map +1 -1
  19. package/build/components/error-boundary/index.js +4 -1
  20. package/build/components/error-boundary/index.js.map +1 -1
  21. package/build/components/global-styles-provider/index.js +3 -4
  22. package/build/components/global-styles-provider/index.js.map +1 -1
  23. package/build/components/header/index.js +4 -4
  24. package/build/components/header/index.js.map +1 -1
  25. package/build/components/index.js +8 -0
  26. package/build/components/index.js.map +1 -1
  27. package/build/components/inserter-sidebar/index.js +5 -10
  28. package/build/components/inserter-sidebar/index.js.map +1 -1
  29. package/build/components/local-autosave-monitor/index.js +5 -5
  30. package/build/components/local-autosave-monitor/index.js.map +1 -1
  31. package/build/components/page-attributes/parent.js +4 -1
  32. package/build/components/page-attributes/parent.js.map +1 -1
  33. package/build/components/plugin-preview-menu-item/index.js +57 -0
  34. package/build/components/plugin-preview-menu-item/index.js.map +1 -0
  35. package/build/components/post-actions/index.js +5 -8
  36. package/build/components/post-actions/index.js.map +1 -1
  37. package/build/components/post-excerpt/panel.js +4 -1
  38. package/build/components/post-excerpt/panel.js.map +1 -1
  39. package/build/components/post-featured-image/index.js +12 -3
  40. package/build/components/post-featured-image/index.js.map +1 -1
  41. package/build/components/post-format/index.js +4 -1
  42. package/build/components/post-format/index.js.map +1 -1
  43. package/build/components/post-last-revision/index.js +4 -1
  44. package/build/components/post-last-revision/index.js.map +1 -1
  45. package/build/components/post-locked-modal/index.js +12 -3
  46. package/build/components/post-locked-modal/index.js.map +1 -1
  47. package/build/components/post-publish-panel/index.js +4 -1
  48. package/build/components/post-publish-panel/index.js.map +1 -1
  49. package/build/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  50. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  51. package/build/components/post-publish-panel/maybe-upload-media.js +158 -33
  52. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  53. package/build/components/post-publish-panel/media-util.js +79 -0
  54. package/build/components/post-publish-panel/media-util.js.map +1 -0
  55. package/build/components/post-status/index.js +4 -2
  56. package/build/components/post-status/index.js.map +1 -1
  57. package/build/components/post-taxonomies/hierarchical-term-selector.js +4 -1
  58. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  59. package/build/components/post-taxonomies/most-used-terms.js +4 -1
  60. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  61. package/build/components/post-template/block-theme.js +13 -4
  62. package/build/components/post-template/block-theme.js.map +1 -1
  63. package/build/components/post-template/classic-theme.js +4 -1
  64. package/build/components/post-template/classic-theme.js.map +1 -1
  65. package/build/components/post-title/index.js +32 -46
  66. package/build/components/post-title/index.js.map +1 -1
  67. package/build/components/post-trash/check.js +2 -1
  68. package/build/components/post-trash/check.js.map +1 -1
  69. package/build/components/post-trash/index.js +22 -8
  70. package/build/components/post-trash/index.js.map +1 -1
  71. package/build/components/post-url/index.js +4 -1
  72. package/build/components/post-url/index.js.map +1 -1
  73. package/build/components/preferences-modal/index.js +28 -1
  74. package/build/components/preferences-modal/index.js.map +1 -1
  75. package/build/components/preview-dropdown/index.js +26 -14
  76. package/build/components/preview-dropdown/index.js.map +1 -1
  77. package/build/components/provider/index.js +34 -8
  78. package/build/components/provider/index.js.map +1 -1
  79. package/build/components/provider/use-block-editor-settings.js +14 -10
  80. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  81. package/build/components/save-publish-panels/index.js +8 -2
  82. package/build/components/save-publish-panels/index.js.map +1 -1
  83. package/build/components/sidebar/post-summary.js +3 -0
  84. package/build/components/sidebar/post-summary.js.map +1 -1
  85. package/build/components/start-page-options/index.js +16 -19
  86. package/build/components/start-page-options/index.js.map +1 -1
  87. package/build/components/start-template-options/index.js +1 -0
  88. package/build/components/start-template-options/index.js.map +1 -1
  89. package/build/components/table-of-contents/index.js +1 -0
  90. package/build/components/table-of-contents/index.js.map +1 -1
  91. package/build/components/text-editor/index.js +1 -0
  92. package/build/components/text-editor/index.js.map +1 -1
  93. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  94. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  95. package/build/components/visual-editor/index.js +1 -6
  96. package/build/components/visual-editor/index.js.map +1 -1
  97. package/build/dataviews/actions/export-pattern.js +2 -0
  98. package/build/dataviews/actions/export-pattern.js.map +1 -1
  99. package/build/dataviews/actions/permanently-delete-post.js +2 -0
  100. package/build/dataviews/actions/permanently-delete-post.js.map +1 -1
  101. package/build/dataviews/actions/reset-post.js +2 -0
  102. package/build/dataviews/actions/reset-post.js.map +1 -1
  103. package/build/dataviews/actions/trash-post.js +2 -0
  104. package/build/dataviews/actions/trash-post.js.map +1 -1
  105. package/build/dataviews/actions/view-post.js +1 -1
  106. package/build/dataviews/actions/view-post.js.map +1 -1
  107. package/build/private-apis.js +0 -2
  108. package/build/private-apis.js.map +1 -1
  109. package/build/store/private-actions.js +1 -1
  110. package/build/store/private-actions.js.map +1 -1
  111. package/build/store/selectors.js +7 -3
  112. package/build/store/selectors.js.map +1 -1
  113. package/build-module/bindings/post-meta.js +11 -8
  114. package/build-module/bindings/post-meta.js.map +1 -1
  115. package/build-module/components/block-manager/index.js +4 -1
  116. package/build-module/components/block-manager/index.js.map +1 -1
  117. package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
  118. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  119. package/build-module/components/document-bar/index.js +4 -4
  120. package/build-module/components/document-bar/index.js.map +1 -1
  121. package/build-module/components/editor/index.js +2 -2
  122. package/build-module/components/editor/index.js.map +1 -1
  123. package/build-module/components/editor-history/redo.js +4 -1
  124. package/build-module/components/editor-history/redo.js.map +1 -1
  125. package/build-module/components/editor-history/undo.js +4 -1
  126. package/build-module/components/editor-history/undo.js.map +1 -1
  127. package/build-module/components/editor-interface/index.js +2 -3
  128. package/build-module/components/editor-interface/index.js.map +1 -1
  129. package/build-module/components/error-boundary/index.js +4 -1
  130. package/build-module/components/error-boundary/index.js.map +1 -1
  131. package/build-module/components/global-styles-provider/index.js +3 -4
  132. package/build-module/components/global-styles-provider/index.js.map +1 -1
  133. package/build-module/components/header/index.js +4 -4
  134. package/build-module/components/header/index.js.map +1 -1
  135. package/build-module/components/index.js +1 -0
  136. package/build-module/components/index.js.map +1 -1
  137. package/build-module/components/inserter-sidebar/index.js +5 -10
  138. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  139. package/build-module/components/local-autosave-monitor/index.js +5 -5
  140. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  141. package/build-module/components/page-attributes/parent.js +4 -1
  142. package/build-module/components/page-attributes/parent.js.map +1 -1
  143. package/build-module/components/plugin-preview-menu-item/index.js +52 -0
  144. package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
  145. package/build-module/components/post-actions/index.js +5 -8
  146. package/build-module/components/post-actions/index.js.map +1 -1
  147. package/build-module/components/post-excerpt/panel.js +4 -1
  148. package/build-module/components/post-excerpt/panel.js.map +1 -1
  149. package/build-module/components/post-featured-image/index.js +12 -3
  150. package/build-module/components/post-featured-image/index.js.map +1 -1
  151. package/build-module/components/post-format/index.js +4 -1
  152. package/build-module/components/post-format/index.js.map +1 -1
  153. package/build-module/components/post-last-revision/index.js +4 -1
  154. package/build-module/components/post-last-revision/index.js.map +1 -1
  155. package/build-module/components/post-locked-modal/index.js +12 -3
  156. package/build-module/components/post-locked-modal/index.js.map +1 -1
  157. package/build-module/components/post-publish-panel/index.js +4 -1
  158. package/build-module/components/post-publish-panel/index.js.map +1 -1
  159. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  160. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  161. package/build-module/components/post-publish-panel/maybe-upload-media.js +157 -32
  162. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  163. package/build-module/components/post-publish-panel/media-util.js +72 -0
  164. package/build-module/components/post-publish-panel/media-util.js.map +1 -0
  165. package/build-module/components/post-status/index.js +4 -2
  166. package/build-module/components/post-status/index.js.map +1 -1
  167. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -1
  168. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  169. package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
  170. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  171. package/build-module/components/post-template/block-theme.js +13 -4
  172. package/build-module/components/post-template/block-theme.js.map +1 -1
  173. package/build-module/components/post-template/classic-theme.js +4 -1
  174. package/build-module/components/post-template/classic-theme.js.map +1 -1
  175. package/build-module/components/post-title/index.js +33 -47
  176. package/build-module/components/post-title/index.js.map +1 -1
  177. package/build-module/components/post-trash/check.js +2 -1
  178. package/build-module/components/post-trash/check.js.map +1 -1
  179. package/build-module/components/post-trash/index.js +23 -11
  180. package/build-module/components/post-trash/index.js.map +1 -1
  181. package/build-module/components/post-url/index.js +4 -1
  182. package/build-module/components/post-url/index.js.map +1 -1
  183. package/build-module/components/preferences-modal/index.js +28 -1
  184. package/build-module/components/preferences-modal/index.js.map +1 -1
  185. package/build-module/components/preview-dropdown/index.js +26 -14
  186. package/build-module/components/preview-dropdown/index.js.map +1 -1
  187. package/build-module/components/provider/index.js +35 -9
  188. package/build-module/components/provider/index.js.map +1 -1
  189. package/build-module/components/provider/use-block-editor-settings.js +15 -11
  190. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  191. package/build-module/components/save-publish-panels/index.js +8 -2
  192. package/build-module/components/save-publish-panels/index.js.map +1 -1
  193. package/build-module/components/sidebar/post-summary.js +3 -0
  194. package/build-module/components/sidebar/post-summary.js.map +1 -1
  195. package/build-module/components/start-page-options/index.js +17 -21
  196. package/build-module/components/start-page-options/index.js.map +1 -1
  197. package/build-module/components/start-template-options/index.js +1 -0
  198. package/build-module/components/start-template-options/index.js.map +1 -1
  199. package/build-module/components/table-of-contents/index.js +1 -0
  200. package/build-module/components/table-of-contents/index.js.map +1 -1
  201. package/build-module/components/text-editor/index.js +1 -0
  202. package/build-module/components/text-editor/index.js.map +1 -1
  203. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  204. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  205. package/build-module/components/visual-editor/index.js +1 -6
  206. package/build-module/components/visual-editor/index.js.map +1 -1
  207. package/build-module/dataviews/actions/export-pattern.js +2 -0
  208. package/build-module/dataviews/actions/export-pattern.js.map +1 -1
  209. package/build-module/dataviews/actions/permanently-delete-post.js +3 -0
  210. package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -1
  211. package/build-module/dataviews/actions/reset-post.js +2 -0
  212. package/build-module/dataviews/actions/reset-post.js.map +1 -1
  213. package/build-module/dataviews/actions/trash-post.js +2 -0
  214. package/build-module/dataviews/actions/trash-post.js.map +1 -1
  215. package/build-module/dataviews/actions/view-post.js +2 -2
  216. package/build-module/dataviews/actions/view-post.js.map +1 -1
  217. package/build-module/private-apis.js +0 -2
  218. package/build-module/private-apis.js.map +1 -1
  219. package/build-module/store/private-actions.js +1 -1
  220. package/build-module/store/private-actions.js.map +1 -1
  221. package/build-module/store/selectors.js +6 -2
  222. package/build-module/store/selectors.js.map +1 -1
  223. package/build-style/style-rtl.css +13 -8
  224. package/build-style/style.css +13 -8
  225. package/build-types/bindings/post-meta.d.ts +0 -3
  226. package/build-types/bindings/post-meta.d.ts.map +1 -1
  227. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
  228. package/build-types/components/editor-history/redo.d.ts.map +1 -1
  229. package/build-types/components/editor-history/undo.d.ts.map +1 -1
  230. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  231. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  232. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  233. package/build-types/components/header/back-button.d.ts.map +1 -1
  234. package/build-types/components/index.d.ts +1 -0
  235. package/build-types/components/index.d.ts.map +1 -1
  236. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  237. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
  238. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  239. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  240. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
  241. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
  242. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
  243. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
  244. package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
  245. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
  246. package/build-types/components/post-actions/index.d.ts.map +1 -1
  247. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
  248. package/build-types/components/post-format/index.d.ts.map +1 -1
  249. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  250. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  251. package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
  252. package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
  253. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +1 -1
  254. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
  255. package/build-types/components/post-publish-panel/media-util.d.ts +20 -0
  256. package/build-types/components/post-publish-panel/media-util.d.ts.map +1 -0
  257. package/build-types/components/post-status/index.d.ts.map +1 -1
  258. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  259. package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
  260. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  261. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  262. package/build-types/components/post-trash/check.d.ts.map +1 -1
  263. package/build-types/components/post-trash/index.d.ts +4 -1
  264. package/build-types/components/post-trash/index.d.ts.map +1 -1
  265. package/build-types/components/post-url/index.d.ts.map +1 -1
  266. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
  267. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  268. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  269. package/build-types/components/provider/index.d.ts.map +1 -1
  270. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  271. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  272. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  273. package/build-types/components/start-page-options/index.d.ts +1 -0
  274. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  275. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  276. package/build-types/components/text-editor/index.d.ts.map +1 -1
  277. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  278. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  279. package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -1
  280. package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -1
  281. package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
  282. package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
  283. package/build-types/private-apis.d.ts.map +1 -1
  284. package/build-types/store/private-actions.d.ts.map +1 -1
  285. package/build-types/store/selectors.d.ts +8 -8
  286. package/build-types/store/selectors.d.ts.map +1 -1
  287. package/package.json +36 -36
  288. package/src/bindings/post-meta.js +12 -6
  289. package/src/components/block-manager/index.js +2 -0
  290. package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
  291. package/src/components/create-template-part-modal/style.scss +1 -1
  292. package/src/components/document-bar/index.js +4 -4
  293. package/src/components/document-outline/style.scss +1 -1
  294. package/src/components/editor/index.js +1 -1
  295. package/src/components/editor-history/redo.js +2 -0
  296. package/src/components/editor-history/undo.js +2 -0
  297. package/src/components/editor-interface/index.js +2 -4
  298. package/src/components/error-boundary/index.js +6 -1
  299. package/src/components/global-styles-provider/index.js +11 -7
  300. package/src/components/header/index.js +3 -3
  301. package/src/components/header/style.scss +6 -3
  302. package/src/components/index.js +1 -0
  303. package/src/components/inserter-sidebar/index.js +6 -8
  304. package/src/components/local-autosave-monitor/index.js +6 -6
  305. package/src/components/page-attributes/parent.js +5 -4
  306. package/src/components/plugin-preview-menu-item/index.js +52 -0
  307. package/src/components/post-actions/index.js +8 -14
  308. package/src/components/post-card-panel/style.scss +1 -1
  309. package/src/components/post-excerpt/panel.js +2 -0
  310. package/src/components/post-featured-image/index.js +6 -0
  311. package/src/components/post-featured-image/style.scss +1 -2
  312. package/src/components/post-format/index.js +2 -0
  313. package/src/components/post-last-revision/index.js +2 -0
  314. package/src/components/post-locked-modal/index.js +14 -2
  315. package/src/components/post-locked-modal/style.scss +1 -1
  316. package/src/components/post-publish-panel/index.js +2 -0
  317. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -0
  318. package/src/components/post-publish-panel/maybe-upload-media.js +145 -36
  319. package/src/components/post-publish-panel/media-util.js +87 -0
  320. package/src/components/post-publish-panel/style.scss +3 -1
  321. package/src/components/post-publish-panel/test/media-util.js +118 -0
  322. package/src/components/post-status/index.js +3 -2
  323. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -0
  324. package/src/components/post-taxonomies/most-used-terms.js +2 -0
  325. package/src/components/post-template/block-theme.js +15 -9
  326. package/src/components/post-template/classic-theme.js +2 -0
  327. package/src/components/post-title/index.js +30 -41
  328. package/src/components/post-trash/check.js +5 -2
  329. package/src/components/post-trash/index.js +23 -12
  330. package/src/components/post-url/index.js +2 -0
  331. package/src/components/preferences-modal/index.js +227 -172
  332. package/src/components/preview-dropdown/index.js +28 -20
  333. package/src/components/provider/index.js +42 -10
  334. package/src/components/provider/use-block-editor-settings.js +16 -11
  335. package/src/components/resizable-editor/style.scss +2 -2
  336. package/src/components/save-publish-panels/index.js +4 -0
  337. package/src/components/sidebar/post-summary.js +4 -0
  338. package/src/components/start-page-options/index.js +28 -26
  339. package/src/components/start-template-options/index.js +5 -1
  340. package/src/components/table-of-contents/index.js +1 -0
  341. package/src/components/text-editor/index.js +1 -0
  342. package/src/components/text-editor/style.scss +1 -1
  343. package/src/components/visual-editor/edit-template-blocks-notification.js +4 -1
  344. package/src/components/visual-editor/index.js +2 -9
  345. package/src/dataviews/actions/export-pattern.tsx +2 -0
  346. package/src/dataviews/actions/permanently-delete-post.tsx +2 -0
  347. package/src/dataviews/actions/reset-post.tsx +2 -0
  348. package/src/dataviews/actions/trash-post.tsx +2 -0
  349. package/src/dataviews/actions/view-post.tsx +2 -2
  350. package/src/private-apis.js +0 -2
  351. package/src/store/private-actions.js +3 -1
  352. package/src/store/selectors.js +9 -3
  353. package/tsconfig.json +1 -0
  354. package/tsconfig.tsbuildinfo +1 -1
@@ -8,6 +8,7 @@ import { store as coreStore } from '@wordpress/core-data';
8
8
  * Internal dependencies
9
9
  */
10
10
  import { store as editorStore } from '../../store';
11
+ import { GLOBAL_POST_TYPES } from '../../store/constants';
11
12
 
12
13
  /**
13
14
  * Wrapper component that renders its children only if the post can trashed.
@@ -34,10 +35,12 @@ export default function PostTrashCheck( { children } ) {
34
35
  : false;
35
36
 
36
37
  return {
37
- canTrashPost: ( ! isNew || postId ) && canUserDelete,
38
+ canTrashPost:
39
+ ( ! isNew || postId ) &&
40
+ canUserDelete &&
41
+ ! GLOBAL_POST_TYPES.includes( postType ),
38
42
  };
39
43
  }, [] );
40
-
41
44
  if ( ! canTrashPost ) {
42
45
  return null;
43
46
  }
@@ -1,31 +1,35 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __ } from '@wordpress/i18n';
4
+ import { __, sprintf } from '@wordpress/i18n';
5
5
  import {
6
6
  Button,
7
7
  __experimentalConfirmDialog as ConfirmDialog,
8
8
  } from '@wordpress/components';
9
- import { useSelect, useDispatch } from '@wordpress/data';
9
+ import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
10
10
  import { useState } from '@wordpress/element';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
15
  import { store as editorStore } from '../../store';
16
+ import PostTrashCheck from './check';
16
17
 
17
18
  /**
18
19
  * Displays the Post Trash Button and Confirm Dialog in the Editor.
19
20
  *
21
+ * @param {?{onActionPerformed: Object}} An object containing the onActionPerformed function.
20
22
  * @return {JSX.Element|null} The rendered PostTrash component.
21
23
  */
22
- export default function PostTrash() {
23
- const { isNew, isDeleting, postId } = useSelect( ( select ) => {
24
+ export default function PostTrash( { onActionPerformed } ) {
25
+ const registry = useRegistry();
26
+ const { isNew, isDeleting, postId, title } = useSelect( ( select ) => {
24
27
  const store = select( editorStore );
25
28
  return {
26
29
  isNew: store.isEditedPostNew(),
27
30
  isDeleting: store.isDeletingPost(),
28
31
  postId: store.getCurrentPostId(),
32
+ title: store.getCurrentPostAttribute( 'title' ),
29
33
  };
30
34
  }, [] );
31
35
  const { trashPost } = useDispatch( editorStore );
@@ -35,13 +39,18 @@ export default function PostTrash() {
35
39
  return null;
36
40
  }
37
41
 
38
- const handleConfirm = () => {
42
+ const handleConfirm = async () => {
39
43
  setShowConfirmDialog( false );
40
- trashPost();
44
+ await trashPost();
45
+ const item = await registry
46
+ .resolveSelect( editorStore )
47
+ .getCurrentPost();
48
+ // After the post is trashed, we want to trigger the onActionPerformed callback, so the user is redirect
49
+ // to the post view depending on if the user is on post editor or site editor.
50
+ onActionPerformed?.( 'move-to-trash', [ item ] );
41
51
  };
42
-
43
52
  return (
44
- <>
53
+ <PostTrashCheck>
45
54
  <Button
46
55
  __next40pxDefaultSize
47
56
  className="editor-post-trash"
@@ -60,12 +69,14 @@ export default function PostTrash() {
60
69
  onConfirm={ handleConfirm }
61
70
  onCancel={ () => setShowConfirmDialog( false ) }
62
71
  confirmButtonText={ __( 'Move to trash' ) }
63
- size="medium"
72
+ size="small"
64
73
  >
65
- { __(
66
- 'Are you sure you want to move this post to the trash?'
74
+ { sprintf(
75
+ // translators: %s: The item's title.
76
+ __( 'Are you sure you want to move "%s" to the trash?' ),
77
+ title
67
78
  ) }
68
79
  </ConfirmDialog>
69
- </>
80
+ </PostTrashCheck>
70
81
  );
71
82
  }
@@ -110,6 +110,8 @@ export default function PostURL( { onClose } ) {
110
110
  }
111
111
  suffix={
112
112
  <Button
113
+ // TODO: Switch to `true` (40px size) if possible
114
+ __next40pxDefaultSize={ false }
113
115
  icon={ copySmall }
114
116
  ref={ copyButtonRef }
115
117
  label={ __( 'Copy' ) }
@@ -26,6 +26,7 @@ import PageAttributesCheck from '../page-attributes/check';
26
26
  import PostTypeSupportCheck from '../post-type-support-check';
27
27
  import { store as editorStore } from '../../store';
28
28
  import { unlock } from '../../lock-unlock';
29
+ import { useStartPatterns } from '../start-page-options';
29
30
 
30
31
  const {
31
32
  PreferencesModal,
@@ -57,214 +58,267 @@ export default function EditorPreferencesModal( { extraSections = {} } ) {
57
58
  const { setIsListViewOpened, setIsInserterOpened } =
58
59
  useDispatch( editorStore );
59
60
  const { set: setPreference } = useDispatch( preferencesStore );
61
+ const hasStarterPatterns = !! useStartPatterns().length;
60
62
 
61
63
  const sections = useMemo(
62
- () => [
63
- {
64
- name: 'general',
65
- tabLabel: __( 'General' ),
66
- content: (
67
- <>
68
- <PreferencesModalSection title={ __( 'Interface' ) }>
69
- <PreferenceToggleControl
70
- scope="core"
71
- featureName="showListViewByDefault"
72
- help={ __(
73
- 'Opens the List View sidebar by default.'
74
- ) }
75
- label={ __( 'Always open List View' ) }
76
- />
77
- { showBlockBreadcrumbsOption && (
64
+ () =>
65
+ [
66
+ {
67
+ name: 'general',
68
+ tabLabel: __( 'General' ),
69
+ content: (
70
+ <>
71
+ <PreferencesModalSection
72
+ title={ __( 'Interface' ) }
73
+ >
78
74
  <PreferenceToggleControl
79
75
  scope="core"
80
- featureName="showBlockBreadcrumbs"
76
+ featureName="showListViewByDefault"
81
77
  help={ __(
82
- 'Display the block hierarchy trail at the bottom of the editor.'
78
+ 'Opens the List View sidebar by default.'
83
79
  ) }
84
- label={ __( 'Show block breadcrumbs' ) }
80
+ label={ __( 'Always open List View' ) }
85
81
  />
86
- ) }
87
- <PreferenceToggleControl
88
- scope="core"
89
- featureName="allowRightClickOverrides"
90
- help={ __(
91
- 'Allows contextual List View menus via right-click, overriding browser defaults.'
92
- ) }
93
- label={ __(
94
- 'Allow right-click contextual menus'
95
- ) }
96
- />
97
- </PreferencesModalSection>
98
- <PreferencesModalSection
99
- title={ __( 'Document settings' ) }
100
- description={ __(
101
- 'Select what settings are shown in the document panel.'
102
- ) }
103
- >
104
- <EnablePluginDocumentSettingPanelOption.Slot />
105
- <PostTaxonomies
106
- taxonomyWrapper={ ( content, taxonomy ) => (
107
- <EnablePanelOption
108
- label={ taxonomy.labels.menu_name }
109
- panelName={ `taxonomy-panel-${ taxonomy.slug }` }
82
+ { showBlockBreadcrumbsOption && (
83
+ <PreferenceToggleControl
84
+ scope="core"
85
+ featureName="showBlockBreadcrumbs"
86
+ help={ __(
87
+ 'Display the block hierarchy trail at the bottom of the editor.'
88
+ ) }
89
+ label={ __( 'Show block breadcrumbs' ) }
110
90
  />
111
91
  ) }
112
- />
113
- <PostFeaturedImageCheck>
114
- <EnablePanelOption
115
- label={ __( 'Featured image' ) }
116
- panelName="featured-image"
117
- />
118
- </PostFeaturedImageCheck>
119
- <PostExcerptCheck>
120
- <EnablePanelOption
121
- label={ __( 'Excerpt' ) }
122
- panelName="post-excerpt"
123
- />
124
- </PostExcerptCheck>
125
- <PostTypeSupportCheck
126
- supportKeys={ [ 'comments', 'trackbacks' ] }
127
- >
128
- <EnablePanelOption
129
- label={ __( 'Discussion' ) }
130
- panelName="discussion-panel"
131
- />
132
- </PostTypeSupportCheck>
133
- <PageAttributesCheck>
134
- <EnablePanelOption
135
- label={ __( 'Page attributes' ) }
136
- panelName="page-attributes"
92
+ <PreferenceToggleControl
93
+ scope="core"
94
+ featureName="allowRightClickOverrides"
95
+ help={ __(
96
+ 'Allows contextual List View menus via right-click, overriding browser defaults.'
97
+ ) }
98
+ label={ __(
99
+ 'Allow right-click contextual menus'
100
+ ) }
137
101
  />
138
- </PageAttributesCheck>
139
- </PreferencesModalSection>
140
- { isLargeViewport && (
102
+ { hasStarterPatterns && (
103
+ <PreferenceToggleControl
104
+ scope="core"
105
+ featureName="enableChoosePatternModal"
106
+ help={ __(
107
+ 'Shows starter patterns when creating a new page.'
108
+ ) }
109
+ label={ __( 'Show starter patterns' ) }
110
+ />
111
+ ) }
112
+ </PreferencesModalSection>
141
113
  <PreferencesModalSection
142
- title={ __( 'Publishing' ) }
114
+ title={ __( 'Document settings' ) }
115
+ description={ __(
116
+ 'Select what settings are shown in the document panel.'
117
+ ) }
143
118
  >
144
- <EnablePublishSidebarOption
145
- help={ __(
146
- 'Review settings, such as visibility and tags.'
119
+ <EnablePluginDocumentSettingPanelOption.Slot />
120
+ <PostTaxonomies
121
+ taxonomyWrapper={ ( content, taxonomy ) => (
122
+ <EnablePanelOption
123
+ label={ taxonomy.labels.menu_name }
124
+ panelName={ `taxonomy-panel-${ taxonomy.slug }` }
125
+ />
147
126
  ) }
148
- label={ __( 'Enable pre-publish checks' ) }
149
127
  />
128
+ <PostFeaturedImageCheck>
129
+ <EnablePanelOption
130
+ label={ __( 'Featured image' ) }
131
+ panelName="featured-image"
132
+ />
133
+ </PostFeaturedImageCheck>
134
+ <PostExcerptCheck>
135
+ <EnablePanelOption
136
+ label={ __( 'Excerpt' ) }
137
+ panelName="post-excerpt"
138
+ />
139
+ </PostExcerptCheck>
140
+ <PostTypeSupportCheck
141
+ supportKeys={ [ 'comments', 'trackbacks' ] }
142
+ >
143
+ <EnablePanelOption
144
+ label={ __( 'Discussion' ) }
145
+ panelName="discussion-panel"
146
+ />
147
+ </PostTypeSupportCheck>
148
+ <PageAttributesCheck>
149
+ <EnablePanelOption
150
+ label={ __( 'Page attributes' ) }
151
+ panelName="page-attributes"
152
+ />
153
+ </PageAttributesCheck>
150
154
  </PreferencesModalSection>
151
- ) }
152
- { extraSections?.general }
153
- </>
154
- ),
155
- },
156
- {
157
- name: 'appearance',
158
- tabLabel: __( 'Appearance' ),
159
- content: (
160
- <PreferencesModalSection
161
- title={ __( 'Appearance' ) }
162
- description={ __(
163
- 'Customize the editor interface to suit your needs.'
164
- ) }
165
- >
166
- <PreferenceToggleControl
167
- scope="core"
168
- featureName="fixedToolbar"
169
- onToggle={ () =>
170
- setPreference(
171
- 'core',
172
- 'distractionFree',
173
- false
174
- )
175
- }
176
- help={ __(
177
- 'Access all block and document tools in a single place.'
178
- ) }
179
- label={ __( 'Top toolbar' ) }
180
- />
181
- <PreferenceToggleControl
182
- scope="core"
183
- featureName="distractionFree"
184
- onToggle={ () => {
185
- setPreference( 'core', 'fixedToolbar', true );
186
- setIsInserterOpened( false );
187
- setIsListViewOpened( false );
188
- } }
189
- help={ __(
190
- 'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'
191
- ) }
192
- label={ __( 'Distraction free' ) }
193
- />
194
- <PreferenceToggleControl
195
- scope="core"
196
- featureName="focusMode"
197
- help={ __(
198
- 'Highlights the current block and fades other content.'
155
+ { isLargeViewport && (
156
+ <PreferencesModalSection
157
+ title={ __( 'Publishing' ) }
158
+ >
159
+ <EnablePublishSidebarOption
160
+ help={ __(
161
+ 'Review settings, such as visibility and tags.'
162
+ ) }
163
+ label={ __(
164
+ 'Enable pre-publish checks'
165
+ ) }
166
+ />
167
+ </PreferencesModalSection>
199
168
  ) }
200
- label={ __( 'Spotlight mode' ) }
201
- />
202
- { extraSections?.appearance }
203
- </PreferencesModalSection>
204
- ),
205
- },
206
- {
207
- name: 'accessibility',
208
- tabLabel: __( 'Accessibility' ),
209
- content: (
210
- <>
169
+ { extraSections?.general }
170
+ </>
171
+ ),
172
+ },
173
+ {
174
+ name: 'appearance',
175
+ tabLabel: __( 'Appearance' ),
176
+ content: (
211
177
  <PreferencesModalSection
212
- title={ __( 'Navigation' ) }
178
+ title={ __( 'Appearance' ) }
213
179
  description={ __(
214
- 'Optimize the editing experience for enhanced control.'
180
+ 'Customize the editor interface to suit your needs.'
215
181
  ) }
216
182
  >
217
183
  <PreferenceToggleControl
218
184
  scope="core"
219
- featureName="keepCaretInsideBlock"
185
+ featureName="fixedToolbar"
186
+ onToggle={ () =>
187
+ setPreference(
188
+ 'core',
189
+ 'distractionFree',
190
+ false
191
+ )
192
+ }
220
193
  help={ __(
221
- 'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'
222
- ) }
223
- label={ __(
224
- 'Contain text cursor inside block'
194
+ 'Access all block and document tools in a single place.'
225
195
  ) }
196
+ label={ __( 'Top toolbar' ) }
226
197
  />
227
- </PreferencesModalSection>
228
- <PreferencesModalSection title={ __( 'Interface' ) }>
229
198
  <PreferenceToggleControl
230
199
  scope="core"
231
- featureName="showIconLabels"
232
- label={ __( 'Show button text labels' ) }
200
+ featureName="distractionFree"
201
+ onToggle={ () => {
202
+ setPreference(
203
+ 'core',
204
+ 'fixedToolbar',
205
+ true
206
+ );
207
+ setIsInserterOpened( false );
208
+ setIsListViewOpened( false );
209
+ } }
233
210
  help={ __(
234
- 'Show text instead of icons on buttons across the interface.'
211
+ 'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'
235
212
  ) }
213
+ label={ __( 'Distraction free' ) }
236
214
  />
237
- </PreferencesModalSection>
238
- </>
239
- ),
240
- },
241
- {
242
- name: 'blocks',
243
- tabLabel: __( 'Blocks' ),
244
- content: (
245
- <>
246
- <PreferencesModalSection title={ __( 'Inserter' ) }>
247
215
  <PreferenceToggleControl
248
216
  scope="core"
249
- featureName="mostUsedBlocks"
217
+ featureName="focusMode"
250
218
  help={ __(
251
- 'Adds a category with the most frequently used blocks in the inserter.'
219
+ 'Highlights the current block and fades other content.'
252
220
  ) }
253
- label={ __( 'Show most used blocks' ) }
221
+ label={ __( 'Spotlight mode' ) }
254
222
  />
223
+ { extraSections?.appearance }
255
224
  </PreferencesModalSection>
256
- <PreferencesModalSection
257
- title={ __( 'Manage block visibility' ) }
258
- description={ __(
259
- "Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."
260
- ) }
261
- >
262
- <BlockManager />
263
- </PreferencesModalSection>
264
- </>
265
- ),
266
- },
267
- ],
225
+ ),
226
+ },
227
+ {
228
+ name: 'accessibility',
229
+ tabLabel: __( 'Accessibility' ),
230
+ content: (
231
+ <>
232
+ <PreferencesModalSection
233
+ title={ __( 'Navigation' ) }
234
+ description={ __(
235
+ 'Optimize the editing experience for enhanced control.'
236
+ ) }
237
+ >
238
+ <PreferenceToggleControl
239
+ scope="core"
240
+ featureName="keepCaretInsideBlock"
241
+ help={ __(
242
+ 'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'
243
+ ) }
244
+ label={ __(
245
+ 'Contain text cursor inside block'
246
+ ) }
247
+ />
248
+ </PreferencesModalSection>
249
+ <PreferencesModalSection
250
+ title={ __( 'Interface' ) }
251
+ >
252
+ <PreferenceToggleControl
253
+ scope="core"
254
+ featureName="showIconLabels"
255
+ label={ __( 'Show button text labels' ) }
256
+ help={ __(
257
+ 'Show text instead of icons on buttons across the interface.'
258
+ ) }
259
+ />
260
+ </PreferencesModalSection>
261
+ </>
262
+ ),
263
+ },
264
+ {
265
+ name: 'blocks',
266
+ tabLabel: __( 'Blocks' ),
267
+ content: (
268
+ <>
269
+ <PreferencesModalSection title={ __( 'Inserter' ) }>
270
+ <PreferenceToggleControl
271
+ scope="core"
272
+ featureName="mostUsedBlocks"
273
+ help={ __(
274
+ 'Adds a category with the most frequently used blocks in the inserter.'
275
+ ) }
276
+ label={ __( 'Show most used blocks' ) }
277
+ />
278
+ </PreferencesModalSection>
279
+ <PreferencesModalSection
280
+ title={ __( 'Manage block visibility' ) }
281
+ description={ __(
282
+ "Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."
283
+ ) }
284
+ >
285
+ <BlockManager />
286
+ </PreferencesModalSection>
287
+ </>
288
+ ),
289
+ },
290
+ window.__experimentalMediaProcessing && {
291
+ name: 'media',
292
+ tabLabel: __( 'Media' ),
293
+ content: (
294
+ <>
295
+ <PreferencesModalSection
296
+ title={ __( 'General' ) }
297
+ description={ __(
298
+ 'Customize options related to the media upload flow.'
299
+ ) }
300
+ >
301
+ <PreferenceToggleControl
302
+ scope="core/media"
303
+ featureName="optimizeOnUpload"
304
+ help={ __(
305
+ 'Compress media items before uploading to the server.'
306
+ ) }
307
+ label={ __( 'Pre-upload compression' ) }
308
+ />
309
+ <PreferenceToggleControl
310
+ scope="core/media"
311
+ featureName="requireApproval"
312
+ help={ __(
313
+ 'Require approval step when optimizing existing media.'
314
+ ) }
315
+ label={ __( 'Approval step' ) }
316
+ />
317
+ </PreferencesModalSection>
318
+ </>
319
+ ),
320
+ },
321
+ ].filter( Boolean ),
268
322
  [
269
323
  showBlockBreadcrumbsOption,
270
324
  extraSections,
@@ -272,6 +326,7 @@ export default function EditorPreferencesModal( { extraSections = {} } ) {
272
326
  setIsListViewOpened,
273
327
  setPreference,
274
328
  isLargeViewport,
329
+ hasStarterPatterns,
275
330
  ]
276
331
  );
277
332
 
@@ -22,6 +22,7 @@ import { store as coreStore } from '@wordpress/core-data';
22
22
  import { useEffect, useRef } from '@wordpress/element';
23
23
  import { store as preferencesStore } from '@wordpress/preferences';
24
24
  import { store as blockEditorStore } from '@wordpress/block-editor';
25
+ import { ActionItem } from '@wordpress/interface';
25
26
 
26
27
  /**
27
28
  * Internal dependencies
@@ -39,14 +40,14 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
39
40
  showIconLabels,
40
41
  } = useSelect( ( select ) => {
41
42
  const { getDeviceType, getCurrentPostType } = select( editorStore );
42
- const { getUnstableBase, getPostType } = select( coreStore );
43
+ const { getEntityRecord, getPostType } = select( coreStore );
43
44
  const { get } = select( preferencesStore );
44
45
  const { __unstableGetEditorMode } = select( blockEditorStore );
45
46
  const _currentPostType = getCurrentPostType();
46
47
  return {
47
48
  deviceType: getDeviceType(),
48
49
  editorMode: __unstableGetEditorMode(),
49
- homeUrl: getUnstableBase()?.home,
50
+ homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
50
51
  isTemplate: _currentPostType === 'wp_template',
51
52
  isViewable: getPostType( _currentPostType )?.viewable ?? false,
52
53
  showIconLabels: get( 'core', 'showIconLabels' ),
@@ -58,18 +59,18 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
58
59
  /**
59
60
  * Save the original editing mode in a ref to restore it when we exit zoom out.
60
61
  */
61
- const originalEditingMode = useRef( editorMode );
62
+ const originalEditingModeRef = useRef( editorMode );
62
63
  useEffect( () => {
63
64
  if ( editorMode !== 'zoom-out' ) {
64
- originalEditingMode.current = editorMode;
65
+ originalEditingModeRef.current = editorMode;
65
66
  }
66
67
 
67
68
  return () => {
68
69
  if (
69
70
  editorMode === 'zoom-out' &&
70
- editorMode !== originalEditingMode.current
71
+ editorMode !== originalEditingModeRef.current
71
72
  ) {
72
- __unstableSetEditorMode( originalEditingMode.current );
73
+ __unstableSetEditorMode( originalEditingModeRef.current );
73
74
  }
74
75
  };
75
76
  }, [ editorMode, __unstableSetEditorMode ] );
@@ -111,22 +112,24 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
111
112
  label: __( 'Desktop' ),
112
113
  icon: desktop,
113
114
  },
114
- {
115
+ ];
116
+ if ( window.__experimentalEnableZoomOutExperiment ) {
117
+ choices.push( {
115
118
  value: 'ZoomOut',
116
119
  label: __( 'Desktop (50%)' ),
117
120
  icon: desktop,
118
- },
119
- {
120
- value: 'Tablet',
121
- label: __( 'Tablet' ),
122
- icon: tablet,
123
- },
124
- {
125
- value: 'Mobile',
126
- label: __( 'Mobile' ),
127
- icon: mobile,
128
- },
129
- ];
121
+ } );
122
+ }
123
+ choices.push( {
124
+ value: 'Tablet',
125
+ label: __( 'Tablet' ),
126
+ icon: tablet,
127
+ } );
128
+ choices.push( {
129
+ value: 'Mobile',
130
+ label: __( 'Mobile' ),
131
+ icon: mobile,
132
+ } );
130
133
 
131
134
  const previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;
132
135
 
@@ -136,7 +139,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
136
139
  * @param {string} value The device type.
137
140
  */
138
141
  const onSelect = ( value ) => {
139
- let newEditorMode = originalEditingMode.current;
142
+ let newEditorMode = originalEditingModeRef.current;
140
143
 
141
144
  if ( value === 'ZoomOut' ) {
142
145
  newEditorMode = 'zoom-out';
@@ -206,6 +209,11 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
206
209
  />
207
210
  </MenuGroup>
208
211
  ) }
212
+ <ActionItem.Slot
213
+ name="core/plugin-preview-menu"
214
+ as={ MenuGroup }
215
+ fillProps={ { onClick: onClose } }
216
+ />
209
217
  </>
210
218
  ) }
211
219
  </DropdownMenu>