@wordpress/edit-post 7.32.0 → 7.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 (302) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +17 -223
  3. package/build/components/browser-url/index.js.map +1 -1
  4. package/build/components/editor-initialization/index.js +0 -1
  5. package/build/components/editor-initialization/index.js.map +1 -1
  6. package/build/components/editor-initialization/listener-hooks.js +1 -38
  7. package/build/components/editor-initialization/listener-hooks.js.map +1 -1
  8. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  9. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  10. package/build/components/header/index.js +20 -51
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/header/index.native.js +1 -1
  13. package/build/components/header/index.native.js.map +1 -1
  14. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  15. package/build/components/header/more-menu/index.js +17 -42
  16. package/build/components/header/more-menu/index.js.map +1 -1
  17. package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
  18. package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
  19. package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
  20. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  21. package/build/components/init-pattern-modal/index.js.map +1 -1
  22. package/build/components/keyboard-shortcuts/index.js +0 -123
  23. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  24. package/build/components/layout/index.js +28 -29
  25. package/build/components/layout/index.js.map +1 -1
  26. package/build/components/layout/index.native.js.map +1 -1
  27. package/build/components/meta-boxes/index.js.map +1 -1
  28. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  29. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  30. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
  31. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  32. package/build/components/preferences-modal/index.js +3 -32
  33. package/build/components/preferences-modal/index.js.map +1 -1
  34. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  35. package/build/components/sidebar/post-format/index.js.map +1 -1
  36. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  37. package/build/components/sidebar/post-slug/index.js.map +1 -1
  38. package/build/components/sidebar/post-status/index.js +35 -12
  39. package/build/components/sidebar/post-status/index.js.map +1 -1
  40. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  41. package/build/components/sidebar/post-trash/index.js.map +1 -1
  42. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  43. package/build/components/sidebar/settings-header/index.js.map +1 -1
  44. package/build/components/sidebar/settings-sidebar/index.js +68 -41
  45. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  46. package/build/components/text-editor/index.js.map +1 -1
  47. package/build/components/visual-editor/block-inspector-button.js +1 -1
  48. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  49. package/build/components/visual-editor/header.native.js.map +1 -1
  50. package/build/components/visual-editor/index.js +4 -1
  51. package/build/components/visual-editor/index.js.map +1 -1
  52. package/build/components/visual-editor/index.native.js.map +1 -1
  53. package/build/components/visual-editor/use-padding-appender.js +62 -0
  54. package/build/components/visual-editor/use-padding-appender.js.map +1 -0
  55. package/build/components/welcome-guide/default.js.map +1 -1
  56. package/build/components/welcome-guide/image.js.map +1 -1
  57. package/build/components/welcome-guide/index.js.map +1 -1
  58. package/build/components/welcome-guide/template.js.map +1 -1
  59. package/build/deprecated.js +132 -0
  60. package/build/deprecated.js.map +1 -0
  61. package/build/editor.js +2 -2
  62. package/build/editor.js.map +1 -1
  63. package/build/editor.native.js.map +1 -1
  64. package/build/hooks/commands/use-common-commands.js +5 -22
  65. package/build/hooks/commands/use-common-commands.js.map +1 -1
  66. package/build/hooks/components/index.js.map +1 -1
  67. package/build/hooks/index.js.map +1 -1
  68. package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
  69. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  70. package/build/index.js +19 -62
  71. package/build/index.js.map +1 -1
  72. package/build/index.native.js.map +1 -1
  73. package/build/lock-unlock.js.map +1 -1
  74. package/build/store/actions.js +10 -8
  75. package/build/store/actions.js.map +1 -1
  76. package/build/store/constants.js.map +1 -1
  77. package/build/store/index.js +1 -1
  78. package/build/store/index.js.map +1 -1
  79. package/build/store/reducer.js.map +1 -1
  80. package/build/store/selectors.js +34 -19
  81. package/build/store/selectors.js.map +1 -1
  82. package/build/utils/meta-boxes.js.map +1 -1
  83. package/build-module/components/browser-url/index.js.map +1 -1
  84. package/build-module/components/editor-initialization/index.js +1 -2
  85. package/build-module/components/editor-initialization/index.js.map +1 -1
  86. package/build-module/components/editor-initialization/listener-hooks.js +2 -38
  87. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  88. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  89. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  90. package/build-module/components/header/index.js +22 -53
  91. package/build-module/components/header/index.js.map +1 -1
  92. package/build-module/components/header/index.native.js +1 -1
  93. package/build-module/components/header/index.native.js.map +1 -1
  94. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  95. package/build-module/components/header/more-menu/index.js +17 -42
  96. package/build-module/components/header/more-menu/index.js.map +1 -1
  97. package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
  98. package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
  99. package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
  100. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  101. package/build-module/components/init-pattern-modal/index.js.map +1 -1
  102. package/build-module/components/keyboard-shortcuts/index.js +1 -124
  103. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  104. package/build-module/components/layout/index.js +28 -29
  105. package/build-module/components/layout/index.js.map +1 -1
  106. package/build-module/components/layout/index.native.js.map +1 -1
  107. package/build-module/components/meta-boxes/index.js.map +1 -1
  108. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  109. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  110. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
  111. package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
  112. package/build-module/components/preferences-modal/index.js +4 -32
  113. package/build-module/components/preferences-modal/index.js.map +1 -1
  114. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  115. package/build-module/components/sidebar/post-format/index.js.map +1 -1
  116. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  117. package/build-module/components/sidebar/post-slug/index.js.map +1 -1
  118. package/build-module/components/sidebar/post-status/index.js +36 -14
  119. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  120. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  121. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  122. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  123. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  124. package/build-module/components/sidebar/settings-sidebar/index.js +71 -44
  125. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  126. package/build-module/components/text-editor/index.js.map +1 -1
  127. package/build-module/components/visual-editor/block-inspector-button.js +1 -1
  128. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  129. package/build-module/components/visual-editor/header.native.js.map +1 -1
  130. package/build-module/components/visual-editor/index.js +4 -1
  131. package/build-module/components/visual-editor/index.js.map +1 -1
  132. package/build-module/components/visual-editor/index.native.js.map +1 -1
  133. package/build-module/components/visual-editor/use-padding-appender.js +55 -0
  134. package/build-module/components/visual-editor/use-padding-appender.js.map +1 -0
  135. package/build-module/components/welcome-guide/default.js.map +1 -1
  136. package/build-module/components/welcome-guide/image.js.map +1 -1
  137. package/build-module/components/welcome-guide/index.js.map +1 -1
  138. package/build-module/components/welcome-guide/template.js.map +1 -1
  139. package/build-module/deprecated.js +116 -0
  140. package/build-module/deprecated.js.map +1 -0
  141. package/build-module/editor.js +2 -2
  142. package/build-module/editor.js.map +1 -1
  143. package/build-module/editor.native.js.map +1 -1
  144. package/build-module/hooks/commands/use-common-commands.js +7 -24
  145. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  146. package/build-module/hooks/components/index.js.map +1 -1
  147. package/build-module/hooks/index.js.map +1 -1
  148. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
  149. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  150. package/build-module/index.js +2 -15
  151. package/build-module/index.js.map +1 -1
  152. package/build-module/index.native.js.map +1 -1
  153. package/build-module/lock-unlock.js.map +1 -1
  154. package/build-module/store/actions.js +8 -7
  155. package/build-module/store/actions.js.map +1 -1
  156. package/build-module/store/constants.js.map +1 -1
  157. package/build-module/store/index.js.map +1 -1
  158. package/build-module/store/reducer.js.map +1 -1
  159. package/build-module/store/selectors.js +33 -18
  160. package/build-module/store/selectors.js.map +1 -1
  161. package/build-module/utils/meta-boxes.js.map +1 -1
  162. package/build-style/classic-rtl.css +2 -2
  163. package/build-style/classic.css +2 -2
  164. package/build-style/style-rtl.css +18 -589
  165. package/build-style/style.css +18 -589
  166. package/package.json +32 -34
  167. package/src/classic.scss +1 -1
  168. package/src/components/editor-initialization/index.js +1 -5
  169. package/src/components/editor-initialization/listener-hooks.js +1 -40
  170. package/src/components/editor-initialization/test/listener-hooks.js +1 -96
  171. package/src/components/header/index.js +25 -71
  172. package/src/components/header/index.native.js +1 -1
  173. package/src/components/header/more-menu/index.js +27 -43
  174. package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
  175. package/src/components/header/style.scss +5 -82
  176. package/src/components/keyboard-shortcuts/index.js +2 -148
  177. package/src/components/layout/index.js +26 -47
  178. package/src/components/layout/style.scss +7 -80
  179. package/src/components/preferences-modal/index.js +3 -46
  180. package/src/components/sidebar/post-status/index.js +61 -24
  181. package/src/components/sidebar/settings-sidebar/index.js +113 -73
  182. package/src/components/visual-editor/block-inspector-button.js +1 -1
  183. package/src/components/visual-editor/index.js +4 -0
  184. package/src/components/visual-editor/use-padding-appender.js +66 -0
  185. package/src/deprecated.js +107 -0
  186. package/src/editor.js +2 -2
  187. package/src/hooks/commands/use-common-commands.js +11 -26
  188. package/src/index.js +3 -20
  189. package/src/store/actions.js +10 -12
  190. package/src/store/selectors.js +41 -33
  191. package/src/store/test/actions.js +11 -10
  192. package/src/style.scss +1 -19
  193. package/build/components/header/plugin-more-menu-item/index.js +0 -78
  194. package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
  195. package/build/components/header/plugin-sidebar-more-menu-item/index.js +0 -71
  196. package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  197. package/build/components/header/post-publish-button-or-toggle.js +0 -91
  198. package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
  199. package/build/components/header/preferences-menu-item/index.js +0 -31
  200. package/build/components/header/preferences-menu-item/index.js.map +0 -1
  201. package/build/components/header/tools-more-menu-group/index.js +0 -26
  202. package/build/components/header/tools-more-menu-group/index.js.map +0 -1
  203. package/build/components/header/writing-menu/index.js +0 -71
  204. package/build/components/header/writing-menu/index.js.map +0 -1
  205. package/build/components/keyboard-shortcut-help-modal/config.js +0 -78
  206. package/build/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  207. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -49
  208. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  209. package/build/components/keyboard-shortcut-help-modal/index.js +0 -132
  210. package/build/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  211. package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -55
  212. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  213. package/build/components/layout/actions-panel.js +0 -86
  214. package/build/components/layout/actions-panel.js.map +0 -1
  215. package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
  216. package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
  217. package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
  218. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
  219. package/build/components/sidebar/plugin-post-status-info/index.js +0 -73
  220. package/build/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  221. package/build/components/sidebar/plugin-pre-publish-panel/index.js +0 -43
  222. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
  223. package/build/components/sidebar/plugin-sidebar/index.js +0 -104
  224. package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
  225. package/build/components/start-page-options/index.js +0 -107
  226. package/build/components/start-page-options/index.js.map +0 -1
  227. package/build/plugins/copy-content-menu-item/index.js +0 -39
  228. package/build/plugins/copy-content-menu-item/index.js.map +0 -1
  229. package/build/plugins/index.js +0 -69
  230. package/build/plugins/index.js.map +0 -1
  231. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -41
  232. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
  233. package/build/plugins/welcome-guide-menu-item/index.js.map +0 -1
  234. package/build-module/components/header/plugin-more-menu-item/index.js +0 -73
  235. package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
  236. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +0 -65
  237. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  238. package/build-module/components/header/post-publish-button-or-toggle.js +0 -83
  239. package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
  240. package/build-module/components/header/preferences-menu-item/index.js +0 -24
  241. package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
  242. package/build-module/components/header/tools-more-menu-group/index.js +0 -19
  243. package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
  244. package/build-module/components/header/writing-menu/index.js +0 -64
  245. package/build-module/components/header/writing-menu/index.js.map +0 -1
  246. package/build-module/components/keyboard-shortcut-help-modal/config.js +0 -71
  247. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  248. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -41
  249. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  250. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -122
  251. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  252. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -48
  253. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  254. package/build-module/components/layout/actions-panel.js +0 -78
  255. package/build-module/components/layout/actions-panel.js.map +0 -1
  256. package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
  257. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
  258. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
  259. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
  260. package/build-module/components/sidebar/plugin-post-status-info/index.js +0 -66
  261. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  262. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +0 -36
  263. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
  264. package/build-module/components/sidebar/plugin-sidebar/index.js +0 -98
  265. package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
  266. package/build-module/components/start-page-options/index.js +0 -100
  267. package/build-module/components/start-page-options/index.js.map +0 -1
  268. package/build-module/plugins/copy-content-menu-item/index.js +0 -32
  269. package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
  270. package/build-module/plugins/index.js +0 -65
  271. package/build-module/plugins/index.js.map +0 -1
  272. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -33
  273. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
  274. package/build-module/plugins/welcome-guide-menu-item/index.js.map +0 -1
  275. package/src/components/header/plugin-more-menu-item/index.js +0 -73
  276. package/src/components/header/plugin-sidebar-more-menu-item/index.js +0 -64
  277. package/src/components/header/post-publish-button-or-toggle.js +0 -92
  278. package/src/components/header/preferences-menu-item/index.js +0 -25
  279. package/src/components/header/test/index.js +0 -51
  280. package/src/components/header/tools-more-menu-group/index.js +0 -20
  281. package/src/components/header/writing-menu/index.js +0 -73
  282. package/src/components/keyboard-shortcut-help-modal/config.js +0 -53
  283. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -43
  284. package/src/components/keyboard-shortcut-help-modal/index.js +0 -163
  285. package/src/components/keyboard-shortcut-help-modal/shortcut.js +0 -67
  286. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -61
  287. package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -36
  288. package/src/components/layout/actions-panel.js +0 -103
  289. package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
  290. package/src/components/preferences-modal/test/index.js +0 -28
  291. package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
  292. package/src/components/sidebar/plugin-post-status-info/index.js +0 -63
  293. package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +0 -11
  294. package/src/components/sidebar/plugin-post-status-info/test/index.js +0 -29
  295. package/src/components/sidebar/plugin-pre-publish-panel/index.js +0 -32
  296. package/src/components/sidebar/plugin-sidebar/index.js +0 -94
  297. package/src/components/start-page-options/index.js +0 -108
  298. package/src/components/start-page-options/style.scss +0 -26
  299. package/src/plugins/copy-content-menu-item/index.js +0 -29
  300. package/src/plugins/index.js +0 -85
  301. package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -34
  302. /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
@@ -4,30 +4,37 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import {
6
6
  __experimentalHStack as HStack,
7
+ __experimentalVStack as VStack,
7
8
  PanelBody,
8
9
  } from '@wordpress/components';
9
10
  import { useDispatch, useSelect } from '@wordpress/data';
10
11
  import {
12
+ PluginPostStatusInfo,
11
13
  PostAuthorPanel,
12
14
  PostSchedulePanel,
13
- PostSwitchToDraftButton,
14
15
  PostSyncStatus,
15
16
  PostURLPanel,
16
17
  PostTemplatePanel,
17
18
  PostFeaturedImagePanel,
18
19
  store as editorStore,
20
+ privateApis as editorPrivateApis,
19
21
  } from '@wordpress/editor';
20
22
 
21
23
  /**
22
24
  * Internal dependencies
23
25
  */
24
- import PostVisibility from '../post-visibility';
25
26
  import PostTrash from '../post-trash';
26
27
  import PostSticky from '../post-sticky';
27
28
  import PostSlug from '../post-slug';
28
29
  import PostFormat from '../post-format';
29
- import PostPendingStatus from '../post-pending-status';
30
- import PluginPostStatusInfo from '../plugin-post-status-info';
30
+ import { unlock } from '../../../lock-unlock';
31
+
32
+ const {
33
+ PostStatus: PostStatusPanel,
34
+ PrivatePostExcerptPanel,
35
+ PostContentInformation,
36
+ PostLastEditedPanel,
37
+ } = unlock( editorPrivateApis );
31
38
 
32
39
  /**
33
40
  * Module Constants
@@ -35,16 +42,30 @@ import PluginPostStatusInfo from '../plugin-post-status-info';
35
42
  const PANEL_NAME = 'post-status';
36
43
 
37
44
  export default function PostStatus() {
38
- const { isOpened, isRemoved } = useSelect( ( select ) => {
39
- // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
40
- // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
41
- const { isEditorPanelRemoved, isEditorPanelOpened } =
42
- select( editorStore );
43
- return {
44
- isRemoved: isEditorPanelRemoved( PANEL_NAME ),
45
- isOpened: isEditorPanelOpened( PANEL_NAME ),
46
- };
47
- }, [] );
45
+ const { isOpened, isRemoved, showPostContentPanels } = useSelect(
46
+ ( select ) => {
47
+ // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
48
+ // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
49
+ const {
50
+ isEditorPanelRemoved,
51
+ isEditorPanelOpened,
52
+ getCurrentPostType,
53
+ } = select( editorStore );
54
+ const postType = getCurrentPostType();
55
+ return {
56
+ isRemoved: isEditorPanelRemoved( PANEL_NAME ),
57
+ isOpened: isEditorPanelOpened( PANEL_NAME ),
58
+ // Post excerpt panel is rendered in different place depending on the post type.
59
+ // So we cannot make this check inside the PostExcerpt component based on the current edited entity.
60
+ showPostContentPanels: ! [
61
+ 'wp_template',
62
+ 'wp_template_part',
63
+ 'wp_block',
64
+ ].includes( postType ),
65
+ };
66
+ },
67
+ []
68
+ );
48
69
  const { toggleEditorPanelOpened } = useDispatch( editorStore );
49
70
 
50
71
  if ( isRemoved ) {
@@ -61,14 +82,33 @@ export default function PostStatus() {
61
82
  <PluginPostStatusInfo.Slot>
62
83
  { ( fills ) => (
63
84
  <>
64
- <PostFeaturedImagePanel withPanelBody={ false } />
65
- <PostVisibility />
66
- <PostSchedulePanel />
67
- <PostTemplatePanel />
68
- <PostURLPanel />
69
- <PostSyncStatus />
85
+ { showPostContentPanels && (
86
+ <VStack
87
+ spacing={ 3 }
88
+ // TODO: this needs to be consolidated with the panel in site editor, when we unify them.
89
+ style={ { marginBlockEnd: '24px' } }
90
+ >
91
+ <PostFeaturedImagePanel
92
+ withPanelBody={ false }
93
+ />
94
+ <PrivatePostExcerptPanel />
95
+ <VStack spacing={ 1 }>
96
+ <PostContentInformation />
97
+ <PostLastEditedPanel />
98
+ </VStack>
99
+ </VStack>
100
+ ) }
101
+ <VStack
102
+ spacing={ 1 }
103
+ style={ { marginBlockEnd: '12px' } }
104
+ >
105
+ <PostStatusPanel />
106
+ <PostSchedulePanel />
107
+ <PostTemplatePanel />
108
+ <PostURLPanel />
109
+ <PostSyncStatus />
110
+ </VStack>
70
111
  <PostSticky />
71
- <PostPendingStatus />
72
112
  <PostFormat />
73
113
  <PostSlug />
74
114
  <PostAuthorPanel />
@@ -77,10 +117,7 @@ export default function PostStatus() {
77
117
  style={ {
78
118
  marginTop: '16px',
79
119
  } }
80
- spacing={ 4 }
81
- wrap
82
120
  >
83
- <PostSwitchToDraftButton />
84
121
  <PostTrash />
85
122
  </HStack>
86
123
  </>
@@ -13,20 +13,21 @@ import {
13
13
  useEffect,
14
14
  useRef,
15
15
  } from '@wordpress/element';
16
- import { isRTL, __ } from '@wordpress/i18n';
16
+ import { isRTL, __, sprintf } from '@wordpress/i18n';
17
17
  import { drawerLeft, drawerRight } from '@wordpress/icons';
18
- import { store as interfaceStore } from '@wordpress/interface';
19
18
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
20
19
  import {
21
20
  store as editorStore,
22
21
  PageAttributesPanel,
23
22
  PluginDocumentSettingPanel,
23
+ PluginSidebar,
24
24
  PostDiscussionPanel,
25
- PostExcerptPanel,
26
25
  PostLastRevisionPanel,
27
26
  PostTaxonomiesPanel,
28
27
  privateApis as editorPrivateApis,
29
28
  } from '@wordpress/editor';
29
+ import { addQueryArgs } from '@wordpress/url';
30
+ import { store as noticesStore } from '@wordpress/notices';
30
31
 
31
32
  /**
32
33
  * Internal dependencies
@@ -34,15 +35,15 @@ import {
34
35
  import SettingsHeader from '../settings-header';
35
36
  import PostStatus from '../post-status';
36
37
  import MetaBoxes from '../../meta-boxes';
37
- import PluginSidebarEditPost from '../plugin-sidebar';
38
38
  import { store as editPostStore } from '../../../store';
39
39
  import { privateApis as componentsPrivateApis } from '@wordpress/components';
40
40
  import { unlock } from '../../../lock-unlock';
41
41
 
42
- const { PostCardPanel } = unlock( editorPrivateApis );
43
-
42
+ const { PostCardPanel, PostActions, interfaceStore } =
43
+ unlock( editorPrivateApis );
44
44
  const { Tabs } = unlock( componentsPrivateApis );
45
- const { PatternOverridesPanel } = unlock( editorPrivateApis );
45
+ const { PatternOverridesPanel, useAutoSwitchEditorSidebars } =
46
+ unlock( editorPrivateApis );
46
47
 
47
48
  const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {
48
49
  web: true,
@@ -53,13 +54,9 @@ export const sidebars = {
53
54
  block: 'edit-post/block',
54
55
  };
55
56
 
56
- const SidebarContent = ( {
57
- sidebarName,
58
- keyboardShortcut,
59
- isEditingTemplate,
60
- } ) => {
57
+ const SidebarContent = ( { tabName, keyboardShortcut, isEditingTemplate } ) => {
61
58
  const tabListRef = useRef( null );
62
- // Because `PluginSidebarEditPost` renders a `ComplementaryArea`, we
59
+ // Because `PluginSidebar` renders a `ComplementaryArea`, we
63
60
  // need to forward the `Tabs` context so it can be passed through the
64
61
  // underlying slot/fill.
65
62
  const tabsContextValue = useContext( Tabs.Context );
@@ -76,7 +73,7 @@ const SidebarContent = ( {
76
73
  // We are purposefully using a custom `data-tab-id` attribute here
77
74
  // because we don't want rely on any assumptions about `Tabs`
78
75
  // component internals.
79
- ( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName
76
+ ( element ) => element.getAttribute( 'data-tab-id' ) === tabName
80
77
  );
81
78
  const activeElement = selectedTabElement?.ownerDocument.activeElement;
82
79
  const tabsHasFocus = tabsElements.some( ( element ) => {
@@ -89,11 +86,61 @@ const SidebarContent = ( {
89
86
  ) {
90
87
  selectedTabElement?.focus();
91
88
  }
92
- }, [ sidebarName ] );
89
+ }, [ tabName ] );
90
+ const { createSuccessNotice } = useDispatch( noticesStore );
91
+
92
+ const onActionPerformed = useCallback(
93
+ ( actionId, items ) => {
94
+ switch ( actionId ) {
95
+ case 'move-to-trash':
96
+ {
97
+ const postType = items[ 0 ].type;
98
+ document.location.href = addQueryArgs( 'edit.php', {
99
+ post_type: postType,
100
+ } );
101
+ }
102
+ break;
103
+ case 'duplicate-post':
104
+ {
105
+ const newItem = items[ 0 ];
106
+ const title =
107
+ typeof newItem.title === 'string'
108
+ ? newItem.title
109
+ : newItem.title?.rendered;
110
+ createSuccessNotice(
111
+ sprintf(
112
+ // translators: %s: Title of the created post e.g: "Post 1".
113
+ __( '"%s" successfully created.' ),
114
+ title
115
+ ),
116
+ {
117
+ type: 'snackbar',
118
+ id: 'duplicate-post-action',
119
+ actions: [
120
+ {
121
+ label: __( 'Edit' ),
122
+ onClick: () => {
123
+ const postId = newItem.id;
124
+ document.location.href =
125
+ addQueryArgs( 'post.php', {
126
+ post: postId,
127
+ action: 'edit',
128
+ } );
129
+ },
130
+ },
131
+ ],
132
+ }
133
+ );
134
+ }
135
+ break;
136
+ }
137
+ },
138
+ [ createSuccessNotice ]
139
+ );
93
140
 
94
141
  return (
95
- <PluginSidebarEditPost
96
- identifier={ sidebarName }
142
+ <PluginSidebar
143
+ identifier={ tabName }
97
144
  header={
98
145
  <Tabs.Context.Provider value={ tabsContextValue }>
99
146
  <SettingsHeader ref={ tabListRef } />
@@ -113,65 +160,63 @@ const SidebarContent = ( {
113
160
  >
114
161
  <Tabs.Context.Provider value={ tabsContextValue }>
115
162
  <Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>
116
- <PostCardPanel />
117
- { ! isEditingTemplate && (
118
- <>
119
- <PostStatus />
120
- <PluginDocumentSettingPanel.Slot />
121
- <PostLastRevisionPanel />
122
- <PostTaxonomiesPanel />
123
- <PostExcerptPanel />
124
- <PostDiscussionPanel />
125
- <PageAttributesPanel />
126
- <PatternOverridesPanel />
127
- <MetaBoxes location="side" />
128
- </>
129
- ) }
163
+ <PostCardPanel
164
+ actions={
165
+ <PostActions
166
+ onActionPerformed={ onActionPerformed }
167
+ />
168
+ }
169
+ />
170
+ { ! isEditingTemplate && <PostStatus /> }
171
+ <PluginDocumentSettingPanel.Slot />
172
+ <PostLastRevisionPanel />
173
+ <PostTaxonomiesPanel />
174
+ <PostDiscussionPanel />
175
+ <PageAttributesPanel />
176
+ <PatternOverridesPanel />
177
+ { ! isEditingTemplate && <MetaBoxes location="side" /> }
130
178
  </Tabs.TabPanel>
131
179
  <Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
132
180
  <BlockInspector />
133
181
  </Tabs.TabPanel>
134
182
  </Tabs.Context.Provider>
135
- </PluginSidebarEditPost>
183
+ </PluginSidebar>
136
184
  );
137
185
  };
138
186
 
139
187
  const SettingsSidebar = () => {
140
- const {
141
- sidebarName,
142
- isSettingsSidebarActive,
143
- keyboardShortcut,
144
- isEditingTemplate,
145
- } = useSelect( ( select ) => {
146
- // The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
147
- // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
148
- // If one of the two sidebars is active the component will contain the content of that sidebar.
149
- // When neither of the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
150
- // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
151
- // should contain the sidebar that will be active when the toggle button is pressed. If a block
152
- // is selected, that should be edit-post/block otherwise it's edit-post/document.
153
- let sidebar = select( interfaceStore ).getActiveComplementaryArea(
154
- editPostStore.name
155
- );
156
- let isSettingsSidebar = true;
157
- if ( ! [ sidebars.document, sidebars.block ].includes( sidebar ) ) {
158
- isSettingsSidebar = false;
159
- if ( select( blockEditorStore ).getBlockSelectionStart() ) {
160
- sidebar = sidebars.block;
188
+ useAutoSwitchEditorSidebars();
189
+ const { tabName, keyboardShortcut, isEditingTemplate } = useSelect(
190
+ ( select ) => {
191
+ const shortcut = select(
192
+ keyboardShortcutsStore
193
+ ).getShortcutRepresentation( 'core/editor/toggle-sidebar' );
194
+
195
+ const sidebar =
196
+ select( interfaceStore ).getActiveComplementaryArea( 'core' );
197
+ const _isEditorSidebarOpened = [
198
+ sidebars.block,
199
+ sidebars.document,
200
+ ].includes( sidebar );
201
+ let _tabName = sidebar;
202
+ if ( ! _isEditorSidebarOpened ) {
203
+ _tabName = !! select(
204
+ blockEditorStore
205
+ ).getBlockSelectionStart()
206
+ ? sidebars.block
207
+ : sidebars.document;
161
208
  }
162
- sidebar = sidebars.document;
163
- }
164
- const shortcut = select(
165
- keyboardShortcutsStore
166
- ).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' );
167
- return {
168
- sidebarName: sidebar,
169
- isSettingsSidebarActive: isSettingsSidebar,
170
- keyboardShortcut: shortcut,
171
- isEditingTemplate:
172
- select( editorStore ).getCurrentPostType() === 'wp_template',
173
- };
174
- }, [] );
209
+
210
+ return {
211
+ tabName: _tabName,
212
+ keyboardShortcut: shortcut,
213
+ isEditingTemplate:
214
+ select( editorStore ).getCurrentPostType() ===
215
+ 'wp_template',
216
+ };
217
+ },
218
+ []
219
+ );
175
220
 
176
221
  const { openGeneralSidebar } = useDispatch( editPostStore );
177
222
 
@@ -186,17 +231,12 @@ const SettingsSidebar = () => {
186
231
 
187
232
  return (
188
233
  <Tabs
189
- // Due to how this component is controlled (via a value from the
190
- // `interfaceStore`), when the sidebar closes the currently selected
191
- // tab can't be found. This causes the component to continuously reset
192
- // the selection to `null` in an infinite loop.Proactively setting
193
- // the selected tab to `null` avoids that.
194
- selectedTabId={ isSettingsSidebarActive ? sidebarName : null }
234
+ selectedTabId={ tabName }
195
235
  onSelect={ onTabSelect }
196
236
  selectOnMove={ false }
197
237
  >
198
238
  <SidebarContent
199
- sidebarName={ sidebarName }
239
+ tabName={ tabName }
200
240
  keyboardShortcut={ keyboardShortcut }
201
241
  isEditingTemplate={ isEditingTemplate }
202
242
  />
@@ -19,7 +19,7 @@ export function BlockInspectorButton( { onClick = noop, small = false } ) {
19
19
  ( select ) => ( {
20
20
  shortcut: select(
21
21
  keyboardShortcutsStore
22
- ).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),
22
+ ).getShortcutRepresentation( 'core/editor/toggle-sidebar' ),
23
23
  areAdvancedSettingsOpened:
24
24
  select( editPostStore ).getActiveGeneralSidebarName() ===
25
25
  'edit-post/block',
@@ -19,6 +19,7 @@ import { store as blocksStore } from '@wordpress/blocks';
19
19
  */
20
20
  import { store as editPostStore } from '../../store';
21
21
  import { unlock } from '../../lock-unlock';
22
+ import { usePaddingAppender } from './use-padding-appender';
22
23
 
23
24
  const { EditorCanvas } = unlock( editorPrivateApis );
24
25
 
@@ -53,6 +54,8 @@ export default function VisualEditor( { styles } ) {
53
54
  []
54
55
  );
55
56
 
57
+ const paddingAppenderRef = usePaddingAppender();
58
+
56
59
  let paddingBottom;
57
60
 
58
61
  // Add a constant padding for the typewritter effect. When typing at the
@@ -91,6 +94,7 @@ export default function VisualEditor( { styles } ) {
91
94
  // We should auto-focus the canvas (title) on load.
92
95
  // eslint-disable-next-line jsx-a11y/no-autofocus
93
96
  autoFocus={ ! isWelcomeGuideVisible }
97
+ contentRef={ paddingAppenderRef }
94
98
  />
95
99
  </div>
96
100
  );
@@ -0,0 +1,66 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useRegistry } from '@wordpress/data';
5
+ import { useRefEffect } from '@wordpress/compose';
6
+ import { store as blockEditorStore } from '@wordpress/block-editor';
7
+ import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
8
+
9
+ export function usePaddingAppender() {
10
+ const registry = useRegistry();
11
+ return useRefEffect(
12
+ ( node ) => {
13
+ function onMouseDown( event ) {
14
+ if ( event.target !== node ) {
15
+ return;
16
+ }
17
+
18
+ const { ownerDocument } = node;
19
+ const { defaultView } = ownerDocument;
20
+
21
+ const paddingBottom = defaultView.parseInt(
22
+ defaultView.getComputedStyle( node ).paddingBottom,
23
+ 10
24
+ );
25
+
26
+ if ( ! paddingBottom ) {
27
+ return;
28
+ }
29
+
30
+ // only handle clicks under the last child
31
+ const lastChild = node.lastElementChild;
32
+ if ( ! lastChild ) {
33
+ return;
34
+ }
35
+
36
+ const lastChildRect = lastChild.getBoundingClientRect();
37
+ if ( event.clientY < lastChildRect.bottom ) {
38
+ return;
39
+ }
40
+
41
+ event.preventDefault();
42
+
43
+ const blockOrder = registry
44
+ .select( blockEditorStore )
45
+ .getBlockOrder( '' );
46
+ const lastBlockClientId = blockOrder[ blockOrder.length - 1 ];
47
+ const lastBlock = registry
48
+ .select( blockEditorStore )
49
+ .getBlock( lastBlockClientId );
50
+ const { selectBlock, insertDefaultBlock } =
51
+ registry.dispatch( blockEditorStore );
52
+
53
+ if ( isUnmodifiedDefaultBlock( lastBlock ) ) {
54
+ selectBlock( lastBlockClientId );
55
+ } else {
56
+ insertDefaultBlock();
57
+ }
58
+ }
59
+ node.addEventListener( 'mousedown', onMouseDown );
60
+ return () => {
61
+ node.removeEventListener( 'mousedown', onMouseDown );
62
+ };
63
+ },
64
+ [ registry ]
65
+ );
66
+ }
@@ -0,0 +1,107 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ privateApis as editorPrivateApis,
6
+ PluginBlockSettingsMenuItem as EditorPluginBlockSettingsMenuItem,
7
+ PluginDocumentSettingPanel as EditorPluginDocumentSettingPanel,
8
+ PluginMoreMenuItem as EditorPluginMoreMenuItem,
9
+ PluginPrePublishPanel as EditorPluginPrePublishPanel,
10
+ PluginPostPublishPanel as EditorPluginPostPublishPanel,
11
+ PluginPostStatusInfo as EditorPluginPostStatusInfo,
12
+ PluginSidebar as EditorPluginSidebar,
13
+ PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
14
+ } from '@wordpress/editor';
15
+ import deprecated from '@wordpress/deprecated';
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+ import { unlock } from './lock-unlock';
21
+ const { PluginPostExcerpt } = unlock( editorPrivateApis );
22
+
23
+ const deprecateSlot = ( name ) => {
24
+ deprecated( `wp.editPost.${ name }`, {
25
+ since: '6.6',
26
+ alternative: `wp.editor.${ name }`,
27
+ } );
28
+ };
29
+
30
+ /* eslint-disable jsdoc/require-param */
31
+ /**
32
+ * @see PluginBlockSettingsMenuItem in @wordpress/editor package.
33
+ */
34
+ export function PluginBlockSettingsMenuItem( props ) {
35
+ deprecateSlot( 'PluginBlockSettingsMenuItem' );
36
+ return <EditorPluginBlockSettingsMenuItem { ...props } />;
37
+ }
38
+
39
+ /**
40
+ * @see PluginDocumentSettingPanel in @wordpress/editor package.
41
+ */
42
+ export function PluginDocumentSettingPanel( props ) {
43
+ deprecateSlot( 'PluginDocumentSettingPanel' );
44
+ return <EditorPluginDocumentSettingPanel { ...props } />;
45
+ }
46
+
47
+ /**
48
+ * @see PluginMoreMenuItem in @wordpress/editor package.
49
+ */
50
+ export function PluginMoreMenuItem( props ) {
51
+ deprecateSlot( 'PluginMoreMenuItem' );
52
+ return <EditorPluginMoreMenuItem { ...props } />;
53
+ }
54
+
55
+ /**
56
+ * @see PluginPrePublishPanel in @wordpress/editor package.
57
+ */
58
+ export function PluginPrePublishPanel( props ) {
59
+ deprecateSlot( 'PluginPrePublishPanel' );
60
+ return <EditorPluginPrePublishPanel { ...props } />;
61
+ }
62
+
63
+ /**
64
+ * @see PluginPostPublishPanel in @wordpress/editor package.
65
+ */
66
+ export function PluginPostPublishPanel( props ) {
67
+ deprecateSlot( 'PluginPostPublishPanel' );
68
+ return <EditorPluginPostPublishPanel { ...props } />;
69
+ }
70
+
71
+ /**
72
+ * @see PluginPostStatusInfo in @wordpress/editor package.
73
+ */
74
+ export function PluginPostStatusInfo( props ) {
75
+ deprecateSlot( 'PluginPostStatusInfo' );
76
+ return <EditorPluginPostStatusInfo { ...props } />;
77
+ }
78
+
79
+ /**
80
+ * @see PluginSidebar in @wordpress/editor package.
81
+ */
82
+ export function PluginSidebar( props ) {
83
+ deprecateSlot( 'PluginSidebar' );
84
+ return <EditorPluginSidebar { ...props } />;
85
+ }
86
+
87
+ /**
88
+ * @see PluginSidebarMoreMenuItem in @wordpress/editor package.
89
+ */
90
+ export function PluginSidebarMoreMenuItem( props ) {
91
+ deprecateSlot( 'PluginSidebarMoreMenuItem' );
92
+ return <EditorPluginSidebarMoreMenuItem { ...props } />;
93
+ }
94
+
95
+ /**
96
+ * @see PluginPostExcerpt in @wordpress/editor package.
97
+ */
98
+ export function __experimentalPluginPostExcerpt() {
99
+ deprecated( 'wp.editPost.__experimentalPluginPostExcerpt', {
100
+ since: '6.6',
101
+ hint: 'Core and custom panels can be access programmatically using their panel name.',
102
+ link: 'https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically',
103
+ } );
104
+ return PluginPostExcerpt;
105
+ }
106
+
107
+ /* eslint-enable jsdoc/require-param */
package/src/editor.js CHANGED
@@ -58,12 +58,12 @@ function Editor( {
58
58
  getEditorSettings().supportsTemplateMode;
59
59
  const isViewable =
60
60
  getPostType( currentPost.postType )?.viewable ?? false;
61
- const canEditTemplate = canUser( 'create', 'templates' );
61
+ const canViewTemplate = canUser( 'read', 'templates' );
62
62
  return {
63
63
  template:
64
64
  supportsTemplateMode &&
65
65
  isViewable &&
66
- canEditTemplate &&
66
+ canViewTemplate &&
67
67
  currentPost.postType !== 'wp_template'
68
68
  ? getEditedPostTemplate()
69
69
  : null,