@wordpress/block-library 9.7.1-next.1f6eadc42.0 → 9.8.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.
- package/CHANGELOG.md +2 -0
- package/build/categories/edit.js +38 -17
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +10 -3
- package/build/categories/index.js.map +1 -1
- package/build/categories/variations.js +43 -0
- package/build/categories/variations.js.map +1 -0
- package/build/embed/edit.js +1 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-preview.js +80 -100
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -0
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/form/view.js +1 -0
- package/build/form/view.js.map +1 -1
- package/build/image/image.js +5 -2
- package/build/image/image.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/navigation-submenu/index.js +13 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/post-template/edit.js +6 -1
- package/build/post-template/edit.js.map +1 -1
- package/build/post-title/index.js +1 -4
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/format-controls.js +102 -0
- package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +45 -9
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +26 -10
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +3 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +12 -1
- package/build/query/utils.js.map +1 -1
- package/build/site-title/index.js +1 -4
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +13 -11
- package/build/social-link/edit.js.map +1 -1
- package/build-module/categories/edit.js +40 -19
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +10 -3
- package/build-module/categories/index.js.map +1 -1
- package/build-module/categories/variations.js +36 -0
- package/build-module/categories/variations.js.map +1 -0
- package/build-module/embed/edit.js +1 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +1 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +80 -100
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +1 -0
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/form/view.js +1 -0
- package/build-module/form/view.js.map +1 -1
- package/build-module/image/image.js +5 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/navigation-submenu/index.js +13 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/post-template/edit.js +6 -1
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-title/index.js +1 -4
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
- package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +45 -9
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +27 -11
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +3 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +12 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/site-title/index.js +1 -4
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +14 -12
- package/build-module/social-link/edit.js.map +1 -1
- package/build-style/editor-rtl.css +1 -1
- package/build-style/editor.css +1 -1
- package/build-style/gallery/editor-rtl.css +1 -1
- package/build-style/gallery/editor.css +1 -1
- package/build-style/post-title/style-rtl.css +4 -18
- package/build-style/post-title/style.css +4 -18
- package/build-style/site-title/style-rtl.css +4 -18
- package/build-style/site-title/style.css +4 -18
- package/build-style/style-rtl.css +8 -36
- package/build-style/style.css +8 -36
- package/package.json +35 -35
- package/src/categories/block.json +7 -2
- package/src/categories/edit.js +69 -30
- package/src/categories/index.js +2 -0
- package/src/categories/index.php +21 -9
- package/src/categories/variations.js +40 -0
- package/src/comments-pagination-next/index.php +1 -1
- package/src/comments-pagination-previous/index.php +2 -1
- package/src/embed/embed-preview.js +96 -112
- package/src/image/image.js +2 -1
- package/src/navigation-submenu/block.json +13 -0
- package/src/post-template/edit.js +6 -0
- package/src/post-template/index.php +5 -0
- package/src/post-title/block.json +1 -4
- package/src/post-title/style.scss +4 -21
- package/src/query/block.json +3 -1
- package/src/query/edit/inspector-controls/format-controls.js +90 -0
- package/src/query/edit/inspector-controls/index.js +68 -9
- package/src/query/edit/query-content.js +38 -5
- package/src/query/utils.js +16 -1
- package/src/site-title/block.json +1 -4
- package/src/site-title/style.scss +4 -21
- package/src/social-link/edit.js +11 -7
|
@@ -92,27 +92,13 @@
|
|
|
92
92
|
.wp-block-site-title {
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
}
|
|
95
|
-
.wp-block-site-title
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
.wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
|
|
95
|
+
.wp-block-site-title :where(a) {
|
|
96
|
+
color: inherit;
|
|
99
97
|
font-family: inherit;
|
|
100
|
-
}
|
|
101
|
-
.wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
|
|
102
98
|
font-size: inherit;
|
|
103
|
-
}
|
|
104
|
-
.wp-block-site-title[style*=line-height] :where(a) {
|
|
105
|
-
line-height: inherit;
|
|
106
|
-
}
|
|
107
|
-
.wp-block-site-title[style*=font-style] :where(a) {
|
|
108
99
|
font-style: inherit;
|
|
109
|
-
|
|
110
|
-
.wp-block-site-title[style*=letter-spacing] :where(a) {
|
|
100
|
+
font-weight: inherit;
|
|
111
101
|
letter-spacing: inherit;
|
|
112
|
-
|
|
113
|
-
.wp-block-site-title[style*=text-decoration] :where(a) {
|
|
102
|
+
line-height: inherit;
|
|
114
103
|
text-decoration: inherit;
|
|
115
|
-
}
|
|
116
|
-
.wp-block-site-title :where(a) {
|
|
117
|
-
color: inherit;
|
|
118
104
|
}
|
|
@@ -92,27 +92,13 @@
|
|
|
92
92
|
.wp-block-site-title {
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
}
|
|
95
|
-
.wp-block-site-title
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
.wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
|
|
95
|
+
.wp-block-site-title :where(a) {
|
|
96
|
+
color: inherit;
|
|
99
97
|
font-family: inherit;
|
|
100
|
-
}
|
|
101
|
-
.wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
|
|
102
98
|
font-size: inherit;
|
|
103
|
-
}
|
|
104
|
-
.wp-block-site-title[style*=line-height] :where(a) {
|
|
105
|
-
line-height: inherit;
|
|
106
|
-
}
|
|
107
|
-
.wp-block-site-title[style*=font-style] :where(a) {
|
|
108
99
|
font-style: inherit;
|
|
109
|
-
|
|
110
|
-
.wp-block-site-title[style*=letter-spacing] :where(a) {
|
|
100
|
+
font-weight: inherit;
|
|
111
101
|
letter-spacing: inherit;
|
|
112
|
-
|
|
113
|
-
.wp-block-site-title[style*=text-decoration] :where(a) {
|
|
102
|
+
line-height: inherit;
|
|
114
103
|
text-decoration: inherit;
|
|
115
|
-
}
|
|
116
|
-
.wp-block-site-title :where(a) {
|
|
117
|
-
color: inherit;
|
|
118
104
|
}
|
|
@@ -3013,30 +3013,16 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
|
|
|
3013
3013
|
word-break: break-word;
|
|
3014
3014
|
box-sizing: border-box;
|
|
3015
3015
|
}
|
|
3016
|
-
.wp-block-post-title
|
|
3017
|
-
|
|
3018
|
-
}
|
|
3019
|
-
.wp-block-post-title[class*=-font-family] :where(a), .wp-block-post-title[style*=font-family] :where(a) {
|
|
3016
|
+
.wp-block-post-title :where(a) {
|
|
3017
|
+
display: inline-block;
|
|
3020
3018
|
font-family: inherit;
|
|
3021
|
-
}
|
|
3022
|
-
.wp-block-post-title[class*=-font-size] :where(a), .wp-block-post-title[style*=font-size] :where(a) {
|
|
3023
3019
|
font-size: inherit;
|
|
3024
|
-
}
|
|
3025
|
-
.wp-block-post-title[style*=line-height] :where(a) {
|
|
3026
|
-
line-height: inherit;
|
|
3027
|
-
}
|
|
3028
|
-
.wp-block-post-title[style*=font-style] :where(a) {
|
|
3029
3020
|
font-style: inherit;
|
|
3030
|
-
|
|
3031
|
-
.wp-block-post-title[style*=letter-spacing] :where(a) {
|
|
3021
|
+
font-weight: inherit;
|
|
3032
3022
|
letter-spacing: inherit;
|
|
3033
|
-
|
|
3034
|
-
.wp-block-post-title[style*=text-decoration] :where(a) {
|
|
3023
|
+
line-height: inherit;
|
|
3035
3024
|
text-decoration: inherit;
|
|
3036
3025
|
}
|
|
3037
|
-
.wp-block-post-title a {
|
|
3038
|
-
display: inline-block;
|
|
3039
|
-
}
|
|
3040
3026
|
|
|
3041
3027
|
.wp-block-post-author-name {
|
|
3042
3028
|
box-sizing: border-box;
|
|
@@ -3458,30 +3444,16 @@ ul.wp-block-rss.is-grid li {
|
|
|
3458
3444
|
.wp-block-site-title {
|
|
3459
3445
|
box-sizing: border-box;
|
|
3460
3446
|
}
|
|
3461
|
-
.wp-block-site-title
|
|
3462
|
-
|
|
3463
|
-
}
|
|
3464
|
-
.wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
|
|
3447
|
+
.wp-block-site-title :where(a) {
|
|
3448
|
+
color: inherit;
|
|
3465
3449
|
font-family: inherit;
|
|
3466
|
-
}
|
|
3467
|
-
.wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
|
|
3468
3450
|
font-size: inherit;
|
|
3469
|
-
}
|
|
3470
|
-
.wp-block-site-title[style*=line-height] :where(a) {
|
|
3471
|
-
line-height: inherit;
|
|
3472
|
-
}
|
|
3473
|
-
.wp-block-site-title[style*=font-style] :where(a) {
|
|
3474
3451
|
font-style: inherit;
|
|
3475
|
-
|
|
3476
|
-
.wp-block-site-title[style*=letter-spacing] :where(a) {
|
|
3452
|
+
font-weight: inherit;
|
|
3477
3453
|
letter-spacing: inherit;
|
|
3478
|
-
|
|
3479
|
-
.wp-block-site-title[style*=text-decoration] :where(a) {
|
|
3454
|
+
line-height: inherit;
|
|
3480
3455
|
text-decoration: inherit;
|
|
3481
3456
|
}
|
|
3482
|
-
.wp-block-site-title :where(a) {
|
|
3483
|
-
color: inherit;
|
|
3484
|
-
}
|
|
3485
3457
|
|
|
3486
3458
|
.wp-block-social-links {
|
|
3487
3459
|
box-sizing: border-box;
|
package/build-style/style.css
CHANGED
|
@@ -3043,30 +3043,16 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
|
|
|
3043
3043
|
word-break: break-word;
|
|
3044
3044
|
box-sizing: border-box;
|
|
3045
3045
|
}
|
|
3046
|
-
.wp-block-post-title
|
|
3047
|
-
|
|
3048
|
-
}
|
|
3049
|
-
.wp-block-post-title[class*=-font-family] :where(a), .wp-block-post-title[style*=font-family] :where(a) {
|
|
3046
|
+
.wp-block-post-title :where(a) {
|
|
3047
|
+
display: inline-block;
|
|
3050
3048
|
font-family: inherit;
|
|
3051
|
-
}
|
|
3052
|
-
.wp-block-post-title[class*=-font-size] :where(a), .wp-block-post-title[style*=font-size] :where(a) {
|
|
3053
3049
|
font-size: inherit;
|
|
3054
|
-
}
|
|
3055
|
-
.wp-block-post-title[style*=line-height] :where(a) {
|
|
3056
|
-
line-height: inherit;
|
|
3057
|
-
}
|
|
3058
|
-
.wp-block-post-title[style*=font-style] :where(a) {
|
|
3059
3050
|
font-style: inherit;
|
|
3060
|
-
|
|
3061
|
-
.wp-block-post-title[style*=letter-spacing] :where(a) {
|
|
3051
|
+
font-weight: inherit;
|
|
3062
3052
|
letter-spacing: inherit;
|
|
3063
|
-
|
|
3064
|
-
.wp-block-post-title[style*=text-decoration] :where(a) {
|
|
3053
|
+
line-height: inherit;
|
|
3065
3054
|
text-decoration: inherit;
|
|
3066
3055
|
}
|
|
3067
|
-
.wp-block-post-title a {
|
|
3068
|
-
display: inline-block;
|
|
3069
|
-
}
|
|
3070
3056
|
|
|
3071
3057
|
.wp-block-post-author-name {
|
|
3072
3058
|
box-sizing: border-box;
|
|
@@ -3491,30 +3477,16 @@ ul.wp-block-rss.is-grid li {
|
|
|
3491
3477
|
.wp-block-site-title {
|
|
3492
3478
|
box-sizing: border-box;
|
|
3493
3479
|
}
|
|
3494
|
-
.wp-block-site-title
|
|
3495
|
-
|
|
3496
|
-
}
|
|
3497
|
-
.wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
|
|
3480
|
+
.wp-block-site-title :where(a) {
|
|
3481
|
+
color: inherit;
|
|
3498
3482
|
font-family: inherit;
|
|
3499
|
-
}
|
|
3500
|
-
.wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
|
|
3501
3483
|
font-size: inherit;
|
|
3502
|
-
}
|
|
3503
|
-
.wp-block-site-title[style*=line-height] :where(a) {
|
|
3504
|
-
line-height: inherit;
|
|
3505
|
-
}
|
|
3506
|
-
.wp-block-site-title[style*=font-style] :where(a) {
|
|
3507
3484
|
font-style: inherit;
|
|
3508
|
-
|
|
3509
|
-
.wp-block-site-title[style*=letter-spacing] :where(a) {
|
|
3485
|
+
font-weight: inherit;
|
|
3510
3486
|
letter-spacing: inherit;
|
|
3511
|
-
|
|
3512
|
-
.wp-block-site-title[style*=text-decoration] :where(a) {
|
|
3487
|
+
line-height: inherit;
|
|
3513
3488
|
text-decoration: inherit;
|
|
3514
3489
|
}
|
|
3515
|
-
.wp-block-site-title :where(a) {
|
|
3516
|
-
color: inherit;
|
|
3517
|
-
}
|
|
3518
3490
|
|
|
3519
3491
|
.wp-block-social-links {
|
|
3520
3492
|
box-sizing: border-box;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -39,39 +39,39 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/runtime": "^7.16.0",
|
|
42
|
-
"@wordpress/a11y": "^4.
|
|
43
|
-
"@wordpress/api-fetch": "^7.
|
|
44
|
-
"@wordpress/autop": "^4.
|
|
45
|
-
"@wordpress/blob": "^4.
|
|
46
|
-
"@wordpress/block-editor": "^14.
|
|
47
|
-
"@wordpress/blocks": "^13.
|
|
48
|
-
"@wordpress/components": "^28.8.
|
|
49
|
-
"@wordpress/compose": "^7.8.
|
|
50
|
-
"@wordpress/core-data": "^7.
|
|
51
|
-
"@wordpress/data": "^10.
|
|
52
|
-
"@wordpress/date": "^5.
|
|
53
|
-
"@wordpress/deprecated": "^4.
|
|
54
|
-
"@wordpress/dom": "^4.
|
|
55
|
-
"@wordpress/element": "^6.
|
|
56
|
-
"@wordpress/escape-html": "^3.
|
|
57
|
-
"@wordpress/hooks": "^4.
|
|
58
|
-
"@wordpress/html-entities": "^4.
|
|
59
|
-
"@wordpress/i18n": "^5.
|
|
60
|
-
"@wordpress/icons": "^10.
|
|
61
|
-
"@wordpress/interactivity": "^6.
|
|
62
|
-
"@wordpress/interactivity-router": "^2.
|
|
63
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
64
|
-
"@wordpress/keycodes": "^4.
|
|
65
|
-
"@wordpress/notices": "^5.
|
|
66
|
-
"@wordpress/patterns": "^2.
|
|
67
|
-
"@wordpress/primitives": "^4.
|
|
68
|
-
"@wordpress/private-apis": "^1.
|
|
69
|
-
"@wordpress/reusable-blocks": "^5.
|
|
70
|
-
"@wordpress/rich-text": "^7.
|
|
71
|
-
"@wordpress/server-side-render": "^5.
|
|
72
|
-
"@wordpress/url": "^4.
|
|
73
|
-
"@wordpress/viewport": "^6.
|
|
74
|
-
"@wordpress/wordcount": "^4.
|
|
42
|
+
"@wordpress/a11y": "^4.8.0",
|
|
43
|
+
"@wordpress/api-fetch": "^7.8.0",
|
|
44
|
+
"@wordpress/autop": "^4.8.0",
|
|
45
|
+
"@wordpress/blob": "^4.8.0",
|
|
46
|
+
"@wordpress/block-editor": "^14.3.0",
|
|
47
|
+
"@wordpress/blocks": "^13.8.0",
|
|
48
|
+
"@wordpress/components": "^28.8.0",
|
|
49
|
+
"@wordpress/compose": "^7.8.0",
|
|
50
|
+
"@wordpress/core-data": "^7.8.0",
|
|
51
|
+
"@wordpress/data": "^10.8.0",
|
|
52
|
+
"@wordpress/date": "^5.8.0",
|
|
53
|
+
"@wordpress/deprecated": "^4.8.0",
|
|
54
|
+
"@wordpress/dom": "^4.8.0",
|
|
55
|
+
"@wordpress/element": "^6.8.0",
|
|
56
|
+
"@wordpress/escape-html": "^3.8.0",
|
|
57
|
+
"@wordpress/hooks": "^4.8.0",
|
|
58
|
+
"@wordpress/html-entities": "^4.8.0",
|
|
59
|
+
"@wordpress/i18n": "^5.8.0",
|
|
60
|
+
"@wordpress/icons": "^10.8.0",
|
|
61
|
+
"@wordpress/interactivity": "^6.8.0",
|
|
62
|
+
"@wordpress/interactivity-router": "^2.8.0",
|
|
63
|
+
"@wordpress/keyboard-shortcuts": "^5.8.0",
|
|
64
|
+
"@wordpress/keycodes": "^4.8.0",
|
|
65
|
+
"@wordpress/notices": "^5.8.0",
|
|
66
|
+
"@wordpress/patterns": "^2.8.0",
|
|
67
|
+
"@wordpress/primitives": "^4.8.0",
|
|
68
|
+
"@wordpress/private-apis": "^1.8.0",
|
|
69
|
+
"@wordpress/reusable-blocks": "^5.8.0",
|
|
70
|
+
"@wordpress/rich-text": "^7.8.0",
|
|
71
|
+
"@wordpress/server-side-render": "^5.8.0",
|
|
72
|
+
"@wordpress/url": "^4.8.0",
|
|
73
|
+
"@wordpress/viewport": "^6.8.0",
|
|
74
|
+
"@wordpress/wordcount": "^4.8.0",
|
|
75
75
|
"change-case": "^4.1.2",
|
|
76
76
|
"clsx": "^2.1.1",
|
|
77
77
|
"colord": "^2.7.0",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "cecf5e14d317aa67407f77a7e5c8b6a43016bd42"
|
|
93
93
|
}
|
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/categories",
|
|
5
|
-
"title": "
|
|
5
|
+
"title": "Terms List",
|
|
6
6
|
"category": "widgets",
|
|
7
|
-
"description": "Display a list of all
|
|
7
|
+
"description": "Display a list of all terms of a given taxonomy.",
|
|
8
|
+
"keywords": [ "categories" ],
|
|
8
9
|
"textdomain": "default",
|
|
9
10
|
"attributes": {
|
|
11
|
+
"taxonomy": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"default": "category"
|
|
14
|
+
},
|
|
10
15
|
"displayAsDropdown": {
|
|
11
16
|
"type": "boolean",
|
|
12
17
|
"default": false
|
package/src/categories/edit.js
CHANGED
|
@@ -9,6 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import {
|
|
10
10
|
PanelBody,
|
|
11
11
|
Placeholder,
|
|
12
|
+
SelectControl,
|
|
12
13
|
Spinner,
|
|
13
14
|
ToggleControl,
|
|
14
15
|
VisuallyHidden,
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
RichText,
|
|
21
22
|
} from '@wordpress/block-editor';
|
|
22
23
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
23
|
-
import { __ } from '@wordpress/i18n';
|
|
24
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
24
25
|
import { pin } from '@wordpress/icons';
|
|
25
26
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
26
27
|
|
|
@@ -33,19 +34,33 @@ export default function CategoriesEdit( {
|
|
|
33
34
|
showEmpty,
|
|
34
35
|
label,
|
|
35
36
|
showLabel,
|
|
37
|
+
taxonomy: taxonomySlug,
|
|
36
38
|
},
|
|
37
39
|
setAttributes,
|
|
38
40
|
className,
|
|
39
41
|
} ) {
|
|
40
42
|
const selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );
|
|
43
|
+
|
|
44
|
+
const { records: allTaxonomies, isResolvingTaxonomies } = useEntityRecords(
|
|
45
|
+
'root',
|
|
46
|
+
'taxonomy'
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const taxonomies = allTaxonomies?.filter( ( t ) => t.visibility.public );
|
|
50
|
+
|
|
51
|
+
const taxonomy = taxonomies?.find( ( t ) => t.slug === taxonomySlug );
|
|
52
|
+
|
|
53
|
+
const isHierarchicalTaxonomy =
|
|
54
|
+
! isResolvingTaxonomies && taxonomy?.hierarchical;
|
|
55
|
+
|
|
41
56
|
const query = { per_page: -1, hide_empty: ! showEmpty, context: 'view' };
|
|
42
|
-
if ( showOnlyTopLevel ) {
|
|
57
|
+
if ( isHierarchicalTaxonomy && showOnlyTopLevel ) {
|
|
43
58
|
query.parent = 0;
|
|
44
59
|
}
|
|
45
60
|
|
|
46
61
|
const { records: categories, isResolving } = useEntityRecords(
|
|
47
62
|
'taxonomy',
|
|
48
|
-
|
|
63
|
+
taxonomySlug,
|
|
49
64
|
query
|
|
50
65
|
);
|
|
51
66
|
|
|
@@ -66,7 +81,7 @@ export default function CategoriesEdit( {
|
|
|
66
81
|
! name ? __( '(Untitled)' ) : decodeEntities( name ).trim();
|
|
67
82
|
|
|
68
83
|
const renderCategoryList = () => {
|
|
69
|
-
const parentId = showHierarchy ? 0 : null;
|
|
84
|
+
const parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;
|
|
70
85
|
const categoriesList = getCategoriesList( parentId );
|
|
71
86
|
return categoriesList.map( ( category ) =>
|
|
72
87
|
renderCategoryListItem( category )
|
|
@@ -82,19 +97,21 @@ export default function CategoriesEdit( {
|
|
|
82
97
|
{ renderCategoryName( name ) }
|
|
83
98
|
</a>
|
|
84
99
|
{ showPostCounts && ` (${ count })` }
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
{ isHierarchicalTaxonomy &&
|
|
101
|
+
showHierarchy &&
|
|
102
|
+
!! childCategories.length && (
|
|
103
|
+
<ul className="children">
|
|
104
|
+
{ childCategories.map( ( childCategory ) =>
|
|
105
|
+
renderCategoryListItem( childCategory )
|
|
106
|
+
) }
|
|
107
|
+
</ul>
|
|
108
|
+
) }
|
|
92
109
|
</li>
|
|
93
110
|
);
|
|
94
111
|
};
|
|
95
112
|
|
|
96
113
|
const renderCategoryDropdown = () => {
|
|
97
|
-
const parentId = showHierarchy ? 0 : null;
|
|
114
|
+
const parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;
|
|
98
115
|
const categoriesList = getCategoriesList( parentId );
|
|
99
116
|
return (
|
|
100
117
|
<>
|
|
@@ -102,7 +119,7 @@ export default function CategoriesEdit( {
|
|
|
102
119
|
<RichText
|
|
103
120
|
className="wp-block-categories__label"
|
|
104
121
|
aria-label={ __( 'Label text' ) }
|
|
105
|
-
placeholder={
|
|
122
|
+
placeholder={ taxonomy.name }
|
|
106
123
|
withoutInteractiveFormatting
|
|
107
124
|
value={ label }
|
|
108
125
|
onChange={ ( html ) =>
|
|
@@ -111,11 +128,17 @@ export default function CategoriesEdit( {
|
|
|
111
128
|
/>
|
|
112
129
|
) : (
|
|
113
130
|
<VisuallyHidden as="label" htmlFor={ selectId }>
|
|
114
|
-
{ label ? label :
|
|
131
|
+
{ label ? label : taxonomy.name }
|
|
115
132
|
</VisuallyHidden>
|
|
116
133
|
) }
|
|
117
134
|
<select id={ selectId }>
|
|
118
|
-
<option>
|
|
135
|
+
<option>
|
|
136
|
+
{ sprintf(
|
|
137
|
+
/* translators: %s: taxonomy's singular name */
|
|
138
|
+
__( 'Select %s' ),
|
|
139
|
+
taxonomy.labels.singular_name
|
|
140
|
+
) }
|
|
141
|
+
</option>
|
|
119
142
|
{ categoriesList.map( ( category ) =>
|
|
120
143
|
renderCategoryDropdownItem( category, 0 )
|
|
121
144
|
) }
|
|
@@ -133,7 +156,8 @@ export default function CategoriesEdit( {
|
|
|
133
156
|
{ renderCategoryName( name ) }
|
|
134
157
|
{ showPostCounts && ` (${ count })` }
|
|
135
158
|
</option>,
|
|
136
|
-
|
|
159
|
+
isHierarchicalTaxonomy &&
|
|
160
|
+
showHierarchy &&
|
|
137
161
|
!! childCategories.length &&
|
|
138
162
|
childCategories.map( ( childCategory ) =>
|
|
139
163
|
renderCategoryDropdownItem( childCategory, level + 1 )
|
|
@@ -161,6 +185,23 @@ export default function CategoriesEdit( {
|
|
|
161
185
|
<TagName { ...blockProps }>
|
|
162
186
|
<InspectorControls>
|
|
163
187
|
<PanelBody title={ __( 'Settings' ) }>
|
|
188
|
+
{ Array.isArray( taxonomies ) && (
|
|
189
|
+
<SelectControl
|
|
190
|
+
__nextHasNoMarginBottom
|
|
191
|
+
__next40pxDefaultSize
|
|
192
|
+
label={ __( 'Taxonomy' ) }
|
|
193
|
+
options={ taxonomies.map( ( t ) => ( {
|
|
194
|
+
label: t.name,
|
|
195
|
+
value: t.slug,
|
|
196
|
+
} ) ) }
|
|
197
|
+
value={ taxonomySlug }
|
|
198
|
+
onChange={ ( selectedTaxonomy ) =>
|
|
199
|
+
setAttributes( {
|
|
200
|
+
taxonomy: selectedTaxonomy,
|
|
201
|
+
} )
|
|
202
|
+
}
|
|
203
|
+
/>
|
|
204
|
+
) }
|
|
164
205
|
<ToggleControl
|
|
165
206
|
__nextHasNoMarginBottom
|
|
166
207
|
label={ __( 'Display as dropdown' ) }
|
|
@@ -182,19 +223,21 @@ export default function CategoriesEdit( {
|
|
|
182
223
|
checked={ showPostCounts }
|
|
183
224
|
onChange={ toggleAttribute( 'showPostCounts' ) }
|
|
184
225
|
/>
|
|
226
|
+
{ isHierarchicalTaxonomy && (
|
|
227
|
+
<ToggleControl
|
|
228
|
+
__nextHasNoMarginBottom
|
|
229
|
+
label={ __( 'Show only top level terms' ) }
|
|
230
|
+
checked={ showOnlyTopLevel }
|
|
231
|
+
onChange={ toggleAttribute( 'showOnlyTopLevel' ) }
|
|
232
|
+
/>
|
|
233
|
+
) }
|
|
185
234
|
<ToggleControl
|
|
186
235
|
__nextHasNoMarginBottom
|
|
187
|
-
label={ __( 'Show
|
|
188
|
-
checked={ showOnlyTopLevel }
|
|
189
|
-
onChange={ toggleAttribute( 'showOnlyTopLevel' ) }
|
|
190
|
-
/>
|
|
191
|
-
<ToggleControl
|
|
192
|
-
__nextHasNoMarginBottom
|
|
193
|
-
label={ __( 'Show empty categories' ) }
|
|
236
|
+
label={ __( 'Show empty terms' ) }
|
|
194
237
|
checked={ showEmpty }
|
|
195
238
|
onChange={ toggleAttribute( 'showEmpty' ) }
|
|
196
239
|
/>
|
|
197
|
-
{ ! showOnlyTopLevel && (
|
|
240
|
+
{ isHierarchicalTaxonomy && ! showOnlyTopLevel && (
|
|
198
241
|
<ToggleControl
|
|
199
242
|
__nextHasNoMarginBottom
|
|
200
243
|
label={ __( 'Show hierarchy' ) }
|
|
@@ -205,16 +248,12 @@ export default function CategoriesEdit( {
|
|
|
205
248
|
</PanelBody>
|
|
206
249
|
</InspectorControls>
|
|
207
250
|
{ isResolving && (
|
|
208
|
-
<Placeholder icon={ pin } label={ __( '
|
|
251
|
+
<Placeholder icon={ pin } label={ __( 'Terms' ) }>
|
|
209
252
|
<Spinner />
|
|
210
253
|
</Placeholder>
|
|
211
254
|
) }
|
|
212
255
|
{ ! isResolving && categories?.length === 0 && (
|
|
213
|
-
<p>
|
|
214
|
-
{ __(
|
|
215
|
-
'Your site does not have any posts, so there is nothing to display here at the moment.'
|
|
216
|
-
) }
|
|
217
|
-
</p>
|
|
256
|
+
<p>{ taxonomy.labels.no_terms }</p>
|
|
218
257
|
) }
|
|
219
258
|
{ ! isResolving &&
|
|
220
259
|
categories?.length > 0 &&
|
package/src/categories/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { category as icon } from '@wordpress/icons';
|
|
|
9
9
|
import initBlock from '../utils/init-block';
|
|
10
10
|
import metadata from './block.json';
|
|
11
11
|
import edit from './edit';
|
|
12
|
+
import variations from './variations';
|
|
12
13
|
|
|
13
14
|
const { name } = metadata;
|
|
14
15
|
|
|
@@ -18,6 +19,7 @@ export const settings = {
|
|
|
18
19
|
icon,
|
|
19
20
|
example: {},
|
|
20
21
|
edit,
|
|
22
|
+
variations,
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/categories/index.php
CHANGED
|
@@ -21,11 +21,14 @@ function render_block_core_categories( $attributes, $content, $block ) {
|
|
|
21
21
|
static $block_id = 0;
|
|
22
22
|
++$block_id;
|
|
23
23
|
|
|
24
|
+
$taxonomy = get_taxonomy( $attributes['taxonomy'] );
|
|
25
|
+
|
|
24
26
|
$args = array(
|
|
25
27
|
'echo' => false,
|
|
26
28
|
'hierarchical' => ! empty( $attributes['showHierarchy'] ),
|
|
27
29
|
'orderby' => 'name',
|
|
28
30
|
'show_count' => ! empty( $attributes['showPostCounts'] ),
|
|
31
|
+
'taxonomy' => $attributes['taxonomy'],
|
|
29
32
|
'title_li' => '',
|
|
30
33
|
'hide_empty' => empty( $attributes['showEmpty'] ),
|
|
31
34
|
);
|
|
@@ -36,13 +39,20 @@ function render_block_core_categories( $attributes, $content, $block ) {
|
|
|
36
39
|
if ( ! empty( $attributes['displayAsDropdown'] ) ) {
|
|
37
40
|
$id = 'wp-block-categories-' . $block_id;
|
|
38
41
|
$args['id'] = $id;
|
|
39
|
-
$args['
|
|
40
|
-
$
|
|
41
|
-
$
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
$args['name'] = $taxonomy->query_var;
|
|
43
|
+
$args['value_field'] = 'slug';
|
|
44
|
+
$args['show_option_none'] = sprintf(
|
|
45
|
+
/* translators: %s: taxonomy's singular name */
|
|
46
|
+
__( 'Select %s' ),
|
|
47
|
+
$taxonomy->labels->singular_name
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
$show_label = empty( $attributes['showLabel'] ) ? ' screen-reader-text' : '';
|
|
51
|
+
$default_label = $taxonomy->label;
|
|
52
|
+
$label_text = ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
|
|
53
|
+
$wrapper_markup = '<div %1$s><label class="wp-block-categories__label' . $show_label . '" for="' . esc_attr( $id ) . '">' . $label_text . '</label>%2$s</div>';
|
|
54
|
+
$items_markup = wp_dropdown_categories( $args );
|
|
55
|
+
$type = 'dropdown';
|
|
46
56
|
|
|
47
57
|
if ( ! is_admin() ) {
|
|
48
58
|
// Inject the dropdown script immediately after the select dropdown.
|
|
@@ -54,6 +64,8 @@ function render_block_core_categories( $attributes, $content, $block ) {
|
|
|
54
64
|
);
|
|
55
65
|
}
|
|
56
66
|
} else {
|
|
67
|
+
$args['show_option_none'] = $taxonomy->labels->no_terms;
|
|
68
|
+
|
|
57
69
|
$wrapper_markup = '<ul %1$s>%2$s</ul>';
|
|
58
70
|
$items_markup = wp_list_categories( $args );
|
|
59
71
|
$type = 'list';
|
|
@@ -92,8 +104,8 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
|
|
|
92
104
|
( function() {
|
|
93
105
|
var dropdown = document.getElementById( '<?php echo esc_js( $dropdown_id ); ?>' );
|
|
94
106
|
function onCatChange() {
|
|
95
|
-
if ( dropdown.options[ dropdown.selectedIndex ].value
|
|
96
|
-
location.href = "<?php echo esc_url( home_url() ); ?>/?
|
|
107
|
+
if ( dropdown.options[ dropdown.selectedIndex ].value !== -1 ) {
|
|
108
|
+
location.href = "<?php echo esc_url( home_url() ); ?>/?" + dropdown.name + '=' + dropdown.options[ dropdown.selectedIndex ].value;
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
dropdown.onchange = onCatChange;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { category as icon } from '@wordpress/icons';
|
|
6
|
+
|
|
7
|
+
const variations = [
|
|
8
|
+
{
|
|
9
|
+
name: 'terms',
|
|
10
|
+
title: __( 'Terms List' ),
|
|
11
|
+
icon,
|
|
12
|
+
attributes: {
|
|
13
|
+
// We need to set an attribute here that will be set when inserting the block.
|
|
14
|
+
// We cannot leave this empty, as that would be interpreted as the default value,
|
|
15
|
+
// which is `category` -- for which we're defining a distinct variation below,
|
|
16
|
+
// for backwards compatibility reasons.
|
|
17
|
+
// The logical fallback is thus the only other built-in and public taxonomy: Tags.
|
|
18
|
+
taxonomy: 'post_tag',
|
|
19
|
+
},
|
|
20
|
+
isActive: ( blockAttributes ) =>
|
|
21
|
+
// This variation is used for any taxonomy other than `category`.
|
|
22
|
+
blockAttributes.taxonomy !== 'category',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'categories',
|
|
26
|
+
title: __( 'Categories List' ),
|
|
27
|
+
description: __( 'Display a list of all categories.' ),
|
|
28
|
+
icon,
|
|
29
|
+
attributes: {
|
|
30
|
+
taxonomy: 'category',
|
|
31
|
+
},
|
|
32
|
+
isActive: [ 'taxonomy' ],
|
|
33
|
+
// The following is needed to prevent "Terms List" from showing up twice in the inserter
|
|
34
|
+
// (once for the block, once for the variation). Fortunately, it does not collide with
|
|
35
|
+
// `categories` being the default value of the `taxonomy` attribute.
|
|
36
|
+
isDefault: true,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export default variations;
|
|
@@ -37,7 +37,7 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
|
|
|
37
37
|
$label .= $pagination_arrow;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
$next_comments_link = get_next_comments_link( $label, $max_page );
|
|
40
|
+
$next_comments_link = get_next_comments_link( $label, $max_page, $comment_vars['paged'] ?? null );
|
|
41
41
|
|
|
42
42
|
remove_filter( 'next_posts_link_attributes', $filter_link_attributes );
|
|
43
43
|
|
|
@@ -29,7 +29,8 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
|
|
|
29
29
|
};
|
|
30
30
|
add_filter( 'previous_comments_link_attributes', $filter_link_attributes );
|
|
31
31
|
|
|
32
|
-
$
|
|
32
|
+
$comment_vars = build_comment_query_vars_from_block( $block );
|
|
33
|
+
$previous_comments_link = get_previous_comments_link( $label, $comment_vars['paged'] ?? null );
|
|
33
34
|
|
|
34
35
|
remove_filter( 'previous_comments_link_attributes', $filter_link_attributes );
|
|
35
36
|
|