@wordpress/editor 14.0.3 → 14.2.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 (279) hide show
  1. package/CHANGELOG.md +16 -12
  2. package/README.md +189 -24
  3. package/build/components/create-template-part-modal/index.js +2 -0
  4. package/build/components/create-template-part-modal/index.js.map +1 -1
  5. package/build/components/document-bar/index.js +11 -4
  6. package/build/components/document-bar/index.js.map +1 -1
  7. package/build/components/editor/index.js +18 -24
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/editor-interface/index.js +3 -1
  10. package/build/components/editor-interface/index.js.map +1 -1
  11. package/build/components/entities-saved-states/hooks/use-is-dirty.js +9 -0
  12. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  13. package/build/components/entities-saved-states/index.js +28 -0
  14. package/build/components/entities-saved-states/index.js.map +1 -1
  15. package/build/components/global-keyboard-shortcuts/index.js +1 -1
  16. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  17. package/build/components/header/index.js +6 -2
  18. package/build/components/header/index.js.map +1 -1
  19. package/build/components/index.js +15 -0
  20. package/build/components/index.js.map +1 -1
  21. package/build/components/post-actions/actions.js +286 -263
  22. package/build/components/post-actions/actions.js.map +1 -1
  23. package/build/components/post-actions/index.js +2 -0
  24. package/build/components/post-actions/index.js.map +1 -1
  25. package/build/components/post-publish-button/index.js +4 -0
  26. package/build/components/post-publish-button/index.js.map +1 -1
  27. package/build/components/post-publish-button/label.js +5 -0
  28. package/build/components/post-publish-button/label.js.map +1 -1
  29. package/build/components/post-publish-panel/index.js +4 -0
  30. package/build/components/post-publish-panel/index.js.map +1 -1
  31. package/build/components/post-slug/check.js +8 -1
  32. package/build/components/post-slug/check.js.map +1 -1
  33. package/build/components/post-slug/index.js +6 -0
  34. package/build/components/post-slug/index.js.map +1 -1
  35. package/build/components/post-status/index.js +2 -1
  36. package/build/components/post-status/index.js.map +1 -1
  37. package/build/components/post-sticky/check.js +8 -0
  38. package/build/components/post-sticky/check.js.map +1 -1
  39. package/build/components/post-sticky/index.js +13 -13
  40. package/build/components/post-sticky/index.js.map +1 -1
  41. package/build/components/post-switch-to-draft-button/index.js +11 -2
  42. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  43. package/build/components/post-sync-status/index.js +5 -1
  44. package/build/components/post-sync-status/index.js.map +1 -1
  45. package/build/components/post-taxonomies/check.js +8 -0
  46. package/build/components/post-taxonomies/check.js.map +1 -1
  47. package/build/components/post-taxonomies/flat-term-selector.js +14 -2
  48. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  49. package/build/components/post-taxonomies/index.js +9 -0
  50. package/build/components/post-taxonomies/index.js.map +1 -1
  51. package/build/components/post-taxonomies/panel.js +10 -0
  52. package/build/components/post-taxonomies/panel.js.map +1 -1
  53. package/build/components/post-template/create-new-template-modal.js +2 -0
  54. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  55. package/build/components/post-title/index.js +4 -8
  56. package/build/components/post-title/index.js.map +1 -1
  57. package/build/components/post-title/post-title-raw.js +3 -7
  58. package/build/components/post-title/post-title-raw.js.map +1 -1
  59. package/build/components/post-trash/check.js +8 -0
  60. package/build/components/post-trash/check.js.map +1 -1
  61. package/build/components/post-trash/index.js +5 -1
  62. package/build/components/post-trash/index.js.map +1 -1
  63. package/build/components/provider/index.js +18 -15
  64. package/build/components/provider/index.js.map +1 -1
  65. package/build/components/sidebar/index.js +2 -1
  66. package/build/components/sidebar/index.js.map +1 -1
  67. package/build/components/sidebar/post-summary.js +2 -3
  68. package/build/components/sidebar/post-summary.js.map +1 -1
  69. package/build/components/table-of-contents/index.js +11 -0
  70. package/build/components/table-of-contents/index.js.map +1 -1
  71. package/build/components/template-part-content-panel/index.js +70 -0
  72. package/build/components/template-part-content-panel/index.js.map +1 -0
  73. package/build/components/template-part-menu-items/convert-to-regular.js +38 -0
  74. package/build/components/template-part-menu-items/convert-to-regular.js.map +1 -0
  75. package/build/components/template-part-menu-items/convert-to-template-part.js +77 -0
  76. package/build/components/template-part-menu-items/convert-to-template-part.js.map +1 -0
  77. package/build/components/template-part-menu-items/index.js +67 -0
  78. package/build/components/template-part-menu-items/index.js.map +1 -0
  79. package/build/components/template-part-menu-items/index.native.js +10 -0
  80. package/build/components/template-part-menu-items/index.native.js.map +1 -0
  81. package/build/components/theme-support-check/index.js +9 -0
  82. package/build/components/theme-support-check/index.js.map +1 -1
  83. package/build/components/time-to-read/index.js +6 -0
  84. package/build/components/time-to-read/index.js.map +1 -1
  85. package/build/components/word-count/index.js +5 -1
  86. package/build/components/word-count/index.js.map +1 -1
  87. package/build/dataviews/api.js +61 -0
  88. package/build/dataviews/api.js.map +1 -0
  89. package/build/dataviews/store/private-actions.js +28 -0
  90. package/build/dataviews/store/private-actions.js.map +1 -0
  91. package/build/dataviews/store/private-selectors.js +20 -0
  92. package/build/dataviews/store/private-selectors.js.map +1 -0
  93. package/build/dataviews/store/reducer.js +36 -0
  94. package/build/dataviews/store/reducer.js.map +1 -0
  95. package/build/index.js +12 -0
  96. package/build/index.js.map +1 -1
  97. package/build/private-apis.js +0 -6
  98. package/build/private-apis.js.map +1 -1
  99. package/build/private-apis.native.js +0 -2
  100. package/build/private-apis.native.js.map +1 -1
  101. package/build/store/private-actions.js +21 -0
  102. package/build/store/private-actions.js.map +1 -1
  103. package/build/store/private-selectors.js +5 -0
  104. package/build/store/private-selectors.js.map +1 -1
  105. package/build/store/reducer.js +4 -1
  106. package/build/store/reducer.js.map +1 -1
  107. package/build-module/components/create-template-part-modal/index.js +2 -0
  108. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  109. package/build-module/components/document-bar/index.js +11 -4
  110. package/build-module/components/document-bar/index.js.map +1 -1
  111. package/build-module/components/editor/index.js +19 -24
  112. package/build-module/components/editor/index.js.map +1 -1
  113. package/build-module/components/editor-interface/index.js +3 -1
  114. package/build-module/components/editor-interface/index.js.map +1 -1
  115. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +10 -0
  116. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  117. package/build-module/components/entities-saved-states/index.js +28 -0
  118. package/build-module/components/entities-saved-states/index.js.map +1 -1
  119. package/build-module/components/global-keyboard-shortcuts/index.js +1 -1
  120. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  121. package/build-module/components/header/index.js +6 -2
  122. package/build-module/components/header/index.js.map +1 -1
  123. package/build-module/components/index.js +16 -0
  124. package/build-module/components/index.js.map +1 -1
  125. package/build-module/components/post-actions/actions.js +286 -263
  126. package/build-module/components/post-actions/actions.js.map +1 -1
  127. package/build-module/components/post-actions/index.js +2 -0
  128. package/build-module/components/post-actions/index.js.map +1 -1
  129. package/build-module/components/post-publish-button/index.js +4 -0
  130. package/build-module/components/post-publish-button/index.js.map +1 -1
  131. package/build-module/components/post-publish-button/label.js +6 -0
  132. package/build-module/components/post-publish-button/label.js.map +1 -1
  133. package/build-module/components/post-publish-panel/index.js +4 -0
  134. package/build-module/components/post-publish-panel/index.js.map +1 -1
  135. package/build-module/components/post-slug/check.js +9 -0
  136. package/build-module/components/post-slug/check.js.map +1 -1
  137. package/build-module/components/post-slug/index.js +6 -0
  138. package/build-module/components/post-slug/index.js.map +1 -1
  139. package/build-module/components/post-status/index.js +2 -1
  140. package/build-module/components/post-status/index.js.map +1 -1
  141. package/build-module/components/post-sticky/check.js +9 -0
  142. package/build-module/components/post-sticky/check.js.map +1 -1
  143. package/build-module/components/post-sticky/index.js +15 -13
  144. package/build-module/components/post-sticky/index.js.map +1 -1
  145. package/build-module/components/post-switch-to-draft-button/index.js +10 -1
  146. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  147. package/build-module/components/post-sync-status/index.js +6 -0
  148. package/build-module/components/post-sync-status/index.js.map +1 -1
  149. package/build-module/components/post-taxonomies/check.js +9 -0
  150. package/build-module/components/post-taxonomies/check.js.map +1 -1
  151. package/build-module/components/post-taxonomies/flat-term-selector.js +14 -2
  152. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  153. package/build-module/components/post-taxonomies/index.js +9 -0
  154. package/build-module/components/post-taxonomies/index.js.map +1 -1
  155. package/build-module/components/post-taxonomies/panel.js +10 -0
  156. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  157. package/build-module/components/post-template/create-new-template-modal.js +2 -0
  158. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  159. package/build-module/components/post-title/index.js +4 -8
  160. package/build-module/components/post-title/index.js.map +1 -1
  161. package/build-module/components/post-title/post-title-raw.js +3 -7
  162. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  163. package/build-module/components/post-trash/check.js +9 -0
  164. package/build-module/components/post-trash/check.js.map +1 -1
  165. package/build-module/components/post-trash/index.js +6 -0
  166. package/build-module/components/post-trash/index.js.map +1 -1
  167. package/build-module/components/provider/index.js +18 -15
  168. package/build-module/components/provider/index.js.map +1 -1
  169. package/build-module/components/sidebar/index.js +2 -1
  170. package/build-module/components/sidebar/index.js.map +1 -1
  171. package/build-module/components/sidebar/post-summary.js +2 -3
  172. package/build-module/components/sidebar/post-summary.js.map +1 -1
  173. package/build-module/components/table-of-contents/index.js +11 -0
  174. package/build-module/components/table-of-contents/index.js.map +1 -1
  175. package/build-module/components/template-part-content-panel/index.js +63 -0
  176. package/build-module/components/template-part-content-panel/index.js.map +1 -0
  177. package/build-module/components/template-part-menu-items/convert-to-regular.js +31 -0
  178. package/build-module/components/template-part-menu-items/convert-to-regular.js.map +1 -0
  179. package/build-module/components/template-part-menu-items/convert-to-template-part.js +71 -0
  180. package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -0
  181. package/build-module/components/template-part-menu-items/index.js +59 -0
  182. package/build-module/components/template-part-menu-items/index.js.map +1 -0
  183. package/build-module/components/template-part-menu-items/index.native.js +4 -0
  184. package/build-module/components/template-part-menu-items/index.native.js.map +1 -0
  185. package/build-module/components/theme-support-check/index.js +10 -0
  186. package/build-module/components/theme-support-check/index.js.map +1 -1
  187. package/build-module/components/time-to-read/index.js +6 -0
  188. package/build-module/components/time-to-read/index.js.map +1 -1
  189. package/build-module/components/word-count/index.js +6 -0
  190. package/build-module/components/word-count/index.js.map +1 -1
  191. package/build-module/dataviews/api.js +54 -0
  192. package/build-module/dataviews/api.js.map +1 -0
  193. package/build-module/dataviews/store/private-actions.js +21 -0
  194. package/build-module/dataviews/store/private-actions.js.map +1 -0
  195. package/build-module/dataviews/store/private-selectors.js +14 -0
  196. package/build-module/dataviews/store/private-selectors.js.map +1 -0
  197. package/build-module/dataviews/store/reducer.js +29 -0
  198. package/build-module/dataviews/store/reducer.js.map +1 -0
  199. package/build-module/index.js +1 -0
  200. package/build-module/index.js.map +1 -1
  201. package/build-module/private-apis.js +0 -6
  202. package/build-module/private-apis.js.map +1 -1
  203. package/build-module/private-apis.native.js +0 -2
  204. package/build-module/private-apis.native.js.map +1 -1
  205. package/build-module/store/private-actions.js +1 -0
  206. package/build-module/store/private-actions.js.map +1 -1
  207. package/build-module/store/private-selectors.js +4 -0
  208. package/build-module/store/private-selectors.js.map +1 -1
  209. package/build-module/store/reducer.js +3 -1
  210. package/build-module/store/reducer.js.map +1 -1
  211. package/build-style/style-rtl.css +10 -9
  212. package/build-style/style.css +10 -9
  213. package/build-types/dataviews/store/private-actions.d.ts +17 -0
  214. package/build-types/dataviews/store/private-actions.d.ts.map +1 -0
  215. package/build-types/dataviews/store/private-selectors.d.ts +10 -0
  216. package/build-types/dataviews/store/private-selectors.d.ts.map +1 -0
  217. package/build-types/dataviews/store/reducer.d.ts +11 -0
  218. package/build-types/dataviews/store/reducer.d.ts.map +1 -0
  219. package/package.json +35 -35
  220. package/src/components/create-template-part-modal/index.js +2 -0
  221. package/src/components/create-template-part-modal/style.scss +0 -6
  222. package/src/components/document-bar/index.js +11 -4
  223. package/src/components/editor/index.js +23 -28
  224. package/src/components/editor-interface/index.js +2 -0
  225. package/src/components/entities-saved-states/hooks/use-is-dirty.js +9 -0
  226. package/src/components/entities-saved-states/index.js +26 -0
  227. package/src/components/global-keyboard-shortcuts/index.js +1 -1
  228. package/src/components/header/index.js +2 -1
  229. package/src/components/index.js +16 -0
  230. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -3
  231. package/src/components/post-actions/actions.js +376 -387
  232. package/src/components/post-actions/index.js +2 -0
  233. package/src/components/post-card-panel/style.scss +4 -0
  234. package/src/components/post-panel-row/style.scss +1 -1
  235. package/src/components/post-publish-button/index.js +3 -0
  236. package/src/components/post-publish-button/label.js +5 -0
  237. package/src/components/post-publish-panel/index.js +3 -0
  238. package/src/components/post-slug/check.js +8 -0
  239. package/src/components/post-slug/index.js +5 -0
  240. package/src/components/post-status/index.js +2 -0
  241. package/src/components/post-status/style.scss +5 -0
  242. package/src/components/post-sticky/check.js +8 -0
  243. package/src/components/post-sticky/index.js +14 -12
  244. package/src/components/post-sticky/style.scss +3 -2
  245. package/src/components/post-switch-to-draft-button/index.js +10 -1
  246. package/src/components/post-sync-status/index.js +5 -0
  247. package/src/components/post-taxonomies/check.js +8 -0
  248. package/src/components/post-taxonomies/flat-term-selector.js +13 -2
  249. package/src/components/post-taxonomies/index.js +8 -0
  250. package/src/components/post-taxonomies/panel.js +9 -0
  251. package/src/components/post-template/create-new-template-modal.js +2 -0
  252. package/src/components/post-title/index.js +2 -5
  253. package/src/components/post-title/post-title-raw.js +2 -5
  254. package/src/components/post-trash/check.js +8 -0
  255. package/src/components/post-trash/index.js +5 -0
  256. package/src/components/provider/index.js +17 -17
  257. package/src/components/sidebar/index.js +2 -0
  258. package/src/components/sidebar/post-summary.js +1 -3
  259. package/src/components/table-of-contents/index.js +10 -0
  260. package/src/components/template-part-content-panel/index.js +62 -0
  261. package/src/components/template-part-menu-items/convert-to-regular.js +32 -0
  262. package/src/components/template-part-menu-items/convert-to-template-part.js +75 -0
  263. package/src/components/template-part-menu-items/index.js +59 -0
  264. package/src/components/template-part-menu-items/index.native.js +3 -0
  265. package/src/components/theme-support-check/index.js +9 -0
  266. package/src/components/time-to-read/index.js +5 -0
  267. package/src/components/word-count/index.js +5 -0
  268. package/src/dataviews/api.js +55 -0
  269. package/src/dataviews/store/private-actions.ts +30 -0
  270. package/src/dataviews/store/private-selectors.ts +15 -0
  271. package/src/dataviews/store/reducer.ts +44 -0
  272. package/src/index.js +1 -0
  273. package/src/private-apis.js +0 -6
  274. package/src/private-apis.native.js +0 -2
  275. package/src/store/private-actions.js +1 -0
  276. package/src/store/private-selectors.js +5 -0
  277. package/src/store/reducer.js +2 -0
  278. package/tsconfig.json +36 -0
  279. package/tsconfig.tsbuildinfo +1 -0
@@ -123,6 +123,8 @@ function ActionWithModal( { action, item, ActionTrigger, onClose } ) {
123
123
  overlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(
124
124
  action.id
125
125
  ) }` }
126
+ focusOnMount="firstContentElement"
127
+ size="small"
126
128
  >
127
129
  <RenderModal
128
130
  items={ [ item ] }
@@ -36,6 +36,10 @@
36
36
 
37
37
  .editor-post-card-panel__icon.is-sync {
38
38
  fill: var(--wp-block-synced-color);
39
+
40
+ & + .editor-post-card-panel__title {
41
+ color: var(--wp-block-synced-color);
42
+ }
39
43
  }
40
44
 
41
45
  .editor-post-card-panel__title-badge {
@@ -6,7 +6,7 @@
6
6
  }
7
7
 
8
8
  .editor-post-panel__row-label {
9
- width: 30%;
9
+ width: 38%;
10
10
  flex-shrink: 0;
11
11
  min-height: $grid-unit-40;
12
12
  display: flex;
@@ -205,6 +205,9 @@ export class PostPublishButton extends Component {
205
205
  }
206
206
  }
207
207
 
208
+ /**
209
+ * Renders the publish button.
210
+ */
208
211
  export default compose( [
209
212
  withSelect( ( select ) => {
210
213
  const {
@@ -10,6 +10,11 @@ import { useViewportMatch } from '@wordpress/compose';
10
10
  */
11
11
  import { store as editorStore } from '../../store';
12
12
 
13
+ /**
14
+ * Renders the label for the publish button.
15
+ *
16
+ * @return {string} The label for the publish button.
17
+ */
13
18
  export default function PublishButtonLabel() {
14
19
  const isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );
15
20
  const {
@@ -131,6 +131,9 @@ export class PostPublishPanel extends Component {
131
131
  }
132
132
  }
133
133
 
134
+ /**
135
+ * Renders a panel for publishing a post.
136
+ */
134
137
  export default compose( [
135
138
  withSelect( ( select ) => {
136
139
  const { getPostType } = select( coreStore );
@@ -3,6 +3,14 @@
3
3
  */
4
4
  import PostTypeSupportCheck from '../post-type-support-check';
5
5
 
6
+ /**
7
+ * Wrapper component that renders its children only if the post type supports the slug.
8
+ *
9
+ * @param {Object} props Props.
10
+ * @param {Element} props.children Children to be rendered.
11
+ *
12
+ * @return {Component} The component to be rendered.
13
+ */
6
14
  export default function PostSlugCheck( { children } ) {
7
15
  return (
8
16
  <PostTypeSupportCheck supportKeys="slug">
@@ -58,6 +58,11 @@ function PostSlugControl() {
58
58
  );
59
59
  }
60
60
 
61
+ /**
62
+ * Renders the PostSlug component. It provide a control for editing the post slug.
63
+ *
64
+ * @return {Component} The component to be rendered.
65
+ */
61
66
  export default function PostSlug() {
62
67
  return (
63
68
  <PostSlugCheck>
@@ -27,6 +27,7 @@ import {
27
27
  NAVIGATION_POST_TYPE,
28
28
  } from '../../store/constants';
29
29
  import PostPanelRow from '../post-panel-row';
30
+ import PostSticky from '../post-sticky';
30
31
  import { PrivatePostSchedule } from '../post-schedule';
31
32
  import { store as editorStore } from '../../store';
32
33
 
@@ -281,6 +282,7 @@ export default function PostStatus() {
281
282
  ) }
282
283
  </VStack>
283
284
  ) }
285
+ <PostSticky />
284
286
  </VStack>
285
287
  </form>
286
288
  </>
@@ -41,4 +41,9 @@
41
41
  padding: 0;
42
42
  margin-bottom: $grid-unit-10;
43
43
  }
44
+
45
+ p.components-base-control__help:has(.components-checkbox-control__help) {
46
+ margin-top: $grid-unit-05;
47
+ }
48
+
44
49
  }
@@ -8,6 +8,14 @@ import { useSelect } from '@wordpress/data';
8
8
  */
9
9
  import { store as editorStore } from '../../store';
10
10
 
11
+ /**
12
+ * Wrapper component that renders its children only if post has a sticky action.
13
+ *
14
+ * @param {Object} props Props.
15
+ * @param {Element} props.children Children to be rendered.
16
+ *
17
+ * @return {Component} The component to be rendered or null if post type is not 'post' or hasStickyAction is false.
18
+ */
11
19
  export default function PostStickyCheck( { children } ) {
12
20
  const { hasStickyAction, postType } = useSelect( ( select ) => {
13
21
  const post = select( editorStore ).getCurrentPost();
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { ToggleControl, VisuallyHidden } from '@wordpress/components';
5
+ import { CheckboxControl } from '@wordpress/components';
6
6
  import { useDispatch, useSelect } from '@wordpress/data';
7
7
 
8
8
  /**
@@ -10,8 +10,12 @@ import { useDispatch, useSelect } from '@wordpress/data';
10
10
  */
11
11
  import PostStickyCheck from './check';
12
12
  import { store as editorStore } from '../../store';
13
- import PostPanelRow from '../post-panel-row';
14
13
 
14
+ /**
15
+ * Renders the PostSticky component. It provides a checkbox control for the sticky post feature.
16
+ *
17
+ * @return {Component} The component to be rendered.
18
+ */
15
19
  export default function PostSticky() {
16
20
  const postSticky = useSelect( ( select ) => {
17
21
  return (
@@ -22,16 +26,14 @@ export default function PostSticky() {
22
26
 
23
27
  return (
24
28
  <PostStickyCheck>
25
- <PostPanelRow label={ __( 'Sticky' ) }>
26
- <ToggleControl
27
- className="editor-post-sticky__toggle-control"
28
- label={
29
- <VisuallyHidden>{ __( 'Sticky' ) }</VisuallyHidden>
30
- }
31
- checked={ postSticky }
32
- onChange={ () => editPost( { sticky: ! postSticky } ) }
33
- />
34
- </PostPanelRow>
29
+ <CheckboxControl
30
+ className="editor-post-sticky__checkbox-control"
31
+ label={ __( 'Sticky' ) }
32
+ help={ __( 'Pin this post to the top of the blog' ) }
33
+ checked={ postSticky }
34
+ onChange={ () => editPost( { sticky: ! postSticky } ) }
35
+ __nextHasNoMarginBottom
36
+ />
35
37
  </PostStickyCheck>
36
38
  );
37
39
  }
@@ -1,3 +1,4 @@
1
- .editor-post-sticky__toggle-control {
2
- padding: 6px 12px;
1
+ .editor-post-sticky__checkbox-control {
2
+ border-top: $border-width solid $gray-200;
3
+ padding-top: $grid-unit-20;
3
4
  }
@@ -8,14 +8,23 @@ import {
8
8
  import { __ } from '@wordpress/i18n';
9
9
  import { useDispatch, useSelect } from '@wordpress/data';
10
10
  import { useState } from '@wordpress/element';
11
+ import deprecated from '@wordpress/deprecated';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
14
15
  */
15
16
  import { store as editorStore } from '../../store';
16
17
 
17
- // TODO: deprecate..
18
+ /**
19
+ * Renders a button component that allows the user to switch a post to draft status.
20
+ *
21
+ * @return {JSX.Element} The rendered component.
22
+ */
18
23
  export default function PostSwitchToDraftButton() {
24
+ deprecated( 'wp.editor.PostSwitchToDraftButton', {
25
+ since: '6.7',
26
+ version: '6.9',
27
+ } );
19
28
  const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
20
29
 
21
30
  const { editPost, savePost } = useDispatch( editorStore );
@@ -10,6 +10,11 @@ import { __, _x } from '@wordpress/i18n';
10
10
  import PostPanelRow from '../post-panel-row';
11
11
  import { store as editorStore } from '../../store';
12
12
 
13
+ /**
14
+ * Renders the sync status of a post.
15
+ *
16
+ * @return {JSX.Element|null} The rendered sync status component.
17
+ */
13
18
  export default function PostSyncStatus() {
14
19
  const { syncStatus, postType } = useSelect( ( select ) => {
15
20
  const { getEditedPostAttribute } = select( editorStore );
@@ -9,6 +9,14 @@ import { store as coreStore } from '@wordpress/core-data';
9
9
  */
10
10
  import { store as editorStore } from '../../store';
11
11
 
12
+ /**
13
+ * Renders the children components only if the current post type has taxonomies.
14
+ *
15
+ * @param {Object} props The component props.
16
+ * @param {Element} props.children The children components to render.
17
+ *
18
+ * @return {Component|null} The rendered children components or null if the current post type has no taxonomies.
19
+ */
12
20
  export default function PostTaxonomiesCheck( { children } ) {
13
21
  const hasTaxonomies = useSelect( ( select ) => {
14
22
  const postType = select( editorStore ).getCurrentPostType();
@@ -26,9 +26,12 @@ import MostUsedTerms from './most-used-terms';
26
26
  const EMPTY_ARRAY = [];
27
27
 
28
28
  /**
29
- * Module constants
29
+ * How the max suggestions limit was chosen:
30
+ * - Matches the `per_page` range set by the REST API.
31
+ * - Can't use "unbound" query. The `FormTokenField` needs a fixed number.
32
+ * - Matches default for `FormTokenField`.
30
33
  */
31
- const MAX_TERMS_SUGGESTIONS = 20;
34
+ const MAX_TERMS_SUGGESTIONS = 100;
32
35
  const DEFAULT_QUERY = {
33
36
  per_page: MAX_TERMS_SUGGESTIONS,
34
37
  _fields: 'id,name',
@@ -49,6 +52,14 @@ const termNamesToIds = ( names, terms ) => {
49
52
  .filter( ( id ) => id !== undefined );
50
53
  };
51
54
 
55
+ /**
56
+ * Renders a flat term selector component.
57
+ *
58
+ * @param {Object} props The component props.
59
+ * @param {string} props.slug The slug of the taxonomy.
60
+ *
61
+ * @return {JSX.Element} The rendered flat term selector component.
62
+ */
52
63
  export function FlatTermSelector( { slug } ) {
53
64
  const [ values, setValues ] = useState( [] );
54
65
  const [ search, setSearch ] = useState( '' );
@@ -43,4 +43,12 @@ export function PostTaxonomies( { taxonomyWrapper = identity } ) {
43
43
  } );
44
44
  }
45
45
 
46
+ /**
47
+ * Renders the taxonomies associated with a post.
48
+ *
49
+ * @param {Object} props The component props.
50
+ * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component.
51
+ *
52
+ * @return {Array} An array of JSX elements representing the visible taxonomies.
53
+ */
46
54
  export default PostTaxonomies;
@@ -63,4 +63,13 @@ function PostTaxonomies() {
63
63
  );
64
64
  }
65
65
 
66
+ /**
67
+ * Renders a panel for a specific taxonomy.
68
+ *
69
+ * @param {Object} props The component props.
70
+ * @param {Object} props.taxonomy The taxonomy object.
71
+ * @param {Element} props.children The child components.
72
+ *
73
+ * @return {Component} The rendered taxonomy panel.
74
+ */
66
75
  export default PostTaxonomies;
@@ -109,6 +109,8 @@ export default function CreateNewTemplateModal( { onClose } ) {
109
109
  <Modal
110
110
  title={ __( 'Create custom template' ) }
111
111
  onRequestClose={ cancel }
112
+ focusOnMount="firstContentElement"
113
+ size="small"
112
114
  >
113
115
  <form
114
116
  className="editor-post-template__create-form"
@@ -30,14 +30,12 @@ import usePostTitle from './use-post-title';
30
30
  import PostTypeSupportCheck from '../post-type-support-check';
31
31
 
32
32
  function PostTitle( _, forwardedRef ) {
33
- const { placeholder, hasFixedToolbar } = useSelect( ( select ) => {
33
+ const { placeholder } = useSelect( ( select ) => {
34
34
  const { getSettings } = select( blockEditorStore );
35
- const { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =
36
- getSettings();
35
+ const { titlePlaceholder } = getSettings();
37
36
 
38
37
  return {
39
38
  placeholder: titlePlaceholder,
40
- hasFixedToolbar: _hasFixedToolbar,
41
39
  };
42
40
  }, [] );
43
41
 
@@ -186,7 +184,6 @@ function PostTitle( _, forwardedRef ) {
186
184
  // This same block is used in both the visual and the code editor.
187
185
  const className = clsx( DEFAULT_CLASSNAMES, {
188
186
  'is-selected': isSelected,
189
- 'has-fixed-toolbar': hasFixedToolbar,
190
187
  } );
191
188
 
192
189
  return (
@@ -29,14 +29,12 @@ import usePostTitle from './use-post-title';
29
29
  * @return {Component} The rendered component.
30
30
  */
31
31
  function PostTitleRaw( _, forwardedRef ) {
32
- const { placeholder, hasFixedToolbar } = useSelect( ( select ) => {
32
+ const { placeholder } = useSelect( ( select ) => {
33
33
  const { getSettings } = select( blockEditorStore );
34
- const { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =
35
- getSettings();
34
+ const { titlePlaceholder } = getSettings();
36
35
 
37
36
  return {
38
37
  placeholder: titlePlaceholder,
39
- hasFixedToolbar: _hasFixedToolbar,
40
38
  };
41
39
  }, [] );
42
40
 
@@ -61,7 +59,6 @@ function PostTitleRaw( _, forwardedRef ) {
61
59
  // This same block is used in both the visual and the code editor.
62
60
  const className = clsx( DEFAULT_CLASSNAMES, {
63
61
  'is-selected': isSelected,
64
- 'has-fixed-toolbar': hasFixedToolbar,
65
62
  'is-raw-text': true,
66
63
  } );
67
64
 
@@ -9,6 +9,14 @@ import { store as coreStore } from '@wordpress/core-data';
9
9
  */
10
10
  import { store as editorStore } from '../../store';
11
11
 
12
+ /**
13
+ * Wrapper component that renders its children only if the post can trashed.
14
+ *
15
+ * @param {Object} props - The component props.
16
+ * @param {Element} props.children - The child components to render.
17
+ *
18
+ * @return {Component|null} The rendered child components or null if the post can not trashed.
19
+ */
12
20
  export default function PostTrashCheck( { children } ) {
13
21
  const { canTrashPost } = useSelect( ( select ) => {
14
22
  const { isEditedPostNew, getCurrentPostId, getCurrentPostType } =
@@ -14,6 +14,11 @@ import { useState } from '@wordpress/element';
14
14
  */
15
15
  import { store as editorStore } from '../../store';
16
16
 
17
+ /**
18
+ * Displays the Post Trash Button and Confirm Dialog in the Editor.
19
+ *
20
+ * @return {JSX.Element|null} The rendered PostTrash component.
21
+ */
17
22
  export default function PostTrash() {
18
23
  const { isNew, isDeleting, postId } = useSelect( ( select ) => {
19
24
  const store = select( editorStore );
@@ -33,6 +33,7 @@ import StartTemplateOptions from '../start-template-options';
33
33
  import EditorKeyboardShortcuts from '../global-keyboard-shortcuts';
34
34
  import PatternRenameModal from '../pattern-rename-modal';
35
35
  import PatternDuplicateModal from '../pattern-duplicate-modal';
36
+ import TemplatePartMenuItems from '../template-part-menu-items';
36
37
 
37
38
  const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
38
39
  const { PatternsMenuItems } = unlock( editPatternsPrivateApis );
@@ -160,8 +161,21 @@ export const ExperimentalEditorProvider = withRegistryProvider(
160
161
  BlockEditorProviderComponent = ExperimentalBlockEditorProvider,
161
162
  __unstableTemplate: template,
162
163
  } ) => {
163
- const mode = useSelect(
164
- ( select ) => select( editorStore ).getRenderingMode(),
164
+ const { editorSettings, selection, isReady, mode } = useSelect(
165
+ ( select ) => {
166
+ const {
167
+ getEditorSettings,
168
+ getEditorSelection,
169
+ getRenderingMode,
170
+ __unstableIsEditorReady,
171
+ } = select( editorStore );
172
+ return {
173
+ editorSettings: getEditorSettings(),
174
+ isReady: __unstableIsEditorReady(),
175
+ mode: getRenderingMode(),
176
+ selection: getEditorSelection(),
177
+ };
178
+ },
165
179
  []
166
180
  );
167
181
  const shouldRenderTemplate = !! template && mode !== 'post-only';
@@ -187,21 +201,6 @@ export const ExperimentalEditorProvider = withRegistryProvider(
187
201
  rootLevelPost.type,
188
202
  rootLevelPost.slug,
189
203
  ] );
190
- const { editorSettings, selection, isReady } = useSelect(
191
- ( select ) => {
192
- const {
193
- getEditorSettings,
194
- getEditorSelection,
195
- __unstableIsEditorReady,
196
- } = select( editorStore );
197
- return {
198
- editorSettings: getEditorSettings(),
199
- isReady: __unstableIsEditorReady(),
200
- selection: getEditorSelection(),
201
- };
202
- },
203
- []
204
- );
205
204
  const { id, type } = rootLevelPost;
206
205
  const blockEditorSettings = useBlockEditorSettings(
207
206
  editorSettings,
@@ -301,6 +300,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
301
300
  { ! settings.__unstableIsPreviewMode && (
302
301
  <>
303
302
  <PatternsMenuItems />
303
+ <TemplatePartMenuItems />
304
304
  <ContentOnlySettingsMenu />
305
305
  { mode === 'template-locked' && (
306
306
  <DisableNonPageContentBlocks />
@@ -30,6 +30,7 @@ import PostTaxonomiesPanel from '../post-taxonomies/panel';
30
30
  import PostTransformPanel from '../post-transform-panel';
31
31
  import SidebarHeader from './header';
32
32
  import TemplateContentPanel from '../template-content-panel';
33
+ import TemplatePartContentPanel from '../template-part-content-panel';
33
34
  import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';
34
35
  import { sidebars } from './constants';
35
36
  import { unlock } from '../../lock-unlock';
@@ -114,6 +115,7 @@ const SidebarContent = ( {
114
115
  { renderingMode !== 'post-only' && (
115
116
  <TemplateContentPanel />
116
117
  ) }
118
+ <TemplatePartContentPanel />
117
119
  <PostTransformPanel />
118
120
  <PostTaxonomiesPanel />
119
121
  <PatternOverridesPanel />
@@ -21,7 +21,6 @@ import PostLastEditedPanel from '../post-last-edited-panel';
21
21
  import PostPanelSection from '../post-panel-section';
22
22
  import PostSchedulePanel from '../post-schedule/panel';
23
23
  import PostStatusPanel from '../post-status';
24
- import PostStickyPanel from '../post-sticky';
25
24
  import PostSyncStatus from '../post-sync-status';
26
25
  import PostTemplatePanel from '../post-template/panel';
27
26
  import PostURLPanel from '../post-url/panel';
@@ -69,7 +68,7 @@ export default function PostSummary( { onActionPerformed } ) {
69
68
  <PostLastEditedPanel />
70
69
  </VStack>
71
70
  { ! isRemovedPostStatusPanel && (
72
- <VStack spacing={ 2 }>
71
+ <VStack spacing={ 4 }>
73
72
  <VStack spacing={ 1 }>
74
73
  <PostStatusPanel />
75
74
  <PostSchedulePanel />
@@ -84,7 +83,6 @@ export default function PostSummary( { onActionPerformed } ) {
84
83
  <PostsPerPage />
85
84
  <SiteDiscussion />
86
85
  <PostFormatPanel />
87
- <PostStickyPanel />
88
86
  </VStack>
89
87
  <TemplateAreas />
90
88
  { fills }
@@ -52,4 +52,14 @@ function TableOfContents(
52
52
  );
53
53
  }
54
54
 
55
+ /**
56
+ * Renders a table of contents component.
57
+ *
58
+ * @param {Object} props The component props.
59
+ * @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled.
60
+ * @param {boolean} props.repositionDropdown Whether to reposition the dropdown.
61
+ * @param {Element.ref} ref The component's ref.
62
+ *
63
+ * @return {JSX.Element} The rendered table of contents component.
64
+ */
55
65
  export default forwardRef( TableOfContents );
@@ -0,0 +1,62 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { useMemo } from '@wordpress/element';
6
+ import { store as blocksStore } from '@wordpress/blocks';
7
+ import {
8
+ store as blockEditorStore,
9
+ privateApis as blockEditorPrivateApis,
10
+ } from '@wordpress/block-editor';
11
+ import { PanelBody } from '@wordpress/components';
12
+ import { __ } from '@wordpress/i18n';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import { unlock } from '../../lock-unlock';
18
+ import { TEMPLATE_PART_POST_TYPE } from '../../store/constants';
19
+ import { store as editorStore } from '../../store';
20
+
21
+ const { BlockQuickNavigation } = unlock( blockEditorPrivateApis );
22
+
23
+ function TemplatePartContentPanelInner() {
24
+ const blockTypes = useSelect( ( select ) => {
25
+ const { getBlockTypes } = select( blocksStore );
26
+ return getBlockTypes();
27
+ }, [] );
28
+ const themeBlockNames = useMemo( () => {
29
+ return blockTypes
30
+ .filter( ( blockType ) => {
31
+ return blockType.category === 'theme';
32
+ } )
33
+ .map( ( { name } ) => name );
34
+ }, [ blockTypes ] );
35
+ const themeBlocks = useSelect(
36
+ ( select ) => {
37
+ const { getBlocksByName } = select( blockEditorStore );
38
+ return getBlocksByName( themeBlockNames );
39
+ },
40
+ [ themeBlockNames ]
41
+ );
42
+ if ( themeBlocks.length === 0 ) {
43
+ return null;
44
+ }
45
+ return (
46
+ <PanelBody title={ __( 'Content' ) }>
47
+ <BlockQuickNavigation clientIds={ themeBlocks } />
48
+ </PanelBody>
49
+ );
50
+ }
51
+
52
+ export default function TemplatePartContentPanel() {
53
+ const postType = useSelect( ( select ) => {
54
+ const { getCurrentPostType } = select( editorStore );
55
+ return getCurrentPostType();
56
+ }, [] );
57
+ if ( postType !== TEMPLATE_PART_POST_TYPE ) {
58
+ return null;
59
+ }
60
+
61
+ return <TemplatePartContentPanelInner />;
62
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect, useDispatch } from '@wordpress/data';
5
+ import { store as blockEditorStore } from '@wordpress/block-editor';
6
+ import { MenuItem } from '@wordpress/components';
7
+ import { __ } from '@wordpress/i18n';
8
+
9
+ export default function ConvertToRegularBlocks( { clientId, onClose } ) {
10
+ const { getBlocks } = useSelect( blockEditorStore );
11
+ const { replaceBlocks } = useDispatch( blockEditorStore );
12
+
13
+ const canRemove = useSelect(
14
+ ( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),
15
+ [ clientId ]
16
+ );
17
+
18
+ if ( ! canRemove ) {
19
+ return null;
20
+ }
21
+
22
+ return (
23
+ <MenuItem
24
+ onClick={ () => {
25
+ replaceBlocks( clientId, getBlocks( clientId ) );
26
+ onClose();
27
+ } }
28
+ >
29
+ { __( 'Detach' ) }
30
+ </MenuItem>
31
+ );
32
+ }