@wordpress/block-library 9.14.0 → 9.15.1
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/LICENSE.md +1 -1
- package/build/archives/edit.js +83 -36
- package/build/archives/edit.js.map +1 -1
- package/build/button/deprecated.js +182 -1
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +47 -25
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +8 -2
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +8 -5
- package/build/button/save.js.map +1 -1
- package/build/column/edit.js +33 -13
- package/build/column/edit.js.map +1 -1
- package/build/columns/edit.js +50 -27
- package/build/columns/edit.js.map +1 -1
- package/build/comments/index.js +1 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/edit/index.js +9 -3
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit.native.js +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/details/edit.js +29 -7
- package/build/details/edit.js.map +1 -1
- package/build/image/transforms.js +1 -0
- package/build/image/transforms.js.map +1 -1
- package/build/latest-posts/deprecated.js +12 -0
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/index.js +12 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/loginout/edit.js +42 -13
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +59 -31
- package/build/media-text/edit.js.map +1 -1
- package/build/more/edit.js +28 -7
- package/build/more/edit.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +5 -3
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation-link/edit.js +95 -55
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +105 -53
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +44 -25
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +14 -4
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-author/edit.js +15 -3
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +4 -2
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-name/edit.js +11 -5
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-author-name/index.js +4 -2
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-comments-form/index.js +6 -1
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +8 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-date/edit.js +58 -18
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +2 -1
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +42 -18
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +17 -19
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +45 -11
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +6 -3
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/index.js +11 -7
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-navigation-link/variations.js +2 -2
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-template/index.js +11 -1
- package/build/post-template/index.js.map +1 -1
- package/build/post-title/index.js +6 -3
- package/build/post-title/index.js.map +1 -1
- package/build/query-no-results/index.js +10 -9
- package/build/query-no-results/index.js.map +1 -1
- package/build/query-pagination/edit.js +47 -17
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination/query-pagination-label-control.js +1 -1
- package/build/query-pagination/query-pagination-label-control.js.map +1 -1
- package/build/query-pagination-numbers/edit.js +33 -15
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-total/edit.js +8 -10
- package/build/query-total/edit.js.map +1 -1
- package/build/query-total/index.js +8 -1
- package/build/query-total/index.js.map +1 -1
- package/build/read-more/index.js +7 -1
- package/build/read-more/index.js.map +1 -1
- package/build/site-logo/index.js +4 -2
- package/build/site-logo/index.js.map +1 -1
- package/build/site-title/edit.js +41 -12
- package/build/site-title/edit.js.map +1 -1
- package/build/site-title/index.js +4 -2
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +19 -3
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/edit.js +41 -12
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/controls.js +34 -12
- package/build/spacer/controls.js.map +1 -1
- package/build/table/edit.js +48 -15
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +4 -1
- package/build/table/index.js.map +1 -1
- package/build/table-of-contents/edit.js +1 -1
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +24 -23
- package/build/table-of-contents/index.js.map +1 -1
- package/build/tag-cloud/edit.js +56 -11
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/video/edit-common-settings.js +90 -30
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +20 -49
- package/build/video/edit.js.map +1 -1
- package/build/video/poster-image.js +81 -0
- package/build/video/poster-image.js.map +1 -0
- package/build/video/tracks-editor.js +1 -1
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/edit.js +84 -37
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/button/deprecated.js +183 -2
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +50 -28
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +8 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +9 -6
- package/build-module/button/save.js.map +1 -1
- package/build-module/column/edit.js +34 -14
- package/build-module/column/edit.js.map +1 -1
- package/build-module/columns/edit.js +52 -29
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/comments/index.js +1 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/edit/index.js +9 -3
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit.native.js +2 -2
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/details/edit.js +30 -8
- package/build-module/details/edit.js.map +1 -1
- package/build-module/image/transforms.js +1 -0
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +12 -0
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/index.js +12 -0
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/loginout/edit.js +42 -14
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +59 -31
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/more/edit.js +28 -8
- package/build-module/more/edit.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +5 -3
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation-link/edit.js +96 -56
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +106 -54
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +45 -26
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +15 -6
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-author/edit.js +16 -4
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +4 -2
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-name/edit.js +12 -6
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +4 -2
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +6 -1
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +8 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-date/edit.js +59 -19
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +2 -1
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +44 -20
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +18 -20
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +47 -13
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +6 -3
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +12 -7
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +2 -2
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-template/index.js +11 -1
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-title/index.js +6 -3
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query-no-results/index.js +10 -9
- package/build-module/query-no-results/index.js.map +1 -1
- package/build-module/query-pagination/edit.js +49 -19
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination/query-pagination-label-control.js +1 -1
- package/build-module/query-pagination/query-pagination-label-control.js.map +1 -1
- package/build-module/query-pagination-numbers/edit.js +34 -16
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-total/edit.js +8 -10
- package/build-module/query-total/edit.js.map +1 -1
- package/build-module/query-total/index.js +8 -1
- package/build-module/query-total/index.js.map +1 -1
- package/build-module/read-more/index.js +7 -1
- package/build-module/read-more/index.js.map +1 -1
- package/build-module/site-logo/index.js +4 -2
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-title/edit.js +42 -13
- package/build-module/site-title/edit.js.map +1 -1
- package/build-module/site-title/index.js +4 -2
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +20 -4
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/edit.js +42 -13
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/controls.js +35 -13
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/edit.js +49 -16
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +4 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table-of-contents/edit.js +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +26 -25
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/tag-cloud/edit.js +57 -12
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/video/edit-common-settings.js +91 -31
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +24 -53
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/poster-image.js +74 -0
- package/build-module/video/poster-image.js.map +1 -0
- package/build-module/video/tracks-editor.js +1 -1
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/comment-template/style-rtl.css +0 -1
- package/build-style/comment-template/style.css +0 -1
- package/build-style/editor-rtl.css +4 -19
- package/build-style/editor.css +4 -19
- package/build-style/form-input/style-rtl.css +0 -2
- package/build-style/form-input/style.css +0 -2
- package/build-style/freeform/editor-rtl.css +4 -8
- package/build-style/freeform/editor.css +4 -8
- package/build-style/{post-template/editor.css → post-comments-link/style-rtl.css} +2 -4
- package/build-style/{post-template/editor-rtl.css → post-comments-link/style.css} +2 -4
- package/build-style/post-template/style-rtl.css +1 -0
- package/build-style/post-template/style.css +1 -0
- package/build-style/query-total/style-rtl.css +103 -0
- package/build-style/query-total/style.css +103 -0
- package/build-style/read-more/style-rtl.css +0 -1
- package/build-style/read-more/style.css +0 -1
- package/build-style/style-rtl.css +9 -4
- package/build-style/style.css +9 -4
- package/build-style/tag-cloud/editor-rtl.css +0 -5
- package/build-style/tag-cloud/editor.css +0 -5
- package/package.json +35 -35
- package/src/archives/edit.js +94 -36
- package/src/audio/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/block/index.php +20 -0
- package/src/button/block.json +17 -2
- package/src/button/deprecated.js +189 -0
- package/src/button/edit.js +60 -31
- package/src/button/save.js +6 -1
- package/src/column/edit.js +34 -13
- package/src/columns/edit.js +71 -40
- package/src/comments/index.js +1 -0
- package/src/cover/edit/index.js +12 -5
- package/src/cover/edit.native.js +5 -2
- package/src/cover/test/edit.js +5 -7
- package/src/details/edit.js +40 -11
- package/src/editor.scss +0 -1
- package/src/file/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/image/transforms.js +1 -0
- package/src/latest-posts/block.json +12 -0
- package/src/loginout/edit.js +56 -20
- package/src/media-text/edit.js +57 -28
- package/src/more/edit.js +39 -12
- package/src/navigation/edit/navigation-menu-selector.js +9 -2
- package/src/navigation/index.php +2 -2
- package/src/navigation-link/edit.js +101 -61
- package/src/navigation-link/index.php +16 -1
- package/src/navigation-submenu/edit.js +113 -57
- package/src/page-list/edit.js +52 -31
- package/src/paragraph/edit.js +18 -4
- package/src/post-author/block.json +4 -2
- package/src/post-author/edit.js +17 -3
- package/src/post-author/index.php +4 -0
- package/src/post-author-name/block.json +4 -2
- package/src/post-author-name/edit.js +17 -4
- package/src/post-author-name/index.php +4 -0
- package/src/post-comments-form/block.json +6 -1
- package/src/post-comments-link/block.json +8 -1
- package/src/post-comments-link/style.scss +4 -0
- package/src/post-content/index.php +23 -0
- package/src/post-date/block.json +2 -1
- package/src/post-date/edit.js +79 -25
- package/src/post-excerpt/edit.js +59 -22
- package/src/post-featured-image/block.json +6 -3
- package/src/post-featured-image/dimension-controls.js +18 -21
- package/src/post-featured-image/edit.js +67 -10
- package/src/post-navigation-link/block.json +0 -6
- package/src/post-navigation-link/index.js +11 -0
- package/src/post-navigation-link/variations.js +2 -2
- package/src/post-template/block.json +11 -1
- package/src/post-template/style.scss +2 -0
- package/src/post-title/block.json +6 -3
- package/src/query-no-results/block.json +0 -10
- package/src/query-no-results/index.js +11 -0
- package/src/query-pagination/edit.js +57 -15
- package/src/query-pagination/query-pagination-label-control.js +1 -3
- package/src/query-pagination-numbers/edit.js +41 -19
- package/src/query-pagination-previous/index.php +21 -14
- package/src/query-total/block.json +8 -1
- package/src/query-total/edit.js +11 -13
- package/src/query-total/index.php +9 -13
- package/src/query-total/style.scss +4 -0
- package/src/read-more/index.js +6 -0
- package/src/site-logo/block.json +4 -2
- package/src/site-title/block.json +4 -2
- package/src/site-title/edit.js +52 -15
- package/src/social-link/edit.js +21 -6
- package/src/social-links/edit.js +52 -15
- package/src/spacer/controls.js +42 -15
- package/src/style.scss +2 -0
- package/src/table/block.json +4 -1
- package/src/table/edit.js +58 -20
- package/src/table-of-contents/block.json +0 -52
- package/src/table-of-contents/edit.js +1 -1
- package/src/table-of-contents/index.js +53 -0
- package/src/tag-cloud/edit.js +60 -8
- package/src/tag-cloud/editor.scss +0 -8
- package/src/video/edit-common-settings.js +97 -39
- package/src/video/edit.js +29 -75
- package/src/video/poster-image.js +86 -0
- package/src/video/tracks-editor.js +1 -1
- package/tsconfig.json +0 -2
- package/src/post-template/editor.scss +0 -7
package/src/archives/edit.js
CHANGED
|
@@ -2,70 +2,128 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
PanelBody,
|
|
6
5
|
ToggleControl,
|
|
7
6
|
SelectControl,
|
|
8
7
|
Disabled,
|
|
8
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
9
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
9
10
|
} from '@wordpress/components';
|
|
10
11
|
import { __ } from '@wordpress/i18n';
|
|
11
12
|
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
12
13
|
import ServerSideRender from '@wordpress/server-side-render';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
19
|
+
|
|
14
20
|
export default function ArchivesEdit( { attributes, setAttributes } ) {
|
|
15
21
|
const { showLabel, showPostCounts, displayAsDropdown, type } = attributes;
|
|
16
22
|
|
|
23
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
24
|
+
|
|
17
25
|
return (
|
|
18
26
|
<>
|
|
19
27
|
<InspectorControls>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
<ToolsPanel
|
|
29
|
+
label={ __( 'Settings' ) }
|
|
30
|
+
resetAll={ () => {
|
|
31
|
+
setAttributes( {
|
|
32
|
+
displayAsDropdown: false,
|
|
33
|
+
showLabel: false,
|
|
34
|
+
showPostCounts: false,
|
|
35
|
+
type: 'monthly',
|
|
36
|
+
} );
|
|
37
|
+
} }
|
|
38
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
39
|
+
>
|
|
40
|
+
<ToolsPanelItem
|
|
23
41
|
label={ __( 'Display as dropdown' ) }
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} )
|
|
42
|
+
isShownByDefault
|
|
43
|
+
hasValue={ () => displayAsDropdown }
|
|
44
|
+
onDeselect={ () =>
|
|
45
|
+
setAttributes( { displayAsDropdown: false } )
|
|
29
46
|
}
|
|
30
|
-
|
|
31
|
-
{ displayAsDropdown && (
|
|
47
|
+
>
|
|
32
48
|
<ToggleControl
|
|
33
49
|
__nextHasNoMarginBottom
|
|
34
|
-
label={ __( '
|
|
35
|
-
checked={
|
|
50
|
+
label={ __( 'Display as dropdown' ) }
|
|
51
|
+
checked={ displayAsDropdown }
|
|
36
52
|
onChange={ () =>
|
|
37
53
|
setAttributes( {
|
|
38
|
-
|
|
54
|
+
displayAsDropdown: ! displayAsDropdown,
|
|
39
55
|
} )
|
|
40
56
|
}
|
|
41
57
|
/>
|
|
58
|
+
</ToolsPanelItem>
|
|
59
|
+
|
|
60
|
+
{ displayAsDropdown && (
|
|
61
|
+
<ToolsPanelItem
|
|
62
|
+
label={ __( 'Show label' ) }
|
|
63
|
+
isShownByDefault
|
|
64
|
+
hasValue={ () => showLabel }
|
|
65
|
+
onDeselect={ () =>
|
|
66
|
+
setAttributes( { showLabel: false } )
|
|
67
|
+
}
|
|
68
|
+
>
|
|
69
|
+
<ToggleControl
|
|
70
|
+
__nextHasNoMarginBottom
|
|
71
|
+
label={ __( 'Show label' ) }
|
|
72
|
+
checked={ showLabel }
|
|
73
|
+
onChange={ () =>
|
|
74
|
+
setAttributes( {
|
|
75
|
+
showLabel: ! showLabel,
|
|
76
|
+
} )
|
|
77
|
+
}
|
|
78
|
+
/>
|
|
79
|
+
</ToolsPanelItem>
|
|
42
80
|
) }
|
|
43
|
-
|
|
44
|
-
|
|
81
|
+
|
|
82
|
+
<ToolsPanelItem
|
|
45
83
|
label={ __( 'Show post counts' ) }
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} )
|
|
84
|
+
isShownByDefault
|
|
85
|
+
hasValue={ () => showPostCounts }
|
|
86
|
+
onDeselect={ () =>
|
|
87
|
+
setAttributes( { showPostCounts: false } )
|
|
51
88
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
89
|
+
>
|
|
90
|
+
<ToggleControl
|
|
91
|
+
__nextHasNoMarginBottom
|
|
92
|
+
label={ __( 'Show post counts' ) }
|
|
93
|
+
checked={ showPostCounts }
|
|
94
|
+
onChange={ () =>
|
|
95
|
+
setAttributes( {
|
|
96
|
+
showPostCounts: ! showPostCounts,
|
|
97
|
+
} )
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
</ToolsPanelItem>
|
|
101
|
+
|
|
102
|
+
<ToolsPanelItem
|
|
56
103
|
label={ __( 'Group by' ) }
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{ label: __( 'Day' ), value: 'daily' },
|
|
62
|
-
] }
|
|
63
|
-
value={ type }
|
|
64
|
-
onChange={ ( value ) =>
|
|
65
|
-
setAttributes( { type: value } )
|
|
104
|
+
isShownByDefault
|
|
105
|
+
hasValue={ () => !! type }
|
|
106
|
+
onDeselect={ () =>
|
|
107
|
+
setAttributes( { type: 'monthly' } )
|
|
66
108
|
}
|
|
67
|
-
|
|
68
|
-
|
|
109
|
+
>
|
|
110
|
+
<SelectControl
|
|
111
|
+
__next40pxDefaultSize
|
|
112
|
+
__nextHasNoMarginBottom
|
|
113
|
+
label={ __( 'Group by' ) }
|
|
114
|
+
options={ [
|
|
115
|
+
{ label: __( 'Year' ), value: 'yearly' },
|
|
116
|
+
{ label: __( 'Month' ), value: 'monthly' },
|
|
117
|
+
{ label: __( 'Week' ), value: 'weekly' },
|
|
118
|
+
{ label: __( 'Day' ), value: 'daily' },
|
|
119
|
+
] }
|
|
120
|
+
value={ type }
|
|
121
|
+
onChange={ ( value ) =>
|
|
122
|
+
setAttributes( { type: value } )
|
|
123
|
+
}
|
|
124
|
+
/>
|
|
125
|
+
</ToolsPanelItem>
|
|
126
|
+
</ToolsPanel>
|
|
69
127
|
</InspectorControls>
|
|
70
128
|
<div { ...useBlockProps() }>
|
|
71
129
|
<Disabled>
|
package/src/block/index.php
CHANGED
|
@@ -87,6 +87,26 @@ function render_block_core_block( $attributes ) {
|
|
|
87
87
|
add_filter( 'render_block_context', $filter_block_context, 1 );
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
$ignored_hooked_blocks = get_post_meta( $attributes['ref'], '_wp_ignored_hooked_blocks', true );
|
|
91
|
+
if ( ! empty( $ignored_hooked_blocks ) ) {
|
|
92
|
+
$ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true );
|
|
93
|
+
$attributes['metadata'] = array(
|
|
94
|
+
'ignoredHookedBlocks' => $ignored_hooked_blocks,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Wrap in "Block" block so the Block Hooks algorithm can insert blocks
|
|
99
|
+
// that are hooked as first or last child of `core/block`.
|
|
100
|
+
$content = get_comment_delimited_block_content(
|
|
101
|
+
'core/block',
|
|
102
|
+
$attributes,
|
|
103
|
+
$content
|
|
104
|
+
);
|
|
105
|
+
// Apply Block Hooks.
|
|
106
|
+
$content = apply_block_hooks_to_content( $content, $reusable_block );
|
|
107
|
+
// Remove block wrapper.
|
|
108
|
+
$content = remove_serialized_parent_block( $content );
|
|
109
|
+
|
|
90
110
|
$content = do_blocks( $content );
|
|
91
111
|
unset( $seen_refs[ $attributes['ref'] ] );
|
|
92
112
|
|
package/src/button/block.json
CHANGED
|
@@ -85,6 +85,16 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"typography": {
|
|
88
|
+
"__experimentalSkipSerialization": [
|
|
89
|
+
"fontSize",
|
|
90
|
+
"lineHeight",
|
|
91
|
+
"fontFamily",
|
|
92
|
+
"fontWeight",
|
|
93
|
+
"fontStyle",
|
|
94
|
+
"textTransform",
|
|
95
|
+
"textDecoration",
|
|
96
|
+
"letterSpacing"
|
|
97
|
+
],
|
|
88
98
|
"fontSize": true,
|
|
89
99
|
"lineHeight": true,
|
|
90
100
|
"__experimentalFontFamily": true,
|
|
@@ -122,7 +132,6 @@
|
|
|
122
132
|
"width": true
|
|
123
133
|
}
|
|
124
134
|
},
|
|
125
|
-
"__experimentalSelector": ".wp-block-button .wp-block-button__link",
|
|
126
135
|
"interactivity": {
|
|
127
136
|
"clientNavigation": true
|
|
128
137
|
}
|
|
@@ -132,5 +141,11 @@
|
|
|
132
141
|
{ "name": "outline", "label": "Outline" }
|
|
133
142
|
],
|
|
134
143
|
"editorStyle": "wp-block-button-editor",
|
|
135
|
-
"style": "wp-block-button"
|
|
144
|
+
"style": "wp-block-button",
|
|
145
|
+
"selectors": {
|
|
146
|
+
"root": ".wp-block-button .wp-block-button__link",
|
|
147
|
+
"typography": {
|
|
148
|
+
"writingMode": ".wp-block-button"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
136
151
|
}
|
package/src/button/deprecated.js
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
|
|
15
15
|
__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
|
|
16
16
|
__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
|
|
17
|
+
__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
|
|
18
|
+
__experimentalGetElementClassName,
|
|
17
19
|
} from '@wordpress/block-editor';
|
|
18
20
|
import { compose } from '@wordpress/compose';
|
|
19
21
|
|
|
@@ -132,6 +134,192 @@ const blockAttributes = {
|
|
|
132
134
|
},
|
|
133
135
|
};
|
|
134
136
|
|
|
137
|
+
const v12 = {
|
|
138
|
+
attributes: {
|
|
139
|
+
tagName: {
|
|
140
|
+
type: 'string',
|
|
141
|
+
enum: [ 'a', 'button' ],
|
|
142
|
+
default: 'a',
|
|
143
|
+
},
|
|
144
|
+
type: {
|
|
145
|
+
type: 'string',
|
|
146
|
+
default: 'button',
|
|
147
|
+
},
|
|
148
|
+
textAlign: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
},
|
|
151
|
+
url: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
source: 'attribute',
|
|
154
|
+
selector: 'a',
|
|
155
|
+
attribute: 'href',
|
|
156
|
+
},
|
|
157
|
+
title: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
source: 'attribute',
|
|
160
|
+
selector: 'a,button',
|
|
161
|
+
attribute: 'title',
|
|
162
|
+
role: 'content',
|
|
163
|
+
},
|
|
164
|
+
text: {
|
|
165
|
+
type: 'rich-text',
|
|
166
|
+
source: 'rich-text',
|
|
167
|
+
selector: 'a,button',
|
|
168
|
+
role: 'content',
|
|
169
|
+
},
|
|
170
|
+
linkTarget: {
|
|
171
|
+
type: 'string',
|
|
172
|
+
source: 'attribute',
|
|
173
|
+
selector: 'a',
|
|
174
|
+
attribute: 'target',
|
|
175
|
+
role: 'content',
|
|
176
|
+
},
|
|
177
|
+
rel: {
|
|
178
|
+
type: 'string',
|
|
179
|
+
source: 'attribute',
|
|
180
|
+
selector: 'a',
|
|
181
|
+
attribute: 'rel',
|
|
182
|
+
role: 'content',
|
|
183
|
+
},
|
|
184
|
+
placeholder: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
},
|
|
187
|
+
backgroundColor: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
},
|
|
190
|
+
textColor: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
},
|
|
193
|
+
gradient: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
},
|
|
196
|
+
width: {
|
|
197
|
+
type: 'number',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
supports: {
|
|
201
|
+
anchor: true,
|
|
202
|
+
align: true,
|
|
203
|
+
alignWide: false,
|
|
204
|
+
color: {
|
|
205
|
+
__experimentalSkipSerialization: true,
|
|
206
|
+
gradients: true,
|
|
207
|
+
__experimentalDefaultControls: {
|
|
208
|
+
background: true,
|
|
209
|
+
text: true,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
typography: {
|
|
213
|
+
fontSize: true,
|
|
214
|
+
lineHeight: true,
|
|
215
|
+
__experimentalFontFamily: true,
|
|
216
|
+
__experimentalFontWeight: true,
|
|
217
|
+
__experimentalFontStyle: true,
|
|
218
|
+
__experimentalTextTransform: true,
|
|
219
|
+
__experimentalTextDecoration: true,
|
|
220
|
+
__experimentalLetterSpacing: true,
|
|
221
|
+
__experimentalWritingMode: true,
|
|
222
|
+
__experimentalDefaultControls: {
|
|
223
|
+
fontSize: true,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
reusable: false,
|
|
227
|
+
shadow: {
|
|
228
|
+
__experimentalSkipSerialization: true,
|
|
229
|
+
},
|
|
230
|
+
spacing: {
|
|
231
|
+
__experimentalSkipSerialization: true,
|
|
232
|
+
padding: [ 'horizontal', 'vertical' ],
|
|
233
|
+
__experimentalDefaultControls: {
|
|
234
|
+
padding: true,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
__experimentalBorder: {
|
|
238
|
+
color: true,
|
|
239
|
+
radius: true,
|
|
240
|
+
style: true,
|
|
241
|
+
width: true,
|
|
242
|
+
__experimentalSkipSerialization: true,
|
|
243
|
+
__experimentalDefaultControls: {
|
|
244
|
+
color: true,
|
|
245
|
+
radius: true,
|
|
246
|
+
style: true,
|
|
247
|
+
width: true,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
__experimentalSelector: '.wp-block-button__link',
|
|
251
|
+
interactivity: {
|
|
252
|
+
clientNavigation: true,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
save( { attributes, className } ) {
|
|
256
|
+
const {
|
|
257
|
+
tagName,
|
|
258
|
+
type,
|
|
259
|
+
textAlign,
|
|
260
|
+
fontSize,
|
|
261
|
+
linkTarget,
|
|
262
|
+
rel,
|
|
263
|
+
style,
|
|
264
|
+
text,
|
|
265
|
+
title,
|
|
266
|
+
url,
|
|
267
|
+
width,
|
|
268
|
+
} = attributes;
|
|
269
|
+
|
|
270
|
+
const TagName = tagName || 'a';
|
|
271
|
+
const isButtonTag = 'button' === TagName;
|
|
272
|
+
const buttonType = type || 'button';
|
|
273
|
+
const borderProps = getBorderClassesAndStyles( attributes );
|
|
274
|
+
const colorProps = getColorClassesAndStyles( attributes );
|
|
275
|
+
const spacingProps = getSpacingClassesAndStyles( attributes );
|
|
276
|
+
const shadowProps = getShadowClassesAndStyles( attributes );
|
|
277
|
+
const buttonClasses = clsx(
|
|
278
|
+
'wp-block-button__link',
|
|
279
|
+
colorProps.className,
|
|
280
|
+
borderProps.className,
|
|
281
|
+
{
|
|
282
|
+
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
283
|
+
// For backwards compatibility add style that isn't provided via
|
|
284
|
+
// block support.
|
|
285
|
+
'no-border-radius': style?.border?.radius === 0,
|
|
286
|
+
},
|
|
287
|
+
__experimentalGetElementClassName( 'button' )
|
|
288
|
+
);
|
|
289
|
+
const buttonStyle = {
|
|
290
|
+
...borderProps.style,
|
|
291
|
+
...colorProps.style,
|
|
292
|
+
...spacingProps.style,
|
|
293
|
+
...shadowProps.style,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
// The use of a `title` attribute here is soft-deprecated, but still applied
|
|
297
|
+
// if it had already been assigned, for the sake of backward-compatibility.
|
|
298
|
+
// A title will no longer be assigned for new or updated button block links.
|
|
299
|
+
|
|
300
|
+
const wrapperClasses = clsx( className, {
|
|
301
|
+
[ `has-custom-width wp-block-button__width-${ width }` ]: width,
|
|
302
|
+
[ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,
|
|
303
|
+
} );
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<div { ...useBlockProps.save( { className: wrapperClasses } ) }>
|
|
307
|
+
<RichText.Content
|
|
308
|
+
tagName={ TagName }
|
|
309
|
+
type={ isButtonTag ? buttonType : null }
|
|
310
|
+
className={ buttonClasses }
|
|
311
|
+
href={ isButtonTag ? null : url }
|
|
312
|
+
title={ title }
|
|
313
|
+
style={ buttonStyle }
|
|
314
|
+
value={ text }
|
|
315
|
+
target={ isButtonTag ? null : linkTarget }
|
|
316
|
+
rel={ isButtonTag ? null : rel }
|
|
317
|
+
/>
|
|
318
|
+
</div>
|
|
319
|
+
);
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
|
|
135
323
|
const v11 = {
|
|
136
324
|
attributes: {
|
|
137
325
|
url: {
|
|
@@ -399,6 +587,7 @@ const v10 = {
|
|
|
399
587
|
};
|
|
400
588
|
|
|
401
589
|
const deprecated = [
|
|
590
|
+
v12,
|
|
402
591
|
v11,
|
|
403
592
|
v10,
|
|
404
593
|
{
|
package/src/button/edit.js
CHANGED
|
@@ -9,6 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';
|
|
10
10
|
import { getUpdatedLinkAttributes } from './get-updated-link-attributes';
|
|
11
11
|
import removeAnchorTag from '../utils/remove-anchor-tag';
|
|
12
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* WordPress dependencies
|
|
@@ -16,12 +17,13 @@ import removeAnchorTag from '../utils/remove-anchor-tag';
|
|
|
16
17
|
import { __ } from '@wordpress/i18n';
|
|
17
18
|
import { useEffect, useState, useRef, useMemo } from '@wordpress/element';
|
|
18
19
|
import {
|
|
19
|
-
Button,
|
|
20
|
-
ButtonGroup,
|
|
21
|
-
PanelBody,
|
|
22
20
|
TextControl,
|
|
23
21
|
ToolbarButton,
|
|
24
22
|
Popover,
|
|
23
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
24
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
25
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
26
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
25
27
|
} from '@wordpress/components';
|
|
26
28
|
import {
|
|
27
29
|
AlignmentControl,
|
|
@@ -37,6 +39,8 @@ import {
|
|
|
37
39
|
__experimentalGetElementClassName,
|
|
38
40
|
store as blockEditorStore,
|
|
39
41
|
useBlockEditingMode,
|
|
42
|
+
getTypographyClassesAndStyles as useTypographyProps,
|
|
43
|
+
useSettings,
|
|
40
44
|
} from '@wordpress/block-editor';
|
|
41
45
|
import { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';
|
|
42
46
|
import { link, linkOff } from '@wordpress/icons';
|
|
@@ -114,35 +118,43 @@ function useEnter( props ) {
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
function WidthPanel( { selectedWidth, setAttributes } ) {
|
|
117
|
-
|
|
118
|
-
// Check if we are toggling the width off
|
|
119
|
-
const width = selectedWidth === newWidth ? undefined : newWidth;
|
|
120
|
-
|
|
121
|
-
// Update attributes.
|
|
122
|
-
setAttributes( { width } );
|
|
123
|
-
}
|
|
121
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
124
122
|
|
|
125
123
|
return (
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
124
|
+
<ToolsPanel
|
|
125
|
+
label={ __( 'Settings' ) }
|
|
126
|
+
resetAll={ () => setAttributes( { width: undefined } ) }
|
|
127
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
128
|
+
>
|
|
129
|
+
<ToolsPanelItem
|
|
130
|
+
label={ __( 'Width' ) }
|
|
131
|
+
isShownByDefault
|
|
132
|
+
hasValue={ () => !! selectedWidth }
|
|
133
|
+
onDeselect={ () => setAttributes( { width: undefined } ) }
|
|
134
|
+
__nextHasNoMarginBottom
|
|
135
|
+
>
|
|
136
|
+
<ToggleGroupControl
|
|
137
|
+
label={ __( 'Width' ) }
|
|
138
|
+
value={ selectedWidth }
|
|
139
|
+
onChange={ ( newWidth ) =>
|
|
140
|
+
setAttributes( { width: newWidth } )
|
|
141
|
+
}
|
|
142
|
+
isBlock
|
|
143
|
+
__next40pxDefaultSize
|
|
144
|
+
__nextHasNoMarginBottom
|
|
145
|
+
>
|
|
146
|
+
{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {
|
|
147
|
+
return (
|
|
148
|
+
<ToggleGroupControlOption
|
|
149
|
+
key={ widthValue }
|
|
150
|
+
value={ widthValue }
|
|
151
|
+
label={ `${ widthValue }%` }
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
} ) }
|
|
155
|
+
</ToggleGroupControl>
|
|
156
|
+
</ToolsPanelItem>
|
|
157
|
+
</ToolsPanel>
|
|
146
158
|
);
|
|
147
159
|
}
|
|
148
160
|
|
|
@@ -256,6 +268,19 @@ function ButtonEdit( props ) {
|
|
|
256
268
|
[ context, isSelected, metadata?.bindings?.url ]
|
|
257
269
|
);
|
|
258
270
|
|
|
271
|
+
const [ fluidTypographySettings, layout ] = useSettings(
|
|
272
|
+
'typography.fluid',
|
|
273
|
+
'layout'
|
|
274
|
+
);
|
|
275
|
+
const typographyProps = useTypographyProps( attributes, {
|
|
276
|
+
typography: {
|
|
277
|
+
fluid: fluidTypographySettings,
|
|
278
|
+
},
|
|
279
|
+
layout: {
|
|
280
|
+
wideSize: layout?.wideSize,
|
|
281
|
+
},
|
|
282
|
+
} );
|
|
283
|
+
|
|
259
284
|
return (
|
|
260
285
|
<>
|
|
261
286
|
<div
|
|
@@ -263,7 +288,6 @@ function ButtonEdit( props ) {
|
|
|
263
288
|
className={ clsx( blockProps.className, {
|
|
264
289
|
[ `has-custom-width wp-block-button__width-${ width }` ]:
|
|
265
290
|
width,
|
|
266
|
-
[ `has-custom-font-size` ]: blockProps.style.fontSize,
|
|
267
291
|
} ) }
|
|
268
292
|
>
|
|
269
293
|
<RichText
|
|
@@ -282,11 +306,14 @@ function ButtonEdit( props ) {
|
|
|
282
306
|
'wp-block-button__link',
|
|
283
307
|
colorProps.className,
|
|
284
308
|
borderProps.className,
|
|
309
|
+
typographyProps.className,
|
|
285
310
|
{
|
|
286
311
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
287
312
|
// For backwards compatibility add style that isn't
|
|
288
313
|
// provided via block support.
|
|
289
314
|
'no-border-radius': style?.border?.radius === 0,
|
|
315
|
+
[ `has-custom-font-size` ]:
|
|
316
|
+
blockProps.style.fontSize,
|
|
290
317
|
},
|
|
291
318
|
__experimentalGetElementClassName( 'button' )
|
|
292
319
|
) }
|
|
@@ -295,6 +322,8 @@ function ButtonEdit( props ) {
|
|
|
295
322
|
...colorProps.style,
|
|
296
323
|
...spacingProps.style,
|
|
297
324
|
...shadowProps.style,
|
|
325
|
+
...typographyProps.style,
|
|
326
|
+
writingMode: undefined,
|
|
298
327
|
} }
|
|
299
328
|
onReplace={ onReplace }
|
|
300
329
|
onMerge={ mergeBlocks }
|
package/src/button/save.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
|
|
15
15
|
__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
|
|
16
16
|
__experimentalGetElementClassName,
|
|
17
|
+
getTypographyClassesAndStyles,
|
|
17
18
|
} from '@wordpress/block-editor';
|
|
18
19
|
|
|
19
20
|
export default function save( { attributes, className } ) {
|
|
@@ -38,15 +39,18 @@ export default function save( { attributes, className } ) {
|
|
|
38
39
|
const colorProps = getColorClassesAndStyles( attributes );
|
|
39
40
|
const spacingProps = getSpacingClassesAndStyles( attributes );
|
|
40
41
|
const shadowProps = getShadowClassesAndStyles( attributes );
|
|
42
|
+
const typographyProps = getTypographyClassesAndStyles( attributes );
|
|
41
43
|
const buttonClasses = clsx(
|
|
42
44
|
'wp-block-button__link',
|
|
43
45
|
colorProps.className,
|
|
44
46
|
borderProps.className,
|
|
47
|
+
typographyProps.className,
|
|
45
48
|
{
|
|
46
49
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
47
50
|
// For backwards compatibility add style that isn't provided via
|
|
48
51
|
// block support.
|
|
49
52
|
'no-border-radius': style?.border?.radius === 0,
|
|
53
|
+
[ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,
|
|
50
54
|
},
|
|
51
55
|
__experimentalGetElementClassName( 'button' )
|
|
52
56
|
);
|
|
@@ -55,6 +59,8 @@ export default function save( { attributes, className } ) {
|
|
|
55
59
|
...colorProps.style,
|
|
56
60
|
...spacingProps.style,
|
|
57
61
|
...shadowProps.style,
|
|
62
|
+
...typographyProps.style,
|
|
63
|
+
writingMode: undefined,
|
|
58
64
|
};
|
|
59
65
|
|
|
60
66
|
// The use of a `title` attribute here is soft-deprecated, but still applied
|
|
@@ -63,7 +69,6 @@ export default function save( { attributes, className } ) {
|
|
|
63
69
|
|
|
64
70
|
const wrapperClasses = clsx( className, {
|
|
65
71
|
[ `has-custom-width wp-block-button__width-${ width }` ]: width,
|
|
66
|
-
[ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,
|
|
67
72
|
} );
|
|
68
73
|
|
|
69
74
|
return (
|