@wordpress/block-library 9.16.0 → 9.17.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 +2 -0
- package/build/archives/edit.js +2 -2
- package/build/archives/edit.js.map +1 -1
- package/build/categories/edit.js +115 -37
- package/build/categories/edit.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +6 -5
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-pagination/index.js +5 -0
- package/build/comments-pagination/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -9
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/edit.js +16 -2
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +9 -0
- package/build/details/index.js.map +1 -1
- package/build/details/save.js +2 -0
- package/build/details/save.js.map +1 -1
- package/build/embed/transforms.js +5 -2
- package/build/embed/transforms.js.map +1 -1
- package/build/form/variations.js +1 -1
- package/build/form/variations.js.map +1 -1
- package/build/group/edit.js +2 -9
- package/build/group/edit.js.map +1 -1
- package/build/home-link/edit.js +1 -2
- package/build/home-link/edit.js.map +1 -1
- package/build/latest-comments/edit.js +73 -26
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/constants.js +2 -1
- package/build/latest-posts/constants.js.map +1 -1
- package/build/latest-posts/edit.js +91 -38
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list-item/index.js +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build/navigation-link/edit.js +14 -19
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +7 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +4 -14
- package/build/paragraph/edit.js.map +1 -1
- package/build/pattern/index.js +1 -1
- package/build/post-content/index.js +1 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +0 -6
- package/build/post-featured-image/edit.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-terms/edit.js +1 -0
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +1 -1
- package/build/query/edit/query-content.js +2 -6
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query-no-results/index.js +1 -1
- package/build/query-pagination-numbers/edit.js +1 -1
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-title/edit.js +1 -0
- package/build/query-title/edit.js.map +1 -1
- package/build/read-more/edit.js +25 -7
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +67 -49
- package/build/search/edit.js.map +1 -1
- package/build/separator/edit.js +2 -4
- package/build/separator/edit.js.map +1 -1
- package/build/spacer/controls.js +13 -9
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/edit.js +23 -21
- package/build/spacer/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +2 -9
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/utils/messages.js +22 -0
- package/build/utils/messages.js.map +1 -0
- package/build/video/edit-common-settings.js +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build-module/archives/edit.js +2 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/categories/edit.js +116 -38
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +5 -4
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-pagination/index.js +5 -0
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -8
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/edit.js +17 -3
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +9 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/save.js +2 -0
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/transforms.js +5 -2
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/form/variations.js +1 -1
- package/build-module/form/variations.js.map +1 -1
- package/build-module/group/edit.js +1 -8
- package/build-module/group/edit.js.map +1 -1
- package/build-module/home-link/edit.js +1 -2
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/latest-comments/edit.js +74 -27
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/constants.js +1 -0
- package/build-module/latest-posts/constants.js.map +1 -1
- package/build-module/latest-posts/edit.js +93 -40
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list-item/index.js +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build-module/navigation-link/edit.js +15 -20
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +7 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +5 -15
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/pattern/index.js +1 -1
- package/build-module/post-content/index.js +1 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +0 -6
- package/build-module/post-featured-image/edit.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-terms/edit.js +1 -0
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +1 -1
- package/build-module/query/edit/query-content.js +1 -5
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query-no-results/index.js +1 -1
- package/build-module/query-pagination-numbers/edit.js +1 -1
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-title/edit.js +1 -0
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/read-more/edit.js +26 -8
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +68 -50
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/edit.js +1 -3
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/spacer/controls.js +13 -9
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/edit.js +24 -22
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -8
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/utils/messages.js +15 -0
- package/build-module/utils/messages.js.map +1 -0
- package/build-module/video/edit-common-settings.js +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-style/editor-rtl.css +8 -45
- package/build-style/editor.css +8 -45
- package/build-style/gallery/editor-rtl.css +0 -44
- package/build-style/gallery/editor.css +0 -44
- package/build-style/navigation-link/editor-rtl.css +3 -0
- package/build-style/navigation-link/editor.css +3 -0
- package/build-style/paragraph/editor-rtl.css +4 -0
- package/build-style/paragraph/editor.css +4 -0
- package/build-style/post-featured-image/editor-rtl.css +1 -1
- package/build-style/post-featured-image/editor.css +1 -1
- package/package.json +35 -35
- package/src/archives/edit.js +2 -2
- package/src/categories/edit.js +133 -45
- package/src/comments/edit/comments-inspector-controls.js +5 -8
- package/src/comments-pagination/block.json +5 -0
- package/src/cover/edit/inspector-controls.js +1 -21
- package/src/details/block.json +9 -0
- package/src/details/edit.js +18 -2
- package/src/details/save.js +6 -2
- package/src/embed/transforms.js +3 -1
- package/src/form/variations.js +1 -1
- package/src/gallery/editor.scss +0 -56
- package/src/group/edit.js +1 -20
- package/src/home-link/edit.js +0 -6
- package/src/latest-comments/edit.js +93 -33
- package/src/latest-posts/constants.js +1 -0
- package/src/latest-posts/edit.js +119 -44
- package/src/list/test/edit.native.js +9 -9
- package/src/list-item/block.json +1 -1
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/src/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/src/navigation-link/edit.js +25 -29
- package/src/navigation-link/editor.scss +27 -18
- package/src/navigation-submenu/index.js +7 -0
- package/src/navigation-submenu/index.php +21 -4
- package/src/page-list/edit.js +52 -50
- package/src/paragraph/edit.js +3 -18
- package/src/paragraph/editor.scss +7 -0
- package/src/pattern/block.json +1 -1
- package/src/post-content/block.json +1 -0
- package/src/post-date/edit.js +1 -3
- package/src/post-featured-image/edit.js +2 -15
- package/src/post-featured-image/editor.scss +2 -2
- package/src/post-navigation-link/variations.js +2 -2
- package/src/post-terms/edit.js +1 -0
- package/src/post-time-to-read/block.json +1 -1
- package/src/query/edit/query-content.js +1 -11
- package/src/query-no-results/block.json +1 -1
- package/src/query-pagination-numbers/edit.js +1 -1
- package/src/query-title/edit.js +1 -0
- package/src/read-more/edit.js +35 -11
- package/src/search/edit.js +99 -74
- package/src/separator/edit.js +1 -6
- package/src/spacer/controls.js +10 -9
- package/src/spacer/edit.js +25 -23
- package/src/template-part/edit/advanced-controls.js +1 -21
- package/src/utils/messages.js +31 -0
- package/src/video/edit-common-settings.js +1 -1
package/src/group/edit.js
CHANGED
|
@@ -18,6 +18,7 @@ import { View } from '@wordpress/primitives';
|
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
20
|
import GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';
|
|
21
|
+
import { htmlElementMessages } from '../utils/messages';
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Render inspector controls for the Group block.
|
|
@@ -29,26 +30,6 @@ import GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';
|
|
|
29
30
|
* @return {JSX.Element} The control group.
|
|
30
31
|
*/
|
|
31
32
|
function GroupEditControls( { tagName, onSelectTagName } ) {
|
|
32
|
-
const htmlElementMessages = {
|
|
33
|
-
header: __(
|
|
34
|
-
'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'
|
|
35
|
-
),
|
|
36
|
-
main: __(
|
|
37
|
-
'The <main> element should be used for the primary content of your document only.'
|
|
38
|
-
),
|
|
39
|
-
section: __(
|
|
40
|
-
"The <section> element should represent a standalone portion of the document that can't be better represented by another element."
|
|
41
|
-
),
|
|
42
|
-
article: __(
|
|
43
|
-
'The <article> element should represent a self-contained, syndicatable portion of the document.'
|
|
44
|
-
),
|
|
45
|
-
aside: __(
|
|
46
|
-
"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
|
|
47
|
-
),
|
|
48
|
-
footer: __(
|
|
49
|
-
'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'
|
|
50
|
-
),
|
|
51
|
-
};
|
|
52
33
|
return (
|
|
53
34
|
<InspectorControls group="advanced">
|
|
54
35
|
<SelectControl
|
package/src/home-link/edit.js
CHANGED
|
@@ -51,12 +51,6 @@ export default function HomeEdit( { attributes, setAttributes, context } ) {
|
|
|
51
51
|
aria-label={ __( 'Home link text' ) }
|
|
52
52
|
placeholder={ __( 'Add home link' ) }
|
|
53
53
|
withoutInteractiveFormatting
|
|
54
|
-
allowedFormats={ [
|
|
55
|
-
'core/bold',
|
|
56
|
-
'core/italic',
|
|
57
|
-
'core/image',
|
|
58
|
-
'core/strikethrough',
|
|
59
|
-
] }
|
|
60
54
|
/>
|
|
61
55
|
</a>
|
|
62
56
|
</div>
|
|
@@ -4,13 +4,19 @@
|
|
|
4
4
|
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
5
5
|
import {
|
|
6
6
|
Disabled,
|
|
7
|
-
PanelBody,
|
|
8
7
|
RangeControl,
|
|
9
8
|
ToggleControl,
|
|
9
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
10
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
10
11
|
} from '@wordpress/components';
|
|
11
12
|
import ServerSideRender from '@wordpress/server-side-render';
|
|
12
13
|
import { __ } from '@wordpress/i18n';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* Minimum number of comments a user can show using this block.
|
|
16
22
|
*
|
|
@@ -36,49 +42,103 @@ export default function LatestComments( { attributes, setAttributes } ) {
|
|
|
36
42
|
},
|
|
37
43
|
};
|
|
38
44
|
|
|
45
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
46
|
+
|
|
39
47
|
return (
|
|
40
48
|
<div { ...useBlockProps() }>
|
|
41
49
|
<InspectorControls>
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
<ToolsPanel
|
|
51
|
+
label={ __( 'Settings' ) }
|
|
52
|
+
resetAll={ () => {
|
|
53
|
+
setAttributes( {
|
|
54
|
+
commentsToShow: 5,
|
|
55
|
+
displayAvatar: true,
|
|
56
|
+
displayDate: true,
|
|
57
|
+
displayExcerpt: true,
|
|
58
|
+
} );
|
|
59
|
+
} }
|
|
60
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
61
|
+
>
|
|
62
|
+
<ToolsPanelItem
|
|
63
|
+
hasValue={ () => ! displayAvatar }
|
|
45
64
|
label={ __( 'Display avatar' ) }
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
setAttributes( { displayAvatar: ! displayAvatar } )
|
|
65
|
+
onDeselect={ () =>
|
|
66
|
+
setAttributes( { displayAvatar: true } )
|
|
49
67
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
isShownByDefault
|
|
69
|
+
>
|
|
70
|
+
<ToggleControl
|
|
71
|
+
__nextHasNoMarginBottom
|
|
72
|
+
label={ __( 'Display avatar' ) }
|
|
73
|
+
checked={ displayAvatar }
|
|
74
|
+
onChange={ () =>
|
|
75
|
+
setAttributes( {
|
|
76
|
+
displayAvatar: ! displayAvatar,
|
|
77
|
+
} )
|
|
78
|
+
}
|
|
79
|
+
/>
|
|
80
|
+
</ToolsPanelItem>
|
|
81
|
+
|
|
82
|
+
<ToolsPanelItem
|
|
83
|
+
hasValue={ () => ! displayDate }
|
|
53
84
|
label={ __( 'Display date' ) }
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setAttributes( { displayDate: ! displayDate } )
|
|
85
|
+
onDeselect={ () =>
|
|
86
|
+
setAttributes( { displayDate: true } )
|
|
57
87
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
isShownByDefault
|
|
89
|
+
>
|
|
90
|
+
<ToggleControl
|
|
91
|
+
__nextHasNoMarginBottom
|
|
92
|
+
label={ __( 'Display date' ) }
|
|
93
|
+
checked={ displayDate }
|
|
94
|
+
onChange={ () =>
|
|
95
|
+
setAttributes( { displayDate: ! displayDate } )
|
|
96
|
+
}
|
|
97
|
+
/>
|
|
98
|
+
</ToolsPanelItem>
|
|
99
|
+
|
|
100
|
+
<ToolsPanelItem
|
|
101
|
+
hasValue={ () => ! displayExcerpt }
|
|
61
102
|
label={ __( 'Display excerpt' ) }
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setAttributes( {
|
|
65
|
-
displayExcerpt: ! displayExcerpt,
|
|
66
|
-
} )
|
|
103
|
+
onDeselect={ () =>
|
|
104
|
+
setAttributes( { displayExcerpt: true } )
|
|
67
105
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
106
|
+
isShownByDefault
|
|
107
|
+
>
|
|
108
|
+
<ToggleControl
|
|
109
|
+
__nextHasNoMarginBottom
|
|
110
|
+
label={ __( 'Display excerpt' ) }
|
|
111
|
+
checked={ displayExcerpt }
|
|
112
|
+
onChange={ () =>
|
|
113
|
+
setAttributes( {
|
|
114
|
+
displayExcerpt: ! displayExcerpt,
|
|
115
|
+
} )
|
|
116
|
+
}
|
|
117
|
+
/>
|
|
118
|
+
</ToolsPanelItem>
|
|
119
|
+
|
|
120
|
+
<ToolsPanelItem
|
|
121
|
+
hasValue={ () => commentsToShow !== 5 }
|
|
72
122
|
label={ __( 'Number of comments' ) }
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
setAttributes( { commentsToShow: value } )
|
|
123
|
+
onDeselect={ () =>
|
|
124
|
+
setAttributes( { commentsToShow: 5 } )
|
|
76
125
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
126
|
+
isShownByDefault
|
|
127
|
+
>
|
|
128
|
+
<RangeControl
|
|
129
|
+
__nextHasNoMarginBottom
|
|
130
|
+
__next40pxDefaultSize
|
|
131
|
+
label={ __( 'Number of comments' ) }
|
|
132
|
+
value={ commentsToShow }
|
|
133
|
+
onChange={ ( value ) =>
|
|
134
|
+
setAttributes( { commentsToShow: value } )
|
|
135
|
+
}
|
|
136
|
+
min={ MIN_COMMENTS }
|
|
137
|
+
max={ MAX_COMMENTS }
|
|
138
|
+
required
|
|
139
|
+
/>
|
|
140
|
+
</ToolsPanelItem>
|
|
141
|
+
</ToolsPanel>
|
|
82
142
|
</InspectorControls>
|
|
83
143
|
<Disabled>
|
|
84
144
|
<ServerSideRender
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
ToolbarGroup,
|
|
18
18
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
19
19
|
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
|
|
20
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
21
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
20
22
|
} from '@wordpress/components';
|
|
21
23
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
22
24
|
import { dateI18n, format, getSettings } from '@wordpress/date';
|
|
@@ -49,7 +51,9 @@ import {
|
|
|
49
51
|
MIN_EXCERPT_LENGTH,
|
|
50
52
|
MAX_EXCERPT_LENGTH,
|
|
51
53
|
MAX_POSTS_COLUMNS,
|
|
54
|
+
DEFAULT_EXCERPT_LENGTH,
|
|
52
55
|
} from './constants';
|
|
56
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
53
57
|
|
|
54
58
|
/**
|
|
55
59
|
* Module Constants
|
|
@@ -77,6 +81,8 @@ function getFeaturedImageDetails( post, size ) {
|
|
|
77
81
|
|
|
78
82
|
export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
79
83
|
const instanceId = useInstanceId( LatestPostsEdit );
|
|
84
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
85
|
+
|
|
80
86
|
const {
|
|
81
87
|
postsToShow,
|
|
82
88
|
order,
|
|
@@ -227,68 +233,137 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
227
233
|
const hasPosts = !! latestPosts?.length;
|
|
228
234
|
const inspectorControls = (
|
|
229
235
|
<InspectorControls>
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
236
|
+
<ToolsPanel
|
|
237
|
+
label={ __( 'Post content' ) }
|
|
238
|
+
resetAll={ () =>
|
|
239
|
+
setAttributes( {
|
|
240
|
+
displayPostContent: false,
|
|
241
|
+
displayPostContentRadio: 'excerpt',
|
|
242
|
+
excerptLength: DEFAULT_EXCERPT_LENGTH,
|
|
243
|
+
} )
|
|
244
|
+
}
|
|
245
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
246
|
+
>
|
|
247
|
+
<ToolsPanelItem
|
|
248
|
+
hasValue={ () => !! displayPostContent }
|
|
233
249
|
label={ __( 'Post content' ) }
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
setAttributes( { displayPostContent: value } )
|
|
250
|
+
onDeselect={ () =>
|
|
251
|
+
setAttributes( { displayPostContent: false } )
|
|
237
252
|
}
|
|
238
|
-
|
|
253
|
+
isShownByDefault
|
|
254
|
+
>
|
|
255
|
+
<ToggleControl
|
|
256
|
+
__nextHasNoMarginBottom
|
|
257
|
+
label={ __( 'Post content' ) }
|
|
258
|
+
checked={ displayPostContent }
|
|
259
|
+
onChange={ ( value ) =>
|
|
260
|
+
setAttributes( { displayPostContent: value } )
|
|
261
|
+
}
|
|
262
|
+
/>
|
|
263
|
+
</ToolsPanelItem>
|
|
239
264
|
{ displayPostContent && (
|
|
240
|
-
<
|
|
265
|
+
<ToolsPanelItem
|
|
266
|
+
hasValue={ () => displayPostContentRadio !== 'excerpt' }
|
|
241
267
|
label={ __( 'Show' ) }
|
|
242
|
-
|
|
243
|
-
options={ [
|
|
244
|
-
{ label: __( 'Excerpt' ), value: 'excerpt' },
|
|
245
|
-
{
|
|
246
|
-
label: __( 'Full post' ),
|
|
247
|
-
value: 'full_post',
|
|
248
|
-
},
|
|
249
|
-
] }
|
|
250
|
-
onChange={ ( value ) =>
|
|
268
|
+
onDeselect={ () =>
|
|
251
269
|
setAttributes( {
|
|
252
|
-
displayPostContentRadio:
|
|
270
|
+
displayPostContentRadio: 'excerpt',
|
|
253
271
|
} )
|
|
254
272
|
}
|
|
255
|
-
|
|
273
|
+
isShownByDefault
|
|
274
|
+
>
|
|
275
|
+
<RadioControl
|
|
276
|
+
label={ __( 'Show' ) }
|
|
277
|
+
selected={ displayPostContentRadio }
|
|
278
|
+
options={ [
|
|
279
|
+
{ label: __( 'Excerpt' ), value: 'excerpt' },
|
|
280
|
+
{
|
|
281
|
+
label: __( 'Full post' ),
|
|
282
|
+
value: 'full_post',
|
|
283
|
+
},
|
|
284
|
+
] }
|
|
285
|
+
onChange={ ( value ) =>
|
|
286
|
+
setAttributes( {
|
|
287
|
+
displayPostContentRadio: value,
|
|
288
|
+
} )
|
|
289
|
+
}
|
|
290
|
+
/>
|
|
291
|
+
</ToolsPanelItem>
|
|
256
292
|
) }
|
|
257
293
|
{ displayPostContent &&
|
|
258
294
|
displayPostContentRadio === 'excerpt' && (
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
|
|
295
|
+
<ToolsPanelItem
|
|
296
|
+
hasValue={ () =>
|
|
297
|
+
excerptLength !== DEFAULT_EXCERPT_LENGTH
|
|
298
|
+
}
|
|
262
299
|
label={ __( 'Max number of words' ) }
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
300
|
+
onDeselect={ () =>
|
|
301
|
+
setAttributes( {
|
|
302
|
+
excerptLength: DEFAULT_EXCERPT_LENGTH,
|
|
303
|
+
} )
|
|
266
304
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
305
|
+
isShownByDefault
|
|
306
|
+
>
|
|
307
|
+
<RangeControl
|
|
308
|
+
__nextHasNoMarginBottom
|
|
309
|
+
__next40pxDefaultSize
|
|
310
|
+
label={ __( 'Max number of words' ) }
|
|
311
|
+
value={ excerptLength }
|
|
312
|
+
onChange={ ( value ) =>
|
|
313
|
+
setAttributes( { excerptLength: value } )
|
|
314
|
+
}
|
|
315
|
+
min={ MIN_EXCERPT_LENGTH }
|
|
316
|
+
max={ MAX_EXCERPT_LENGTH }
|
|
317
|
+
/>
|
|
318
|
+
</ToolsPanelItem>
|
|
270
319
|
) }
|
|
271
|
-
</
|
|
320
|
+
</ToolsPanel>
|
|
272
321
|
|
|
273
|
-
<
|
|
274
|
-
|
|
275
|
-
|
|
322
|
+
<ToolsPanel
|
|
323
|
+
label={ __( 'Post meta' ) }
|
|
324
|
+
resetAll={ () =>
|
|
325
|
+
setAttributes( {
|
|
326
|
+
displayAuthor: false,
|
|
327
|
+
displayPostDate: false,
|
|
328
|
+
} )
|
|
329
|
+
}
|
|
330
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
331
|
+
>
|
|
332
|
+
<ToolsPanelItem
|
|
333
|
+
hasValue={ () => !! displayAuthor }
|
|
276
334
|
label={ __( 'Display author name' ) }
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
setAttributes( { displayAuthor: value } )
|
|
335
|
+
onDeselect={ () =>
|
|
336
|
+
setAttributes( { displayAuthor: false } )
|
|
280
337
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
338
|
+
isShownByDefault
|
|
339
|
+
>
|
|
340
|
+
<ToggleControl
|
|
341
|
+
__nextHasNoMarginBottom
|
|
342
|
+
label={ __( 'Display author name' ) }
|
|
343
|
+
checked={ displayAuthor }
|
|
344
|
+
onChange={ ( value ) =>
|
|
345
|
+
setAttributes( { displayAuthor: value } )
|
|
346
|
+
}
|
|
347
|
+
/>
|
|
348
|
+
</ToolsPanelItem>
|
|
349
|
+
<ToolsPanelItem
|
|
350
|
+
hasValue={ () => !! displayPostDate }
|
|
284
351
|
label={ __( 'Display post date' ) }
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
setAttributes( { displayPostDate: value } )
|
|
352
|
+
onDeselect={ () =>
|
|
353
|
+
setAttributes( { displayPostDate: false } )
|
|
288
354
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
355
|
+
isShownByDefault
|
|
356
|
+
>
|
|
357
|
+
<ToggleControl
|
|
358
|
+
__nextHasNoMarginBottom
|
|
359
|
+
label={ __( 'Display post date' ) }
|
|
360
|
+
checked={ displayPostDate }
|
|
361
|
+
onChange={ ( value ) =>
|
|
362
|
+
setAttributes( { displayPostDate: value } )
|
|
363
|
+
}
|
|
364
|
+
/>
|
|
365
|
+
</ToolsPanelItem>
|
|
366
|
+
</ToolsPanel>
|
|
292
367
|
<PanelBody title={ __( 'Featured image' ) }>
|
|
293
368
|
<ToggleControl
|
|
294
369
|
__nextHasNoMarginBottom
|
|
@@ -50,7 +50,7 @@ describe( 'List block', () => {
|
|
|
50
50
|
await triggerBlockListLayout( listBlock );
|
|
51
51
|
|
|
52
52
|
// Get List item
|
|
53
|
-
const listItemBlock = await getBlock( screen, 'List
|
|
53
|
+
const listItemBlock = await getBlock( screen, 'List Item' );
|
|
54
54
|
fireEvent.press( listItemBlock );
|
|
55
55
|
|
|
56
56
|
expect( listItemBlock ).toBeVisible();
|
|
@@ -75,7 +75,7 @@ describe( 'List block', () => {
|
|
|
75
75
|
|
|
76
76
|
// Select List Item block
|
|
77
77
|
const [ listItemBlock ] = screen.getAllByLabelText(
|
|
78
|
-
/List
|
|
78
|
+
/List Item Block\. Row 1/
|
|
79
79
|
);
|
|
80
80
|
fireEvent.press( listItemBlock );
|
|
81
81
|
|
|
@@ -124,7 +124,7 @@ describe( 'List block', () => {
|
|
|
124
124
|
|
|
125
125
|
// Select List Item block
|
|
126
126
|
const [ firstNestedLevelBlock ] = within( listBlock ).getAllByLabelText(
|
|
127
|
-
/List
|
|
127
|
+
/List Item Block\. Row 2/
|
|
128
128
|
);
|
|
129
129
|
fireEvent.press( firstNestedLevelBlock );
|
|
130
130
|
await triggerBlockListLayout( firstNestedLevelBlock );
|
|
@@ -159,7 +159,7 @@ describe( 'List block', () => {
|
|
|
159
159
|
|
|
160
160
|
// Select Second List Item block
|
|
161
161
|
const [ listItemBlock ] = screen.getAllByLabelText(
|
|
162
|
-
/List
|
|
162
|
+
/List Item Block\. Row 2/
|
|
163
163
|
);
|
|
164
164
|
fireEvent.press( listItemBlock );
|
|
165
165
|
|
|
@@ -169,7 +169,7 @@ describe( 'List block', () => {
|
|
|
169
169
|
|
|
170
170
|
// Await recently indented list item layout
|
|
171
171
|
const [ listItemBlock1 ] = screen.getAllByLabelText(
|
|
172
|
-
/List
|
|
172
|
+
/List Item Block\. Row 1/
|
|
173
173
|
);
|
|
174
174
|
await triggerBlockListLayout( listItemBlock1 );
|
|
175
175
|
|
|
@@ -203,7 +203,7 @@ describe( 'List block', () => {
|
|
|
203
203
|
|
|
204
204
|
// Select List Item block
|
|
205
205
|
const [ firstNestedLevelBlock ] = within( listBlock ).getAllByLabelText(
|
|
206
|
-
/List
|
|
206
|
+
/List Item Block\. Row 1/
|
|
207
207
|
);
|
|
208
208
|
fireEvent.press( firstNestedLevelBlock );
|
|
209
209
|
await triggerBlockListLayout( firstNestedLevelBlock );
|
|
@@ -217,7 +217,7 @@ describe( 'List block', () => {
|
|
|
217
217
|
|
|
218
218
|
// Select nested List Item block
|
|
219
219
|
const [ listItemBlock ] = within( innerBlockList ).getAllByLabelText(
|
|
220
|
-
/List
|
|
220
|
+
/List Item Block\. Row 1/
|
|
221
221
|
);
|
|
222
222
|
fireEvent.press( listItemBlock );
|
|
223
223
|
|
|
@@ -500,7 +500,7 @@ describe( 'List block', () => {
|
|
|
500
500
|
|
|
501
501
|
// Select List Item block
|
|
502
502
|
const [ listItemBlock ] = within( listBlock ).getAllByLabelText(
|
|
503
|
-
/List
|
|
503
|
+
/List Item Block\. Row 1/
|
|
504
504
|
);
|
|
505
505
|
fireEvent.press( listItemBlock );
|
|
506
506
|
|
|
@@ -560,7 +560,7 @@ describe( 'List block', () => {
|
|
|
560
560
|
|
|
561
561
|
// Select List Item block
|
|
562
562
|
const [ listItemBlock ] = within( listBlock ).getAllByLabelText(
|
|
563
|
-
/List
|
|
563
|
+
/List Item Block\. Row 1/
|
|
564
564
|
);
|
|
565
565
|
fireEvent.press( listItemBlock );
|
|
566
566
|
|
package/src/list-item/block.json
CHANGED
|
@@ -47,7 +47,7 @@ function useConvertClassicToBlockMenu(
|
|
|
47
47
|
} catch ( err ) {
|
|
48
48
|
throw new Error(
|
|
49
49
|
sprintf(
|
|
50
|
-
// translators: %s:
|
|
50
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
51
51
|
__( `Unable to fetch classic menu "%s" from API.` ),
|
|
52
52
|
menuName
|
|
53
53
|
),
|
|
@@ -61,7 +61,7 @@ function useConvertClassicToBlockMenu(
|
|
|
61
61
|
if ( classicMenuItems === null ) {
|
|
62
62
|
throw new Error(
|
|
63
63
|
sprintf(
|
|
64
|
-
// translators: %s:
|
|
64
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
65
65
|
__( `Unable to fetch classic menu "%s" from API.` ),
|
|
66
66
|
menuName
|
|
67
67
|
)
|
|
@@ -98,7 +98,7 @@ function useConvertClassicToBlockMenu(
|
|
|
98
98
|
} catch ( err ) {
|
|
99
99
|
throw new Error(
|
|
100
100
|
sprintf(
|
|
101
|
-
// translators: %s:
|
|
101
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
102
102
|
__( `Unable to create Navigation Menu "%s".` ),
|
|
103
103
|
menuName
|
|
104
104
|
),
|
|
@@ -155,7 +155,7 @@ function useConvertClassicToBlockMenu(
|
|
|
155
155
|
if ( throwOnError ) {
|
|
156
156
|
throw new Error(
|
|
157
157
|
sprintf(
|
|
158
|
-
// translators: %s:
|
|
158
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
159
159
|
__( `Unable to create Navigation Menu "%s".` ),
|
|
160
160
|
menuName
|
|
161
161
|
),
|
|
@@ -50,12 +50,12 @@ export default function useGenerateDefaultNavigationTitle( clientId ) {
|
|
|
50
50
|
|
|
51
51
|
const title = area
|
|
52
52
|
? sprintf(
|
|
53
|
-
// translators: %s: the name of a menu (e.g. Header
|
|
54
|
-
__( '%s
|
|
53
|
+
// translators: %s: the name of a menu (e.g. Header menu).
|
|
54
|
+
__( '%s menu' ),
|
|
55
55
|
area
|
|
56
56
|
)
|
|
57
|
-
: // translators: '
|
|
58
|
-
__( '
|
|
57
|
+
: // translators: 'menu' as in website navigation menu.
|
|
58
|
+
__( 'Menu' );
|
|
59
59
|
|
|
60
60
|
// Determine how many menus start with the automatic title.
|
|
61
61
|
const matchingMenuTitleCount = [
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
TextControl,
|
|
15
15
|
TextareaControl,
|
|
16
16
|
ToolbarButton,
|
|
17
|
-
Tooltip,
|
|
18
17
|
ToolbarGroup,
|
|
19
18
|
} from '@wordpress/components';
|
|
20
19
|
import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
|
|
@@ -490,10 +489,6 @@ export default function NavigationLinkEdit( {
|
|
|
490
489
|
const placeholderText = `(${
|
|
491
490
|
isInvalid ? __( 'Invalid' ) : __( 'Draft' )
|
|
492
491
|
})`;
|
|
493
|
-
const tooltipText =
|
|
494
|
-
isInvalid || isDraft
|
|
495
|
-
? __( 'This item has been deleted, or is a draft' )
|
|
496
|
-
: __( 'This item is missing a link' );
|
|
497
492
|
|
|
498
493
|
return (
|
|
499
494
|
<>
|
|
@@ -533,9 +528,7 @@ export default function NavigationLinkEdit( {
|
|
|
533
528
|
{ /* eslint-enable */ }
|
|
534
529
|
{ ! url ? (
|
|
535
530
|
<div className="wp-block-navigation-link__placeholder-text">
|
|
536
|
-
<
|
|
537
|
-
<span>{ missingText }</span>
|
|
538
|
-
</Tooltip>
|
|
531
|
+
<span>{ missingText }</span>
|
|
539
532
|
</div>
|
|
540
533
|
) : (
|
|
541
534
|
<>
|
|
@@ -578,27 +571,30 @@ export default function NavigationLinkEdit( {
|
|
|
578
571
|
{ ( isInvalid ||
|
|
579
572
|
isDraft ||
|
|
580
573
|
isLabelFieldFocused ) && (
|
|
581
|
-
<div
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
574
|
+
<div
|
|
575
|
+
className={ clsx(
|
|
576
|
+
'wp-block-navigation-link__placeholder-text',
|
|
577
|
+
'wp-block-navigation-link__label',
|
|
578
|
+
{
|
|
579
|
+
'is-invalid': isInvalid,
|
|
580
|
+
'is-draft': isDraft,
|
|
581
|
+
}
|
|
582
|
+
) }
|
|
583
|
+
>
|
|
584
|
+
<span>
|
|
585
|
+
{
|
|
586
|
+
// Some attributes are stored in an escaped form. It's a legacy issue.
|
|
587
|
+
// Ideally they would be stored in a raw, unescaped form.
|
|
588
|
+
// Unescape is used here to "recover" the escaped characters
|
|
589
|
+
// so they display without encoding.
|
|
590
|
+
// See `updateAttributes` for more details.
|
|
591
|
+
`${ decodeEntities( label ) } ${
|
|
592
|
+
isInvalid || isDraft
|
|
593
|
+
? placeholderText
|
|
594
|
+
: ''
|
|
595
|
+
}`.trim()
|
|
596
|
+
}
|
|
597
|
+
</span>
|
|
602
598
|
</div>
|
|
603
599
|
) }
|
|
604
600
|
</>
|