@wordpress/block-library 9.30.1-next.6870dfe5b.0 → 9.30.1-next.6f42e1382.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/build/buttons/index.js +2 -1
- package/build/buttons/index.js.map +1 -1
- package/build/categories/edit.js +3 -1
- package/build/categories/edit.js.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/build/social-links/index.js +2 -1
- package/build/social-links/index.js.map +1 -1
- package/build/table-of-contents/edit.js +33 -9
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +4 -0
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +6 -3
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +6 -3
- package/build/table-of-contents/save.js.map +1 -1
- package/build/term-template/edit.js +318 -0
- package/build/term-template/edit.js.map +1 -0
- package/build/term-template/index.js +109 -0
- package/build/term-template/index.js.map +1 -0
- package/build/term-template/save.js +16 -0
- package/build/term-template/save.js.map +1 -0
- package/build/term-template/variations.js +83 -0
- package/build/term-template/variations.js.map +1 -0
- package/build/terms-query/edit.js +20 -0
- package/build/terms-query/edit.js.map +1 -0
- package/build/terms-query/index.js +83 -0
- package/build/terms-query/index.js.map +1 -0
- package/build/terms-query/inspector-controls.js +246 -0
- package/build/terms-query/inspector-controls.js.map +1 -0
- package/build/terms-query/save.js +24 -0
- package/build/terms-query/save.js.map +1 -0
- package/build/terms-query/terms-query-content.js +71 -0
- package/build/terms-query/terms-query-content.js.map +1 -0
- package/build-module/buttons/index.js +2 -1
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/categories/edit.js +3 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/social-links/index.js +2 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table-of-contents/edit.js +35 -11
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +4 -0
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +6 -3
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +6 -3
- package/build-module/table-of-contents/save.js.map +1 -1
- package/build-module/term-template/edit.js +310 -0
- package/build-module/term-template/edit.js.map +1 -0
- package/build-module/term-template/index.js +102 -0
- package/build-module/term-template/index.js.map +1 -0
- package/build-module/term-template/save.js +9 -0
- package/build-module/term-template/save.js.map +1 -0
- package/build-module/term-template/variations.js +76 -0
- package/build-module/term-template/variations.js.map +1 -0
- package/build-module/terms-query/edit.js +12 -0
- package/build-module/terms-query/edit.js.map +1 -0
- package/build-module/terms-query/index.js +76 -0
- package/build-module/terms-query/index.js.map +1 -0
- package/build-module/terms-query/inspector-controls.js +239 -0
- package/build-module/terms-query/inspector-controls.js.map +1 -0
- package/build-module/terms-query/save.js +17 -0
- package/build-module/terms-query/save.js.map +1 -0
- package/build-module/terms-query/terms-query-content.js +63 -0
- package/build-module/terms-query/terms-query-content.js.map +1 -0
- package/build-style/editor-rtl.css +24 -0
- package/build-style/editor.css +24 -0
- package/build-style/style-rtl.css +16 -0
- package/build-style/style.css +16 -0
- package/build-style/term-template/editor-rtl.css +160 -0
- package/build-style/term-template/editor.css +160 -0
- package/build-style/term-template/style-rtl.css +146 -0
- package/build-style/term-template/style.css +146 -0
- package/build-style/terms-query/style-rtl.css +140 -0
- package/build-style/terms-query/style.css +140 -0
- package/build-types/table-of-contents/list.d.ts +2 -1
- package/build-types/table-of-contents/list.d.ts.map +1 -1
- package/package.json +35 -35
- package/src/buttons/block.json +2 -1
- package/src/categories/edit.js +2 -1
- package/src/editor.scss +1 -0
- package/src/index.js +4 -0
- package/src/post-date/index.php +18 -13
- package/src/social-links/block.json +2 -1
- package/src/style.scss +2 -0
- package/src/table-of-contents/block.json +4 -0
- package/src/table-of-contents/edit.js +58 -21
- package/src/table-of-contents/list.tsx +7 -2
- package/src/table-of-contents/save.js +7 -3
- package/src/term-template/block.json +73 -0
- package/src/term-template/edit.js +391 -0
- package/src/term-template/editor.scss +26 -0
- package/src/term-template/index.js +26 -0
- package/src/term-template/index.php +224 -0
- package/src/term-template/save.js +8 -0
- package/src/term-template/style.scss +12 -0
- package/src/term-template/variations.js +87 -0
- package/src/terms-query/block.json +49 -0
- package/src/terms-query/edit.js +10 -0
- package/src/terms-query/index.js +24 -0
- package/src/terms-query/index.php +44 -0
- package/src/terms-query/inspector-controls.js +233 -0
- package/src/terms-query/save.js +10 -0
- package/src/terms-query/style.scss +6 -0
- package/src/terms-query/terms-query-content.js +74 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,9 +6,10 @@ import type { MouseEvent, ReactElement } from 'react';
|
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
8
|
import type { NestedHeadingData } from './utils';
|
|
9
|
-
export default function TableOfContentsList({ nestedHeadingList, disableLinkActivation, onClick, }: {
|
|
9
|
+
export default function TableOfContentsList({ nestedHeadingList, disableLinkActivation, onClick, ordered, }: {
|
|
10
10
|
nestedHeadingList: NestedHeadingData[];
|
|
11
11
|
disableLinkActivation?: boolean;
|
|
12
12
|
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
13
|
+
ordered?: boolean;
|
|
13
14
|
}): ReactElement;
|
|
14
15
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/table-of-contents/list.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/table-of-contents/list.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,EACP,OAAc,GACd,EAAE;IACF,iBAAiB,EAAE,iBAAiB,EAAE,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,CAAE,KAAK,EAAE,UAAU,CAAE,iBAAiB,CAAE,KAAM,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,GAAI,YAAY,CAmDhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.30.1-next.
|
|
3
|
+
"version": "9.30.1-next.6f42e1382.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -42,39 +42,39 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime": "7.25.7",
|
|
45
|
-
"@wordpress/a11y": "^4.30.1-next.
|
|
46
|
-
"@wordpress/api-fetch": "^7.30.1-next.
|
|
47
|
-
"@wordpress/autop": "^4.30.1-next.
|
|
48
|
-
"@wordpress/blob": "^4.30.1-next.
|
|
49
|
-
"@wordpress/block-editor": "^15.3.1-next.
|
|
50
|
-
"@wordpress/blocks": "^15.3.1-next.
|
|
51
|
-
"@wordpress/components": "^30.3.2-next.
|
|
52
|
-
"@wordpress/compose": "^7.30.1-next.
|
|
53
|
-
"@wordpress/core-data": "^7.30.1-next.
|
|
54
|
-
"@wordpress/data": "^10.30.1-next.
|
|
55
|
-
"@wordpress/date": "^5.30.1-next.
|
|
56
|
-
"@wordpress/deprecated": "^4.30.1-next.
|
|
57
|
-
"@wordpress/dom": "^4.30.1-next.
|
|
58
|
-
"@wordpress/element": "^6.30.1-next.
|
|
59
|
-
"@wordpress/escape-html": "^3.30.1-next.
|
|
60
|
-
"@wordpress/hooks": "^4.30.1-next.
|
|
61
|
-
"@wordpress/html-entities": "^4.30.1-next.
|
|
62
|
-
"@wordpress/i18n": "^6.3.1-next.
|
|
63
|
-
"@wordpress/icons": "^10.30.1-next.
|
|
64
|
-
"@wordpress/interactivity": "^6.30.1-next.
|
|
65
|
-
"@wordpress/interactivity-router": "^2.30.1-next.
|
|
66
|
-
"@wordpress/keyboard-shortcuts": "^5.30.1-next.
|
|
67
|
-
"@wordpress/keycodes": "^4.30.1-next.
|
|
68
|
-
"@wordpress/notices": "^5.30.1-next.
|
|
69
|
-
"@wordpress/patterns": "^2.30.1-next.
|
|
70
|
-
"@wordpress/primitives": "^4.30.1-next.
|
|
71
|
-
"@wordpress/private-apis": "^1.30.1-next.
|
|
72
|
-
"@wordpress/reusable-blocks": "^5.30.1-next.
|
|
73
|
-
"@wordpress/rich-text": "^7.30.1-next.
|
|
74
|
-
"@wordpress/server-side-render": "^6.6.1-next.
|
|
75
|
-
"@wordpress/url": "^4.30.1-next.
|
|
76
|
-
"@wordpress/viewport": "^6.30.1-next.
|
|
77
|
-
"@wordpress/wordcount": "^4.30.1-next.
|
|
45
|
+
"@wordpress/a11y": "^4.30.1-next.6f42e1382.0",
|
|
46
|
+
"@wordpress/api-fetch": "^7.30.1-next.6f42e1382.0",
|
|
47
|
+
"@wordpress/autop": "^4.30.1-next.6f42e1382.0",
|
|
48
|
+
"@wordpress/blob": "^4.30.1-next.6f42e1382.0",
|
|
49
|
+
"@wordpress/block-editor": "^15.3.1-next.6f42e1382.0",
|
|
50
|
+
"@wordpress/blocks": "^15.3.1-next.6f42e1382.0",
|
|
51
|
+
"@wordpress/components": "^30.3.2-next.6f42e1382.0",
|
|
52
|
+
"@wordpress/compose": "^7.30.1-next.6f42e1382.0",
|
|
53
|
+
"@wordpress/core-data": "^7.30.1-next.6f42e1382.0",
|
|
54
|
+
"@wordpress/data": "^10.30.1-next.6f42e1382.0",
|
|
55
|
+
"@wordpress/date": "^5.30.1-next.6f42e1382.0",
|
|
56
|
+
"@wordpress/deprecated": "^4.30.1-next.6f42e1382.0",
|
|
57
|
+
"@wordpress/dom": "^4.30.1-next.6f42e1382.0",
|
|
58
|
+
"@wordpress/element": "^6.30.1-next.6f42e1382.0",
|
|
59
|
+
"@wordpress/escape-html": "^3.30.1-next.6f42e1382.0",
|
|
60
|
+
"@wordpress/hooks": "^4.30.1-next.6f42e1382.0",
|
|
61
|
+
"@wordpress/html-entities": "^4.30.1-next.6f42e1382.0",
|
|
62
|
+
"@wordpress/i18n": "^6.3.1-next.6f42e1382.0",
|
|
63
|
+
"@wordpress/icons": "^10.30.1-next.6f42e1382.0",
|
|
64
|
+
"@wordpress/interactivity": "^6.30.1-next.6f42e1382.0",
|
|
65
|
+
"@wordpress/interactivity-router": "^2.30.1-next.6f42e1382.0",
|
|
66
|
+
"@wordpress/keyboard-shortcuts": "^5.30.1-next.6f42e1382.0",
|
|
67
|
+
"@wordpress/keycodes": "^4.30.1-next.6f42e1382.0",
|
|
68
|
+
"@wordpress/notices": "^5.30.1-next.6f42e1382.0",
|
|
69
|
+
"@wordpress/patterns": "^2.30.1-next.6f42e1382.0",
|
|
70
|
+
"@wordpress/primitives": "^4.30.1-next.6f42e1382.0",
|
|
71
|
+
"@wordpress/private-apis": "^1.30.1-next.6f42e1382.0",
|
|
72
|
+
"@wordpress/reusable-blocks": "^5.30.1-next.6f42e1382.0",
|
|
73
|
+
"@wordpress/rich-text": "^7.30.1-next.6f42e1382.0",
|
|
74
|
+
"@wordpress/server-side-render": "^6.6.1-next.6f42e1382.0",
|
|
75
|
+
"@wordpress/url": "^4.30.1-next.6f42e1382.0",
|
|
76
|
+
"@wordpress/viewport": "^6.30.1-next.6f42e1382.0",
|
|
77
|
+
"@wordpress/wordcount": "^4.30.1-next.6f42e1382.0",
|
|
78
78
|
"change-case": "^4.1.2",
|
|
79
79
|
"clsx": "^2.1.1",
|
|
80
80
|
"colord": "^2.7.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "8806899f598577a3c90a55d9aa79fbc372fe1e75"
|
|
96
96
|
}
|
package/src/buttons/block.json
CHANGED
package/src/categories/edit.js
CHANGED
|
@@ -52,7 +52,8 @@ export default function CategoriesEdit( {
|
|
|
52
52
|
|
|
53
53
|
const { records: allTaxonomies, isResolvingTaxonomies } = useEntityRecords(
|
|
54
54
|
'root',
|
|
55
|
-
'taxonomy'
|
|
55
|
+
'taxonomy',
|
|
56
|
+
{ per_page: -1 }
|
|
56
57
|
);
|
|
57
58
|
|
|
58
59
|
const taxonomies = allTaxonomies?.filter( ( t ) => t.visibility.public );
|
package/src/editor.scss
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
@import "./table/editor.scss";
|
|
47
47
|
@import "./tag-cloud/editor.scss";
|
|
48
48
|
@import "./template-part/editor.scss";
|
|
49
|
+
@import "./term-template/editor.scss";
|
|
49
50
|
@import "./text-columns/editor.scss";
|
|
50
51
|
@import "./video/editor.scss";
|
|
51
52
|
@import "./query/editor.scss";
|
package/src/index.js
CHANGED
|
@@ -122,6 +122,8 @@ import * as tableOfContents from './table-of-contents';
|
|
|
122
122
|
import * as tagCloud from './tag-cloud';
|
|
123
123
|
import * as templatePart from './template-part';
|
|
124
124
|
import * as termDescription from './term-description';
|
|
125
|
+
import * as termsQuery from './terms-query';
|
|
126
|
+
import * as termTemplate from './term-template';
|
|
125
127
|
import * as textColumns from './text-columns';
|
|
126
128
|
import * as verse from './verse';
|
|
127
129
|
import * as video from './video';
|
|
@@ -244,6 +246,8 @@ const getAllBlocks = () => {
|
|
|
244
246
|
blocks.push( accordionContent );
|
|
245
247
|
blocks.push( accordionHeader );
|
|
246
248
|
blocks.push( accordionPanel );
|
|
249
|
+
blocks.push( termsQuery );
|
|
250
|
+
blocks.push( termTemplate );
|
|
247
251
|
}
|
|
248
252
|
|
|
249
253
|
if ( window?.__experimentalEnableFormBlocks ) {
|
package/src/post-date/index.php
CHANGED
|
@@ -20,19 +20,11 @@ function render_block_core_post_date( $attributes, $content, $block ) {
|
|
|
20
20
|
$classes = array();
|
|
21
21
|
|
|
22
22
|
if (
|
|
23
|
-
isset( $attributes['
|
|
24
|
-
|
|
23
|
+
! isset( $attributes['datetime'] ) && ! (
|
|
24
|
+
isset( $attributes['metadata']['bindings']['datetime']['source'] ) &&
|
|
25
|
+
isset( $attributes['metadata']['bindings']['datetime']['args'] )
|
|
26
|
+
)
|
|
25
27
|
) {
|
|
26
|
-
/*
|
|
27
|
-
* We might be running on a version of WordPress that doesn't support binding the block's `datetime` attribute
|
|
28
|
-
* to a Block Bindings source. In this case, we need to manually set the `datetime` attribute to its correct value.
|
|
29
|
-
* This branch can be removed once the minimum required WordPress version is 6.9 or newer.
|
|
30
|
-
*/
|
|
31
|
-
$source = get_block_bindings_source( $attributes['metadata']['bindings']['datetime']['source'] );
|
|
32
|
-
$source_args = $attributes['metadata']['bindings']['datetime']['args'];
|
|
33
|
-
|
|
34
|
-
$attributes['datetime'] = $source->get_value( $source_args, $block, 'datetime' );
|
|
35
|
-
} elseif ( ! isset( $attributes['datetime'] ) ) {
|
|
36
28
|
/*
|
|
37
29
|
* This is the legacy version of the block that didn't have the `datetime` attribute.
|
|
38
30
|
* This branch needs to be kept for backward compatibility.
|
|
@@ -61,7 +53,7 @@ function render_block_core_post_date( $attributes, $content, $block ) {
|
|
|
61
53
|
// (See https://github.com/WordPress/gutenberg/pull/46839 where this logic was originally
|
|
62
54
|
// implemented.)
|
|
63
55
|
// In this case, we have to respect and return the empty value.
|
|
64
|
-
return
|
|
56
|
+
return '';
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
$unformatted_date = $attributes['datetime'];
|
|
@@ -113,5 +105,18 @@ function register_block_core_post_date() {
|
|
|
113
105
|
'render_callback' => 'render_block_core_post_date',
|
|
114
106
|
)
|
|
115
107
|
);
|
|
108
|
+
|
|
109
|
+
// The following filter can be removed once the minimum required WordPress version is 6.9 or newer.
|
|
110
|
+
add_filter(
|
|
111
|
+
'block_bindings_supported_attributes_core/post-date',
|
|
112
|
+
function ( $attributes ) {
|
|
113
|
+
if ( ! in_array( 'datetime', $attributes, true ) ) {
|
|
114
|
+
$attributes[] = 'datetime';
|
|
115
|
+
}
|
|
116
|
+
return $attributes;
|
|
117
|
+
},
|
|
118
|
+
10,
|
|
119
|
+
3
|
|
120
|
+
);
|
|
116
121
|
}
|
|
117
122
|
add_action( 'init', 'register_block_core_post_date' );
|
package/src/style.scss
CHANGED
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
@import "./table/style.scss";
|
|
69
69
|
@import "./table-of-contents/style.scss";
|
|
70
70
|
@import "./term-description/style.scss";
|
|
71
|
+
@import "./term-template/style.scss";
|
|
72
|
+
@import "./terms-query/style.scss";
|
|
71
73
|
@import "./text-columns/style.scss";
|
|
72
74
|
@import "./verse/style.scss";
|
|
73
75
|
@import "./video/style.scss";
|
|
@@ -20,10 +20,16 @@ import {
|
|
|
20
20
|
} from '@wordpress/components';
|
|
21
21
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
22
22
|
import { renderToString } from '@wordpress/element';
|
|
23
|
-
import { __ } from '@wordpress/i18n';
|
|
23
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
24
24
|
import { useInstanceId } from '@wordpress/compose';
|
|
25
25
|
import { store as noticeStore } from '@wordpress/notices';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
tableOfContents as icon,
|
|
28
|
+
formatListBullets,
|
|
29
|
+
formatListBulletsRTL,
|
|
30
|
+
formatListNumbered,
|
|
31
|
+
formatListNumberedRTL,
|
|
32
|
+
} from '@wordpress/icons';
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
35
|
* Internal dependencies
|
|
@@ -43,13 +49,19 @@ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
|
43
49
|
* @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.
|
|
44
50
|
* @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).
|
|
45
51
|
* @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.
|
|
52
|
+
* @param {boolean} props.attributes.ordered Whether to display as an ordered list (true) or unordered list (false).
|
|
46
53
|
* @param {string} props.clientId The client id.
|
|
47
54
|
* @param {(attributes: Object) => void} props.setAttributes The set attributes function.
|
|
48
55
|
*
|
|
49
56
|
* @return {Component} The component.
|
|
50
57
|
*/
|
|
51
58
|
export default function TableOfContentsEdit( {
|
|
52
|
-
attributes: {
|
|
59
|
+
attributes: {
|
|
60
|
+
headings = [],
|
|
61
|
+
onlyIncludeCurrentPage,
|
|
62
|
+
maxLevel,
|
|
63
|
+
ordered = true,
|
|
64
|
+
},
|
|
53
65
|
clientId,
|
|
54
66
|
setAttributes,
|
|
55
67
|
} ) {
|
|
@@ -86,27 +98,48 @@ export default function TableOfContentsEdit( {
|
|
|
86
98
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
87
99
|
const headingTree = linearToNestedHeadingList( headings );
|
|
88
100
|
|
|
89
|
-
const toolbarControls =
|
|
101
|
+
const toolbarControls = (
|
|
90
102
|
<BlockControls>
|
|
91
103
|
<ToolbarGroup>
|
|
92
104
|
<ToolbarButton
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
),
|
|
103
|
-
} )
|
|
104
|
-
)
|
|
105
|
+
icon={ isRTL() ? formatListBulletsRTL : formatListBullets }
|
|
106
|
+
title={ __( 'Unordered' ) }
|
|
107
|
+
description={ __( 'Convert to unordered list' ) }
|
|
108
|
+
onClick={ () => setAttributes( { ordered: false } ) }
|
|
109
|
+
isActive={ ordered === false }
|
|
110
|
+
/>
|
|
111
|
+
<ToolbarButton
|
|
112
|
+
icon={
|
|
113
|
+
isRTL() ? formatListNumberedRTL : formatListNumbered
|
|
105
114
|
}
|
|
106
|
-
|
|
107
|
-
{ __( 'Convert to
|
|
108
|
-
|
|
115
|
+
title={ __( 'Ordered' ) }
|
|
116
|
+
description={ __( 'Convert to ordered list' ) }
|
|
117
|
+
onClick={ () => setAttributes( { ordered: true } ) }
|
|
118
|
+
isActive={ ordered === true }
|
|
119
|
+
/>
|
|
109
120
|
</ToolbarGroup>
|
|
121
|
+
{ canInsertList && (
|
|
122
|
+
<ToolbarGroup>
|
|
123
|
+
<ToolbarButton
|
|
124
|
+
onClick={ () =>
|
|
125
|
+
replaceBlocks(
|
|
126
|
+
clientId,
|
|
127
|
+
createBlock( 'core/list', {
|
|
128
|
+
ordered,
|
|
129
|
+
values: renderToString(
|
|
130
|
+
<TableOfContentsList
|
|
131
|
+
nestedHeadingList={ headingTree }
|
|
132
|
+
ordered={ ordered }
|
|
133
|
+
/>
|
|
134
|
+
),
|
|
135
|
+
} )
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
{ __( 'Convert to static list' ) }
|
|
140
|
+
</ToolbarButton>
|
|
141
|
+
</ToolbarGroup>
|
|
142
|
+
) }
|
|
110
143
|
</BlockControls>
|
|
111
144
|
);
|
|
112
145
|
|
|
@@ -118,6 +151,7 @@ export default function TableOfContentsEdit( {
|
|
|
118
151
|
setAttributes( {
|
|
119
152
|
onlyIncludeCurrentPage: false,
|
|
120
153
|
maxLevel: undefined,
|
|
154
|
+
ordered: true,
|
|
121
155
|
} );
|
|
122
156
|
} }
|
|
123
157
|
dropdownMenuProps={ dropdownMenuProps }
|
|
@@ -210,16 +244,19 @@ export default function TableOfContentsEdit( {
|
|
|
210
244
|
);
|
|
211
245
|
}
|
|
212
246
|
|
|
247
|
+
const ListTag = ordered ? 'ol' : 'ul';
|
|
248
|
+
|
|
213
249
|
return (
|
|
214
250
|
<>
|
|
215
251
|
<nav { ...blockProps }>
|
|
216
|
-
<
|
|
252
|
+
<ListTag>
|
|
217
253
|
<TableOfContentsList
|
|
218
254
|
nestedHeadingList={ headingTree }
|
|
219
255
|
disableLinkActivation
|
|
220
256
|
onClick={ showRedirectionPreventedNotice }
|
|
257
|
+
ordered={ ordered }
|
|
221
258
|
/>
|
|
222
|
-
</
|
|
259
|
+
</ListTag>
|
|
223
260
|
</nav>
|
|
224
261
|
{ toolbarControls }
|
|
225
262
|
{ inspectorControls }
|
|
@@ -14,10 +14,12 @@ export default function TableOfContentsList( {
|
|
|
14
14
|
nestedHeadingList,
|
|
15
15
|
disableLinkActivation,
|
|
16
16
|
onClick,
|
|
17
|
+
ordered = true,
|
|
17
18
|
}: {
|
|
18
19
|
nestedHeadingList: NestedHeadingData[];
|
|
19
20
|
disableLinkActivation?: boolean;
|
|
20
21
|
onClick?: ( event: MouseEvent< HTMLAnchorElement > ) => void;
|
|
22
|
+
ordered?: boolean;
|
|
21
23
|
} ): ReactElement {
|
|
22
24
|
return (
|
|
23
25
|
<>
|
|
@@ -42,11 +44,13 @@ export default function TableOfContentsList( {
|
|
|
42
44
|
<span className={ ENTRY_CLASS_NAME }>{ content }</span>
|
|
43
45
|
);
|
|
44
46
|
|
|
47
|
+
const NestedListTag = ordered ? 'ol' : 'ul';
|
|
48
|
+
|
|
45
49
|
return (
|
|
46
50
|
<li key={ index }>
|
|
47
51
|
{ entry }
|
|
48
52
|
{ node.children ? (
|
|
49
|
-
<
|
|
53
|
+
<NestedListTag>
|
|
50
54
|
<TableOfContentsList
|
|
51
55
|
nestedHeadingList={ node.children }
|
|
52
56
|
disableLinkActivation={
|
|
@@ -58,8 +62,9 @@ export default function TableOfContentsList( {
|
|
|
58
62
|
? onClick
|
|
59
63
|
: undefined
|
|
60
64
|
}
|
|
65
|
+
ordered={ ordered }
|
|
61
66
|
/>
|
|
62
|
-
</
|
|
67
|
+
</NestedListTag>
|
|
63
68
|
) : null }
|
|
64
69
|
</li>
|
|
65
70
|
);
|
|
@@ -9,17 +9,21 @@ import { useBlockProps } from '@wordpress/block-editor';
|
|
|
9
9
|
import TableOfContentsList from './list';
|
|
10
10
|
import { linearToNestedHeadingList } from './utils';
|
|
11
11
|
|
|
12
|
-
export default function save( {
|
|
12
|
+
export default function save( {
|
|
13
|
+
attributes: { headings = [], ordered = true },
|
|
14
|
+
} ) {
|
|
13
15
|
if ( headings.length === 0 ) {
|
|
14
16
|
return null;
|
|
15
17
|
}
|
|
18
|
+
const ListTag = ordered ? 'ol' : 'ul';
|
|
16
19
|
return (
|
|
17
20
|
<nav { ...useBlockProps.save() }>
|
|
18
|
-
<
|
|
21
|
+
<ListTag>
|
|
19
22
|
<TableOfContentsList
|
|
20
23
|
nestedHeadingList={ linearToNestedHeadingList( headings ) }
|
|
24
|
+
ordered={ ordered }
|
|
21
25
|
/>
|
|
22
|
-
</
|
|
26
|
+
</ListTag>
|
|
23
27
|
</nav>
|
|
24
28
|
);
|
|
25
29
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
+
"apiVersion": 3,
|
|
4
|
+
"__experimental": true,
|
|
5
|
+
"name": "core/term-template",
|
|
6
|
+
"title": "Term Template",
|
|
7
|
+
"category": "theme",
|
|
8
|
+
"ancestor": [ "core/terms-query" ],
|
|
9
|
+
"description": "Contains the block elements used to render a taxonomy term, like the name, description, and more.",
|
|
10
|
+
"textdomain": "default",
|
|
11
|
+
"usesContext": [ "termQuery" ],
|
|
12
|
+
"attributes": {
|
|
13
|
+
"namespace": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"supports": {
|
|
18
|
+
"reusable": false,
|
|
19
|
+
"html": false,
|
|
20
|
+
"align": [ "wide", "full" ],
|
|
21
|
+
"layout": {
|
|
22
|
+
"allowSwitching": true,
|
|
23
|
+
"allowEditing": true,
|
|
24
|
+
"default": {
|
|
25
|
+
"type": "flex"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"color": {
|
|
29
|
+
"gradients": true,
|
|
30
|
+
"link": true,
|
|
31
|
+
"__experimentalDefaultControls": {
|
|
32
|
+
"background": true,
|
|
33
|
+
"text": true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"typography": {
|
|
37
|
+
"fontSize": true,
|
|
38
|
+
"lineHeight": true,
|
|
39
|
+
"__experimentalFontFamily": true,
|
|
40
|
+
"__experimentalFontWeight": true,
|
|
41
|
+
"__experimentalFontStyle": true,
|
|
42
|
+
"__experimentalTextTransform": true,
|
|
43
|
+
"__experimentalTextDecoration": true,
|
|
44
|
+
"__experimentalLetterSpacing": true,
|
|
45
|
+
"__experimentalDefaultControls": {
|
|
46
|
+
"fontSize": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"spacing": {
|
|
50
|
+
"margin": true,
|
|
51
|
+
"padding": true,
|
|
52
|
+
"blockGap": {
|
|
53
|
+
"__experimentalDefault": "1.25em"
|
|
54
|
+
},
|
|
55
|
+
"__experimentalDefaultControls": {
|
|
56
|
+
"blockGap": true,
|
|
57
|
+
"padding": false,
|
|
58
|
+
"margin": false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"interactivity": {
|
|
62
|
+
"clientNavigation": true
|
|
63
|
+
},
|
|
64
|
+
"__experimentalBorder": {
|
|
65
|
+
"radius": true,
|
|
66
|
+
"color": true,
|
|
67
|
+
"width": true,
|
|
68
|
+
"style": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"style": "wp-block-term-template",
|
|
72
|
+
"variations": "file:./variations.js"
|
|
73
|
+
}
|