@wordpress/block-library 7.3.0 → 7.3.3

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 (140) hide show
  1. package/build/audio/edit.js +1 -1
  2. package/build/audio/edit.js.map +1 -1
  3. package/build/comment-template/edit.js +3 -1
  4. package/build/comment-template/edit.js.map +1 -1
  5. package/build/comment-template/hooks.js +14 -4
  6. package/build/comment-template/hooks.js.map +1 -1
  7. package/build/comments-pagination/edit.js +18 -1
  8. package/build/comments-pagination/edit.js.map +1 -1
  9. package/build/comments-query-loop/edit.js +2 -2
  10. package/build/comments-query-loop/edit.js.map +1 -1
  11. package/build/comments-title/edit.js +149 -0
  12. package/build/comments-title/edit.js.map +1 -0
  13. package/build/comments-title/index.js +101 -0
  14. package/build/comments-title/index.js.map +1 -0
  15. package/build/cover/transforms.js +33 -32
  16. package/build/cover/transforms.js.map +1 -1
  17. package/build/index.js +6 -4
  18. package/build/index.js.map +1 -1
  19. package/build/list/index.js +13 -2
  20. package/build/list/index.js.map +1 -1
  21. package/build/navigation/edit/index.js +17 -1
  22. package/build/navigation/edit/index.js.map +1 -1
  23. package/build/navigation/edit/navigation-menu-selector.js +7 -2
  24. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  25. package/build/post-comments/edit.js +141 -35
  26. package/build/post-comments/edit.js.map +1 -1
  27. package/build/post-comments/index.js +6 -4
  28. package/build/post-comments/index.js.map +1 -1
  29. package/build/post-comments-form/edit.js +22 -1
  30. package/build/post-comments-form/edit.js.map +1 -1
  31. package/build/post-comments-form/index.js +1 -0
  32. package/build/post-comments-form/index.js.map +1 -1
  33. package/build/post-featured-image/edit.js +19 -7
  34. package/build/post-featured-image/edit.js.map +1 -1
  35. package/build/query/edit/index.js +84 -22
  36. package/build/query/edit/index.js.map +1 -1
  37. package/build/query/edit/query-placeholder.js +7 -14
  38. package/build/query/edit/query-placeholder.js.map +1 -1
  39. package/build/query/edit/query-toolbar.js +6 -1
  40. package/build/query/edit/query-toolbar.js.map +1 -1
  41. package/build/query-no-results/edit.js +1 -1
  42. package/build/query-no-results/edit.js.map +1 -1
  43. package/build/quote/index.js +13 -2
  44. package/build/quote/index.js.map +1 -1
  45. package/build-module/audio/edit.js +1 -1
  46. package/build-module/audio/edit.js.map +1 -1
  47. package/build-module/comment-template/edit.js +3 -1
  48. package/build-module/comment-template/edit.js.map +1 -1
  49. package/build-module/comment-template/hooks.js +14 -4
  50. package/build-module/comment-template/hooks.js.map +1 -1
  51. package/build-module/comments-pagination/edit.js +19 -2
  52. package/build-module/comments-pagination/edit.js.map +1 -1
  53. package/build-module/comments-query-loop/edit.js +2 -2
  54. package/build-module/comments-query-loop/edit.js.map +1 -1
  55. package/build-module/comments-title/edit.js +133 -0
  56. package/build-module/comments-title/edit.js.map +1 -0
  57. package/build-module/comments-title/index.js +88 -0
  58. package/build-module/comments-title/index.js.map +1 -0
  59. package/build-module/cover/transforms.js +33 -32
  60. package/build-module/cover/transforms.js.map +1 -1
  61. package/build-module/index.js +5 -4
  62. package/build-module/index.js.map +1 -1
  63. package/build-module/list/index.js +9 -3
  64. package/build-module/list/index.js.map +1 -1
  65. package/build-module/navigation/edit/index.js +17 -1
  66. package/build-module/navigation/edit/index.js.map +1 -1
  67. package/build-module/navigation/edit/navigation-menu-selector.js +6 -2
  68. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  69. package/build-module/post-comments/edit.js +143 -38
  70. package/build-module/post-comments/edit.js.map +1 -1
  71. package/build-module/post-comments/index.js +6 -4
  72. package/build-module/post-comments/index.js.map +1 -1
  73. package/build-module/post-comments-form/edit.js +21 -1
  74. package/build-module/post-comments-form/edit.js.map +1 -1
  75. package/build-module/post-comments-form/index.js +1 -0
  76. package/build-module/post-comments-form/index.js.map +1 -1
  77. package/build-module/post-featured-image/edit.js +19 -7
  78. package/build-module/post-featured-image/edit.js.map +1 -1
  79. package/build-module/query/edit/index.js +87 -26
  80. package/build-module/query/edit/index.js.map +1 -1
  81. package/build-module/query/edit/query-placeholder.js +8 -15
  82. package/build-module/query/edit/query-placeholder.js.map +1 -1
  83. package/build-module/query/edit/query-toolbar.js +6 -1
  84. package/build-module/query/edit/query-toolbar.js.map +1 -1
  85. package/build-module/query-no-results/edit.js +1 -1
  86. package/build-module/query-no-results/edit.js.map +1 -1
  87. package/build-module/quote/index.js +9 -3
  88. package/build-module/quote/index.js.map +1 -1
  89. package/build-style/comments-title/editor-rtl.css +79 -0
  90. package/build-style/comments-title/editor.css +79 -0
  91. package/build-style/editor-rtl.css +51 -0
  92. package/build-style/editor.css +51 -0
  93. package/build-style/post-comments/editor-rtl.css +79 -0
  94. package/build-style/post-comments/editor.css +79 -0
  95. package/build-style/post-comments/style-rtl.css +1 -3
  96. package/build-style/post-comments/style.css +1 -3
  97. package/build-style/post-comments-form/editor-rtl.css +79 -0
  98. package/build-style/post-comments-form/editor.css +79 -0
  99. package/build-style/post-comments-form/style-rtl.css +9 -0
  100. package/build-style/post-comments-form/style.css +9 -0
  101. package/build-style/query/editor-rtl.css +39 -0
  102. package/build-style/query/editor.css +39 -0
  103. package/build-style/style-rtl.css +10 -3
  104. package/build-style/style.css +10 -3
  105. package/package.json +28 -28
  106. package/src/audio/edit.js +1 -1
  107. package/src/comment-edit-link/index.php +1 -4
  108. package/src/comment-reply-link/index.php +1 -4
  109. package/src/comment-template/edit.js +5 -2
  110. package/src/comment-template/hooks.js +15 -2
  111. package/src/comment-template/index.php +23 -2
  112. package/src/comments-pagination/edit.js +23 -0
  113. package/src/comments-query-loop/edit.js +2 -0
  114. package/src/comments-title/block.json +70 -0
  115. package/src/comments-title/edit.js +197 -0
  116. package/src/comments-title/editor.scss +4 -0
  117. package/src/comments-title/index.js +18 -0
  118. package/src/comments-title/index.php +68 -0
  119. package/src/cover/transforms.js +51 -28
  120. package/src/editor.scss +3 -0
  121. package/src/index.js +8 -2
  122. package/src/list/index.js +7 -3
  123. package/src/navigation/edit/index.js +24 -0
  124. package/src/navigation/edit/navigation-menu-selector.js +15 -9
  125. package/src/post-comments/block.json +6 -4
  126. package/src/post-comments/edit.js +204 -44
  127. package/src/post-comments/editor.scss +3 -0
  128. package/src/post-comments/style.scss +1 -5
  129. package/src/post-comments-form/block.json +1 -0
  130. package/src/post-comments-form/edit.js +39 -2
  131. package/src/post-comments-form/editor.scss +3 -0
  132. package/src/post-comments-form/index.php +12 -4
  133. package/src/post-comments-form/style.scss +11 -0
  134. package/src/post-featured-image/edit.js +24 -12
  135. package/src/query/edit/index.js +125 -26
  136. package/src/query/edit/query-placeholder.js +3 -13
  137. package/src/query/edit/query-toolbar.js +6 -0
  138. package/src/query/editor.scss +38 -0
  139. package/src/query-no-results/edit.js +1 -1
  140. package/src/quote/index.js +7 -3
@@ -128,4 +128,13 @@
128
128
  }
129
129
  .wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent {
130
130
  margin-top: 0.35em;
131
+ }
132
+ .wp-block-post-comments-form .comment-reply-title {
133
+ align-items: baseline;
134
+ display: flex;
135
+ justify-content: space-between;
136
+ margin-bottom: 0;
137
+ }
138
+ .wp-block-post-comments-form .comment-reply-title :where(small) {
139
+ font-size: var(--wp--preset--font-size--medium, smaller);
131
140
  }
@@ -80,4 +80,43 @@
80
80
 
81
81
  .wp-block-query__create-new-link {
82
82
  padding: 0 56px 16px 16px;
83
+ }
84
+
85
+ .block-library-query__pattern-selection-content .block-editor-block-patterns-list {
86
+ display: grid;
87
+ grid-template-columns: 1fr 1fr 1fr;
88
+ grid-gap: 8px;
89
+ }
90
+ .block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
91
+ margin-bottom: 0;
92
+ }
93
+ .block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
94
+ max-height: 250px;
95
+ }
96
+
97
+ .block-editor-query-pattern__selection-modal .components-modal__content {
98
+ overflow: hidden;
99
+ padding: 0;
100
+ }
101
+ .block-editor-query-pattern__selection-modal .components-modal__content::before {
102
+ margin-bottom: 0;
103
+ }
104
+
105
+ @media (min-width: 600px) {
106
+ .block-editor-query-pattern__selection-modal {
107
+ width: calc(100% - 32px);
108
+ height: calc(100% - 120px);
109
+ }
110
+ }
111
+ @media (min-width: 782px) {
112
+ .block-editor-query-pattern__selection-modal {
113
+ width: 750px;
114
+ }
115
+ }
116
+ @media (min-width: 960px) {
117
+ .block-editor-query-pattern__selection-modal {
118
+ height: 80%;
119
+ width: 80%;
120
+ max-height: none;
121
+ }
83
122
  }
@@ -80,4 +80,43 @@
80
80
 
81
81
  .wp-block-query__create-new-link {
82
82
  padding: 0 16px 16px 56px;
83
+ }
84
+
85
+ .block-library-query__pattern-selection-content .block-editor-block-patterns-list {
86
+ display: grid;
87
+ grid-template-columns: 1fr 1fr 1fr;
88
+ grid-gap: 8px;
89
+ }
90
+ .block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
91
+ margin-bottom: 0;
92
+ }
93
+ .block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
94
+ max-height: 250px;
95
+ }
96
+
97
+ .block-editor-query-pattern__selection-modal .components-modal__content {
98
+ overflow: hidden;
99
+ padding: 0;
100
+ }
101
+ .block-editor-query-pattern__selection-modal .components-modal__content::before {
102
+ margin-bottom: 0;
103
+ }
104
+
105
+ @media (min-width: 600px) {
106
+ .block-editor-query-pattern__selection-modal {
107
+ width: calc(100% - 32px);
108
+ height: calc(100% - 120px);
109
+ }
110
+ }
111
+ @media (min-width: 782px) {
112
+ .block-editor-query-pattern__selection-modal {
113
+ width: 750px;
114
+ }
115
+ }
116
+ @media (min-width: 960px) {
117
+ .block-editor-query-pattern__selection-modal {
118
+ height: 80%;
119
+ width: 80%;
120
+ max-height: none;
121
+ }
83
122
  }
@@ -2099,10 +2099,8 @@ p.has-background {
2099
2099
  margin: 0;
2100
2100
  }
2101
2101
 
2102
- .wp-block-post-comments > h3:first-of-type {
2103
- margin-top: 0;
2104
- }
2105
2102
  .wp-block-post-comments .commentlist {
2103
+ clear: both;
2106
2104
  list-style: none;
2107
2105
  margin: 0;
2108
2106
  padding: 0;
@@ -2240,6 +2238,15 @@ p.has-background {
2240
2238
  .wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent {
2241
2239
  margin-top: 0.35em;
2242
2240
  }
2241
+ .wp-block-post-comments-form .comment-reply-title {
2242
+ align-items: baseline;
2243
+ display: flex;
2244
+ justify-content: space-between;
2245
+ margin-bottom: 0;
2246
+ }
2247
+ .wp-block-post-comments-form .comment-reply-title :where(small) {
2248
+ font-size: var(--wp--preset--font-size--medium, smaller);
2249
+ }
2243
2250
 
2244
2251
  .wp-block-post-excerpt__more-link {
2245
2252
  display: inline-block;
@@ -2123,10 +2123,8 @@ p.has-background {
2123
2123
  margin: 0;
2124
2124
  }
2125
2125
 
2126
- .wp-block-post-comments > h3:first-of-type {
2127
- margin-top: 0;
2128
- }
2129
2126
  .wp-block-post-comments .commentlist {
2127
+ clear: both;
2130
2128
  list-style: none;
2131
2129
  margin: 0;
2132
2130
  padding: 0;
@@ -2264,6 +2262,15 @@ p.has-background {
2264
2262
  .wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent {
2265
2263
  margin-top: 0.35em;
2266
2264
  }
2265
+ .wp-block-post-comments-form .comment-reply-title {
2266
+ align-items: baseline;
2267
+ display: flex;
2268
+ justify-content: space-between;
2269
+ margin-bottom: 0;
2270
+ }
2271
+ .wp-block-post-comments-form .comment-reply-title :where(small) {
2272
+ font-size: var(--wp--preset--font-size--medium, smaller);
2273
+ }
2267
2274
 
2268
2275
  .wp-block-post-excerpt__more-link {
2269
2276
  display: inline-block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "7.3.0",
3
+ "version": "7.3.3",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -33,32 +33,32 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.16.0",
36
- "@wordpress/a11y": "^3.6.0",
37
- "@wordpress/api-fetch": "^6.3.0",
38
- "@wordpress/autop": "^3.6.0",
39
- "@wordpress/blob": "^3.6.0",
40
- "@wordpress/block-editor": "^8.5.0",
41
- "@wordpress/blocks": "^11.5.0",
42
- "@wordpress/components": "^19.8.0",
43
- "@wordpress/compose": "^5.4.0",
44
- "@wordpress/core-data": "^4.4.0",
45
- "@wordpress/data": "^6.6.0",
46
- "@wordpress/date": "^4.6.0",
47
- "@wordpress/deprecated": "^3.6.0",
48
- "@wordpress/dom": "^3.6.0",
49
- "@wordpress/element": "^4.4.0",
50
- "@wordpress/hooks": "^3.6.0",
51
- "@wordpress/html-entities": "^3.6.0",
52
- "@wordpress/i18n": "^4.6.0",
53
- "@wordpress/icons": "^8.2.0",
54
- "@wordpress/keycodes": "^3.6.0",
55
- "@wordpress/notices": "^3.6.0",
56
- "@wordpress/primitives": "^3.4.0",
57
- "@wordpress/reusable-blocks": "^3.4.0",
58
- "@wordpress/rich-text": "^5.4.0",
59
- "@wordpress/server-side-render": "^3.4.0",
60
- "@wordpress/url": "^3.7.0",
61
- "@wordpress/viewport": "^4.4.0",
36
+ "@wordpress/a11y": "^3.6.1",
37
+ "@wordpress/api-fetch": "^6.3.1",
38
+ "@wordpress/autop": "^3.6.1",
39
+ "@wordpress/blob": "^3.6.1",
40
+ "@wordpress/block-editor": "^8.5.3",
41
+ "@wordpress/blocks": "^11.5.3",
42
+ "@wordpress/components": "^19.8.2",
43
+ "@wordpress/compose": "^5.4.1",
44
+ "@wordpress/core-data": "^4.4.3",
45
+ "@wordpress/data": "^6.6.1",
46
+ "@wordpress/date": "^4.6.1",
47
+ "@wordpress/deprecated": "^3.6.1",
48
+ "@wordpress/dom": "^3.6.1",
49
+ "@wordpress/element": "^4.4.1",
50
+ "@wordpress/hooks": "^3.6.1",
51
+ "@wordpress/html-entities": "^3.6.1",
52
+ "@wordpress/i18n": "^4.6.1",
53
+ "@wordpress/icons": "^8.2.2",
54
+ "@wordpress/keycodes": "^3.6.1",
55
+ "@wordpress/notices": "^3.6.1",
56
+ "@wordpress/primitives": "^3.4.1",
57
+ "@wordpress/reusable-blocks": "^3.4.3",
58
+ "@wordpress/rich-text": "^5.4.1",
59
+ "@wordpress/server-side-render": "^3.4.3",
60
+ "@wordpress/url": "^3.7.1",
61
+ "@wordpress/viewport": "^4.4.1",
62
62
  "classnames": "^2.3.1",
63
63
  "colord": "^2.7.0",
64
64
  "fast-average-color": "4.3.0",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "11eb1241e63c9240018323551c6753f8a5fa96f9"
77
+ "gitHead": "37e930b93fbba88fa024a91eb527a90f855c97f3"
78
78
  }
package/src/audio/edit.js CHANGED
@@ -186,7 +186,7 @@ function AudioEdit( {
186
186
  { value: 'metadata', label: __( 'Metadata' ) },
187
187
  {
188
188
  value: 'none',
189
- label: _x( 'None', '"Preload" value' ),
189
+ label: _x( 'None', 'Preload value' ),
190
190
  },
191
191
  ] }
192
192
  />
@@ -29,10 +29,7 @@ function render_block_core_comment_edit_link( $attributes, $content, $block ) {
29
29
 
30
30
  $classes = '';
31
31
  if ( isset( $attributes['textAlign'] ) ) {
32
- $classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] );
33
- }
34
- if ( isset( $attributes['fontSize'] ) ) {
35
- $classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
32
+ $classes .= 'has-text-align-' . $attributes['textAlign'];
36
33
  }
37
34
 
38
35
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
@@ -53,10 +53,7 @@ function render_block_core_comment_reply_link( $attributes, $content, $block ) {
53
53
 
54
54
  $classes = '';
55
55
  if ( isset( $attributes['textAlign'] ) ) {
56
- $classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] );
57
- }
58
- if ( isset( $attributes['fontSize'] ) ) {
59
- $classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
56
+ $classes .= 'has-text-align-' . $attributes['textAlign'];
60
57
  }
61
58
 
62
59
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
@@ -252,7 +252,6 @@ export default function CommentTemplateEdit( {
252
252
  ( select ) => {
253
253
  const { getEntityRecords } = select( coreStore );
254
254
  const { getBlocks } = select( blockEditorStore );
255
-
256
255
  return {
257
256
  // Request only top-level comments. Replies are embedded.
258
257
  topLevelComments: commentQuery
@@ -289,7 +288,11 @@ export default function CommentTemplateEdit( {
289
288
  }
290
289
 
291
290
  if ( ! commentTree.length ) {
292
- return <p { ...blockProps }> { __( 'No results found.' ) }</p>;
291
+ return (
292
+ <p { ...blockProps } data-testid="noresults">
293
+ { __( 'No results found.' ) }
294
+ </p>
295
+ );
293
296
  }
294
297
 
295
298
  return (
@@ -7,6 +7,9 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
7
7
  import { addQueryArgs } from '@wordpress/url';
8
8
  import apiFetch from '@wordpress/api-fetch';
9
9
 
10
+ // This is limited by WP REST API
11
+ const MAX_COMMENTS_PER_PAGE = 100;
12
+
10
13
  /**
11
14
  * Return an object with the query args needed to fetch the default page of
12
15
  * comments.
@@ -29,7 +32,8 @@ export const useCommentQueryArgs = ( { postId } ) => {
29
32
 
30
33
  // Get the Discussion settings that may be needed to query the comments.
31
34
  const {
32
- commentsPerPage: perPage,
35
+ pageComments,
36
+ commentsPerPage,
33
37
  defaultCommentsPage: defaultPage,
34
38
  } = useSelect( ( select ) => {
35
39
  const { getSettings } = select( blockEditorStore );
@@ -37,6 +41,14 @@ export const useCommentQueryArgs = ( { postId } ) => {
37
41
  return __experimentalDiscussionSettings;
38
42
  } );
39
43
 
44
+ // WP REST API doesn't allow fetching more than max items limit set per single page of data.
45
+ // As for the editor performance is more important than completeness of data and fetching only the
46
+ // max allowed for single page should be enough for the purpose of design and laying out the page.
47
+ // Fetching over the limit would return an error here but would work with backend query.
48
+ const perPage = pageComments
49
+ ? Math.min( commentsPerPage, MAX_COMMENTS_PER_PAGE )
50
+ : MAX_COMMENTS_PER_PAGE;
51
+
40
52
  // Get the number of the default page.
41
53
  const page = useDefaultPageIndex( {
42
54
  defaultPage,
@@ -96,9 +108,10 @@ const useDefaultPageIndex = ( { defaultPage, postId, perPage, queryArgs } ) => {
96
108
  method: 'HEAD',
97
109
  parse: false,
98
110
  } ).then( ( res ) => {
111
+ const pages = parseInt( res.headers.get( 'X-WP-TotalPages' ) );
99
112
  setDefaultPages( {
100
113
  ...defaultPages,
101
- [ key ]: parseInt( res.headers.get( 'X-WP-TotalPages' ) ),
114
+ [ key ]: pages <= 1 ? 1 : pages, // If there are 0 pages, it means that there are no comments, but there is no 0th page.
102
115
  } );
103
116
  } );
104
117
  }, [ defaultPage, postId, perPage, setDefaultPages ] );
@@ -8,11 +8,19 @@
8
8
  /**
9
9
  * Function that recursively renders a list of nested comments.
10
10
  *
11
- * @param WP_Comment[] $comments The array of comments.
11
+ * @global int $comment_depth
12
+ *
13
+ * @param WP_Comment[] $comments The array of comments.
12
14
  * @param WP_Block $block Block instance.
13
15
  * @return string
14
16
  */
15
17
  function block_core_comment_template_render_comments( $comments, $block ) {
18
+ global $comment_depth;
19
+
20
+ if ( empty( $comment_depth ) ) {
21
+ $comment_depth = 1;
22
+ }
23
+
16
24
  $content = '';
17
25
  foreach ( $comments as $comment ) {
18
26
 
@@ -25,17 +33,30 @@ function block_core_comment_template_render_comments( $comments, $block ) {
25
33
 
26
34
  $children = $comment->get_children();
27
35
 
36
+ /*
37
+ * We need to create the CSS classes BEFORE recursing into the children.
38
+ * This is because comment_class() uses globals like `$comment_alt`
39
+ * and `$comment_thread_alt` which are order-sensitive.
40
+ *
41
+ * The `false` parameter at the end means that we do NOT want the function
42
+ * to `echo` the output but to return a string.
43
+ * See https://developer.wordpress.org/reference/functions/comment_class/#parameters.
44
+ */
45
+ $comment_classes = comment_class( '', $comment->comment_ID, $comment->comment_post_ID, false );
46
+
28
47
  // If the comment has children, recurse to create the HTML for the nested
29
48
  // comments.
30
49
  if ( ! empty( $children ) ) {
50
+ $comment_depth += 1;
31
51
  $inner_content = block_core_comment_template_render_comments(
32
52
  $children,
33
53
  $block
34
54
  );
35
55
  $block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
56
+ $comment_depth -= 1;
36
57
  }
37
58
 
38
- $content .= '<li>' . $block_content . '</li>';
59
+ $content .= sprintf( '<li id="comment-%1$s" %2$s>%3$s</li>', $comment->comment_ID, $comment_classes, $block_content );
39
60
  }
40
61
 
41
62
  return $content;
@@ -7,6 +7,7 @@ import {
7
7
  useBlockProps,
8
8
  useInnerBlocksProps,
9
9
  store as blockEditorStore,
10
+ Warning,
10
11
  } from '@wordpress/block-editor';
11
12
  import { useSelect } from '@wordpress/data';
12
13
  import { getBlockSupport } from '@wordpress/blocks';
@@ -53,6 +54,7 @@ export default function QueryPaginationEdit( {
53
54
  ].includes( innerBlock.name );
54
55
  } );
55
56
  }, [] );
57
+
56
58
  const blockProps = useBlockProps();
57
59
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
58
60
  template: TEMPLATE,
@@ -63,6 +65,27 @@ export default function QueryPaginationEdit( {
63
65
  ],
64
66
  __experimentalLayout: usedLayout,
65
67
  } );
68
+
69
+ // Get the Discussion settings
70
+ const pageComments = useSelect( ( select ) => {
71
+ const { getSettings } = select( blockEditorStore );
72
+ const { __experimentalDiscussionSettings } = getSettings();
73
+ return __experimentalDiscussionSettings?.pageComments;
74
+ }, [] );
75
+
76
+ // If paging comments is not enabled in the Discussion Settings then hide the pagination
77
+ // controls. We don't want to remove them from the template so that when the user enables
78
+ // paging comments, the controls will be visible.
79
+ if ( ! pageComments ) {
80
+ return (
81
+ <Warning>
82
+ { __(
83
+ 'Comments Pagination block: paging comments is disabled in the Discussion Settings'
84
+ ) }
85
+ </Warning>
86
+ );
87
+ }
88
+
66
89
  return (
67
90
  <>
68
91
  { hasNextPreviousBlocks && (
@@ -9,6 +9,7 @@ import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
9
9
  import CommentsInspectorControls from './edit/comments-inspector-controls';
10
10
 
11
11
  const TEMPLATE = [
12
+ [ 'core/comments-title' ],
12
13
  [
13
14
  'core/comment-template',
14
15
  {},
@@ -64,6 +65,7 @@ const TEMPLATE = [
64
65
  ],
65
66
  ],
66
67
  [ 'core/comments-pagination' ],
68
+ [ 'core/post-comments-form' ],
67
69
  ];
68
70
 
69
71
  export default function CommentsQueryLoopEdit( { attributes, setAttributes } ) {
@@ -0,0 +1,70 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "core/comments-title",
5
+ "title": "Comments Title",
6
+ "category": "theme",
7
+ "ancestor": [ "core/comments-query-loop" ],
8
+ "description": "Displays a title with the number of comments",
9
+ "textdomain": "default",
10
+ "usesContext": [ "postId", "postType" ],
11
+ "attributes": {
12
+ "textAlign": {
13
+ "type": "string"
14
+ },
15
+ "singleCommentLabel": {
16
+ "type": "string"
17
+ },
18
+ "multipleCommentsLabel": {
19
+ "type": "string"
20
+ },
21
+ "showPostTitle": {
22
+ "type": "boolean",
23
+ "default": true
24
+ },
25
+ "showCommentsCount": {
26
+ "type": "boolean",
27
+ "default": true
28
+ },
29
+ "level": {
30
+ "type": "number",
31
+ "default": 2
32
+ }
33
+ },
34
+ "supports": {
35
+ "anchor": false,
36
+ "align": true,
37
+ "html": false,
38
+ "__experimentalBorder": {
39
+ "radius": true,
40
+ "color": true,
41
+ "width": true,
42
+ "style": true
43
+ },
44
+ "color": {
45
+ "gradients": true,
46
+ "__experimentalDefaultControls": {
47
+ "background": true,
48
+ "text": true
49
+ }
50
+ },
51
+ "spacing": {
52
+ "margin": true,
53
+ "padding": true
54
+ },
55
+ "typography": {
56
+ "fontSize": true,
57
+ "lineHeight": true,
58
+ "__experimentalFontStyle": true,
59
+ "__experimentalFontWeight": true,
60
+ "__experimentalFontFamily": true,
61
+ "__experimentalTextTransform": true,
62
+ "__experimentalDefaultControls": {
63
+ "fontSize": true,
64
+ "__experimentalFontFamily": true,
65
+ "__experimentalFontStyle": true,
66
+ "__experimentalFontWeight": true
67
+ }
68
+ }
69
+ }
70
+ }