@wordpress/block-library 7.3.1 → 7.3.4
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.
- package/build/audio/edit.js +1 -1
- package/build/audio/edit.js.map +1 -1
- package/build/comment-template/edit.js +3 -1
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +14 -4
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comments-pagination/edit.js +18 -1
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-query-loop/edit.js +2 -2
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-title/edit.js +151 -0
- package/build/comments-title/edit.js.map +1 -0
- package/build/comments-title/index.js +101 -0
- package/build/comments-title/index.js.map +1 -0
- package/build/cover/transforms.js +33 -32
- package/build/cover/transforms.js.map +1 -1
- package/build/index.js +6 -4
- package/build/index.js.map +1 -1
- package/build/list/index.js +13 -2
- package/build/list/index.js.map +1 -1
- package/build/navigation/edit/index.js +17 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +5 -7
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +7 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation-link/edit.js +29 -30
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +14 -14
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/post-comments/edit.js +141 -35
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments/index.js +2 -1
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-form/edit.js +22 -1
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +19 -7
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/quote/index.js +13 -2
- package/build/quote/index.js.map +1 -1
- package/build-module/audio/edit.js +1 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +3 -1
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +14 -4
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comments-pagination/edit.js +19 -2
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +2 -2
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +135 -0
- package/build-module/comments-title/edit.js.map +1 -0
- package/build-module/comments-title/index.js +88 -0
- package/build-module/comments-title/index.js.map +1 -0
- package/build-module/cover/transforms.js +33 -32
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/index.js +5 -4
- package/build-module/index.js.map +1 -1
- package/build-module/list/index.js +9 -3
- package/build-module/list/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +17 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +5 -7
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +6 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation-link/edit.js +29 -30
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +14 -14
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/post-comments/edit.js +143 -38
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments/index.js +2 -1
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +21 -1
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +19 -7
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/query-no-results/edit.js +1 -1
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/quote/index.js +9 -3
- package/build-module/quote/index.js.map +1 -1
- package/build-style/comment-content/style-rtl.css +81 -0
- package/build-style/comment-content/style.css +81 -0
- package/build-style/comments-title/editor-rtl.css +79 -0
- package/build-style/comments-title/editor.css +79 -0
- package/build-style/cover/style-rtl.css +1 -1
- package/build-style/cover/style.css +1 -1
- package/build-style/editor-rtl.css +12 -0
- package/build-style/editor.css +12 -0
- package/build-style/latest-posts/style-rtl.css +2 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/post-comments/editor-rtl.css +79 -0
- package/build-style/post-comments/editor.css +79 -0
- package/build-style/post-comments/style-rtl.css +1 -3
- package/build-style/post-comments/style.css +1 -3
- package/build-style/post-comments-form/editor-rtl.css +79 -0
- package/build-style/post-comments-form/editor.css +79 -0
- package/build-style/post-comments-form/style-rtl.css +9 -0
- package/build-style/post-comments-form/style.css +9 -0
- package/build-style/style-rtl.css +13 -4
- package/build-style/style.css +15 -4
- package/package.json +28 -28
- package/src/audio/edit.js +1 -1
- package/src/comment-author-name/index.php +7 -5
- package/src/comment-content/index.php +25 -3
- package/src/comment-content/style.scss +5 -0
- package/src/comment-edit-link/index.php +1 -4
- package/src/comment-reply-link/index.php +1 -4
- package/src/comment-template/edit.js +5 -2
- package/src/comment-template/hooks.js +15 -2
- package/src/comment-template/index.php +23 -2
- package/src/comments-pagination/edit.js +23 -0
- package/src/comments-query-loop/edit.js +2 -0
- package/src/comments-title/block.json +70 -0
- package/src/comments-title/edit.js +213 -0
- package/src/comments-title/editor.scss +4 -0
- package/src/comments-title/index.js +18 -0
- package/src/comments-title/index.php +75 -0
- package/src/cover/index.php +1 -1
- package/src/cover/style.scss +1 -1
- package/src/cover/transforms.js +51 -28
- package/src/editor.scss +3 -0
- package/src/index.js +8 -2
- package/src/latest-posts/style.scss +4 -0
- package/src/list/index.js +7 -3
- package/src/navigation/edit/index.js +24 -0
- package/src/navigation/edit/inner-blocks.js +5 -7
- package/src/navigation/edit/navigation-menu-selector.js +15 -9
- package/src/navigation-link/edit.js +40 -43
- package/src/navigation-submenu/edit.js +13 -17
- package/src/post-comments/block.json +2 -1
- package/src/post-comments/edit.js +204 -44
- package/src/post-comments/editor.scss +3 -0
- package/src/post-comments/style.scss +1 -5
- package/src/post-comments-form/block.json +1 -0
- package/src/post-comments-form/edit.js +39 -2
- package/src/post-comments-form/editor.scss +3 -0
- package/src/post-comments-form/index.php +16 -5
- package/src/post-comments-form/style.scss +11 -0
- package/src/post-content/edit.js +15 -1
- package/src/post-featured-image/edit.js +24 -12
- package/src/query-no-results/edit.js +1 -1
- package/src/quote/index.js +7 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colors
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Breakpoints & Media Queries
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* SCSS Variables.
|
|
9
|
+
*
|
|
10
|
+
* Please use variables from this sheet to ensure consistency across the UI.
|
|
11
|
+
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
|
+
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Colors
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Fonts & basic variables.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Grid System.
|
|
22
|
+
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Dimensions.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Shadows.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Editor widths.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Block & Editor UI.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Block paddings.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* React Native specific.
|
|
41
|
+
* These variables do not appear to be used anywhere else.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Converts a hex value into the rgb equivalent.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
47
|
+
* @return {string} comma separated rgb values
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Breakpoint mixins
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Long content fade mixin
|
|
54
|
+
*
|
|
55
|
+
* Creates a fading overlay to signify that the content is longer
|
|
56
|
+
* than the space allows.
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* Focus styles.
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Applies editor left position to the selector passed as argument
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Styles that are reused verbatim in a few places
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Allows users to opt-out of animations via OS-level preferences.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Reset default styles for JavaScript UI based pages.
|
|
72
|
+
* This is a WP-admin agnostic reset
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
76
|
+
*/
|
|
77
|
+
.wp-block-post-comments-form * {
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
.wp-block-cover.has-parallax {
|
|
418
418
|
background-attachment: fixed;
|
|
419
419
|
}
|
|
420
|
-
@supports (-webkit-
|
|
420
|
+
@supports (-webkit-touch-callout: inherit) {
|
|
421
421
|
.wp-block-cover-image.has-parallax,
|
|
422
422
|
.wp-block-cover.has-parallax {
|
|
423
423
|
background-attachment: scroll;
|
|
@@ -1435,9 +1435,11 @@ ol.wp-block-latest-comments {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
.wp-block-latest-posts__featured-image.alignleft {
|
|
1437
1437
|
margin-right: 1em;
|
|
1438
|
+
float: left;
|
|
1438
1439
|
}
|
|
1439
1440
|
.wp-block-latest-posts__featured-image.alignright {
|
|
1440
1441
|
margin-left: 1em;
|
|
1442
|
+
float: right;
|
|
1441
1443
|
}
|
|
1442
1444
|
.wp-block-latest-posts__featured-image.aligncenter {
|
|
1443
1445
|
margin-bottom: 1em;
|
|
@@ -2099,10 +2101,8 @@ p.has-background {
|
|
|
2099
2101
|
margin: 0;
|
|
2100
2102
|
}
|
|
2101
2103
|
|
|
2102
|
-
.wp-block-post-comments > h3:first-of-type {
|
|
2103
|
-
margin-top: 0;
|
|
2104
|
-
}
|
|
2105
2104
|
.wp-block-post-comments .commentlist {
|
|
2105
|
+
clear: both;
|
|
2106
2106
|
list-style: none;
|
|
2107
2107
|
margin: 0;
|
|
2108
2108
|
padding: 0;
|
|
@@ -2240,6 +2240,15 @@ p.has-background {
|
|
|
2240
2240
|
.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent {
|
|
2241
2241
|
margin-top: 0.35em;
|
|
2242
2242
|
}
|
|
2243
|
+
.wp-block-post-comments-form .comment-reply-title {
|
|
2244
|
+
align-items: baseline;
|
|
2245
|
+
display: flex;
|
|
2246
|
+
justify-content: space-between;
|
|
2247
|
+
margin-bottom: 0;
|
|
2248
|
+
}
|
|
2249
|
+
.wp-block-post-comments-form .comment-reply-title :where(small) {
|
|
2250
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2251
|
+
}
|
|
2243
2252
|
|
|
2244
2253
|
.wp-block-post-excerpt__more-link {
|
|
2245
2254
|
display: inline-block;
|
package/build-style/style.css
CHANGED
|
@@ -422,7 +422,7 @@
|
|
|
422
422
|
.wp-block-cover.has-parallax {
|
|
423
423
|
background-attachment: fixed;
|
|
424
424
|
}
|
|
425
|
-
@supports (-webkit-
|
|
425
|
+
@supports (-webkit-touch-callout: inherit) {
|
|
426
426
|
.wp-block-cover-image.has-parallax,
|
|
427
427
|
.wp-block-cover.has-parallax {
|
|
428
428
|
background-attachment: scroll;
|
|
@@ -1448,10 +1448,14 @@ ol.wp-block-latest-comments {
|
|
|
1448
1448
|
.wp-block-latest-posts__featured-image.alignleft {
|
|
1449
1449
|
/*rtl:ignore*/
|
|
1450
1450
|
margin-right: 1em;
|
|
1451
|
+
/*rtl:ignore*/
|
|
1452
|
+
float: left;
|
|
1451
1453
|
}
|
|
1452
1454
|
.wp-block-latest-posts__featured-image.alignright {
|
|
1453
1455
|
/*rtl:ignore*/
|
|
1454
1456
|
margin-left: 1em;
|
|
1457
|
+
/*rtl:ignore*/
|
|
1458
|
+
float: right;
|
|
1455
1459
|
}
|
|
1456
1460
|
.wp-block-latest-posts__featured-image.aligncenter {
|
|
1457
1461
|
margin-bottom: 1em;
|
|
@@ -2123,10 +2127,8 @@ p.has-background {
|
|
|
2123
2127
|
margin: 0;
|
|
2124
2128
|
}
|
|
2125
2129
|
|
|
2126
|
-
.wp-block-post-comments > h3:first-of-type {
|
|
2127
|
-
margin-top: 0;
|
|
2128
|
-
}
|
|
2129
2130
|
.wp-block-post-comments .commentlist {
|
|
2131
|
+
clear: both;
|
|
2130
2132
|
list-style: none;
|
|
2131
2133
|
margin: 0;
|
|
2132
2134
|
padding: 0;
|
|
@@ -2264,6 +2266,15 @@ p.has-background {
|
|
|
2264
2266
|
.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent {
|
|
2265
2267
|
margin-top: 0.35em;
|
|
2266
2268
|
}
|
|
2269
|
+
.wp-block-post-comments-form .comment-reply-title {
|
|
2270
|
+
align-items: baseline;
|
|
2271
|
+
display: flex;
|
|
2272
|
+
justify-content: space-between;
|
|
2273
|
+
margin-bottom: 0;
|
|
2274
|
+
}
|
|
2275
|
+
.wp-block-post-comments-form .comment-reply-title :where(small) {
|
|
2276
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2277
|
+
}
|
|
2267
2278
|
|
|
2268
2279
|
.wp-block-post-excerpt__more-link {
|
|
2269
2280
|
display: inline-block;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.4",
|
|
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.
|
|
37
|
-
"@wordpress/api-fetch": "^6.3.
|
|
38
|
-
"@wordpress/autop": "^3.6.
|
|
39
|
-
"@wordpress/blob": "^3.6.
|
|
40
|
-
"@wordpress/block-editor": "^8.5.
|
|
41
|
-
"@wordpress/blocks": "^11.5.
|
|
42
|
-
"@wordpress/components": "^19.8.
|
|
43
|
-
"@wordpress/compose": "^5.4.
|
|
44
|
-
"@wordpress/core-data": "^4.4.
|
|
45
|
-
"@wordpress/data": "^6.6.
|
|
46
|
-
"@wordpress/date": "^4.6.
|
|
47
|
-
"@wordpress/deprecated": "^3.6.
|
|
48
|
-
"@wordpress/dom": "^3.6.
|
|
49
|
-
"@wordpress/element": "^4.4.
|
|
50
|
-
"@wordpress/hooks": "^3.6.
|
|
51
|
-
"@wordpress/html-entities": "^3.6.
|
|
52
|
-
"@wordpress/i18n": "^4.6.
|
|
53
|
-
"@wordpress/icons": "^8.2.
|
|
54
|
-
"@wordpress/keycodes": "^3.6.
|
|
55
|
-
"@wordpress/notices": "^3.6.
|
|
56
|
-
"@wordpress/primitives": "^3.4.
|
|
57
|
-
"@wordpress/reusable-blocks": "^3.4.
|
|
58
|
-
"@wordpress/rich-text": "^5.4.
|
|
59
|
-
"@wordpress/server-side-render": "^3.4.
|
|
60
|
-
"@wordpress/url": "^3.7.
|
|
61
|
-
"@wordpress/viewport": "^4.4.
|
|
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.4",
|
|
41
|
+
"@wordpress/blocks": "^11.5.3",
|
|
42
|
+
"@wordpress/components": "^19.8.3",
|
|
43
|
+
"@wordpress/compose": "^5.4.1",
|
|
44
|
+
"@wordpress/core-data": "^4.4.4",
|
|
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.4",
|
|
58
|
+
"@wordpress/rich-text": "^5.4.2",
|
|
59
|
+
"@wordpress/server-side-render": "^3.4.4",
|
|
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": "
|
|
77
|
+
"gitHead": "1fdd4758150247d6b690051aed18fa27c15f3a32"
|
|
78
78
|
}
|
package/src/audio/edit.js
CHANGED
|
@@ -18,17 +18,16 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
|
|
|
18
18
|
return '';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
$comment
|
|
21
|
+
$comment = get_comment( $block->context['commentId'] );
|
|
22
|
+
$commenter = wp_get_current_commenter();
|
|
23
|
+
$show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author'];
|
|
22
24
|
if ( empty( $comment ) ) {
|
|
23
25
|
return '';
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
$classes = '';
|
|
27
29
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
28
|
-
$classes .= 'has-text-align-' .
|
|
29
|
-
}
|
|
30
|
-
if ( isset( $attributes['fontSize'] ) ) {
|
|
31
|
-
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
|
|
30
|
+
$classes .= 'has-text-align-' . $attributes['textAlign'];
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
@@ -38,6 +37,9 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
|
|
|
38
37
|
if ( ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) {
|
|
39
38
|
$comment_author = sprintf( '<a rel="external nofollow ugc" href="%1s" target="%2s" >%3s</a>', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $comment_author );
|
|
40
39
|
}
|
|
40
|
+
if ( '0' === $comment->comment_approved && ! $show_pending_links ) {
|
|
41
|
+
$comment_author = wp_kses( $comment_author, array() );
|
|
42
|
+
}
|
|
41
43
|
|
|
42
44
|
return sprintf(
|
|
43
45
|
'<div %1$s>%2$s</div>',
|
|
@@ -18,16 +18,37 @@ function render_block_core_comment_content( $attributes, $content, $block ) {
|
|
|
18
18
|
return '';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
$comment
|
|
21
|
+
$comment = get_comment( $block->context['commentId'] );
|
|
22
|
+
$commenter = wp_get_current_commenter();
|
|
23
|
+
$show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author'];
|
|
22
24
|
if ( empty( $comment ) ) {
|
|
23
25
|
return '';
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
$
|
|
28
|
+
$args = array();
|
|
29
|
+
$comment_text = get_comment_text( $comment, $args );
|
|
27
30
|
if ( ! $comment_text ) {
|
|
28
31
|
return '';
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
/** This filter is documented in wp-includes/comment-template.php */
|
|
35
|
+
$comment_text = apply_filters( 'comment_text', $comment_text, $comment, $args );
|
|
36
|
+
|
|
37
|
+
$moderation_note = '';
|
|
38
|
+
if ( '0' === $comment->comment_approved ) {
|
|
39
|
+
$commenter = wp_get_current_commenter();
|
|
40
|
+
|
|
41
|
+
if ( $commenter['comment_author_email'] ) {
|
|
42
|
+
$moderation_note = __( 'Your comment is awaiting moderation.' );
|
|
43
|
+
} else {
|
|
44
|
+
$moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' );
|
|
45
|
+
}
|
|
46
|
+
$moderation_note = '<p><em class="comment-awaiting-moderation">' . $moderation_note . '</em></p>';
|
|
47
|
+
if ( ! $show_pending_links ) {
|
|
48
|
+
$comment_text = wp_kses( $comment_text, array() );
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
31
52
|
$classes = '';
|
|
32
53
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
33
54
|
$classes .= 'has-text-align-' . $attributes['textAlign'];
|
|
@@ -36,8 +57,9 @@ function render_block_core_comment_content( $attributes, $content, $block ) {
|
|
|
36
57
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
37
58
|
|
|
38
59
|
return sprintf(
|
|
39
|
-
'<div %1$s>%2$s</div>',
|
|
60
|
+
'<div %1$s>%2$s%3$s</div>',
|
|
40
61
|
$wrapper_attributes,
|
|
62
|
+
$moderation_note,
|
|
41
63
|
$comment_text
|
|
42
64
|
);
|
|
43
65
|
}
|
|
@@ -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-' .
|
|
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-' .
|
|
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
|
|
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
|
-
|
|
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 ]:
|
|
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
|
-
* @
|
|
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>'
|
|
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
|
+
}
|