@wordpress/editor 13.34.0 → 13.35.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 (263) hide show
  1. package/CHANGELOG.md +10 -4
  2. package/build/bindings/pattern-overrides.js +70 -1
  3. package/build/bindings/pattern-overrides.js.map +1 -1
  4. package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
  5. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
  6. package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
  7. package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
  8. package/build/components/collapsible-block-toolbar/index.js +2 -2
  9. package/build/components/collapsible-block-toolbar/index.js.map +1 -1
  10. package/build/components/document-bar/index.js +2 -2
  11. package/build/components/document-bar/index.js.map +1 -1
  12. package/build/components/document-outline/item.js +2 -2
  13. package/build/components/document-outline/item.js.map +1 -1
  14. package/build/components/document-tools/index.js +15 -18
  15. package/build/components/document-tools/index.js.map +1 -1
  16. package/build/components/editor-canvas/index.js +19 -8
  17. package/build/components/editor-canvas/index.js.map +1 -1
  18. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
  19. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  20. package/build/components/global-styles-provider/index.js +130 -0
  21. package/build/components/global-styles-provider/index.js.map +1 -0
  22. package/build/components/header/index.js +147 -0
  23. package/build/components/header/index.js.map +1 -0
  24. package/build/components/inserter-sidebar/index.js +56 -31
  25. package/build/components/inserter-sidebar/index.js.map +1 -1
  26. package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
  27. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  28. package/build/components/post-actions/actions.js +122 -64
  29. package/build/components/post-actions/actions.js.map +1 -1
  30. package/build/components/post-actions/index.js +7 -14
  31. package/build/components/post-actions/index.js.map +1 -1
  32. package/build/components/post-card-panel/index.js +5 -29
  33. package/build/components/post-card-panel/index.js.map +1 -1
  34. package/build/components/post-comments/index.js +28 -8
  35. package/build/components/post-comments/index.js.map +1 -1
  36. package/build/components/post-discussion/panel.js +103 -21
  37. package/build/components/post-discussion/panel.js.map +1 -1
  38. package/build/components/post-excerpt/panel.js +2 -2
  39. package/build/components/post-excerpt/panel.js.map +1 -1
  40. package/build/components/post-format/panel.js +27 -0
  41. package/build/components/post-format/panel.js.map +1 -0
  42. package/build/components/post-panel-row/index.js +2 -2
  43. package/build/components/post-panel-row/index.js.map +1 -1
  44. package/build/components/post-panel-section/index.js +28 -0
  45. package/build/components/post-panel-section/index.js.map +1 -0
  46. package/build/components/post-pingbacks/index.js +5 -2
  47. package/build/components/post-pingbacks/index.js.map +1 -1
  48. package/build/components/post-saved-state/index.js +2 -2
  49. package/build/components/post-saved-state/index.js.map +1 -1
  50. package/build/components/post-slug/panel.js +27 -0
  51. package/build/components/post-slug/panel.js.map +1 -0
  52. package/build/components/post-status/index.js +4 -4
  53. package/build/components/post-status/index.js.map +1 -1
  54. package/build/components/post-sticky/panel.js +21 -0
  55. package/build/components/post-sticky/panel.js.map +1 -0
  56. package/build/components/post-title/index.js +2 -2
  57. package/build/components/post-title/index.js.map +1 -1
  58. package/build/components/post-title/post-title-raw.js +2 -2
  59. package/build/components/post-title/post-title-raw.js.map +1 -1
  60. package/build/components/post-transform-panel/hooks.js +90 -0
  61. package/build/components/post-transform-panel/hooks.js.map +1 -0
  62. package/build/components/post-transform-panel/index.js +101 -0
  63. package/build/components/post-transform-panel/index.js.map +1 -0
  64. package/build/components/post-trash/panel.js +18 -0
  65. package/build/components/post-trash/panel.js.map +1 -0
  66. package/build/components/post-type-support-check/index.js +1 -1
  67. package/build/components/post-type-support-check/index.js.map +1 -1
  68. package/build/components/preferences-modal/index.js +3 -3
  69. package/build/components/preferences-modal/index.js.map +1 -1
  70. package/build/components/provider/index.js +3 -1
  71. package/build/components/provider/index.js.map +1 -1
  72. package/build/components/provider/use-block-editor-settings.js +21 -3
  73. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  74. package/build/components/sidebar/constants.js +11 -0
  75. package/build/components/sidebar/constants.js.map +1 -0
  76. package/build/components/sidebar/header.js +53 -0
  77. package/build/components/sidebar/header.js.map +1 -0
  78. package/build/components/sidebar/index.js +157 -0
  79. package/build/components/sidebar/index.js.map +1 -0
  80. package/build/components/sidebar/post-summary.js +84 -0
  81. package/build/components/sidebar/post-summary.js.map +1 -0
  82. package/build/components/start-page-options/index.js +5 -7
  83. package/build/components/start-page-options/index.js.map +1 -1
  84. package/build/components/start-template-options/index.js +192 -0
  85. package/build/components/start-template-options/index.js.map +1 -0
  86. package/build/components/template-content-panel/index.js +38 -0
  87. package/build/components/template-content-panel/index.js.map +1 -0
  88. package/build/hooks/pattern-overrides.js +10 -5
  89. package/build/hooks/pattern-overrides.js.map +1 -1
  90. package/build/private-apis.js +7 -12
  91. package/build/private-apis.js.map +1 -1
  92. package/build/private-apis.native.js +72 -0
  93. package/build/private-apis.native.js.map +1 -0
  94. package/build/store/private-selectors.js +6 -1
  95. package/build/store/private-selectors.js.map +1 -1
  96. package/build/store/reducer.js +15 -0
  97. package/build/store/reducer.js.map +1 -1
  98. package/build-module/bindings/pattern-overrides.js +69 -1
  99. package/build-module/bindings/pattern-overrides.js.map +1 -1
  100. package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
  101. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
  102. package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
  103. package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
  104. package/build-module/components/collapsible-block-toolbar/index.js +2 -2
  105. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  106. package/build-module/components/document-bar/index.js +2 -2
  107. package/build-module/components/document-bar/index.js.map +1 -1
  108. package/build-module/components/document-outline/item.js +2 -2
  109. package/build-module/components/document-outline/item.js.map +1 -1
  110. package/build-module/components/document-tools/index.js +16 -19
  111. package/build-module/components/document-tools/index.js.map +1 -1
  112. package/build-module/components/editor-canvas/index.js +19 -8
  113. package/build-module/components/editor-canvas/index.js.map +1 -1
  114. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
  115. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  116. package/build-module/components/global-styles-provider/index.js +120 -0
  117. package/build-module/components/global-styles-provider/index.js.map +1 -0
  118. package/build-module/components/header/index.js +139 -0
  119. package/build-module/components/header/index.js.map +1 -0
  120. package/build-module/components/inserter-sidebar/index.js +59 -34
  121. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  122. package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
  123. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  124. package/build-module/components/post-actions/actions.js +125 -66
  125. package/build-module/components/post-actions/actions.js.map +1 -1
  126. package/build-module/components/post-actions/index.js +7 -14
  127. package/build-module/components/post-actions/index.js.map +1 -1
  128. package/build-module/components/post-card-panel/index.js +7 -30
  129. package/build-module/components/post-card-panel/index.js.map +1 -1
  130. package/build-module/components/post-comments/index.js +30 -10
  131. package/build-module/components/post-comments/index.js.map +1 -1
  132. package/build-module/components/post-discussion/panel.js +105 -23
  133. package/build-module/components/post-discussion/panel.js.map +1 -1
  134. package/build-module/components/post-excerpt/panel.js +2 -2
  135. package/build-module/components/post-excerpt/panel.js.map +1 -1
  136. package/build-module/components/post-format/panel.js +18 -0
  137. package/build-module/components/post-format/panel.js.map +1 -0
  138. package/build-module/components/post-panel-row/index.js +2 -2
  139. package/build-module/components/post-panel-row/index.js.map +1 -1
  140. package/build-module/components/post-panel-section/index.js +20 -0
  141. package/build-module/components/post-panel-section/index.js.map +1 -0
  142. package/build-module/components/post-pingbacks/index.js +6 -3
  143. package/build-module/components/post-pingbacks/index.js.map +1 -1
  144. package/build-module/components/post-saved-state/index.js +2 -2
  145. package/build-module/components/post-saved-state/index.js.map +1 -1
  146. package/build-module/components/post-slug/panel.js +18 -0
  147. package/build-module/components/post-slug/panel.js.map +1 -0
  148. package/build-module/components/post-status/index.js +4 -4
  149. package/build-module/components/post-status/index.js.map +1 -1
  150. package/build-module/components/post-sticky/panel.js +12 -0
  151. package/build-module/components/post-sticky/panel.js.map +1 -0
  152. package/build-module/components/post-title/index.js +2 -2
  153. package/build-module/components/post-title/index.js.map +1 -1
  154. package/build-module/components/post-title/post-title-raw.js +2 -2
  155. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  156. package/build-module/components/post-transform-panel/hooks.js +83 -0
  157. package/build-module/components/post-transform-panel/hooks.js.map +1 -0
  158. package/build-module/components/post-transform-panel/index.js +94 -0
  159. package/build-module/components/post-transform-panel/index.js.map +1 -0
  160. package/build-module/components/post-trash/panel.js +10 -0
  161. package/build-module/components/post-trash/panel.js.map +1 -0
  162. package/build-module/components/post-type-support-check/index.js +1 -1
  163. package/build-module/components/post-type-support-check/index.js.map +1 -1
  164. package/build-module/components/preferences-modal/index.js +3 -3
  165. package/build-module/components/preferences-modal/index.js.map +1 -1
  166. package/build-module/components/provider/index.js +3 -1
  167. package/build-module/components/provider/index.js.map +1 -1
  168. package/build-module/components/provider/use-block-editor-settings.js +21 -3
  169. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  170. package/build-module/components/sidebar/constants.js +5 -0
  171. package/build-module/components/sidebar/constants.js.map +1 -0
  172. package/build-module/components/sidebar/header.js +46 -0
  173. package/build-module/components/sidebar/header.js.map +1 -0
  174. package/build-module/components/sidebar/index.js +149 -0
  175. package/build-module/components/sidebar/index.js.map +1 -0
  176. package/build-module/components/sidebar/post-summary.js +77 -0
  177. package/build-module/components/sidebar/post-summary.js.map +1 -0
  178. package/build-module/components/start-page-options/index.js +5 -7
  179. package/build-module/components/start-page-options/index.js.map +1 -1
  180. package/build-module/components/start-template-options/index.js +185 -0
  181. package/build-module/components/start-template-options/index.js.map +1 -0
  182. package/build-module/components/template-content-panel/index.js +31 -0
  183. package/build-module/components/template-content-panel/index.js.map +1 -0
  184. package/build-module/hooks/pattern-overrides.js +10 -5
  185. package/build-module/hooks/pattern-overrides.js.map +1 -1
  186. package/build-module/private-apis.js +7 -12
  187. package/build-module/private-apis.js.map +1 -1
  188. package/build-module/private-apis.native.js +62 -0
  189. package/build-module/private-apis.native.js.map +1 -0
  190. package/build-module/store/private-selectors.js +3 -0
  191. package/build-module/store/private-selectors.js.map +1 -1
  192. package/build-module/store/reducer.js +14 -0
  193. package/build-module/store/reducer.js.map +1 -1
  194. package/build-style/style-rtl.css +328 -18
  195. package/build-style/style.css +328 -18
  196. package/package.json +38 -36
  197. package/src/bindings/pattern-overrides.js +83 -1
  198. package/src/components/autocompleters/style.scss +1 -2
  199. package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
  200. package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
  201. package/src/components/block-settings-menu/style.scss +4 -0
  202. package/src/components/collapsible-block-toolbar/index.js +2 -2
  203. package/src/components/document-bar/index.js +2 -2
  204. package/src/components/document-outline/item.js +2 -2
  205. package/src/components/document-tools/index.js +19 -21
  206. package/src/components/editor-canvas/index.js +18 -6
  207. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
  208. package/src/components/global-styles-provider/index.js +162 -0
  209. package/src/components/header/index.js +154 -0
  210. package/src/components/header/style.scss +231 -0
  211. package/src/components/inserter-sidebar/index.js +52 -29
  212. package/src/components/inserter-sidebar/style.scss +10 -3
  213. package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
  214. package/src/components/list-view-sidebar/style.scss +1 -0
  215. package/src/components/page-attributes/test/order.js +5 -1
  216. package/src/components/post-actions/actions.js +256 -150
  217. package/src/components/post-actions/index.js +5 -38
  218. package/src/components/post-card-panel/index.js +39 -85
  219. package/src/components/post-comments/index.js +47 -9
  220. package/src/components/post-discussion/panel.js +108 -31
  221. package/src/components/post-discussion/style.scss +26 -0
  222. package/src/components/post-excerpt/panel.js +2 -2
  223. package/src/components/post-format/panel.js +22 -0
  224. package/src/components/post-format/style.scss +6 -0
  225. package/src/components/post-last-revision/test/check.js +5 -1
  226. package/src/components/post-panel-row/index.js +2 -2
  227. package/src/components/post-panel-section/index.js +19 -0
  228. package/src/components/post-panel-section/style.scss +3 -0
  229. package/src/components/post-pingbacks/index.js +11 -2
  230. package/src/components/post-publish-panel/style.scss +5 -0
  231. package/src/components/post-saved-state/index.js +2 -2
  232. package/src/components/post-slug/panel.js +22 -0
  233. package/src/components/post-slug/style.scss +5 -0
  234. package/src/components/post-slug/test/index.js +5 -1
  235. package/src/components/post-status/index.js +4 -4
  236. package/src/components/post-sticky/panel.js +18 -0
  237. package/src/components/post-title/index.js +2 -2
  238. package/src/components/post-title/post-title-raw.js +2 -2
  239. package/src/components/post-transform-panel/hooks.js +114 -0
  240. package/src/components/post-transform-panel/index.js +99 -0
  241. package/src/components/post-trash/panel.js +13 -0
  242. package/src/components/post-type-support-check/index.js +1 -1
  243. package/src/components/post-type-support-check/test/index.js +2 -2
  244. package/src/components/preferences-modal/index.js +3 -3
  245. package/src/components/provider/index.js +4 -0
  246. package/src/components/provider/use-block-editor-settings.js +19 -4
  247. package/src/components/sidebar/constants.js +4 -0
  248. package/src/components/sidebar/header.js +49 -0
  249. package/src/components/sidebar/index.js +200 -0
  250. package/src/components/sidebar/post-summary.js +104 -0
  251. package/src/components/sidebar/style.scss +18 -0
  252. package/src/components/start-page-options/index.js +6 -4
  253. package/src/components/start-template-options/index.js +219 -0
  254. package/src/components/start-template-options/style.scss +55 -0
  255. package/src/components/template-areas/style.scss +0 -1
  256. package/src/components/template-content-panel/index.js +36 -0
  257. package/src/hooks/pattern-overrides.js +12 -6
  258. package/src/private-apis.js +10 -12
  259. package/src/private-apis.native.js +61 -0
  260. package/src/store/private-selectors.js +3 -0
  261. package/src/store/reducer.js +12 -0
  262. package/src/style.scss +7 -0
  263. package/src/components/post-slug/test/check.js +0 -17
@@ -1,17 +1,10 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
4
  import {
10
5
  Icon,
11
6
  __experimentalHStack as HStack,
12
- __experimentalVStack as VStack,
13
7
  __experimentalText as Text,
14
- PanelBody,
15
8
  } from '@wordpress/components';
16
9
  import { store as coreStore } from '@wordpress/core-data';
17
10
  import { useSelect } from '@wordpress/data';
@@ -25,89 +18,50 @@ import { store as editorStore } from '../../store';
25
18
  import {
26
19
  TEMPLATE_POST_TYPE,
27
20
  TEMPLATE_PART_POST_TYPE,
28
- PATTERN_POST_TYPE,
29
21
  } from '../../store/constants';
30
- import { PrivatePostExcerptPanel } from '../post-excerpt/panel';
31
- import PostLastEditedPanel from '../post-last-edited-panel';
32
22
  import { unlock } from '../../lock-unlock';
33
- import TemplateAreas from '../template-areas';
34
23
 
35
- export default function PostCardPanel( { className, actions } ) {
36
- const { title, showPostContentPanels, icon, postType } = useSelect(
37
- ( select ) => {
38
- const {
39
- getEditedPostAttribute,
40
- getCurrentPostType,
41
- getCurrentPostId,
42
- __experimentalGetTemplateInfo,
43
- } = select( editorStore );
44
- const { getEditedEntityRecord } = select( coreStore );
45
- const _type = getCurrentPostType();
46
- const _id = getCurrentPostId();
47
- const _record = getEditedEntityRecord( 'postType', _type, _id );
48
- const _templateInfo =
49
- [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(
50
- _type
51
- ) && __experimentalGetTemplateInfo( _record );
52
- return {
53
- title:
54
- _templateInfo?.title || getEditedPostAttribute( 'title' ),
55
- id: _id,
56
- postType: _type,
57
- icon: unlock( select( editorStore ) ).getPostIcon( _type, {
58
- area: _record?.area,
59
- } ),
60
- // Post excerpt panel and Last Edited info are rendered in different place depending on the post type.
61
- // So we cannot make this check inside the PostExcerpt or PostLastEditedPanel component based on the current edited entity.
62
- showPostContentPanels: [
63
- TEMPLATE_POST_TYPE,
64
- TEMPLATE_PART_POST_TYPE,
65
- PATTERN_POST_TYPE,
66
- ].includes( _type ),
67
- };
68
- },
69
- []
70
- );
24
+ export default function PostCardPanel( { actions } ) {
25
+ const { title, icon } = useSelect( ( select ) => {
26
+ const {
27
+ getEditedPostAttribute,
28
+ getCurrentPostType,
29
+ getCurrentPostId,
30
+ __experimentalGetTemplateInfo,
31
+ } = select( editorStore );
32
+ const { getEditedEntityRecord } = select( coreStore );
33
+ const _type = getCurrentPostType();
34
+ const _id = getCurrentPostId();
35
+ const _record = getEditedEntityRecord( 'postType', _type, _id );
36
+ const _templateInfo =
37
+ [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( _type ) &&
38
+ __experimentalGetTemplateInfo( _record );
39
+ return {
40
+ title: _templateInfo?.title || getEditedPostAttribute( 'title' ),
41
+ icon: unlock( select( editorStore ) ).getPostIcon( _type, {
42
+ area: _record?.area,
43
+ } ),
44
+ };
45
+ }, [] );
71
46
  return (
72
- <PanelBody>
73
- <div
74
- className={ classnames( 'editor-post-card-panel', className, {
75
- 'has-description': showPostContentPanels,
76
- } ) }
47
+ <div className="editor-post-card-panel">
48
+ <HStack
49
+ spacing={ 2 }
50
+ className="editor-post-card-panel__header"
51
+ align="flex-start"
77
52
  >
78
- <HStack
79
- spacing={ 2 }
80
- className="editor-post-card-panel__header"
81
- align="flex-start"
53
+ <Icon className="editor-post-card-panel__icon" icon={ icon } />
54
+ <Text
55
+ numberOfLines={ 2 }
56
+ truncate
57
+ className="editor-post-card-panel__title"
58
+ weight={ 500 }
59
+ as="h2"
82
60
  >
83
- <Icon
84
- className="editor-post-card-panel__icon"
85
- icon={ icon }
86
- />
87
- <Text
88
- numberOfLines={ 2 }
89
- truncate
90
- className="editor-post-card-panel__title"
91
- weight={ 500 }
92
- as="h2"
93
- >
94
- { title ? decodeEntities( title ) : __( 'No Title' ) }
95
- </Text>
96
- { actions }
97
- </HStack>
98
- <VStack className="editor-post-card-panel__content">
99
- { showPostContentPanels && (
100
- <VStack
101
- className="editor-post-card-panel__description"
102
- spacing={ 2 }
103
- >
104
- <PrivatePostExcerptPanel />
105
- <PostLastEditedPanel />
106
- </VStack>
107
- ) }
108
- { postType === TEMPLATE_POST_TYPE && <TemplateAreas /> }
109
- </VStack>
110
- </div>
111
- </PanelBody>
61
+ { title ? decodeEntities( title ) : __( 'No Title' ) }
62
+ </Text>
63
+ { actions }
64
+ </HStack>
65
+ </div>
112
66
  );
113
67
  }
@@ -2,7 +2,11 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { CheckboxControl } from '@wordpress/components';
5
+ import {
6
+ RadioControl,
7
+ __experimentalText as Text,
8
+ __experimentalVStack as VStack,
9
+ } from '@wordpress/components';
6
10
  import { useDispatch, useSelect } from '@wordpress/data';
7
11
 
8
12
  /**
@@ -10,6 +14,34 @@ import { useDispatch, useSelect } from '@wordpress/data';
10
14
  */
11
15
  import { store as editorStore } from '../../store';
12
16
 
17
+ const COMMENT_OPTIONS = [
18
+ {
19
+ label: (
20
+ <>
21
+ { __( 'Open' ) }
22
+ <Text variant="muted" size={ 12 }>
23
+ { __( 'Visitors can add new comments and replies.' ) }
24
+ </Text>
25
+ </>
26
+ ),
27
+ value: 'open',
28
+ },
29
+ {
30
+ label: (
31
+ <>
32
+ { __( 'Closed' ) }
33
+ <Text variant="muted" size={ 12 }>
34
+ { __( 'Visitors cannot add new comments or replies.' ) }
35
+ </Text>
36
+ <Text variant="muted" size={ 12 }>
37
+ { __( 'Existing comments remain visible.' ) }
38
+ </Text>
39
+ </>
40
+ ),
41
+ value: 'closed',
42
+ },
43
+ ];
44
+
13
45
  function PostComments() {
14
46
  const commentStatus = useSelect(
15
47
  ( select ) =>
@@ -18,18 +50,24 @@ function PostComments() {
18
50
  []
19
51
  );
20
52
  const { editPost } = useDispatch( editorStore );
21
- const onToggleComments = () =>
53
+ const handleStatus = ( newCommentStatus ) =>
22
54
  editPost( {
23
- comment_status: commentStatus === 'open' ? 'closed' : 'open',
55
+ comment_status: newCommentStatus,
24
56
  } );
25
57
 
26
58
  return (
27
- <CheckboxControl
28
- __nextHasNoMarginBottom
29
- label={ __( 'Allow comments' ) }
30
- checked={ commentStatus === 'open' }
31
- onChange={ onToggleComments }
32
- />
59
+ <form>
60
+ <VStack spacing={ 4 }>
61
+ <RadioControl
62
+ className="editor-change-status__options"
63
+ hideLabelFromVision
64
+ label={ __( 'Comment status' ) }
65
+ options={ COMMENT_OPTIONS }
66
+ onChange={ handleStatus }
67
+ selected={ commentStatus }
68
+ />
69
+ </VStack>
70
+ </form>
33
71
  );
34
72
  }
35
73
 
@@ -2,8 +2,16 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { PanelBody, PanelRow } from '@wordpress/components';
6
- import { useDispatch, useSelect } from '@wordpress/data';
5
+ import {
6
+ Dropdown,
7
+ Button,
8
+ __experimentalVStack as VStack,
9
+ __experimentalText as Text,
10
+ } from '@wordpress/components';
11
+ import { useSelect } from '@wordpress/data';
12
+ import { useState, useMemo } from '@wordpress/element';
13
+ import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
14
+ import { store as coreStore } from '@wordpress/core-data';
7
15
 
8
16
  /**
9
17
  * Internal dependencies
@@ -12,50 +20,119 @@ import { store as editorStore } from '../../store';
12
20
  import PostTypeSupportCheck from '../post-type-support-check';
13
21
  import PostComments from '../post-comments';
14
22
  import PostPingbacks from '../post-pingbacks';
23
+ import PostPanelRow from '../post-panel-row';
15
24
 
16
25
  const PANEL_NAME = 'discussion-panel';
17
26
 
18
- function DiscussionPanel() {
19
- const { isEnabled, isOpened } = useSelect( ( select ) => {
20
- const { isEditorPanelEnabled, isEditorPanelOpened } =
21
- select( editorStore );
27
+ function ModalContents( { onClose } ) {
28
+ return (
29
+ <div className="editor-post-discussion">
30
+ <InspectorPopoverHeader
31
+ title={ __( 'Discussion' ) }
32
+ onClose={ onClose }
33
+ />
34
+ <VStack spacing={ 4 }>
35
+ <PostTypeSupportCheck supportKeys="comments">
36
+ <PostComments />
37
+ </PostTypeSupportCheck>
38
+ <PostTypeSupportCheck supportKeys="trackbacks">
39
+ <PostPingbacks />
40
+ </PostTypeSupportCheck>
41
+ </VStack>
42
+ </div>
43
+ );
44
+ }
45
+
46
+ function PostDiscussionToggle( { isOpen, onClick } ) {
47
+ const {
48
+ commentStatus,
49
+ pingStatus,
50
+ commentsSupported,
51
+ trackbacksSupported,
52
+ } = useSelect( ( select ) => {
53
+ const { getEditedPostAttribute } = select( editorStore );
54
+ const { getPostType } = select( coreStore );
55
+ const postType = getPostType( getEditedPostAttribute( 'type' ) );
22
56
  return {
23
- isEnabled: isEditorPanelEnabled( PANEL_NAME ),
24
- isOpened: isEditorPanelOpened( PANEL_NAME ),
57
+ commentStatus: getEditedPostAttribute( 'comment_status' ) ?? 'open',
58
+ pingStatus: getEditedPostAttribute( 'ping_status' ) ?? 'open',
59
+ commentsSupported: !! postType.supports.comments,
60
+ trackbacksSupported: !! postType.supports.trackbacks,
25
61
  };
26
62
  }, [] );
27
-
28
- const { toggleEditorPanelOpened } = useDispatch( editorStore );
29
-
30
- if ( ! isEnabled ) {
31
- return null;
63
+ let label;
64
+ if ( commentStatus === 'open' ) {
65
+ if ( pingStatus === 'open' ) {
66
+ label = __( 'Open' );
67
+ } else {
68
+ label = trackbacksSupported ? __( 'Comments only' ) : __( 'Open' );
69
+ }
70
+ } else if ( pingStatus === 'open' ) {
71
+ label = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );
72
+ } else {
73
+ label = __( 'Closed' );
32
74
  }
33
-
34
75
  return (
35
- <PanelBody
36
- title={ __( 'Discussion' ) }
37
- opened={ isOpened }
38
- onToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }
76
+ <Button
77
+ size="compact"
78
+ className="editor-post-discussion__panel-toggle"
79
+ variant="tertiary"
80
+ aria-label={ __( 'Change discussion options' ) }
81
+ aria-expanded={ isOpen }
82
+ onClick={ onClick }
39
83
  >
40
- <PostTypeSupportCheck supportKeys="comments">
41
- <PanelRow>
42
- <PostComments />
43
- </PanelRow>
44
- </PostTypeSupportCheck>
45
-
46
- <PostTypeSupportCheck supportKeys="trackbacks">
47
- <PanelRow>
48
- <PostPingbacks />
49
- </PanelRow>
50
- </PostTypeSupportCheck>
51
- </PanelBody>
84
+ <Text>{ label }</Text>
85
+ </Button>
52
86
  );
53
87
  }
54
88
 
55
89
  export default function PostDiscussionPanel() {
90
+ const { isEnabled } = useSelect( ( select ) => {
91
+ const { isEditorPanelEnabled } = select( editorStore );
92
+ return {
93
+ isEnabled: isEditorPanelEnabled( PANEL_NAME ),
94
+ };
95
+ }, [] );
96
+
97
+ // Use internal state instead of a ref to make sure that the component
98
+ // re-renders when the popover's anchor updates.
99
+ const [ popoverAnchor, setPopoverAnchor ] = useState( null );
100
+ // Memoize popoverProps to avoid returning a new object every time.
101
+ const popoverProps = useMemo(
102
+ () => ( {
103
+ // Anchor the popover to the middle of the entire row so that it doesn't
104
+ // move around when the label changes.
105
+ anchor: popoverAnchor,
106
+ placement: 'left-start',
107
+ offset: 36,
108
+ shift: true,
109
+ } ),
110
+ [ popoverAnchor ]
111
+ );
112
+
113
+ if ( ! isEnabled ) {
114
+ return null;
115
+ }
116
+
56
117
  return (
57
118
  <PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>
58
- <DiscussionPanel />
119
+ <PostPanelRow label={ __( 'Discussion' ) } ref={ setPopoverAnchor }>
120
+ <Dropdown
121
+ popoverProps={ popoverProps }
122
+ className="editor-post-discussion__panel-dropdown"
123
+ contentClassName="editor-post-discussion__panel-dialog"
124
+ focusOnMount
125
+ renderToggle={ ( { isOpen, onToggle } ) => (
126
+ <PostDiscussionToggle
127
+ isOpen={ isOpen }
128
+ onClick={ onToggle }
129
+ />
130
+ ) }
131
+ renderContent={ ( { onClose } ) => (
132
+ <ModalContents onClose={ onClose } />
133
+ ) }
134
+ />
135
+ </PostPanelRow>
59
136
  </PostTypeSupportCheck>
60
137
  );
61
138
  }
@@ -0,0 +1,26 @@
1
+ .editor-post-discussion__panel-dialog .editor-post-discussion {
2
+ // sidebar width - popover padding - form margin
3
+ min-width: $sidebar-width - $grid-unit-20 - $grid-unit-20;
4
+ margin: $grid-unit-10;
5
+
6
+ .components-radio-control__option {
7
+ align-items: flex-start;
8
+ }
9
+
10
+ .components-radio-control__label .components-text {
11
+ display: block;
12
+ margin-top: $grid-unit-05;
13
+ }
14
+ }
15
+ .editor-post-discussion__panel-toggle {
16
+ &.components-button {
17
+ height: auto;
18
+ }
19
+ .components-text {
20
+ color: inherit;
21
+ }
22
+ }
23
+
24
+ .editor-post-discussion__panel-dialog .components-popover__content {
25
+ min-width: 320px;
26
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -194,7 +194,7 @@ function PrivateExcerpt() {
194
194
  ref={ setPopoverAnchor }
195
195
  renderToggle={ ( { onToggle } ) => (
196
196
  <Button
197
- className={ classnames(
197
+ className={ clsx(
198
198
  'editor-post-excerpt__dropdown__trigger',
199
199
  { 'has-excerpt': !! excerpt }
200
200
  ) }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { PanelRow } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostFormatForm from './';
10
+ import PostFormatCheck from './check';
11
+
12
+ export function PostFormat() {
13
+ return (
14
+ <PostFormatCheck>
15
+ <PanelRow className="editor-post-format__panel">
16
+ <PostFormatForm />
17
+ </PanelRow>
18
+ </PostFormatCheck>
19
+ );
20
+ }
21
+
22
+ export default PostFormat;
@@ -1,3 +1,9 @@
1
1
  [class].editor-post-format__suggestion {
2
2
  margin: $grid-unit-05 0 0 0;
3
3
  }
4
+
5
+ .editor-post-format__panel {
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: stretch;
9
+ }
@@ -21,7 +21,11 @@ function setupDataMock( id, count ) {
21
21
  getCurrentPostLastRevisionId: () => id,
22
22
  getCurrentPostRevisionsCount: () => count,
23
23
  getEditedPostAttribute: () => null,
24
- getPostType: () => null,
24
+ getPostType: () => ( {
25
+ supports: {
26
+ revisions: true,
27
+ },
28
+ } ),
25
29
  } ) )
26
30
  );
27
31
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -12,7 +12,7 @@ import { forwardRef } from '@wordpress/element';
12
12
  const PostPanelRow = forwardRef( ( { className, label, children }, ref ) => {
13
13
  return (
14
14
  <HStack
15
- className={ classnames( 'editor-post-panel__row', className ) }
15
+ className={ clsx( 'editor-post-panel__row', className ) }
16
16
  ref={ ref }
17
17
  >
18
18
  { label && (
@@ -0,0 +1,19 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { __experimentalVStack as VStack } from '@wordpress/components';
10
+
11
+ function PostPanelSection( { className, children } ) {
12
+ return (
13
+ <VStack className={ clsx( 'editor-post-panel__section', className ) }>
14
+ { children }
15
+ </VStack>
16
+ );
17
+ }
18
+
19
+ export default PostPanelSection;
@@ -0,0 +1,3 @@
1
+ .editor-post-panel__section {
2
+ padding: $grid-unit-20;
3
+ }
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { CheckboxControl } from '@wordpress/components';
5
+ import { CheckboxControl, ExternalLink } from '@wordpress/components';
6
6
  import { useDispatch, useSelect } from '@wordpress/data';
7
7
 
8
8
  /**
@@ -26,9 +26,18 @@ function PostPingbacks() {
26
26
  return (
27
27
  <CheckboxControl
28
28
  __nextHasNoMarginBottom
29
- label={ __( 'Allow pingbacks & trackbacks' ) }
29
+ label={ __( 'Enable pingbacks & trackbacks' ) }
30
30
  checked={ pingStatus === 'open' }
31
31
  onChange={ onTogglePingback }
32
+ help={
33
+ <ExternalLink
34
+ href={ __(
35
+ 'https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'
36
+ ) }
37
+ >
38
+ { __( 'Learn more about pingbacks & trackbacks' ) }
39
+ </ExternalLink>
40
+ }
32
41
  />
33
42
  );
34
43
  }
@@ -119,6 +119,11 @@
119
119
  .editor-post-visibility__dialog-legend {
120
120
  display: none;
121
121
  }
122
+
123
+ .components-panel__body-title .components-button {
124
+ align-items: flex-start;
125
+ text-wrap: pretty;
126
+ }
122
127
  }
123
128
 
124
129
  .post-publish-panel__postpublish .components-panel__body {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -141,7 +141,7 @@ export default function PostSavedState( { forceIsDirty } ) {
141
141
  <Button
142
142
  className={
143
143
  isSaveable || isSaving
144
- ? classnames( {
144
+ ? clsx( {
145
145
  'editor-post-save-draft': ! isSavedState,
146
146
  'editor-post-saved-state': isSavedState,
147
147
  'is-saving': isSaving,
@@ -0,0 +1,22 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { PanelRow } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostSlugForm from './';
10
+ import PostSlugCheck from './check';
11
+
12
+ export function PostSlug() {
13
+ return (
14
+ <PostSlugCheck>
15
+ <PanelRow className="editor-post-slug">
16
+ <PostSlugForm />
17
+ </PanelRow>
18
+ </PostSlugCheck>
19
+ );
20
+ }
21
+
22
+ export default PostSlug;
@@ -0,0 +1,5 @@
1
+ .editor-post-slug {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: stretch;
5
+ }
@@ -26,7 +26,11 @@ describe( 'PostSlug', () => {
26
26
 
27
27
  useSelect.mockImplementation( ( mapSelect ) =>
28
28
  mapSelect( () => ( {
29
- getPostType: () => null,
29
+ getPostType: () => ( {
30
+ supports: {
31
+ slug: true,
32
+ },
33
+ } ),
30
34
  getEditedPostAttribute: () => 'post',
31
35
  getEditedPostSlug: () => '1',
32
36
  } ) )
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -53,15 +53,15 @@ function PostStatusLabel( { canEdit } ) {
53
53
  statusLabel = __( 'Draft' );
54
54
  break;
55
55
  case 'pending':
56
- statusLabel = __( 'Pending review' );
56
+ statusLabel = __( 'Pending' );
57
57
  break;
58
58
  case 'private':
59
- statusLabel = __( 'Published privately' );
59
+ statusLabel = __( 'Private' );
60
60
  break;
61
61
  }
62
62
  return (
63
63
  <Text
64
- className={ classnames( 'editor-post-status-label', {
64
+ className={ clsx( 'editor-post-status-label', {
65
65
  [ ` has-status-${ status }` ]: !! status,
66
66
  'has-icon': canEdit,
67
67
  } ) }