@wordpress/block-library 9.30.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/accordion-content/edit.js +8 -8
- package/build/accordion-content/edit.js.map +1 -1
- package/build/accordion-content/index.js +2 -1
- package/build/accordion-content/index.js.map +1 -1
- package/build/accordion-panel/index.js +2 -1
- package/build/accordion-panel/index.js.map +1 -1
- 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/navigation/constants.js +5 -1
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/edit/index.js +45 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/leaf-more-menu.js +0 -1
- package/build/navigation/edit/leaf-more-menu.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +40 -5
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation-link/block-inserter.js +69 -0
- package/build/navigation-link/block-inserter.js.map +1 -0
- package/build/navigation-link/dialog-wrapper.js +80 -0
- package/build/navigation-link/dialog-wrapper.js.map +1 -0
- package/build/navigation-link/link-ui.js +80 -120
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-link/page-creator.js +137 -0
- package/build/navigation-link/page-creator.js.map +1 -0
- package/build/search/edit.js +22 -14
- package/build/search/edit.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/accordion-content/edit.js +8 -8
- package/build-module/accordion-content/edit.js.map +1 -1
- package/build-module/accordion-content/index.js +2 -1
- package/build-module/accordion-content/index.js.map +1 -1
- package/build-module/accordion-panel/index.js +2 -1
- package/build-module/accordion-panel/index.js.map +1 -1
- 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/navigation/constants.js +5 -1
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/edit/index.js +50 -4
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/leaf-more-menu.js +0 -1
- package/build-module/navigation/edit/leaf-more-menu.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +40 -5
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation-link/block-inserter.js +61 -0
- package/build-module/navigation-link/block-inserter.js.map +1 -0
- package/build-module/navigation-link/dialog-wrapper.js +75 -0
- package/build-module/navigation-link/dialog-wrapper.js.map +1 -0
- package/build-module/navigation-link/link-ui.js +85 -125
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-link/page-creator.js +130 -0
- package/build-module/navigation-link/page-creator.js.map +1 -0
- package/build-module/search/edit.js +22 -14
- package/build-module/search/edit.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/accordion/style-rtl.css +5 -6
- package/build-style/accordion/style.css +5 -6
- package/build-style/editor-rtl.css +38 -0
- package/build-style/editor.css +38 -0
- package/build-style/form-input/style-rtl.css +4 -3
- package/build-style/form-input/style.css +4 -3
- package/build-style/navigation-link/editor-rtl.css +14 -0
- package/build-style/navigation-link/editor.css +14 -0
- package/build-style/navigation-link/style-rtl.css +1 -1
- package/build-style/navigation-link/style.css +1 -1
- package/build-style/post-comments-form/style-rtl.css +8 -5
- package/build-style/post-comments-form/style.css +8 -5
- package/build-style/search/style-rtl.css +11 -12
- package/build-style/search/style.css +11 -12
- package/build-style/style-rtl.css +45 -27
- package/build-style/style.css +45 -27
- 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/accordion/style.scss +6 -6
- package/src/accordion-content/block.json +2 -1
- package/src/accordion-content/edit.js +21 -27
- package/src/accordion-panel/block.json +2 -1
- package/src/buttons/block.json +2 -1
- package/src/categories/edit.js +2 -1
- package/src/cover/test/edit.js +1 -5
- package/src/editor.scss +1 -0
- package/src/form-input/style.scss +3 -2
- package/src/index.js +4 -0
- package/src/navigation/constants.js +4 -0
- package/src/navigation/edit/index.js +50 -1
- package/src/navigation/edit/leaf-more-menu.js +0 -1
- package/src/navigation/edit/menu-inspector-controls.js +40 -5
- package/src/navigation-link/block-inserter.js +65 -0
- package/src/navigation-link/dialog-wrapper.js +74 -0
- package/src/navigation-link/editor.scss +17 -0
- package/src/navigation-link/link-ui.js +108 -164
- package/src/navigation-link/page-creator.js +157 -0
- package/src/navigation-link/style.scss +1 -1
- package/src/post-comments-form/style.scss +11 -11
- package/src/post-date/index.php +18 -13
- package/src/search/edit.js +44 -13
- package/src/search/index.php +16 -2
- package/src/search/style.scss +15 -16
- 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
package/src/search/edit.js
CHANGED
|
@@ -228,7 +228,17 @@ export default function SearchEdit( {
|
|
|
228
228
|
);
|
|
229
229
|
const textFieldStyles = {
|
|
230
230
|
...( isButtonPositionInside
|
|
231
|
-
? {
|
|
231
|
+
? {
|
|
232
|
+
borderRadius: borderProps.style?.borderRadius,
|
|
233
|
+
borderTopLeftRadius:
|
|
234
|
+
borderProps.style?.borderTopLeftRadius,
|
|
235
|
+
borderTopRightRadius:
|
|
236
|
+
borderProps.style?.borderTopRightRadius,
|
|
237
|
+
borderBottomLeftRadius:
|
|
238
|
+
borderProps.style?.borderBottomLeftRadius,
|
|
239
|
+
borderBottomRightRadius:
|
|
240
|
+
borderProps.style?.borderBottomRightRadius,
|
|
241
|
+
}
|
|
232
242
|
: borderProps.style ),
|
|
233
243
|
...typographyProps.style,
|
|
234
244
|
textDecoration: undefined,
|
|
@@ -269,7 +279,17 @@ export default function SearchEdit( {
|
|
|
269
279
|
...colorProps.style,
|
|
270
280
|
...typographyProps.style,
|
|
271
281
|
...( isButtonPositionInside
|
|
272
|
-
? {
|
|
282
|
+
? {
|
|
283
|
+
borderRadius: borderProps.style?.borderRadius,
|
|
284
|
+
borderTopLeftRadius:
|
|
285
|
+
borderProps.style?.borderTopLeftRadius,
|
|
286
|
+
borderTopRightRadius:
|
|
287
|
+
borderProps.style?.borderTopRightRadius,
|
|
288
|
+
borderBottomLeftRadius:
|
|
289
|
+
borderProps.style?.borderBottomLeftRadius,
|
|
290
|
+
borderBottomRightRadius:
|
|
291
|
+
borderProps.style?.borderBottomRightRadius,
|
|
292
|
+
}
|
|
273
293
|
: borderProps.style ),
|
|
274
294
|
};
|
|
275
295
|
const handleButtonClick = () => {
|
|
@@ -495,8 +515,13 @@ export default function SearchEdit( {
|
|
|
495
515
|
</>
|
|
496
516
|
);
|
|
497
517
|
|
|
518
|
+
const isNonZeroBorderRadius = ( radius ) =>
|
|
519
|
+
radius !== undefined && parseInt( radius, 10 ) !== 0;
|
|
520
|
+
|
|
498
521
|
const padBorderRadius = ( radius ) =>
|
|
499
|
-
|
|
522
|
+
isNonZeroBorderRadius( radius )
|
|
523
|
+
? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`
|
|
524
|
+
: undefined;
|
|
500
525
|
|
|
501
526
|
const getWrapperStyles = () => {
|
|
502
527
|
const styles = isButtonPositionInside
|
|
@@ -512,10 +537,7 @@ export default function SearchEdit( {
|
|
|
512
537
|
borderProps.style?.borderBottomRightRadius,
|
|
513
538
|
};
|
|
514
539
|
|
|
515
|
-
|
|
516
|
-
borderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;
|
|
517
|
-
|
|
518
|
-
if ( isButtonPositionInside && isNonZeroBorderRadius ) {
|
|
540
|
+
if ( isButtonPositionInside ) {
|
|
519
541
|
// We have button inside wrapper and a border radius value to apply.
|
|
520
542
|
// Add default padding so we don't get "fat" corners.
|
|
521
543
|
//
|
|
@@ -524,15 +546,24 @@ export default function SearchEdit( {
|
|
|
524
546
|
|
|
525
547
|
if ( typeof borderRadius === 'object' ) {
|
|
526
548
|
// Individual corner border radii present.
|
|
527
|
-
const {
|
|
528
|
-
|
|
549
|
+
const {
|
|
550
|
+
borderTopLeftRadius,
|
|
551
|
+
borderTopRightRadius,
|
|
552
|
+
borderBottomLeftRadius,
|
|
553
|
+
borderBottomRightRadius,
|
|
554
|
+
} = borderProps.style;
|
|
529
555
|
|
|
530
556
|
return {
|
|
531
557
|
...styles,
|
|
532
|
-
borderTopLeftRadius: padBorderRadius(
|
|
533
|
-
borderTopRightRadius:
|
|
534
|
-
|
|
535
|
-
|
|
558
|
+
borderTopLeftRadius: padBorderRadius( borderTopLeftRadius ),
|
|
559
|
+
borderTopRightRadius:
|
|
560
|
+
padBorderRadius( borderTopRightRadius ),
|
|
561
|
+
borderBottomLeftRadius: padBorderRadius(
|
|
562
|
+
borderBottomLeftRadius
|
|
563
|
+
),
|
|
564
|
+
borderBottomRightRadius: padBorderRadius(
|
|
565
|
+
borderBottomRightRadius
|
|
566
|
+
),
|
|
536
567
|
};
|
|
537
568
|
}
|
|
538
569
|
|
package/src/search/index.php
CHANGED
|
@@ -372,6 +372,13 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
372
372
|
if ( is_array( $border_radius ) ) {
|
|
373
373
|
// Apply styles for individual corner border radii.
|
|
374
374
|
foreach ( $border_radius as $key => $value ) {
|
|
375
|
+
// Get border-radius CSS variable from preset value if provided.
|
|
376
|
+
if ( is_string( $value ) && str_contains( $value, 'var:preset|border-radius|' ) ) {
|
|
377
|
+
$index_to_splice = strrpos( $value, '|' ) + 1;
|
|
378
|
+
$slug = _wp_to_kebab_case( substr( $value, $index_to_splice ) );
|
|
379
|
+
$value = "var(--wp--preset--border-radius--$slug)";
|
|
380
|
+
}
|
|
381
|
+
|
|
375
382
|
if ( null !== $value ) {
|
|
376
383
|
// Convert camelCase key to kebab-case.
|
|
377
384
|
$name = strtolower( preg_replace( '/(?<!^)[A-Z]/', '-$0', $key ) );
|
|
@@ -387,7 +394,7 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
387
394
|
|
|
388
395
|
// Add adjusted border radius styles for the wrapper element
|
|
389
396
|
// if button is positioned inside.
|
|
390
|
-
if ( $is_button_inside && intval( $value ) !== 0 ) {
|
|
397
|
+
if ( $is_button_inside && ( intval( $value ) !== 0 || str_contains( $value, 'var(--wp--preset--border-radius--' ) ) ) {
|
|
391
398
|
$wrapper_styles[] = sprintf(
|
|
392
399
|
'border-%s-radius: calc(%s + %s);',
|
|
393
400
|
esc_attr( $name ),
|
|
@@ -399,7 +406,14 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
399
406
|
}
|
|
400
407
|
} else {
|
|
401
408
|
// Numeric check is for backwards compatibility purposes.
|
|
402
|
-
$border_radius
|
|
409
|
+
$border_radius = is_numeric( $border_radius ) ? $border_radius . 'px' : $border_radius;
|
|
410
|
+
// Get border-radius CSS variable from preset value if provided.
|
|
411
|
+
if ( is_string( $border_radius ) && str_contains( $border_radius, 'var:preset|border-radius|' ) ) {
|
|
412
|
+
$index_to_splice = strrpos( $border_radius, '|' ) + 1;
|
|
413
|
+
$slug = _wp_to_kebab_case( substr( $border_radius, $index_to_splice ) );
|
|
414
|
+
$border_radius = "var(--wp--preset--border-radius--$slug)";
|
|
415
|
+
}
|
|
416
|
+
|
|
403
417
|
$border_style = sprintf( 'border-radius: %s;', esc_attr( $border_radius ) );
|
|
404
418
|
$input_styles[] = $border_style;
|
|
405
419
|
$button_styles[] = $border_style;
|
package/src/search/style.scss
CHANGED
|
@@ -37,21 +37,6 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
|
|
|
37
37
|
width: 100%;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.wp-block-search__input {
|
|
41
|
-
padding: $grid-unit-10;
|
|
42
|
-
flex-grow: 1;
|
|
43
|
-
margin-left: 0;
|
|
44
|
-
margin-right: 0;
|
|
45
|
-
min-width: 3rem;
|
|
46
|
-
border: 1px solid $gray-600;
|
|
47
|
-
// !important used to forcibly prevent undesired application of
|
|
48
|
-
// text-decoration styles on the input field.
|
|
49
|
-
text-decoration: unset !important;
|
|
50
|
-
|
|
51
|
-
// Hides a redundant extra search icon on Mobile Safari.
|
|
52
|
-
appearance: initial;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
40
|
.wp-block-search.wp-block-search__button-only {
|
|
56
41
|
.wp-block-search__button {
|
|
57
42
|
margin-left: 0;
|
|
@@ -104,12 +89,26 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
|
|
|
104
89
|
letter-spacing: inherit;
|
|
105
90
|
text-transform: inherit;
|
|
106
91
|
font-style: inherit;
|
|
92
|
+
padding: $grid-unit-10;
|
|
93
|
+
flex-grow: 1;
|
|
94
|
+
margin-left: 0;
|
|
95
|
+
margin-right: 0;
|
|
96
|
+
min-width: 3rem;
|
|
97
|
+
border: 1px solid $gray-600;
|
|
98
|
+
// !important used to forcibly prevent undesired application of
|
|
99
|
+
// text-decoration styles on the input field.
|
|
100
|
+
text-decoration: unset !important;
|
|
101
|
+
|
|
102
|
+
// Hides a redundant extra search icon on Mobile Safari.
|
|
103
|
+
appearance: initial;
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
// We are lowering the specificity so that the button element can override the rule for the button inside the search block.
|
|
110
107
|
:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) {
|
|
111
108
|
padding: $grid-unit-05;
|
|
112
|
-
border: 1px
|
|
109
|
+
border-width: 1px;
|
|
110
|
+
border-style: solid;
|
|
111
|
+
border-color: $gray-600;
|
|
113
112
|
background-color: $white;
|
|
114
113
|
box-sizing: border-box;
|
|
115
114
|
|
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
|
+
}
|