@wordpress/block-library 7.14.2 → 7.15.1-next.4d3b314fd5.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 +3 -0
- package/build/avatar/index.js +1 -1
- package/build/block/edit.native.js +1 -1
- package/build/block/edit.native.js.map +1 -1
- package/build/buttons/edit.native.js +1 -3
- package/build/buttons/edit.native.js.map +1 -1
- package/build/calendar/index.js +9 -0
- package/build/calendar/index.js.map +1 -1
- package/build/code/index.js +1 -1
- package/build/code/index.js.map +1 -1
- package/build/comments/edit/comments-legacy.js +1 -1
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +8 -1
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/comments-title/edit.js +1 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/edit/use-cover-is-dark.js +10 -7
- package/build/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build/cover/index.js +9 -2
- package/build/cover/index.js.map +1 -1
- package/build/embed/deprecated.js +12 -6
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/index.js +12 -6
- package/build/embed/index.js.map +1 -1
- package/build/embed/transforms.js +12 -6
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +12 -6
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/freeform/edit.js +5 -8
- package/build/freeform/edit.js.map +1 -1
- package/build/gallery/deprecated.js +4 -4
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/gallery.js +2 -28
- package/build/gallery/gallery.js.map +1 -1
- package/build/list-item/edit.js +2 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/missing/edit.js +9 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/edit.js +1 -1
- package/build/more/edit.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +16 -6
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/paragraph/drop-zone.js +99 -0
- package/build/paragraph/drop-zone.js.map +1 -0
- package/build/paragraph/edit.js +11 -3
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-content/edit.js +6 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js +35 -4
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +6 -1
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +13 -28
- package/build/post-template/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +4 -8
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build/query/edit/query-placeholder.js +2 -2
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query-title/edit.js +1 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/quote/transforms.js +2 -2
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/edit.js +1 -1
- package/build/read-more/edit.js.map +1 -1
- package/build/site-tagline/index.js +1 -1
- package/build/social-links/edit.native.js +1 -0
- package/build/social-links/edit.native.js.map +1 -1
- package/build/template-part/edit/index.js +2 -2
- package/build/template-part/edit/index.js.map +1 -1
- package/build-module/avatar/index.js +1 -1
- package/build-module/block/edit.native.js +1 -1
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -2
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/calendar/index.js +9 -0
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/code/index.js +1 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +1 -1
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +8 -1
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/comments-title/edit.js +1 -1
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/edit/use-cover-is-dark.js +9 -4
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build-module/cover/index.js +9 -2
- package/build-module/cover/index.js.map +1 -1
- package/build-module/embed/deprecated.js +12 -6
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/index.js +12 -6
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/transforms.js +12 -6
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +12 -6
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/freeform/edit.js +3 -6
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/gallery/deprecated.js +4 -4
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -29
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/list-item/edit.js +2 -1
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/missing/edit.js +11 -4
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/more/edit.js +1 -1
- package/build-module/more/edit.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +16 -6
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/paragraph/drop-zone.js +88 -0
- package/build-module/paragraph/drop-zone.js.map +1 -0
- package/build-module/paragraph/edit.js +10 -3
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-content/edit.js +6 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +37 -6
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +6 -1
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +14 -29
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -6
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +2 -2
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query-title/edit.js +1 -1
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/quote/transforms.js +2 -2
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +1 -1
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -1
- package/build-module/social-links/edit.native.js +1 -0
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/template-part/edit/index.js +3 -3
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-style/calendar/style-rtl.css +21 -12
- package/build-style/calendar/style.css +21 -12
- package/build-style/classic-rtl.css +85 -0
- package/build-style/classic.css +85 -0
- package/build-style/editor-rtl.css +41 -2
- package/build-style/editor.css +41 -2
- package/build-style/group/editor-rtl.css +11 -1
- package/build-style/group/editor.css +11 -1
- package/build-style/image/editor-rtl.css +3 -0
- package/build-style/image/editor.css +3 -0
- package/build-style/navigation/editor-rtl.css +11 -1
- package/build-style/navigation/editor.css +11 -1
- package/build-style/paragraph/editor-rtl.css +16 -0
- package/build-style/paragraph/editor.css +16 -0
- package/build-style/post-navigation-link/style-rtl.css +90 -0
- package/build-style/post-navigation-link/style.css +90 -0
- package/build-style/style-rtl.css +36 -12
- package/build-style/style.css +36 -12
- package/package.json +29 -29
- package/src/archives/index.php +4 -7
- package/src/avatar/block.json +1 -1
- package/src/block/edit.native.js +1 -1
- package/src/buttons/edit.native.js +1 -2
- package/src/buttons/test/__snapshots__/edit.native.js.snap +28 -0
- package/src/buttons/test/edit.native.js +170 -0
- package/src/calendar/block.json +9 -0
- package/src/calendar/index.php +22 -1
- package/src/calendar/style.scss +28 -15
- package/src/classic.scss +15 -0
- package/src/code/index.js +1 -1
- package/src/columns/test/__snapshots__/edit.native.js.snap +219 -0
- package/src/columns/test/edit.native.js +432 -0
- package/src/comment-template/index.php +18 -8
- package/src/comments/edit/comments-legacy.js +1 -1
- package/src/comments-pagination-next/block.json +1 -1
- package/src/comments-pagination-numbers/block.json +8 -1
- package/src/comments-pagination-previous/block.json +1 -1
- package/src/comments-title/edit.js +1 -1
- package/src/cover/edit/use-cover-is-dark.js +11 -7
- package/src/cover/index.js +8 -1
- package/src/cover/test/__snapshots__/edit.native.js.snap +64 -0
- package/src/cover/test/edit.native.js +136 -4
- package/src/embed/block.json +12 -6
- package/src/embed/test/index.native.js +1 -2
- package/src/embed/variations.js +1 -1
- package/src/freeform/edit.js +12 -10
- package/src/gallery/deprecated.js +4 -4
- package/src/gallery/gallery.js +1 -31
- package/src/group/test/__snapshots__/edit.native.js.snap +19 -0
- package/src/group/test/edit.native.js +102 -0
- package/src/image/editor.scss +4 -0
- package/src/list-item/edit.js +1 -0
- package/src/missing/edit.js +15 -4
- package/src/more/edit.js +1 -1
- package/src/navigation/menu-items-to-blocks.js +39 -22
- package/src/navigation/test/menu-items-to-blocks.js +6 -0
- package/src/navigation-submenu/index.php +11 -2
- package/src/page-list/index.php +1 -1
- package/src/paragraph/drop-zone.js +105 -0
- package/src/paragraph/edit.js +14 -1
- package/src/paragraph/editor.scss +20 -0
- package/src/post-content/edit.js +3 -1
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/index.php +11 -18
- package/src/post-navigation-link/block.json +6 -1
- package/src/post-navigation-link/edit.js +64 -3
- package/src/post-navigation-link/index.php +23 -0
- package/src/post-navigation-link/style.scss +23 -0
- package/src/post-template/edit.js +14 -23
- package/src/query/edit/inspector-controls/index.js +2 -6
- package/src/query/edit/inspector-controls/sticky-control.js +1 -1
- package/src/query/edit/query-placeholder.js +4 -1
- package/src/query-title/edit.js +1 -1
- package/src/quote/transforms.js +1 -1
- package/src/read-more/edit.js +1 -1
- package/src/site-tagline/block.json +1 -1
- package/src/social-links/edit.native.js +7 -1
- package/src/social-links/test/__snapshots__/edit.native.js.snap +57 -0
- package/src/social-links/test/edit.native.js +199 -0
- package/src/style.scss +1 -0
- package/src/tag-cloud/index.php +1 -8
- package/src/template-part/edit/index.js +60 -58
|
@@ -6,7 +6,12 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
11
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
12
|
+
ToggleControl,
|
|
13
|
+
PanelBody,
|
|
14
|
+
} from '@wordpress/components';
|
|
10
15
|
import {
|
|
11
16
|
InspectorControls,
|
|
12
17
|
RichText,
|
|
@@ -14,15 +19,23 @@ import {
|
|
|
14
19
|
AlignmentToolbar,
|
|
15
20
|
useBlockProps,
|
|
16
21
|
} from '@wordpress/block-editor';
|
|
17
|
-
import { __ } from '@wordpress/i18n';
|
|
22
|
+
import { __, _x } from '@wordpress/i18n';
|
|
18
23
|
|
|
19
24
|
export default function PostNavigationLinkEdit( {
|
|
20
|
-
attributes: { type, label, showTitle, textAlign, linkLabel },
|
|
25
|
+
attributes: { type, label, showTitle, textAlign, linkLabel, arrow },
|
|
21
26
|
setAttributes,
|
|
22
27
|
} ) {
|
|
23
28
|
const isNext = type === 'next';
|
|
24
29
|
let placeholder = isNext ? __( 'Next' ) : __( 'Previous' );
|
|
25
30
|
|
|
31
|
+
const arrowMap = {
|
|
32
|
+
none: '',
|
|
33
|
+
arrow: isNext ? '→' : '←',
|
|
34
|
+
chevron: isNext ? '»' : '«',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const displayArrow = arrowMap[ arrow ];
|
|
38
|
+
|
|
26
39
|
if ( showTitle ) {
|
|
27
40
|
/* translators: Label before for next and previous post. There is a space after the colon. */
|
|
28
41
|
placeholder = isNext ? __( 'Next: ' ) : __( 'Previous: ' );
|
|
@@ -63,6 +76,39 @@ export default function PostNavigationLinkEdit( {
|
|
|
63
76
|
}
|
|
64
77
|
/>
|
|
65
78
|
) }
|
|
79
|
+
<ToggleGroupControl
|
|
80
|
+
label={ __( 'Arrow' ) }
|
|
81
|
+
value={ arrow }
|
|
82
|
+
onChange={ ( value ) => {
|
|
83
|
+
setAttributes( { arrow: value } );
|
|
84
|
+
} }
|
|
85
|
+
help={ __(
|
|
86
|
+
'A decorative arrow for the next and previous link.'
|
|
87
|
+
) }
|
|
88
|
+
isBlock
|
|
89
|
+
>
|
|
90
|
+
<ToggleGroupControlOption
|
|
91
|
+
value="none"
|
|
92
|
+
label={ _x(
|
|
93
|
+
'None',
|
|
94
|
+
'Arrow option for Next/Previous link'
|
|
95
|
+
) }
|
|
96
|
+
/>
|
|
97
|
+
<ToggleGroupControlOption
|
|
98
|
+
value="arrow"
|
|
99
|
+
label={ _x(
|
|
100
|
+
'Arrow',
|
|
101
|
+
'Arrow option for Next/Previous link'
|
|
102
|
+
) }
|
|
103
|
+
/>
|
|
104
|
+
<ToggleGroupControlOption
|
|
105
|
+
value="chevron"
|
|
106
|
+
label={ _x(
|
|
107
|
+
'Chevron',
|
|
108
|
+
'Arrow option for Next/Previous link'
|
|
109
|
+
) }
|
|
110
|
+
/>
|
|
111
|
+
</ToggleGroupControl>
|
|
66
112
|
</PanelBody>
|
|
67
113
|
</InspectorControls>
|
|
68
114
|
<BlockControls>
|
|
@@ -74,6 +120,13 @@ export default function PostNavigationLinkEdit( {
|
|
|
74
120
|
/>
|
|
75
121
|
</BlockControls>
|
|
76
122
|
<div { ...blockProps }>
|
|
123
|
+
{ ! isNext && displayArrow && (
|
|
124
|
+
<span
|
|
125
|
+
className={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }
|
|
126
|
+
>
|
|
127
|
+
{ displayArrow }
|
|
128
|
+
</span>
|
|
129
|
+
) }
|
|
77
130
|
<RichText
|
|
78
131
|
tagName="a"
|
|
79
132
|
aria-label={ ariaLabel }
|
|
@@ -92,6 +145,14 @@ export default function PostNavigationLinkEdit( {
|
|
|
92
145
|
{ __( 'An example title' ) }
|
|
93
146
|
</a>
|
|
94
147
|
) }
|
|
148
|
+
{ isNext && displayArrow && (
|
|
149
|
+
<span
|
|
150
|
+
className={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }
|
|
151
|
+
aria-hidden={ true }
|
|
152
|
+
>
|
|
153
|
+
{ displayArrow }
|
|
154
|
+
</span>
|
|
155
|
+
) }
|
|
95
156
|
</div>
|
|
96
157
|
</>
|
|
97
158
|
);
|
|
@@ -34,6 +34,18 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
|
|
|
34
34
|
$link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link' ) : _x( 'Previous', 'label for previous post link' );
|
|
35
35
|
$label = '';
|
|
36
36
|
|
|
37
|
+
$arrow_map = array(
|
|
38
|
+
'none' => '',
|
|
39
|
+
'arrow' => array(
|
|
40
|
+
'next' => '→',
|
|
41
|
+
'previous' => '←',
|
|
42
|
+
),
|
|
43
|
+
'chevron' => array(
|
|
44
|
+
'next' => '»',
|
|
45
|
+
'previous' => '«',
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
|
|
37
49
|
// If a custom label is provided, make this a link.
|
|
38
50
|
// `$label` is used to prepend the provided label, if we want to show the page title as well.
|
|
39
51
|
if ( isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ) {
|
|
@@ -71,6 +83,17 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
|
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
|
|
86
|
+
// Display arrows.
|
|
87
|
+
if ( isset( $attributes['arrow'] ) && ! empty( $attributes['arrow'] ) && 'none' !== $attributes['arrow'] ) {
|
|
88
|
+
$arrow = $arrow_map[ $attributes['arrow'] ][ $navigation_type ];
|
|
89
|
+
|
|
90
|
+
if ( 'next' === $navigation_type ) {
|
|
91
|
+
$format = '%link <span class="wp-block-post-navigation-link__arrow-next is-arrow-' . $attributes['arrow'] . '" aria-hidden="true">' . $arrow . '</span>';
|
|
92
|
+
} else {
|
|
93
|
+
$format = '<span class="wp-block-post-navigation-link__arrow-previous is-arrow-' . $attributes['arrow'] . '" aria-hidden="true">' . $arrow . '</span> %link';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
74
97
|
// The dynamic portion of the function name, `$navigation_type`,
|
|
75
98
|
// refers to the type of adjacency, 'next' or 'previous'.
|
|
76
99
|
$get_link_function = "get_{$navigation_type}_post_link";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.wp-block-post-navigation-link {
|
|
2
|
+
|
|
3
|
+
.wp-block-post-navigation-link__arrow-previous {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
margin-right: 1ch;
|
|
6
|
+
// chevron(`»`) symbol doesn't need the mirroring by us.
|
|
7
|
+
&:not(.is-arrow-chevron) {
|
|
8
|
+
// Flip for RTL.
|
|
9
|
+
transform: scaleX(1) #{"/*rtl:scaleX(-1);*/"}; // This points the arrow right for LTR and left for RTL.
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.wp-block-post-navigation-link__arrow-next {
|
|
14
|
+
display: inline-block;
|
|
15
|
+
margin-left: 1ch;
|
|
16
|
+
// chevron(`»`) symbol doesn't need the mirroring by us.
|
|
17
|
+
&:not(.is-arrow-chevron) {
|
|
18
|
+
// Flip for RTL.
|
|
19
|
+
transform: scaleX(1) #{"/*rtl:scaleX(-1);*/"}; // This points the arrow right for LTR and left for RTL.
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
store as blockEditorStore,
|
|
18
18
|
} from '@wordpress/block-editor';
|
|
19
19
|
import { Spinner } from '@wordpress/components';
|
|
20
|
-
import { store as coreStore
|
|
20
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
21
21
|
|
|
22
22
|
const TEMPLATE = [
|
|
23
23
|
[ 'core/post-title' ],
|
|
@@ -101,19 +101,6 @@ export default function PostTemplateEdit( {
|
|
|
101
101
|
} ) {
|
|
102
102
|
const [ { page } ] = queryContext;
|
|
103
103
|
const [ activeBlockContextId, setActiveBlockContextId ] = useState();
|
|
104
|
-
|
|
105
|
-
let categorySlug = null;
|
|
106
|
-
if ( templateSlug?.startsWith( 'category-' ) ) {
|
|
107
|
-
categorySlug = templateSlug.replace( 'category-', '' );
|
|
108
|
-
}
|
|
109
|
-
const { records: categories, hasResolved: hasResolvedCategories } =
|
|
110
|
-
useEntityRecords( 'taxonomy', 'category', {
|
|
111
|
-
context: 'view',
|
|
112
|
-
per_page: -1,
|
|
113
|
-
_fields: [ 'id' ],
|
|
114
|
-
slug: categorySlug,
|
|
115
|
-
} );
|
|
116
|
-
|
|
117
104
|
const { posts, blocks } = useSelect(
|
|
118
105
|
( select ) => {
|
|
119
106
|
const { getEntityRecords, getTaxonomies } = select( coreStore );
|
|
@@ -123,12 +110,22 @@ export default function PostTemplateEdit( {
|
|
|
123
110
|
per_page: -1,
|
|
124
111
|
context: 'view',
|
|
125
112
|
} );
|
|
113
|
+
const templateCategory =
|
|
114
|
+
inherit &&
|
|
115
|
+
templateSlug?.startsWith( 'category-' ) &&
|
|
116
|
+
getEntityRecords( 'taxonomy', 'category', {
|
|
117
|
+
context: 'view',
|
|
118
|
+
per_page: 1,
|
|
119
|
+
_fields: [ 'id' ],
|
|
120
|
+
slug: templateSlug.replace( 'category-', '' ),
|
|
121
|
+
} );
|
|
126
122
|
const query = {
|
|
127
123
|
offset: perPage ? perPage * ( page - 1 ) + offset : 0,
|
|
128
124
|
order,
|
|
129
125
|
orderby: orderBy,
|
|
130
126
|
};
|
|
131
|
-
|
|
127
|
+
// There is no need to build the taxQuery if we inherit.
|
|
128
|
+
if ( taxQuery && ! inherit ) {
|
|
132
129
|
// We have to build the tax query for the REST API and use as
|
|
133
130
|
// keys the taxonomies `rest_base` with the `term ids` as values.
|
|
134
131
|
const builtTaxQuery = Object.entries( taxQuery ).reduce(
|
|
@@ -174,11 +171,8 @@ export default function PostTemplateEdit( {
|
|
|
174
171
|
if ( templateSlug?.startsWith( 'archive-' ) ) {
|
|
175
172
|
query.postType = templateSlug.replace( 'archive-', '' );
|
|
176
173
|
postType = query.postType;
|
|
177
|
-
} else if (
|
|
178
|
-
query.
|
|
179
|
-
category: categories.map( ( { id } ) => id ),
|
|
180
|
-
};
|
|
181
|
-
taxQuery = query.taxQuery;
|
|
174
|
+
} else if ( templateCategory ) {
|
|
175
|
+
query.categories = templateCategory[ 0 ]?.id;
|
|
182
176
|
}
|
|
183
177
|
}
|
|
184
178
|
// When we preview Query Loop blocks we should prefer the current
|
|
@@ -210,9 +204,6 @@ export default function PostTemplateEdit( {
|
|
|
210
204
|
parents,
|
|
211
205
|
restQueryArgs,
|
|
212
206
|
previewPostType,
|
|
213
|
-
categories,
|
|
214
|
-
categorySlug,
|
|
215
|
-
hasResolvedCategories,
|
|
216
207
|
]
|
|
217
208
|
);
|
|
218
209
|
const blockContexts = useMemo(
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { debounce } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -18,6 +13,7 @@ import {
|
|
|
18
13
|
} from '@wordpress/components';
|
|
19
14
|
import { __ } from '@wordpress/i18n';
|
|
20
15
|
import { InspectorControls } from '@wordpress/block-editor';
|
|
16
|
+
import { debounce } from '@wordpress/compose';
|
|
21
17
|
import { useEffect, useState, useCallback } from '@wordpress/element';
|
|
22
18
|
|
|
23
19
|
/**
|
|
@@ -137,7 +133,7 @@ export default function QueryInspectorControls( {
|
|
|
137
133
|
label={ __( 'Post type' ) }
|
|
138
134
|
onChange={ onPostTypeChange }
|
|
139
135
|
help={ __(
|
|
140
|
-
'WordPress contains different types of content and they are divided into collections called
|
|
136
|
+
'WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.'
|
|
141
137
|
) }
|
|
142
138
|
/>
|
|
143
139
|
) }
|
|
@@ -18,7 +18,7 @@ export default function StickyControl( { value, onChange } ) {
|
|
|
18
18
|
value={ value }
|
|
19
19
|
onChange={ onChange }
|
|
20
20
|
help={ __(
|
|
21
|
-
'Blog posts can be
|
|
21
|
+
'Blog posts can be “stickied”, a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.'
|
|
22
22
|
) }
|
|
23
23
|
/>
|
|
24
24
|
);
|
|
@@ -48,7 +48,10 @@ export default function QueryPlaceholder( {
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
const matchingVariation = getMatchingVariation( attributes, allVariations );
|
|
51
|
-
const icon =
|
|
51
|
+
const icon =
|
|
52
|
+
matchingVariation?.icon?.src ||
|
|
53
|
+
matchingVariation?.icon ||
|
|
54
|
+
blockType?.icon?.src;
|
|
52
55
|
const label = matchingVariation?.title || blockType?.title;
|
|
53
56
|
if ( isStartingBlank ) {
|
|
54
57
|
return (
|
package/src/query-title/edit.js
CHANGED
package/src/quote/transforms.js
CHANGED
package/src/read-more/edit.js
CHANGED
|
@@ -33,7 +33,7 @@ export default function ReadMore( {
|
|
|
33
33
|
</InspectorControls>
|
|
34
34
|
<RichText
|
|
35
35
|
tagName="a"
|
|
36
|
-
aria-label={ __( '
|
|
36
|
+
aria-label={ __( '“Read more” link text' ) }
|
|
37
37
|
placeholder={ __( 'Read more' ) }
|
|
38
38
|
value={ content }
|
|
39
39
|
onChange={ ( newValue ) =>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "core/site-tagline",
|
|
5
5
|
"title": "Site Tagline",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"description": "Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it
|
|
7
|
+
"description": "Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it’s not displayed in the theme design.",
|
|
8
8
|
"keywords": [ "description" ],
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"attributes": {
|
|
@@ -69,7 +69,13 @@ function SocialLinksEdit( {
|
|
|
69
69
|
|
|
70
70
|
function renderPlaceholder() {
|
|
71
71
|
return [ ...new Array( innerBlocks.length || 1 ) ].map(
|
|
72
|
-
( _, index ) =>
|
|
72
|
+
( _, index ) => (
|
|
73
|
+
<View
|
|
74
|
+
testID="social-links-placeholder"
|
|
75
|
+
style={ placeholderStyle }
|
|
76
|
+
key={ index }
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
73
79
|
);
|
|
74
80
|
}
|
|
75
81
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Social links block inserts block with the default icons and the WordPress link set as active 1`] = `
|
|
4
|
+
"<!-- wp:social-links -->
|
|
5
|
+
<ul class=\\"wp-block-social-links\\"><!-- wp:social-link {\\"url\\":\\"https://wordpress.org\\",\\"service\\":\\"wordpress\\"} /-->
|
|
6
|
+
|
|
7
|
+
<!-- wp:social-link {\\"service\\":\\"facebook\\"} /-->
|
|
8
|
+
|
|
9
|
+
<!-- wp:social-link {\\"service\\":\\"twitter\\"} /-->
|
|
10
|
+
|
|
11
|
+
<!-- wp:social-link {\\"service\\":\\"instagram\\"} /--></ul>
|
|
12
|
+
<!-- /wp:social-links -->"
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`Social links block shows active links correctly when not selected 1`] = `
|
|
16
|
+
"<!-- wp:social-links -->
|
|
17
|
+
<ul class=\\"wp-block-social-links\\"><!-- wp:social-link {\\"url\\":\\"https://wordpress.org\\",\\"service\\":\\"wordpress\\"} /-->
|
|
18
|
+
|
|
19
|
+
<!-- wp:social-link {\\"service\\":\\"facebook\\"} /-->
|
|
20
|
+
|
|
21
|
+
<!-- wp:social-link {\\"service\\":\\"twitter\\"} /-->
|
|
22
|
+
|
|
23
|
+
<!-- wp:social-link {\\"service\\":\\"instagram\\"} /--></ul>
|
|
24
|
+
<!-- /wp:social-links -->
|
|
25
|
+
|
|
26
|
+
<!-- wp:paragraph -->
|
|
27
|
+
<p></p>
|
|
28
|
+
<!-- /wp:paragraph -->"
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
exports[`Social links block shows the ghost placeholder when no icon is active 1`] = `
|
|
32
|
+
"<!-- wp:social-links -->
|
|
33
|
+
<ul class=\\"wp-block-social-links\\"><!-- wp:social-link {\\"service\\":\\"facebook\\"} /-->
|
|
34
|
+
|
|
35
|
+
<!-- wp:social-link {\\"service\\":\\"twitter\\"} /-->
|
|
36
|
+
|
|
37
|
+
<!-- wp:social-link {\\"service\\":\\"instagram\\"} /--></ul>
|
|
38
|
+
<!-- /wp:social-links -->
|
|
39
|
+
|
|
40
|
+
<!-- wp:paragraph -->
|
|
41
|
+
<p></p>
|
|
42
|
+
<!-- /wp:paragraph -->"
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`Social links block shows the social links bottom sheet when tapping on the inline appender 1`] = `
|
|
46
|
+
"<!-- wp:social-links -->
|
|
47
|
+
<ul class=\\"wp-block-social-links\\"><!-- wp:social-link {\\"url\\":\\"https://wordpress.org\\",\\"service\\":\\"wordpress\\"} /-->
|
|
48
|
+
|
|
49
|
+
<!-- wp:social-link {\\"service\\":\\"facebook\\"} /-->
|
|
50
|
+
|
|
51
|
+
<!-- wp:social-link {\\"service\\":\\"twitter\\"} /-->
|
|
52
|
+
|
|
53
|
+
<!-- wp:social-link {\\"service\\":\\"instagram\\"} /-->
|
|
54
|
+
|
|
55
|
+
<!-- wp:social-link-amazon {\\"url\\":\\"\\"} /--></ul>
|
|
56
|
+
<!-- /wp:social-links -->"
|
|
57
|
+
`;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
fireEvent,
|
|
7
|
+
getEditorHtml,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
within,
|
|
10
|
+
getBlock,
|
|
11
|
+
waitFor,
|
|
12
|
+
} from 'test/helpers';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
18
|
+
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
19
|
+
|
|
20
|
+
beforeAll( () => {
|
|
21
|
+
// Register all core blocks
|
|
22
|
+
registerCoreBlocks();
|
|
23
|
+
} );
|
|
24
|
+
|
|
25
|
+
afterAll( () => {
|
|
26
|
+
// Clean up registered blocks
|
|
27
|
+
getBlockTypes().forEach( ( block ) => {
|
|
28
|
+
unregisterBlockType( block.name );
|
|
29
|
+
} );
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
describe( 'Social links block', () => {
|
|
33
|
+
it( 'inserts block with the default icons and the WordPress link set as active', async () => {
|
|
34
|
+
const screen = await initializeEditor();
|
|
35
|
+
|
|
36
|
+
// Add block
|
|
37
|
+
await addBlock( screen, 'Social Icons' );
|
|
38
|
+
|
|
39
|
+
// Get block
|
|
40
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
41
|
+
|
|
42
|
+
// Trigger inner blocks layout
|
|
43
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
44
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
45
|
+
);
|
|
46
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
47
|
+
nativeEvent: {
|
|
48
|
+
layout: {
|
|
49
|
+
width: 300,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
} );
|
|
53
|
+
|
|
54
|
+
// Check the WordPress icon has a URL set (active)
|
|
55
|
+
const firstLinkBlock = await getBlock( screen, 'Social Icon' );
|
|
56
|
+
fireEvent.press( firstLinkBlock );
|
|
57
|
+
const firstLink = within( socialLinksBlock ).getByAccessibilityHint(
|
|
58
|
+
/WordPress has URL set/
|
|
59
|
+
);
|
|
60
|
+
expect( firstLink ).toBeVisible();
|
|
61
|
+
|
|
62
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
it( 'shows active links correctly when not selected', async () => {
|
|
66
|
+
const screen = await initializeEditor();
|
|
67
|
+
|
|
68
|
+
// Add Social Icons block
|
|
69
|
+
await addBlock( screen, 'Social Icons' );
|
|
70
|
+
|
|
71
|
+
// Get block
|
|
72
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
73
|
+
|
|
74
|
+
// Trigger inner blocks layout
|
|
75
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
76
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
77
|
+
);
|
|
78
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
79
|
+
nativeEvent: {
|
|
80
|
+
layout: {
|
|
81
|
+
width: 300,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
} );
|
|
85
|
+
|
|
86
|
+
// Add Paragraph block
|
|
87
|
+
await addBlock( screen, 'Paragraph' );
|
|
88
|
+
|
|
89
|
+
// Check there's only one active social link
|
|
90
|
+
const socialLinks =
|
|
91
|
+
within( socialLinksBlock ).getAllByA11yLabel( / social icon/ );
|
|
92
|
+
expect( socialLinks.length ).toBe( 1 );
|
|
93
|
+
|
|
94
|
+
// Check the WordPress link is shown when unselected
|
|
95
|
+
const firstLinkBlock = await getBlock( screen, 'Social Icon' );
|
|
96
|
+
fireEvent.press( firstLinkBlock );
|
|
97
|
+
const firstLink = within( socialLinksBlock ).getByAccessibilityHint(
|
|
98
|
+
/WordPress has URL set/
|
|
99
|
+
);
|
|
100
|
+
expect( firstLink ).toBeVisible();
|
|
101
|
+
|
|
102
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
103
|
+
} );
|
|
104
|
+
|
|
105
|
+
it( 'shows the social links bottom sheet when tapping on the inline appender', async () => {
|
|
106
|
+
const screen = await initializeEditor();
|
|
107
|
+
const { getByTestId, getByText } = screen;
|
|
108
|
+
|
|
109
|
+
// Add block
|
|
110
|
+
await addBlock( screen, 'Social Icons' );
|
|
111
|
+
|
|
112
|
+
// Get block
|
|
113
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
114
|
+
fireEvent.press( socialLinksBlock );
|
|
115
|
+
|
|
116
|
+
// Trigger inner blocks layout
|
|
117
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
118
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
119
|
+
);
|
|
120
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
121
|
+
nativeEvent: {
|
|
122
|
+
layout: {
|
|
123
|
+
width: 300,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
} );
|
|
127
|
+
|
|
128
|
+
// Open the links bottom sheet
|
|
129
|
+
const appenderButton =
|
|
130
|
+
within( socialLinksBlock ).getByTestId( 'appender-button' );
|
|
131
|
+
fireEvent.press( appenderButton );
|
|
132
|
+
|
|
133
|
+
// Find a social link in the inserter
|
|
134
|
+
const blockList = getByTestId( 'InserterUI-Blocks' );
|
|
135
|
+
|
|
136
|
+
// onScroll event used to force the FlatList to render all items
|
|
137
|
+
fireEvent.scroll( blockList, {
|
|
138
|
+
nativeEvent: {
|
|
139
|
+
contentOffset: { y: 0, x: 0 },
|
|
140
|
+
contentSize: { width: 100, height: 100 },
|
|
141
|
+
layoutMeasurement: { width: 100, height: 100 },
|
|
142
|
+
},
|
|
143
|
+
} );
|
|
144
|
+
|
|
145
|
+
// Add the Amazon link
|
|
146
|
+
const amazonBlock = await waitFor( () => getByText( 'Amazon' ) );
|
|
147
|
+
expect( amazonBlock ).toBeVisible();
|
|
148
|
+
|
|
149
|
+
fireEvent.press( amazonBlock );
|
|
150
|
+
|
|
151
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
152
|
+
} );
|
|
153
|
+
|
|
154
|
+
it( 'shows the ghost placeholder when no icon is active', async () => {
|
|
155
|
+
const screen = await initializeEditor();
|
|
156
|
+
const { getByA11yLabel } = screen;
|
|
157
|
+
|
|
158
|
+
// Add block
|
|
159
|
+
await addBlock( screen, 'Social Icons' );
|
|
160
|
+
|
|
161
|
+
// Get block
|
|
162
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
163
|
+
|
|
164
|
+
// Trigger inner blocks layout
|
|
165
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
166
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
167
|
+
);
|
|
168
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
169
|
+
nativeEvent: {
|
|
170
|
+
layout: {
|
|
171
|
+
width: 300,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
} );
|
|
175
|
+
|
|
176
|
+
// Get the first social link
|
|
177
|
+
const firstLinkBlock = await getBlock( screen, 'Social Icon' );
|
|
178
|
+
fireEvent.press( firstLinkBlock );
|
|
179
|
+
|
|
180
|
+
// Open block actions menu
|
|
181
|
+
const blockActionsButton = getByA11yLabel( /Open Block Actions Menu/ );
|
|
182
|
+
fireEvent.press( blockActionsButton );
|
|
183
|
+
|
|
184
|
+
// Delete the social link
|
|
185
|
+
const deleteButton = getByA11yLabel( /Remove block/ );
|
|
186
|
+
fireEvent.press( deleteButton );
|
|
187
|
+
|
|
188
|
+
// Add Paragraph block
|
|
189
|
+
await addBlock( screen, 'Paragraph' );
|
|
190
|
+
|
|
191
|
+
// Check the ghost placeholders are visible
|
|
192
|
+
const socialLinks = within( socialLinksBlock ).getAllByTestId(
|
|
193
|
+
'social-links-placeholder'
|
|
194
|
+
);
|
|
195
|
+
expect( socialLinks.length ).toBe( 3 );
|
|
196
|
+
|
|
197
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
198
|
+
} );
|
|
199
|
+
} );
|
package/src/style.scss
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
@import "./post-date/style.scss";
|
|
31
31
|
@import "./post-excerpt/style.scss";
|
|
32
32
|
@import "./post-featured-image/style.scss";
|
|
33
|
+
@import "./post-navigation-link/style.scss";
|
|
33
34
|
@import "./post-terms/style.scss";
|
|
34
35
|
@import "./post-title/style.scss";
|
|
35
36
|
@import "./preformatted/style.scss";
|
package/src/tag-cloud/index.php
CHANGED
|
@@ -28,14 +28,7 @@ function render_block_core_tag_cloud( $attributes ) {
|
|
|
28
28
|
$tag_cloud = wp_tag_cloud( $args );
|
|
29
29
|
|
|
30
30
|
if ( ! $tag_cloud ) {
|
|
31
|
-
$
|
|
32
|
-
$tag_cloud = esc_html(
|
|
33
|
-
sprintf(
|
|
34
|
-
/* translators: %s: taxonomy name */
|
|
35
|
-
__( 'Your site doesn’t have any %s, so there’s nothing to display here at the moment.' ),
|
|
36
|
-
strtolower( $labels->name )
|
|
37
|
-
)
|
|
38
|
-
);
|
|
31
|
+
$tag_cloud = __( 'There’s no content to show here yet.' );
|
|
39
32
|
}
|
|
40
33
|
|
|
41
34
|
$wrapper_attributes = get_block_wrapper_attributes();
|