@wordpress/block-library 10.0.1-next.v.202606191442.0 → 10.1.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 +4 -1
- package/build/audio/edit.cjs +8 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/breadcrumbs/edit.cjs +0 -1
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/button/edit.cjs +0 -1
- package/build/button/edit.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +0 -1
- package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
- package/build/details/edit.cjs +0 -1
- package/build/details/edit.cjs.map +2 -2
- package/build/form/edit.cjs +0 -2
- package/build/form/edit.cjs.map +2 -2
- package/build/form-input/edit.cjs +0 -2
- package/build/form-input/edit.cjs.map +2 -2
- package/build/freeform/edit.cjs +5 -14
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/migration-notice.cjs.map +2 -2
- package/build/home-link/edit.cjs +0 -1
- package/build/home-link/edit.cjs.map +2 -2
- package/build/html/modal.cjs +6 -3
- package/build/html/modal.cjs.map +2 -2
- package/build/icon/edit.cjs +2 -4
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/image.cjs +0 -2
- package/build/image/image.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +5 -25
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +0 -1
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +9 -9
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
- package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/link-ui/page-creator.cjs +0 -1
- package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
- package/build/navigation-link/shared/controls.cjs +0 -2
- package/build/navigation-link/shared/controls.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +0 -3
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-comment/edit.cjs +0 -1
- package/build/post-comment/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +0 -1
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +0 -1
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-title/edit.cjs +0 -1
- package/build/post-title/edit.cjs.map +2 -2
- package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
- package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
- package/build/query/edit/inspector-controls/index.cjs +0 -1
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/rss/edit.cjs +0 -1
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/block.json +4 -0
- package/build/search/edit.cjs +242 -204
- package/build/search/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +2 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/social-link/edit.cjs +0 -3
- package/build/social-link/edit.cjs.map +2 -2
- package/build/tab-list/block.json +2 -2
- package/build/tab-list/edit.cjs +14 -8
- package/build/tab-list/edit.cjs.map +2 -2
- package/build/tab-list/init.cjs +28 -0
- package/build/tab-list/init.cjs.map +7 -0
- package/build/tab-panel/edit.cjs +0 -9
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/tab-panel/save.cjs +2 -1
- package/build/tab-panel/save.cjs.map +2 -2
- package/build/tab-panels/block.json +0 -1
- package/build/tab-panels/init.cjs +28 -0
- package/build/tab-panels/init.cjs.map +7 -0
- package/build/table/edit.cjs +0 -2
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/view.cjs +20 -94
- package/build/tabs/view.cjs.map +2 -2
- package/build/template-part/edit/advanced-controls.cjs +0 -1
- package/build/template-part/edit/advanced-controls.cjs.map +2 -2
- package/build/template-part/edit/title-modal.cjs +1 -2
- package/build/template-part/edit/title-modal.cjs.map +2 -2
- package/build/video/edit.cjs +3 -2
- package/build/video/edit.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -2
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/audio/edit.mjs +8 -2
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +0 -1
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/button/edit.mjs +0 -1
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/details/edit.mjs +0 -1
- package/build-module/details/edit.mjs.map +2 -2
- package/build-module/form/edit.mjs +0 -2
- package/build-module/form/edit.mjs.map +2 -2
- package/build-module/form-input/edit.mjs +0 -2
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/freeform/edit.mjs +5 -14
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/migration-notice.mjs.map +2 -2
- package/build-module/home-link/edit.mjs +0 -1
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +6 -3
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/edit.mjs +2 -4
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +0 -2
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +0 -1
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +9 -9
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
- package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +0 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +0 -3
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-comment/edit.mjs +0 -1
- package/build-module/post-comment/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +0 -1
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +0 -1
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +0 -1
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
- package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +0 -1
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/rss/edit.mjs +0 -1
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/block.json +4 -0
- package/build-module/search/edit.mjs +242 -204
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +2 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/social-link/edit.mjs +0 -3
- package/build-module/social-link/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +2 -2
- package/build-module/tab-list/edit.mjs +15 -9
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/init.mjs +7 -0
- package/build-module/tab-list/init.mjs.map +7 -0
- package/build-module/tab-panel/edit.mjs +1 -10
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/tab-panel/save.mjs +2 -1
- package/build-module/tab-panel/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +0 -1
- package/build-module/tab-panels/init.mjs +7 -0
- package/build-module/tab-panels/init.mjs.map +7 -0
- package/build-module/table/edit.mjs +0 -2
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/view.mjs +20 -94
- package/build-module/tabs/view.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +0 -1
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/title-modal.mjs +1 -2
- package/build-module/template-part/edit/title-modal.mjs.map +2 -2
- package/build-module/video/edit.mjs +3 -3
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -2
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/editor-rtl.css +0 -15
- package/build-style/editor.css +0 -15
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/build-style/tab-list/style-rtl.css +1 -1
- package/build-style/tab-list/style.css +1 -1
- package/package.json +40 -40
- package/src/audio/edit.js +5 -9
- package/src/breadcrumbs/edit.js +0 -1
- package/src/button/edit.js +0 -1
- package/src/cover/edit/embed-video-url-input.js +0 -1
- package/src/cover/test/edit.js +51 -40
- package/src/details/edit.js +0 -1
- package/src/editor.scss +0 -1
- package/src/form/edit.js +0 -2
- package/src/form-input/edit.js +0 -2
- package/src/freeform/edit.js +6 -29
- package/src/freeform/migration-notice.js +2 -4
- package/src/home-link/edit.js +0 -1
- package/src/html/modal.js +3 -0
- package/src/icon/edit.js +0 -2
- package/src/image/image.js +0 -2
- package/src/image/test/use-open-image-media-editor-modal.js +20 -26
- package/src/image/use-open-image-media-editor-modal.js +24 -42
- package/src/list/ordered-list-settings.js +0 -1
- package/src/navigation/edit/index.js +9 -13
- package/src/navigation/edit/navigation-menu-name-control.js +0 -1
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/link-ui/page-creator.js +0 -1
- package/src/navigation-link/shared/controls.js +0 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
- package/src/playlist-track/edit.js +0 -3
- package/src/post-comment/edit.js +0 -1
- package/src/post-featured-image/edit.js +0 -1
- package/src/post-terms/edit.js +0 -1
- package/src/post-title/edit.js +0 -1
- package/src/query/edit/enhanced-pagination-modal.js +11 -1
- package/src/query/edit/inspector-controls/index.js +0 -1
- package/src/rss/edit.js +0 -1
- package/src/search/README.md +1 -0
- package/src/search/block.json +4 -0
- package/src/search/edit.js +106 -55
- package/src/search/index.php +25 -1
- package/src/site-logo/edit.js +3 -1
- package/src/social-link/edit.js +0 -3
- package/src/tab-list/README.md +1 -1
- package/src/tab-list/block.json +2 -2
- package/src/tab-list/edit.js +14 -8
- package/src/tab-list/index.php +4 -6
- package/src/tab-list/init.js +6 -0
- package/src/tab-list/style.scss +1 -2
- package/src/tab-panel/edit.js +1 -14
- package/src/tab-panel/index.php +2 -25
- package/src/tab-panel/save.js +1 -0
- package/src/tab-panels/block.json +0 -1
- package/src/tab-panels/init.js +6 -0
- package/src/table/edit.js +0 -2
- package/src/tabs/index.php +12 -19
- package/src/tabs/view.js +20 -100
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/title-modal.js +0 -1
- package/src/utils/test/style-state.js +26 -26
- package/src/video/edit.js +9 -16
- package/src/video/tracks-editor.js +0 -2
- package/build/freeform/convert-to-blocks-button.cjs +0 -40
- package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
- package/build/list-item/utils.cjs +0 -57
- package/build/list-item/utils.cjs.map +0 -7
- package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
- package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
- package/build-module/list-item/utils.mjs +0 -32
- package/build-module/list-item/utils.mjs.map +0 -7
- package/build-style/tab-list/editor-rtl.css +0 -14
- package/build-style/tab-list/editor.css +0 -14
- package/src/freeform/convert-to-blocks-button.js +0 -18
- package/src/list-item/utils.js +0 -34
- package/src/tab-list/editor.scss +0 -17
package/src/search/edit.js
CHANGED
|
@@ -35,6 +35,7 @@ import { useInstanceId } from '@wordpress/compose';
|
|
|
35
35
|
import { Icon, search } from '@wordpress/icons';
|
|
36
36
|
import { __, sprintf } from '@wordpress/i18n';
|
|
37
37
|
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
38
|
+
import { speak } from '@wordpress/a11y';
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* Internal dependencies
|
|
@@ -47,6 +48,20 @@ import {
|
|
|
47
48
|
} from './utils.js';
|
|
48
49
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
49
50
|
|
|
51
|
+
// Help text describing each wrapper element option. Kept local to the block
|
|
52
|
+
// because the choices and their guidance are specific to the Search block.
|
|
53
|
+
const TAG_NAME_MESSAGES = {
|
|
54
|
+
'': __(
|
|
55
|
+
'Lets the theme decide. Uses the <search> landmark element if the theme opts in, otherwise a <form>.'
|
|
56
|
+
),
|
|
57
|
+
search: __(
|
|
58
|
+
'Wraps the block in a <search> landmark, announced as a search region by assistive technologies.'
|
|
59
|
+
),
|
|
60
|
+
form: __(
|
|
61
|
+
'Uses a <form role="search"> wrapper for backward compatibility with existing theme styles.'
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
|
|
50
65
|
// Used to calculate border radius adjustment to avoid "fat" corners when
|
|
51
66
|
// button is placed inside wrapper.
|
|
52
67
|
const DEFAULT_INNER_PADDING = '4px';
|
|
@@ -70,6 +85,7 @@ export default function SearchEdit( {
|
|
|
70
85
|
buttonText,
|
|
71
86
|
buttonPosition,
|
|
72
87
|
buttonUseIcon,
|
|
88
|
+
tagName,
|
|
73
89
|
style,
|
|
74
90
|
} = attributes;
|
|
75
91
|
|
|
@@ -477,6 +493,31 @@ export default function SearchEdit( {
|
|
|
477
493
|
</ToolsPanelItem>
|
|
478
494
|
</ToolsPanel>
|
|
479
495
|
</InspectorControls>
|
|
496
|
+
<InspectorControls group="advanced">
|
|
497
|
+
<SelectControl
|
|
498
|
+
__next40pxDefaultSize
|
|
499
|
+
label={ __( 'HTML element' ) }
|
|
500
|
+
value={ tagName ?? '' }
|
|
501
|
+
options={ [
|
|
502
|
+
{ label: __( 'Default' ), value: '' },
|
|
503
|
+
{ label: '<search>', value: 'search' },
|
|
504
|
+
{ label: '<form>', value: 'form' },
|
|
505
|
+
] }
|
|
506
|
+
onChange={ ( value ) => {
|
|
507
|
+
setAttributes( { tagName: value } );
|
|
508
|
+
// The help text is updated via aria-describedby, which
|
|
509
|
+
// is not re-announced while focus remains on the select.
|
|
510
|
+
// Announce the new description so it is not missed.
|
|
511
|
+
// speak() strips HTML-like tags, which would drop the
|
|
512
|
+
// element names (e.g. <search>) entirely. Remove only the
|
|
513
|
+
// angle brackets so the words are retained when spoken.
|
|
514
|
+
speak(
|
|
515
|
+
TAG_NAME_MESSAGES[ value ].replace( /[<>]/g, '' )
|
|
516
|
+
);
|
|
517
|
+
} }
|
|
518
|
+
help={ TAG_NAME_MESSAGES[ tagName ?? '' ] }
|
|
519
|
+
/>
|
|
520
|
+
</InspectorControls>
|
|
480
521
|
</>
|
|
481
522
|
);
|
|
482
523
|
|
|
@@ -559,64 +600,74 @@ export default function SearchEdit( {
|
|
|
559
600
|
typographyProps.className
|
|
560
601
|
);
|
|
561
602
|
|
|
603
|
+
// Reflect an explicit <search> choice in the editor markup so wrapper
|
|
604
|
+
// styles match the front end. The <form> and theme-deferred default keep
|
|
605
|
+
// the historical <div> to avoid nesting a live <form> in the editor.
|
|
606
|
+
const Wrapper = 'search' === tagName ? 'search' : 'div';
|
|
607
|
+
|
|
562
608
|
return (
|
|
563
|
-
|
|
609
|
+
<>
|
|
564
610
|
{ controls }
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
<ResizableBox
|
|
580
|
-
size={ {
|
|
581
|
-
width:
|
|
582
|
-
width === undefined
|
|
583
|
-
? 'auto'
|
|
584
|
-
: `${ width }${ widthUnit }`,
|
|
585
|
-
height: 'auto',
|
|
586
|
-
} }
|
|
587
|
-
className={ clsx(
|
|
588
|
-
'wp-block-search__inside-wrapper',
|
|
589
|
-
isButtonPositionInside ? borderProps.className : undefined
|
|
590
|
-
) }
|
|
591
|
-
style={ getWrapperStyles() }
|
|
592
|
-
minWidth={ MIN_WIDTH }
|
|
593
|
-
enable={ getResizableSides() }
|
|
594
|
-
onResizeStart={ ( event, direction, elt ) => {
|
|
595
|
-
setAttributes( {
|
|
596
|
-
width: parseInt( elt.offsetWidth, 10 ),
|
|
597
|
-
widthUnit: 'px',
|
|
598
|
-
} );
|
|
599
|
-
toggleSelection( false );
|
|
600
|
-
} }
|
|
601
|
-
onResizeStop={ ( event, direction, elt, delta ) => {
|
|
602
|
-
setAttributes( {
|
|
603
|
-
width: parseInt( width + delta.width, 10 ),
|
|
604
|
-
} );
|
|
605
|
-
toggleSelection( true );
|
|
606
|
-
} }
|
|
607
|
-
showHandle={ isSelected }
|
|
608
|
-
>
|
|
609
|
-
{ ( isButtonPositionInside ||
|
|
610
|
-
isButtonPositionOutside ||
|
|
611
|
-
hasOnlyButton ) && (
|
|
612
|
-
<>
|
|
613
|
-
{ renderTextField() }
|
|
614
|
-
{ renderButton() }
|
|
615
|
-
</>
|
|
611
|
+
<Wrapper { ...blockProps }>
|
|
612
|
+
{ showLabel && (
|
|
613
|
+
<RichText
|
|
614
|
+
identifier="label"
|
|
615
|
+
className={ labelClassnames }
|
|
616
|
+
aria-label={ __( 'Label text' ) }
|
|
617
|
+
placeholder={ __( 'Add label…' ) }
|
|
618
|
+
withoutInteractiveFormatting
|
|
619
|
+
value={ label }
|
|
620
|
+
onChange={ ( html ) =>
|
|
621
|
+
setAttributes( { label: html } )
|
|
622
|
+
}
|
|
623
|
+
style={ typographyProps.style }
|
|
624
|
+
/>
|
|
616
625
|
) }
|
|
617
626
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
627
|
+
<ResizableBox
|
|
628
|
+
size={ {
|
|
629
|
+
width:
|
|
630
|
+
width === undefined
|
|
631
|
+
? 'auto'
|
|
632
|
+
: `${ width }${ widthUnit }`,
|
|
633
|
+
height: 'auto',
|
|
634
|
+
} }
|
|
635
|
+
className={ clsx(
|
|
636
|
+
'wp-block-search__inside-wrapper',
|
|
637
|
+
isButtonPositionInside
|
|
638
|
+
? borderProps.className
|
|
639
|
+
: undefined
|
|
640
|
+
) }
|
|
641
|
+
style={ getWrapperStyles() }
|
|
642
|
+
minWidth={ MIN_WIDTH }
|
|
643
|
+
enable={ getResizableSides() }
|
|
644
|
+
onResizeStart={ ( event, direction, elt ) => {
|
|
645
|
+
setAttributes( {
|
|
646
|
+
width: parseInt( elt.offsetWidth, 10 ),
|
|
647
|
+
widthUnit: 'px',
|
|
648
|
+
} );
|
|
649
|
+
toggleSelection( false );
|
|
650
|
+
} }
|
|
651
|
+
onResizeStop={ ( event, direction, elt, delta ) => {
|
|
652
|
+
setAttributes( {
|
|
653
|
+
width: parseInt( width + delta.width, 10 ),
|
|
654
|
+
} );
|
|
655
|
+
toggleSelection( true );
|
|
656
|
+
} }
|
|
657
|
+
showHandle={ isSelected }
|
|
658
|
+
>
|
|
659
|
+
{ ( isButtonPositionInside ||
|
|
660
|
+
isButtonPositionOutside ||
|
|
661
|
+
hasOnlyButton ) && (
|
|
662
|
+
<>
|
|
663
|
+
{ renderTextField() }
|
|
664
|
+
{ renderButton() }
|
|
665
|
+
</>
|
|
666
|
+
) }
|
|
667
|
+
|
|
668
|
+
{ hasNoButton && renderTextField() }
|
|
669
|
+
</ResizableBox>
|
|
670
|
+
</Wrapper>
|
|
671
|
+
</>
|
|
621
672
|
);
|
|
622
673
|
}
|
package/src/search/index.php
CHANGED
|
@@ -191,8 +191,32 @@ function render_block_core_search( $attributes ) {
|
|
|
191
191
|
';
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
/*
|
|
195
|
+
* The semantic <search> landmark wrapper is opt-in to preserve back
|
|
196
|
+
* compatibility with themes targeting <form role="search">. The block
|
|
197
|
+
* exposes a per-instance HTML element selector with three values:
|
|
198
|
+
*
|
|
199
|
+
* - 'search' forces the <search> wrapper
|
|
200
|
+
* - 'form' forces the original <form role="search"> markup
|
|
201
|
+
* - empty defers to the 'search-element' html5 sub-feature
|
|
202
|
+
* ( add_theme_support( 'html5', array( 'search-element' ) ) ),
|
|
203
|
+
* matching the opt-in added to get_search_form() in core
|
|
204
|
+
*/
|
|
205
|
+
$tag_name = $attributes['tagName'] ?? '';
|
|
206
|
+
$use_search_element = 'search' === $tag_name || ( '' === $tag_name && current_theme_supports( 'html5', 'search-element' ) );
|
|
207
|
+
|
|
208
|
+
/*
|
|
209
|
+
* Only the wrapper markup differs between the semantic <search> landmark
|
|
210
|
+
* and the classic <form role="search">. Positional specifiers keep a
|
|
211
|
+
* single argument list usable by both formats, since the action URL
|
|
212
|
+
* precedes the wrapper attributes in the <search> variant.
|
|
213
|
+
*/
|
|
214
|
+
$format = $use_search_element
|
|
215
|
+
? '<search %2$s %3$s><form method="get" action="%1$s">%4$s</form></search>'
|
|
216
|
+
: '<form role="search" method="get" action="%1$s" %2$s %3$s>%4$s</form>';
|
|
217
|
+
|
|
194
218
|
return sprintf(
|
|
195
|
-
|
|
219
|
+
$format,
|
|
196
220
|
esc_url( home_url( '/' ) ),
|
|
197
221
|
$wrapper_attributes,
|
|
198
222
|
$form_directives,
|
package/src/site-logo/edit.js
CHANGED
|
@@ -75,7 +75,8 @@ const SiteLogo = ( {
|
|
|
75
75
|
const [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );
|
|
76
76
|
const [ isEditingImage, setIsEditingImage ] = useState( false );
|
|
77
77
|
const cropButtonRef = useRef();
|
|
78
|
-
const { toggleSelection } =
|
|
78
|
+
const { toggleSelection, __unstableMarkNextChangeAsNotPersistent } =
|
|
79
|
+
useDispatch( blockEditorStore );
|
|
79
80
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
80
81
|
|
|
81
82
|
// Check if we're in contentOnly mode
|
|
@@ -108,6 +109,7 @@ const SiteLogo = ( {
|
|
|
108
109
|
// fallen out of sync. This can happen if the toggle is saved in the `on` position,
|
|
109
110
|
// but changes are later made to the site icon in the Customizer.
|
|
110
111
|
if ( shouldSyncIcon && logoId !== iconId ) {
|
|
112
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
111
113
|
setAttributes( { shouldSyncIcon: false } );
|
|
112
114
|
}
|
|
113
115
|
}, [] );
|
package/src/social-link/edit.js
CHANGED
|
@@ -191,7 +191,6 @@ const SocialLinkEdit = ( {
|
|
|
191
191
|
) }
|
|
192
192
|
renderContent={ () => (
|
|
193
193
|
<TextControl
|
|
194
|
-
__next40pxDefaultSize
|
|
195
194
|
className="wp-block-social-link__toolbar_content_text"
|
|
196
195
|
label={ __( 'Text' ) }
|
|
197
196
|
help={ __(
|
|
@@ -224,7 +223,6 @@ const SocialLinkEdit = ( {
|
|
|
224
223
|
} }
|
|
225
224
|
>
|
|
226
225
|
<TextControl
|
|
227
|
-
__next40pxDefaultSize
|
|
228
226
|
label={ __( 'Text' ) }
|
|
229
227
|
help={ __(
|
|
230
228
|
'The text is visible when enabled from the parent Social Icons block.'
|
|
@@ -240,7 +238,6 @@ const SocialLinkEdit = ( {
|
|
|
240
238
|
</InspectorControls>
|
|
241
239
|
<InspectorControls group="advanced">
|
|
242
240
|
<TextControl
|
|
243
|
-
__next40pxDefaultSize
|
|
244
241
|
label={ __( 'Link relation' ) }
|
|
245
242
|
help={ createInterpolateElement(
|
|
246
243
|
__(
|
package/src/tab-list/README.md
CHANGED
|
@@ -36,7 +36,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
36
36
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
37
37
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
38
38
|
- [`layout`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout):
|
|
39
|
-
- [`default`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-default): `{"type":"flex"}`
|
|
39
|
+
- [`default`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-default): `{"type":"flex","flexWrap":"nowrap"}`
|
|
40
40
|
- [`allowVerticalAlignment`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowverticalalignment): `false`
|
|
41
41
|
- [`allowOrientation`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-alloworientation): `false`
|
|
42
42
|
- [`allowWrap`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowwrap): `false`
|
package/src/tab-list/block.json
CHANGED
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"layout": {
|
|
51
51
|
"default": {
|
|
52
|
-
"type": "flex"
|
|
52
|
+
"type": "flex",
|
|
53
|
+
"flexWrap": "nowrap"
|
|
53
54
|
},
|
|
54
55
|
"allowVerticalAlignment": false,
|
|
55
56
|
"allowOrientation": false,
|
|
@@ -75,6 +76,5 @@
|
|
|
75
76
|
"padding": ".wp-block-tab-list button"
|
|
76
77
|
}
|
|
77
78
|
},
|
|
78
|
-
"editorStyle": "wp-block-tab-list-editor",
|
|
79
79
|
"style": "wp-block-tab-list"
|
|
80
80
|
}
|
package/src/tab-list/edit.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
|
|
17
17
|
} from '@wordpress/block-editor';
|
|
18
18
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
19
|
-
import {
|
|
19
|
+
import { useCallback, useEffect, useRef } from '@wordpress/element';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
@@ -26,7 +26,12 @@ import RemoveTabToolbarControl from '../tab-panel/remove-tab-toolbar-control';
|
|
|
26
26
|
|
|
27
27
|
const EMPTY_ARRAY = [];
|
|
28
28
|
|
|
29
|
-
function Edit( {
|
|
29
|
+
function Edit( {
|
|
30
|
+
attributes,
|
|
31
|
+
clientId,
|
|
32
|
+
context,
|
|
33
|
+
__unstableLayoutClassNames: layoutClassNames,
|
|
34
|
+
} ) {
|
|
30
35
|
const tabsList = context[ 'core/tabs-list' ] || EMPTY_ARRAY;
|
|
31
36
|
|
|
32
37
|
const colorProps = useColorProps( attributes );
|
|
@@ -52,9 +57,7 @@ function Edit( { attributes, clientId, context } ) {
|
|
|
52
57
|
[ clientId ]
|
|
53
58
|
);
|
|
54
59
|
|
|
55
|
-
const effectiveActiveIndex =
|
|
56
|
-
return editorActiveTabIndex ?? activeTabIndex;
|
|
57
|
-
}, [ editorActiveTabIndex, activeTabIndex ] );
|
|
60
|
+
const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
|
|
58
61
|
|
|
59
62
|
const { __unstableMarkNextChangeAsNotPersistent, updateBlockAttributes } =
|
|
60
63
|
useDispatch( blockEditorStore );
|
|
@@ -126,6 +129,9 @@ function Edit( { attributes, clientId, context } ) {
|
|
|
126
129
|
const blockProps = useBlockProps( {
|
|
127
130
|
role: 'tablist',
|
|
128
131
|
ref: menuRef,
|
|
132
|
+
// Applied manually since this block has no inner blocks for the layout
|
|
133
|
+
// support to add its container classes to.
|
|
134
|
+
className: layoutClassNames,
|
|
129
135
|
} );
|
|
130
136
|
|
|
131
137
|
const buttonClassName = clsx( colorProps.className, borderProps.className );
|
|
@@ -147,9 +153,9 @@ function Edit( { attributes, clientId, context } ) {
|
|
|
147
153
|
<button
|
|
148
154
|
key={ tab.clientId || index }
|
|
149
155
|
type="button"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
role="tab"
|
|
157
|
+
aria-selected={ isActive }
|
|
158
|
+
className={ buttonClassName || undefined }
|
|
153
159
|
style={ buttonStyle }
|
|
154
160
|
tabIndex={ -1 }
|
|
155
161
|
onClick={ ( event ) => {
|
package/src/tab-list/index.php
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* tab-specific attributes (id, aria-controls, context) and interactivity
|
|
14
14
|
* directives using data from the tabs-list context.
|
|
15
15
|
*
|
|
16
|
-
* @since 7.
|
|
16
|
+
* @since 7.1.0
|
|
17
17
|
*
|
|
18
18
|
* @param array $attributes Block attributes.
|
|
19
19
|
* @param string $content Block content (rendered buttons from save.js).
|
|
@@ -32,14 +32,12 @@ function block_core_tab_list_render_callback( array $attributes, string $content
|
|
|
32
32
|
$tab_index = 0;
|
|
33
33
|
|
|
34
34
|
while ( $tag_processor->next_tag( 'button' ) ) {
|
|
35
|
-
$
|
|
35
|
+
$tab_id = $tabs_list[ $tab_index ] ?? null;
|
|
36
36
|
|
|
37
|
-
if ( null === $
|
|
37
|
+
if ( null === $tab_id ) {
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
$tab_id = $tab['id'] ?? 'tab-' . $tab_index;
|
|
42
|
-
|
|
43
41
|
$tag_processor->set_attribute( 'id', 'tab__' . $tab_id );
|
|
44
42
|
$tag_processor->set_attribute( 'aria-controls', $tab_id );
|
|
45
43
|
$tag_processor->set_attribute( 'data-wp-on--click', 'actions.handleTabClick' );
|
|
@@ -60,7 +58,7 @@ function block_core_tab_list_render_callback( array $attributes, string $content
|
|
|
60
58
|
/**
|
|
61
59
|
* Registers the `core/tab-list` block on the server.
|
|
62
60
|
*
|
|
63
|
-
* @since 7.
|
|
61
|
+
* @since 7.1.0
|
|
64
62
|
*/
|
|
65
63
|
function register_block_core_tab_list() {
|
|
66
64
|
register_block_type_from_metadata(
|
package/src/tab-list/style.scss
CHANGED
package/src/tab-panel/edit.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
store as blockEditorStore,
|
|
9
9
|
} from '@wordpress/block-editor';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
|
-
import { useMemo,
|
|
11
|
+
import { useMemo, useEffect } from '@wordpress/element';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -24,25 +24,12 @@ const TEMPLATE = [
|
|
|
24
24
|
],
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
-
const { cancelAnimationFrame } = window;
|
|
28
|
-
|
|
29
27
|
export default function Edit( { clientId, context, isSelected } ) {
|
|
30
|
-
const focusRef = useRef();
|
|
31
|
-
|
|
32
28
|
// Consume tab indices from context
|
|
33
29
|
const activeTabIndex = context[ 'core/tabs-activeTabIndex' ];
|
|
34
30
|
const editorActiveTabIndex = context[ 'core/tabs-editorActiveTabIndex' ];
|
|
35
31
|
const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
|
|
36
32
|
|
|
37
|
-
// Clean up animation frames on unmount.
|
|
38
|
-
useEffect( () => {
|
|
39
|
-
return () => {
|
|
40
|
-
if ( focusRef.current ) {
|
|
41
|
-
cancelAnimationFrame( focusRef.current );
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}, [] );
|
|
45
|
-
|
|
46
33
|
const { blockIndex, hasInnerBlocksSelected, tabsClientId } = useSelect(
|
|
47
34
|
( select ) => {
|
|
48
35
|
const {
|
package/src/tab-panel/index.php
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Render callback for core/tab-panel.
|
|
10
10
|
*
|
|
11
|
-
* @since 7.
|
|
11
|
+
* @since 7.1.0
|
|
12
12
|
*
|
|
13
13
|
* @param array $attributes Block attributes.
|
|
14
14
|
* @param string $content Block content.
|
|
@@ -41,31 +41,8 @@ function block_core_tab_panel_render( array $attributes, string $content, \WP_Bl
|
|
|
41
41
|
$tag_processor->set_attribute( 'id', $tab_id );
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* Add interactivity to the tab element.
|
|
46
|
-
*/
|
|
47
|
-
$tag_processor->set_attribute(
|
|
48
|
-
'data-wp-interactive',
|
|
49
|
-
'core/tabs/private'
|
|
50
|
-
);
|
|
51
|
-
$tag_processor->set_attribute(
|
|
52
|
-
'data-wp-context',
|
|
53
|
-
wp_json_encode(
|
|
54
|
-
array(
|
|
55
|
-
'tab' => array(
|
|
56
|
-
'id' => $tab_id,
|
|
57
|
-
),
|
|
58
|
-
)
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Process accessibility and interactivity attributes.
|
|
64
|
-
*/
|
|
65
|
-
$tag_processor->set_attribute( 'role', 'tabpanel' );
|
|
66
44
|
$tag_processor->set_attribute( 'aria-labelledby', 'tab__' . $tab_id );
|
|
67
45
|
$tag_processor->set_attribute( 'data-wp-bind--hidden', '!state.isActiveTab' );
|
|
68
|
-
$tag_processor->set_attribute( 'tabindex', 0 );
|
|
69
46
|
|
|
70
47
|
return (string) $tag_processor->get_updated_html();
|
|
71
48
|
}
|
|
@@ -75,7 +52,7 @@ function block_core_tab_panel_render( array $attributes, string $content, \WP_Bl
|
|
|
75
52
|
*
|
|
76
53
|
* @hook init
|
|
77
54
|
*
|
|
78
|
-
* @since 7.
|
|
55
|
+
* @since 7.1.0
|
|
79
56
|
*/
|
|
80
57
|
function register_block_core_tab_panel() {
|
|
81
58
|
register_block_type_from_metadata(
|
package/src/tab-panel/save.js
CHANGED
|
@@ -6,6 +6,7 @@ import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
|
6
6
|
export default function save() {
|
|
7
7
|
const blockProps = useBlockProps.save( {
|
|
8
8
|
role: 'tabpanel',
|
|
9
|
+
tabIndex: 0,
|
|
9
10
|
} );
|
|
10
11
|
const innerBlocksProps = useInnerBlocksProps.save( blockProps );
|
|
11
12
|
|
package/src/table/edit.js
CHANGED
|
@@ -563,7 +563,6 @@ function TableEdit( {
|
|
|
563
563
|
onSubmit={ onCreateTable }
|
|
564
564
|
>
|
|
565
565
|
<TextControl
|
|
566
|
-
__next40pxDefaultSize
|
|
567
566
|
type="number"
|
|
568
567
|
label={ __( 'Column count' ) }
|
|
569
568
|
value={ initialColumnCount }
|
|
@@ -572,7 +571,6 @@ function TableEdit( {
|
|
|
572
571
|
className="blocks-table__placeholder-input"
|
|
573
572
|
/>
|
|
574
573
|
<TextControl
|
|
575
|
-
__next40pxDefaultSize
|
|
576
574
|
type="number"
|
|
577
575
|
label={ __( 'Row count' ) }
|
|
578
576
|
value={ initialRowCount }
|
package/src/tabs/index.php
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Extract tabs list from tab-panel innerblocks.
|
|
10
10
|
*
|
|
11
|
-
* @since 7.
|
|
11
|
+
* @since 7.1.0
|
|
12
12
|
*
|
|
13
13
|
* @param array $innerblocks Parsed inner blocks of tabs block.
|
|
14
14
|
* @param string $tabs_id Unique ID for the tabs instance, used to generate tab IDs.
|
|
15
15
|
*
|
|
16
|
-
* @return array List of
|
|
16
|
+
* @return array List of tab IDs.
|
|
17
17
|
*/
|
|
18
18
|
function block_core_tabs_generate_tabs_list( array $innerblocks = array(), string $tabs_id = '' ): array {
|
|
19
19
|
$tabs_list = array();
|
|
@@ -24,8 +24,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
|
|
|
24
24
|
$tab_index = 0;
|
|
25
25
|
foreach ( $inner_block['innerBlocks'] ?? array() as $tab_block ) {
|
|
26
26
|
if ( 'core/tab-panel' === ( $tab_block['blockName'] ?? '' ) ) {
|
|
27
|
-
$attrs
|
|
28
|
-
$tab_label = $attrs['label'] ?? '';
|
|
27
|
+
$attrs = $tab_block['attrs'] ?? array();
|
|
29
28
|
|
|
30
29
|
$tab_id = ! empty( $attrs['anchor'] )
|
|
31
30
|
? $attrs['anchor']
|
|
@@ -33,11 +32,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
|
|
|
33
32
|
? $tabs_id . '-tab-' . $tab_index
|
|
34
33
|
: 'tab-' . $tab_index );
|
|
35
34
|
|
|
36
|
-
$tabs_list[] =
|
|
37
|
-
'id' => esc_attr( $tab_id ),
|
|
38
|
-
'label' => $tab_label,
|
|
39
|
-
'index' => $tab_index,
|
|
40
|
-
);
|
|
35
|
+
$tabs_list[] = esc_attr( $tab_id );
|
|
41
36
|
++$tab_index;
|
|
42
37
|
}
|
|
43
38
|
}
|
|
@@ -53,7 +48,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
|
|
|
53
48
|
* It is more performant to do this here, once, rather than in the tabs render and tabs context filters.
|
|
54
49
|
* In this way core/tabs is both a provider and a consumer of the core/tabs-list context.
|
|
55
50
|
*
|
|
56
|
-
* @since 7.
|
|
51
|
+
* @since 7.1.0
|
|
57
52
|
*
|
|
58
53
|
* @param array $context Default block context.
|
|
59
54
|
* @param array $parsed_block The block being rendered.
|
|
@@ -63,8 +58,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
|
|
|
63
58
|
function block_core_tabs_provide_context( array $context, array $parsed_block ): array {
|
|
64
59
|
if ( 'core/tabs' === $parsed_block['blockName'] ) {
|
|
65
60
|
// Generate a unique ID for the tabs instance first, so it can be used
|
|
66
|
-
// to derive stable tab IDs.
|
|
67
|
-
// the tabs instance.
|
|
61
|
+
// to derive stable tab IDs.
|
|
68
62
|
$tabs_id = $parsed_block['attrs']['anchor'] ?? wp_unique_id( 'tabs_' );
|
|
69
63
|
$tabs_list = block_core_tabs_generate_tabs_list( $parsed_block['innerBlocks'] ?? array(), $tabs_id );
|
|
70
64
|
$context['core/tabs-list'] = $tabs_list;
|
|
@@ -78,7 +72,7 @@ add_filter( 'render_block_context', 'block_core_tabs_provide_context', 10, 2 );
|
|
|
78
72
|
/**
|
|
79
73
|
* Render callback for core/tabs.
|
|
80
74
|
*
|
|
81
|
-
* @since 7.
|
|
75
|
+
* @since 7.1.0
|
|
82
76
|
*
|
|
83
77
|
* @param array $attributes Block attributes.
|
|
84
78
|
* @param string $content Block content.
|
|
@@ -99,7 +93,7 @@ function block_core_tabs_render_block_callback( array $attributes, string $conte
|
|
|
99
93
|
$tag_processor = new WP_HTML_Tag_Processor( $content );
|
|
100
94
|
|
|
101
95
|
$tag_processor->next_tag( array( 'class_name' => 'wp-block-tabs' ) );
|
|
102
|
-
$tag_processor->set_attribute( 'data-wp-interactive', 'core/tabs
|
|
96
|
+
$tag_processor->set_attribute( 'data-wp-interactive', 'core/tabs' );
|
|
103
97
|
|
|
104
98
|
$tag_processor->set_attribute(
|
|
105
99
|
'data-wp-context',
|
|
@@ -116,12 +110,11 @@ function block_core_tabs_render_block_callback( array $attributes, string $conte
|
|
|
116
110
|
$output = $tag_processor->get_updated_html();
|
|
117
111
|
|
|
118
112
|
/**
|
|
119
|
-
* Builds a client side state for just this tabs instance
|
|
120
|
-
*
|
|
121
|
-
* client side state management per core/tabs instance, like context.
|
|
113
|
+
* Builds a client side state for just this tabs instance, so each
|
|
114
|
+
* core/tabs block manages its own state, like context.
|
|
122
115
|
*/
|
|
123
116
|
wp_interactivity_state(
|
|
124
|
-
'core/tabs
|
|
117
|
+
'core/tabs',
|
|
125
118
|
array(
|
|
126
119
|
$tabs_id => $tabs_list,
|
|
127
120
|
)
|
|
@@ -133,7 +126,7 @@ function block_core_tabs_render_block_callback( array $attributes, string $conte
|
|
|
133
126
|
/**
|
|
134
127
|
* Registers the `core/tabs` block on the server.
|
|
135
128
|
*
|
|
136
|
-
* @since 7.
|
|
129
|
+
* @since 7.1.0
|
|
137
130
|
*/
|
|
138
131
|
function register_block_core_tabs() {
|
|
139
132
|
register_block_type_from_metadata(
|