@wordpress/edit-post 7.31.0 → 7.33.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 (294) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +9 -323
  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 +5 -5
  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 +7 -6
  16. package/build/components/header/more-menu/index.js.map +1 -1
  17. package/build/components/header/post-publish-button-or-toggle.js +11 -13
  18. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  19. package/build/components/header/preferences-menu-item/index.js +12 -4
  20. package/build/components/header/preferences-menu-item/index.js.map +1 -1
  21. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  22. package/build/components/header/writing-menu/index.js.map +1 -1
  23. package/build/components/init-pattern-modal/index.js.map +1 -1
  24. package/build/components/keyboard-shortcuts/index.js +1 -36
  25. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  26. package/build/components/layout/actions-panel.js +4 -7
  27. package/build/components/layout/actions-panel.js.map +1 -1
  28. package/build/components/layout/index.js +16 -21
  29. package/build/components/layout/index.js.map +1 -1
  30. package/build/components/layout/index.native.js.map +1 -1
  31. package/build/components/meta-boxes/index.js.map +1 -1
  32. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  33. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  34. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
  35. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  36. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
  37. package/build/components/preferences-modal/index.js +1 -21
  38. package/build/components/preferences-modal/index.js.map +1 -1
  39. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  40. package/build/components/sidebar/plugin-post-publish-panel/index.js +16 -64
  41. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  42. package/build/components/sidebar/plugin-pre-publish-panel/index.js +16 -63
  43. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  44. package/build/components/sidebar/post-format/index.js.map +1 -1
  45. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  46. package/build/components/sidebar/post-slug/index.js.map +1 -1
  47. package/build/components/sidebar/post-status/index.js +9 -9
  48. package/build/components/sidebar/post-status/index.js.map +1 -1
  49. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  50. package/build/components/sidebar/post-trash/index.js.map +1 -1
  51. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  52. package/build/components/sidebar/settings-header/index.js.map +1 -1
  53. package/build/components/sidebar/settings-sidebar/index.js +42 -40
  54. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  55. package/build/components/text-editor/index.js.map +1 -1
  56. package/build/components/visual-editor/block-inspector-button.js +1 -1
  57. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  58. package/build/components/visual-editor/header.native.js.map +1 -1
  59. package/build/components/visual-editor/index.js +4 -1
  60. package/build/components/visual-editor/index.js.map +1 -1
  61. package/build/components/visual-editor/index.native.js.map +1 -1
  62. package/build/components/visual-editor/use-padding-appender.js +62 -0
  63. package/build/components/visual-editor/use-padding-appender.js.map +1 -0
  64. package/build/components/welcome-guide/default.js.map +1 -1
  65. package/build/components/welcome-guide/image.js.map +1 -1
  66. package/build/components/welcome-guide/index.js.map +1 -1
  67. package/build/components/welcome-guide/template.js.map +1 -1
  68. package/build/editor.js +9 -4
  69. package/build/editor.js.map +1 -1
  70. package/build/editor.native.js.map +1 -1
  71. package/build/hooks/commands/use-common-commands.js +7 -24
  72. package/build/hooks/commands/use-common-commands.js.map +1 -1
  73. package/build/hooks/components/index.js.map +1 -1
  74. package/build/hooks/index.js.map +1 -1
  75. package/build/hooks/use-navigate-to-entity-record.js +36 -19
  76. package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
  77. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  78. package/build/index.js +7 -12
  79. package/build/index.js.map +1 -1
  80. package/build/index.native.js +2 -4
  81. package/build/index.native.js.map +1 -1
  82. package/build/lock-unlock.js.map +1 -1
  83. package/build/plugins/copy-content-menu-item/index.js.map +1 -1
  84. package/build/plugins/index.js.map +1 -1
  85. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +7 -4
  86. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  87. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  88. package/build/store/actions.js +46 -31
  89. package/build/store/actions.js.map +1 -1
  90. package/build/store/constants.js.map +1 -1
  91. package/build/store/index.js +1 -1
  92. package/build/store/index.js.map +1 -1
  93. package/build/store/reducer.js +1 -15
  94. package/build/store/reducer.js.map +1 -1
  95. package/build/store/selectors.js +44 -24
  96. package/build/store/selectors.js.map +1 -1
  97. package/build/utils/meta-boxes.js.map +1 -1
  98. package/build-module/components/browser-url/index.js.map +1 -1
  99. package/build-module/components/editor-initialization/index.js +1 -2
  100. package/build-module/components/editor-initialization/index.js.map +1 -1
  101. package/build-module/components/editor-initialization/listener-hooks.js +2 -38
  102. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  103. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  104. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  105. package/build-module/components/header/index.js +4 -4
  106. package/build-module/components/header/index.js.map +1 -1
  107. package/build-module/components/header/index.native.js +1 -1
  108. package/build-module/components/header/index.native.js.map +1 -1
  109. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  110. package/build-module/components/header/more-menu/index.js +5 -4
  111. package/build-module/components/header/more-menu/index.js.map +1 -1
  112. package/build-module/components/header/post-publish-button-or-toggle.js +11 -13
  113. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  114. package/build-module/components/header/preferences-menu-item/index.js +11 -3
  115. package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
  116. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  117. package/build-module/components/header/writing-menu/index.js.map +1 -1
  118. package/build-module/components/init-pattern-modal/index.js.map +1 -1
  119. package/build-module/components/keyboard-shortcuts/index.js +1 -36
  120. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  121. package/build-module/components/layout/actions-panel.js +4 -5
  122. package/build-module/components/layout/actions-panel.js.map +1 -1
  123. package/build-module/components/layout/index.js +15 -20
  124. package/build-module/components/layout/index.js.map +1 -1
  125. package/build-module/components/layout/index.native.js.map +1 -1
  126. package/build-module/components/meta-boxes/index.js.map +1 -1
  127. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  128. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  129. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
  130. package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
  131. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
  132. package/build-module/components/preferences-modal/index.js +1 -20
  133. package/build-module/components/preferences-modal/index.js.map +1 -1
  134. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  135. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +14 -62
  136. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  137. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +14 -61
  138. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  139. package/build-module/components/sidebar/post-format/index.js.map +1 -1
  140. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  141. package/build-module/components/sidebar/post-slug/index.js.map +1 -1
  142. package/build-module/components/sidebar/post-status/index.js +9 -10
  143. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  144. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  145. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  146. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  147. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  148. package/build-module/components/sidebar/settings-sidebar/index.js +43 -41
  149. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  150. package/build-module/components/text-editor/index.js.map +1 -1
  151. package/build-module/components/visual-editor/block-inspector-button.js +1 -1
  152. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  153. package/build-module/components/visual-editor/header.native.js.map +1 -1
  154. package/build-module/components/visual-editor/index.js +4 -1
  155. package/build-module/components/visual-editor/index.js.map +1 -1
  156. package/build-module/components/visual-editor/index.native.js.map +1 -1
  157. package/build-module/components/visual-editor/use-padding-appender.js +55 -0
  158. package/build-module/components/visual-editor/use-padding-appender.js.map +1 -0
  159. package/build-module/components/welcome-guide/default.js.map +1 -1
  160. package/build-module/components/welcome-guide/image.js.map +1 -1
  161. package/build-module/components/welcome-guide/index.js.map +1 -1
  162. package/build-module/components/welcome-guide/template.js.map +1 -1
  163. package/build-module/editor.js +9 -4
  164. package/build-module/editor.js.map +1 -1
  165. package/build-module/editor.native.js.map +1 -1
  166. package/build-module/hooks/commands/use-common-commands.js +9 -26
  167. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  168. package/build-module/hooks/components/index.js.map +1 -1
  169. package/build-module/hooks/index.js.map +1 -1
  170. package/build-module/hooks/use-navigate-to-entity-record.js +37 -20
  171. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
  172. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  173. package/build-module/index.js +8 -8
  174. package/build-module/index.js.map +1 -1
  175. package/build-module/index.native.js +2 -4
  176. package/build-module/index.native.js.map +1 -1
  177. package/build-module/lock-unlock.js.map +1 -1
  178. package/build-module/plugins/copy-content-menu-item/index.js.map +1 -1
  179. package/build-module/plugins/index.js.map +1 -1
  180. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +6 -3
  181. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  182. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  183. package/build-module/store/actions.js +38 -22
  184. package/build-module/store/actions.js.map +1 -1
  185. package/build-module/store/constants.js.map +1 -1
  186. package/build-module/store/index.js.map +1 -1
  187. package/build-module/store/reducer.js +1 -13
  188. package/build-module/store/reducer.js.map +1 -1
  189. package/build-module/store/selectors.js +42 -21
  190. package/build-module/store/selectors.js.map +1 -1
  191. package/build-module/utils/meta-boxes.js.map +1 -1
  192. package/build-style/classic-rtl.css +2 -2
  193. package/build-style/classic.css +2 -2
  194. package/build-style/style-rtl.css +12 -454
  195. package/build-style/style.css +12 -454
  196. package/package.json +32 -34
  197. package/src/classic.scss +2 -1
  198. package/src/components/editor-initialization/index.js +1 -5
  199. package/src/components/editor-initialization/listener-hooks.js +1 -40
  200. package/src/components/editor-initialization/test/listener-hooks.js +1 -96
  201. package/src/components/header/index.js +3 -4
  202. package/src/components/header/index.native.js +1 -1
  203. package/src/components/header/more-menu/index.js +3 -4
  204. package/src/components/header/post-publish-button-or-toggle.js +10 -11
  205. package/src/components/header/preferences-menu-item/index.js +9 -3
  206. package/src/components/header/style.scss +5 -3
  207. package/src/components/header/test/index.js +13 -1
  208. package/src/components/keyboard-shortcuts/index.js +3 -44
  209. package/src/components/layout/actions-panel.js +5 -4
  210. package/src/components/layout/index.js +20 -42
  211. package/src/components/meta-boxes/meta-boxes-area/style.scss +1 -1
  212. package/src/components/preferences-modal/index.js +1 -24
  213. package/src/components/sidebar/plugin-post-publish-panel/index.js +12 -67
  214. package/src/components/sidebar/plugin-pre-publish-panel/index.js +12 -66
  215. package/src/components/sidebar/post-status/index.js +6 -9
  216. package/src/components/sidebar/settings-sidebar/index.js +64 -56
  217. package/src/components/visual-editor/block-inspector-button.js +1 -1
  218. package/src/components/visual-editor/index.js +4 -0
  219. package/src/components/visual-editor/use-padding-appender.js +66 -0
  220. package/src/editor.js +14 -4
  221. package/src/hooks/commands/use-common-commands.js +13 -28
  222. package/src/hooks/use-navigate-to-entity-record.js +37 -24
  223. package/src/index.js +11 -6
  224. package/src/index.native.js +1 -4
  225. package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +5 -3
  226. package/src/store/actions.js +37 -24
  227. package/src/store/reducer.js +0 -13
  228. package/src/store/selectors.js +52 -36
  229. package/src/store/test/actions.js +11 -10
  230. package/src/style.scss +1 -20
  231. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -107
  232. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  233. package/build/components/header/plugin-more-menu-item/index.js +0 -78
  234. package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
  235. package/build/components/header/plugin-sidebar-more-menu-item/index.js +0 -71
  236. package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  237. package/build/components/keyboard-shortcut-help-modal/config.js +0 -78
  238. package/build/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  239. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -49
  240. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  241. package/build/components/keyboard-shortcut-help-modal/index.js +0 -129
  242. package/build/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  243. package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -55
  244. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  245. package/build/components/sidebar/plugin-post-status-info/index.js +0 -73
  246. package/build/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  247. package/build/components/sidebar/plugin-sidebar/index.js +0 -104
  248. package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
  249. package/build/components/sidebar/template-summary/index.js +0 -36
  250. package/build/components/sidebar/template-summary/index.js.map +0 -1
  251. package/build/components/start-page-options/index.js +0 -107
  252. package/build/components/start-page-options/index.js.map +0 -1
  253. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -100
  254. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  255. package/build-module/components/header/plugin-more-menu-item/index.js +0 -73
  256. package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
  257. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +0 -65
  258. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  259. package/build-module/components/keyboard-shortcut-help-modal/config.js +0 -71
  260. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  261. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -41
  262. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  263. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -119
  264. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  265. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -48
  266. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  267. package/build-module/components/sidebar/plugin-post-status-info/index.js +0 -66
  268. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  269. package/build-module/components/sidebar/plugin-sidebar/index.js +0 -98
  270. package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
  271. package/build-module/components/sidebar/template-summary/index.js +0 -29
  272. package/build-module/components/sidebar/template-summary/index.js.map +0 -1
  273. package/build-module/components/start-page-options/index.js +0 -100
  274. package/build-module/components/start-page-options/index.js.map +0 -1
  275. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -108
  276. package/src/components/header/plugin-more-menu-item/index.js +0 -73
  277. package/src/components/header/plugin-sidebar-more-menu-item/index.js +0 -64
  278. package/src/components/keyboard-shortcut-help-modal/config.js +0 -53
  279. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -43
  280. package/src/components/keyboard-shortcut-help-modal/index.js +0 -159
  281. package/src/components/keyboard-shortcut-help-modal/shortcut.js +0 -67
  282. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -61
  283. package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -36
  284. package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +0 -39
  285. package/src/components/sidebar/plugin-post-publish-panel/test/index.js +0 -33
  286. package/src/components/sidebar/plugin-post-status-info/index.js +0 -63
  287. package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +0 -11
  288. package/src/components/sidebar/plugin-post-status-info/test/index.js +0 -29
  289. package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +0 -33
  290. package/src/components/sidebar/plugin-sidebar/index.js +0 -94
  291. package/src/components/sidebar/template-summary/index.js +0 -37
  292. package/src/components/sidebar/template-summary/style.scss +0 -5
  293. package/src/components/start-page-options/index.js +0 -108
  294. package/src/components/start-page-options/style.scss +0 -26
@@ -1,83 +1,28 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { usePluginContext } from '@wordpress/plugins';
5
- import { createSlotFill, PanelBody } from '@wordpress/components';
6
-
7
- const { Fill, Slot } = createSlotFill( 'PluginPostPublishPanel' );
4
+ import deprecated from '@wordpress/deprecated';
5
+ import { PluginPostPublishPanel } from '@wordpress/editor';
8
6
 
9
7
  /**
10
8
  * Renders provided content to the post-publish panel in the publish flow
11
9
  * (side panel that opens after a user publishes the post).
12
10
  *
11
+ * @deprecated since 6.6, use `wp.editor.PluginPostPublishPanel` instead.
12
+ *
13
13
  * @param {Object} props Component properties.
14
14
  * @param {string} [props.className] An optional class name added to the panel.
15
15
  * @param {string} [props.title] Title displayed at the top of the panel.
16
16
  * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
17
17
  * @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.
18
18
  * @param {Element} props.children Children to be rendered
19
- *
20
- * @example
21
- * ```js
22
- * // Using ES5 syntax
23
- * var __ = wp.i18n.__;
24
- * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
25
- *
26
- * function MyPluginPostPublishPanel() {
27
- * return React.createElement(
28
- * PluginPostPublishPanel,
29
- * {
30
- * className: 'my-plugin-post-publish-panel',
31
- * title: __( 'My panel title' ),
32
- * initialOpen: true,
33
- * },
34
- * __( 'My panel content' )
35
- * );
36
- * }
37
- * ```
38
- *
39
- * @example
40
- * ```jsx
41
- * // Using ESNext syntax
42
- * import { __ } from '@wordpress/i18n';
43
- * import { PluginPostPublishPanel } from '@wordpress/edit-post';
44
- *
45
- * const MyPluginPostPublishPanel = () => (
46
- * <PluginPostPublishPanel
47
- * className="my-plugin-post-publish-panel"
48
- * title={ __( 'My panel title' ) }
49
- * initialOpen={ true }
50
- * >
51
- * { __( 'My panel content' ) }
52
- * </PluginPostPublishPanel>
53
- * );
54
- * ```
55
- *
56
19
  * @return {Component} The component to be rendered.
57
20
  */
58
- const PluginPostPublishPanel = ( {
59
- children,
60
- className,
61
- title,
62
- initialOpen = false,
63
- icon,
64
- } ) => {
65
- const { icon: pluginIcon } = usePluginContext();
66
-
67
- return (
68
- <Fill>
69
- <PanelBody
70
- className={ className }
71
- initialOpen={ initialOpen || ! title }
72
- title={ title }
73
- icon={ icon ?? pluginIcon }
74
- >
75
- { children }
76
- </PanelBody>
77
- </Fill>
78
- );
79
- };
80
-
81
- PluginPostPublishPanel.Slot = Slot;
82
-
83
- export default PluginPostPublishPanel;
21
+ export default function EditPostPluginPostPublishPanel( props ) {
22
+ deprecated( 'wp.editPost.PluginPostPublishPanel', {
23
+ since: '6.6',
24
+ version: '6.8',
25
+ alternative: 'wp.editor.PluginPostPublishPanel',
26
+ } );
27
+ return <PluginPostPublishPanel { ...props } />;
28
+ }
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { createSlotFill, PanelBody } from '@wordpress/components';
5
- import { usePluginContext } from '@wordpress/plugins';
6
-
7
- const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
4
+ import deprecated from '@wordpress/deprecated';
5
+ import { PluginPrePublishPanel } from '@wordpress/editor';
8
6
 
9
7
  /**
10
8
  * Renders provided content to the pre-publish side panel in the publish flow
11
9
  * (side panel that opens when a user first pushes "Publish" from the main editor).
12
10
  *
11
+ * @deprecated since 6.6, use `wp.editor.PluginPrePublishPanel` instead.
12
+ *
13
13
  * @param {Object} props Component props.
14
14
  * @param {string} [props.className] An optional class name added to the panel.
15
15
  * @param {string} [props.title] Title displayed at the top of the panel.
@@ -20,67 +20,13 @@ const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
20
20
  * the sidebar is pinned to toolbar.
21
21
  * @param {Element} props.children Children to be rendered
22
22
  *
23
- * @example
24
- * ```js
25
- * // Using ES5 syntax
26
- * var __ = wp.i18n.__;
27
- * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
28
- *
29
- * function MyPluginPrePublishPanel() {
30
- * return React.createElement(
31
- * PluginPrePublishPanel,
32
- * {
33
- * className: 'my-plugin-pre-publish-panel',
34
- * title: __( 'My panel title' ),
35
- * initialOpen: true,
36
- * },
37
- * __( 'My panel content' )
38
- * );
39
- * }
40
- * ```
41
- *
42
- * @example
43
- * ```jsx
44
- * // Using ESNext syntax
45
- * import { __ } from '@wordpress/i18n';
46
- * import { PluginPrePublishPanel } from '@wordpress/edit-post';
47
- *
48
- * const MyPluginPrePublishPanel = () => (
49
- * <PluginPrePublishPanel
50
- * className="my-plugin-pre-publish-panel"
51
- * title={ __( 'My panel title' ) }
52
- * initialOpen={ true }
53
- * >
54
- * { __( 'My panel content' ) }
55
- * </PluginPrePublishPanel>
56
- * );
57
- * ```
58
- *
59
23
  * @return {Component} The component to be rendered.
60
24
  */
61
- const PluginPrePublishPanel = ( {
62
- children,
63
- className,
64
- title,
65
- initialOpen = false,
66
- icon,
67
- } ) => {
68
- const { icon: pluginIcon } = usePluginContext();
69
-
70
- return (
71
- <Fill>
72
- <PanelBody
73
- className={ className }
74
- initialOpen={ initialOpen || ! title }
75
- title={ title }
76
- icon={ icon ?? pluginIcon }
77
- >
78
- { children }
79
- </PanelBody>
80
- </Fill>
81
- );
82
- };
83
-
84
- PluginPrePublishPanel.Slot = Slot;
85
-
86
- export default PluginPrePublishPanel;
25
+ export default function EditPostPluginPrePublishPanel( props ) {
26
+ deprecated( 'wp.editPost.PluginPrePublishPanel', {
27
+ since: '6.6',
28
+ version: '6.8',
29
+ alternative: 'wp.editor.PluginPrePublishPanel',
30
+ } );
31
+ return <PluginPrePublishPanel { ...props } />;
32
+ }
@@ -8,26 +8,27 @@ import {
8
8
  } from '@wordpress/components';
9
9
  import { useDispatch, useSelect } from '@wordpress/data';
10
10
  import {
11
+ PluginPostStatusInfo,
11
12
  PostAuthorPanel,
12
13
  PostSchedulePanel,
13
- PostSwitchToDraftButton,
14
14
  PostSyncStatus,
15
15
  PostURLPanel,
16
16
  PostTemplatePanel,
17
17
  PostFeaturedImagePanel,
18
18
  store as editorStore,
19
+ privateApis as editorPrivateApis,
19
20
  } from '@wordpress/editor';
20
21
 
21
22
  /**
22
23
  * Internal dependencies
23
24
  */
24
- import PostVisibility from '../post-visibility';
25
25
  import PostTrash from '../post-trash';
26
26
  import PostSticky from '../post-sticky';
27
27
  import PostSlug from '../post-slug';
28
28
  import PostFormat from '../post-format';
29
- import PostPendingStatus from '../post-pending-status';
30
- import PluginPostStatusInfo from '../plugin-post-status-info';
29
+ import { unlock } from '../../../lock-unlock';
30
+
31
+ const { PostStatus: PostStatusPanel } = unlock( editorPrivateApis );
31
32
 
32
33
  /**
33
34
  * Module Constants
@@ -61,14 +62,13 @@ export default function PostStatus() {
61
62
  <PluginPostStatusInfo.Slot>
62
63
  { ( fills ) => (
63
64
  <>
65
+ <PostStatusPanel />
64
66
  <PostFeaturedImagePanel withPanelBody={ false } />
65
- <PostVisibility />
66
67
  <PostSchedulePanel />
67
68
  <PostTemplatePanel />
68
69
  <PostURLPanel />
69
70
  <PostSyncStatus />
70
71
  <PostSticky />
71
- <PostPendingStatus />
72
72
  <PostFormat />
73
73
  <PostSlug />
74
74
  <PostAuthorPanel />
@@ -77,10 +77,7 @@ export default function PostStatus() {
77
77
  style={ {
78
78
  marginTop: '16px',
79
79
  } }
80
- spacing={ 4 }
81
- wrap
82
80
  >
83
- <PostSwitchToDraftButton />
84
81
  <PostTrash />
85
82
  </HStack>
86
83
  </>
@@ -15,17 +15,19 @@ import {
15
15
  } from '@wordpress/element';
16
16
  import { isRTL, __ } 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
25
  PostExcerptPanel,
26
26
  PostLastRevisionPanel,
27
27
  PostTaxonomiesPanel,
28
+ privateApis as editorPrivateApis,
28
29
  } from '@wordpress/editor';
30
+ import { addQueryArgs } from '@wordpress/url';
29
31
 
30
32
  /**
31
33
  * Internal dependencies
@@ -33,13 +35,15 @@ import {
33
35
  import SettingsHeader from '../settings-header';
34
36
  import PostStatus from '../post-status';
35
37
  import MetaBoxes from '../../meta-boxes';
36
- import PluginSidebarEditPost from '../plugin-sidebar';
37
- import TemplateSummary from '../template-summary';
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, PostActions, interfaceStore } =
43
+ unlock( editorPrivateApis );
42
44
  const { Tabs } = unlock( componentsPrivateApis );
45
+ const { PatternOverridesPanel, useAutoSwitchEditorSidebars } =
46
+ unlock( editorPrivateApis );
43
47
 
44
48
  const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {
45
49
  web: true,
@@ -50,13 +54,18 @@ export const sidebars = {
50
54
  block: 'edit-post/block',
51
55
  };
52
56
 
53
- const SidebarContent = ( {
54
- sidebarName,
55
- keyboardShortcut,
56
- isEditingTemplate,
57
- } ) => {
57
+ function onActionPerformed( actionId, items ) {
58
+ if ( actionId === 'move-to-trash' ) {
59
+ const postType = items[ 0 ].type;
60
+ document.location.href = addQueryArgs( 'edit.php', {
61
+ post_type: postType,
62
+ } );
63
+ }
64
+ }
65
+
66
+ const SidebarContent = ( { tabName, keyboardShortcut, isEditingTemplate } ) => {
58
67
  const tabListRef = useRef( null );
59
- // Because `PluginSidebarEditPost` renders a `ComplementaryArea`, we
68
+ // Because `PluginSidebar` renders a `ComplementaryArea`, we
60
69
  // need to forward the `Tabs` context so it can be passed through the
61
70
  // underlying slot/fill.
62
71
  const tabsContextValue = useContext( Tabs.Context );
@@ -73,7 +82,7 @@ const SidebarContent = ( {
73
82
  // We are purposefully using a custom `data-tab-id` attribute here
74
83
  // because we don't want rely on any assumptions about `Tabs`
75
84
  // component internals.
76
- ( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName
85
+ ( element ) => element.getAttribute( 'data-tab-id' ) === tabName
77
86
  );
78
87
  const activeElement = selectedTabElement?.ownerDocument.activeElement;
79
88
  const tabsHasFocus = tabsElements.some( ( element ) => {
@@ -86,11 +95,11 @@ const SidebarContent = ( {
86
95
  ) {
87
96
  selectedTabElement?.focus();
88
97
  }
89
- }, [ sidebarName ] );
98
+ }, [ tabName ] );
90
99
 
91
100
  return (
92
- <PluginSidebarEditPost
93
- identifier={ sidebarName }
101
+ <PluginSidebar
102
+ identifier={ tabName }
94
103
  header={
95
104
  <Tabs.Context.Provider value={ tabsContextValue }>
96
105
  <SettingsHeader ref={ tabListRef } />
@@ -110,6 +119,13 @@ const SidebarContent = ( {
110
119
  >
111
120
  <Tabs.Context.Provider value={ tabsContextValue }>
112
121
  <Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>
122
+ <PostCardPanel
123
+ actions={
124
+ <PostActions
125
+ onActionPerformed={ onActionPerformed }
126
+ />
127
+ }
128
+ />
113
129
  { ! isEditingTemplate && (
114
130
  <>
115
131
  <PostStatus />
@@ -119,55 +135,52 @@ const SidebarContent = ( {
119
135
  <PostExcerptPanel />
120
136
  <PostDiscussionPanel />
121
137
  <PageAttributesPanel />
138
+ <PatternOverridesPanel />
122
139
  <MetaBoxes location="side" />
123
140
  </>
124
141
  ) }
125
- { isEditingTemplate && <TemplateSummary /> }
126
142
  </Tabs.TabPanel>
127
143
  <Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
128
144
  <BlockInspector />
129
145
  </Tabs.TabPanel>
130
146
  </Tabs.Context.Provider>
131
- </PluginSidebarEditPost>
147
+ </PluginSidebar>
132
148
  );
133
149
  };
134
150
 
135
151
  const SettingsSidebar = () => {
136
- const {
137
- sidebarName,
138
- isSettingsSidebarActive,
139
- keyboardShortcut,
140
- isEditingTemplate,
141
- } = useSelect( ( select ) => {
142
- // The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
143
- // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
144
- // If one of the two sidebars is active the component will contain the content of that sidebar.
145
- // When neither of the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
146
- // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
147
- // should contain the sidebar that will be active when the toggle button is pressed. If a block
148
- // is selected, that should be edit-post/block otherwise it's edit-post/document.
149
- let sidebar = select( interfaceStore ).getActiveComplementaryArea(
150
- editPostStore.name
151
- );
152
- let isSettingsSidebar = true;
153
- if ( ! [ sidebars.document, sidebars.block ].includes( sidebar ) ) {
154
- isSettingsSidebar = false;
155
- if ( select( blockEditorStore ).getBlockSelectionStart() ) {
156
- sidebar = sidebars.block;
152
+ useAutoSwitchEditorSidebars();
153
+ const { tabName, keyboardShortcut, isEditingTemplate } = useSelect(
154
+ ( select ) => {
155
+ const shortcut = select(
156
+ keyboardShortcutsStore
157
+ ).getShortcutRepresentation( 'core/editor/toggle-sidebar' );
158
+
159
+ const sidebar =
160
+ select( interfaceStore ).getActiveComplementaryArea( 'core' );
161
+ const _isEditorSidebarOpened = [
162
+ sidebars.block,
163
+ sidebars.document,
164
+ ].includes( sidebar );
165
+ let _tabName = sidebar;
166
+ if ( ! _isEditorSidebarOpened ) {
167
+ _tabName = !! select(
168
+ blockEditorStore
169
+ ).getBlockSelectionStart()
170
+ ? sidebars.block
171
+ : sidebars.document;
157
172
  }
158
- sidebar = sidebars.document;
159
- }
160
- const shortcut = select(
161
- keyboardShortcutsStore
162
- ).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' );
163
- return {
164
- sidebarName: sidebar,
165
- isSettingsSidebarActive: isSettingsSidebar,
166
- keyboardShortcut: shortcut,
167
- isEditingTemplate:
168
- select( editorStore ).getCurrentPostType() === 'wp_template',
169
- };
170
- }, [] );
173
+
174
+ return {
175
+ tabName: _tabName,
176
+ keyboardShortcut: shortcut,
177
+ isEditingTemplate:
178
+ select( editorStore ).getCurrentPostType() ===
179
+ 'wp_template',
180
+ };
181
+ },
182
+ []
183
+ );
171
184
 
172
185
  const { openGeneralSidebar } = useDispatch( editPostStore );
173
186
 
@@ -182,17 +195,12 @@ const SettingsSidebar = () => {
182
195
 
183
196
  return (
184
197
  <Tabs
185
- // Due to how this component is controlled (via a value from the
186
- // `interfaceStore`), when the sidebar closes the currently selected
187
- // tab can't be found. This causes the component to continuously reset
188
- // the selection to `null` in an infinite loop.Proactively setting
189
- // the selected tab to `null` avoids that.
190
- selectedTabId={ isSettingsSidebarActive ? sidebarName : null }
198
+ selectedTabId={ tabName }
191
199
  onSelect={ onTabSelect }
192
200
  selectOnMove={ false }
193
201
  >
194
202
  <SidebarContent
195
- sidebarName={ sidebarName }
203
+ tabName={ tabName }
196
204
  keyboardShortcut={ keyboardShortcut }
197
205
  isEditingTemplate={ isEditingTemplate }
198
206
  />
@@ -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
+ }
package/src/editor.js CHANGED
@@ -32,11 +32,14 @@ function Editor( {
32
32
  ...props
33
33
  } ) {
34
34
  const {
35
- initialPost,
36
35
  currentPost,
37
36
  onNavigateToEntityRecord,
38
37
  onNavigateToPreviousEntityRecord,
39
- } = useNavigateToEntityRecord( initialPostId, initialPostType );
38
+ } = useNavigateToEntityRecord(
39
+ initialPostId,
40
+ initialPostType,
41
+ 'post-only'
42
+ );
40
43
 
41
44
  const { post, template } = useSelect(
42
45
  ( select ) => {
@@ -55,12 +58,12 @@ function Editor( {
55
58
  getEditorSettings().supportsTemplateMode;
56
59
  const isViewable =
57
60
  getPostType( currentPost.postType )?.viewable ?? false;
58
- const canEditTemplate = canUser( 'create', 'templates' );
61
+ const canViewTemplate = canUser( 'read', 'templates' );
59
62
  return {
60
63
  template:
61
64
  supportsTemplateMode &&
62
65
  isViewable &&
63
- canEditTemplate &&
66
+ canViewTemplate &&
64
67
  currentPost.postType !== 'wp_template'
65
68
  ? getEditedPostTemplate()
66
69
  : null,
@@ -80,6 +83,13 @@ function Editor( {
80
83
  [ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]
81
84
  );
82
85
 
86
+ const initialPost = useMemo( () => {
87
+ return {
88
+ type: initialPostType,
89
+ id: initialPostId,
90
+ };
91
+ }, [ initialPostType, initialPostId ] );
92
+
83
93
  if ( ! post ) {
84
94
  return null;
85
95
  }