@wordpress/block-library 9.25.0 → 9.26.1-next.719a03cbe.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/avatar/edit.js +84 -39
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/user-control.js +32 -17
- package/build/avatar/user-control.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -2
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/index.js +1 -1
- package/build/details/index.js.map +1 -1
- package/build/embed/variations.js +0 -10
- package/build/embed/variations.js.map +1 -1
- package/build/form/edit.js +0 -1
- package/build/form/edit.js.map +1 -1
- package/build/form/index.js +3 -3
- package/build/form/index.js.map +1 -1
- package/build/form-input/index.js +2 -1
- package/build/form-input/index.js.map +1 -1
- package/build/form-submission-notification/index.js +2 -1
- package/build/form-submission-notification/index.js.map +1 -1
- package/build/form-submit-button/index.js +2 -1
- package/build/form-submit-button/index.js.map +1 -1
- package/build/gallery/constants.js +2 -1
- package/build/gallery/constants.js.map +1 -1
- package/build/gallery/edit.js +93 -15
- package/build/gallery/edit.js.map +1 -1
- package/build/image/edit.js +6 -0
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +1 -0
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +0 -3
- package/build/image/view.js.map +1 -1
- package/build/list/index.js +0 -1
- package/build/list/index.js.map +1 -1
- package/build/more/edit.native.js +17 -32
- package/build/more/edit.native.js.map +1 -1
- package/build/navigation-link/edit.js +28 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-author/edit.js +152 -52
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js +72 -33
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +69 -24
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-link/edit.js +21 -5
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/edit.native.js +13 -5
- package/build/social-link/edit.native.js.map +1 -1
- package/build/social-link/social-list.js +17 -25
- package/build/social-link/social-list.js.map +1 -1
- package/build/social-links/edit.js +8 -5
- package/build/social-links/edit.js.map +1 -1
- package/build/video/tracks-editor.js +23 -9
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/avatar/edit.js +83 -38
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/user-control.js +33 -18
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -2
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/index.js +1 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/embed/variations.js +0 -10
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/form/edit.js +0 -1
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form/index.js +3 -3
- package/build-module/form/index.js.map +1 -1
- package/build-module/form-input/index.js +2 -1
- package/build-module/form-input/index.js.map +1 -1
- package/build-module/form-submission-notification/index.js +2 -1
- package/build-module/form-submission-notification/index.js.map +1 -1
- package/build-module/form-submit-button/index.js +2 -1
- package/build-module/form-submit-button/index.js.map +1 -1
- package/build-module/gallery/constants.js +1 -0
- package/build-module/gallery/constants.js.map +1 -1
- package/build-module/gallery/edit.js +95 -17
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/image/edit.js +6 -0
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +1 -0
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +0 -3
- package/build-module/image/view.js.map +1 -1
- package/build-module/list/index.js +0 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/more/edit.native.js +16 -30
- package/build-module/more/edit.native.js.map +1 -1
- package/build-module/navigation-link/edit.js +29 -2
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-author/edit.js +153 -53
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +1 -1
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +73 -34
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/search/edit.js +1 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +70 -25
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-link/edit.js +24 -8
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +15 -6
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/social-link/social-list.js +16 -21
- package/build-module/social-link/social-list.js.map +1 -1
- package/build-module/social-links/edit.js +8 -5
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +24 -10
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/calendar/style-rtl.css +7 -7
- package/build-style/calendar/style.css +7 -7
- package/build-style/comments-pagination/editor-rtl.css +0 -12
- package/build-style/comments-pagination/editor.css +0 -14
- package/build-style/comments-pagination/style-rtl.css +0 -7
- package/build-style/comments-pagination/style.css +0 -9
- package/build-style/editor-rtl.css +0 -30
- package/build-style/editor.css +0 -32
- package/build-style/gallery/editor-rtl.css +0 -13
- package/build-style/gallery/editor.css +0 -13
- package/build-style/navigation/style-rtl.css +5 -0
- package/build-style/navigation/style.css +5 -0
- package/build-style/style-rtl.css +12 -14
- package/build-style/style.css +12 -16
- package/package.json +35 -35
- package/src/avatar/edit.js +99 -51
- package/src/avatar/user-control.js +34 -29
- package/src/button/edit.js +1 -1
- package/src/calendar/style.scss +10 -10
- package/src/comments-pagination/editor.scss +0 -15
- package/src/comments-pagination/style.scss +0 -8
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/details/index.js +1 -1
- package/src/editor.scss +0 -1
- package/src/embed/variations.js +0 -8
- package/src/form/block.json +1 -2
- package/src/form/edit.js +0 -1
- package/src/form/index.js +1 -0
- package/src/form-input/index.js +1 -0
- package/src/form-submission-notification/index.js +1 -0
- package/src/form-submit-button/index.js +1 -0
- package/src/gallery/constants.js +1 -0
- package/src/gallery/edit.js +182 -68
- package/src/gallery/editor.scss +0 -17
- package/src/image/edit.js +12 -0
- package/src/image/image.js +1 -0
- package/src/image/index.php +4 -1
- package/src/image/view.js +0 -3
- package/src/list/block.json +0 -1
- package/src/more/edit.native.js +19 -33
- package/src/navigation/style.scss +9 -0
- package/src/navigation-link/edit.js +32 -2
- package/src/post-author/edit.js +178 -63
- package/src/post-comments-form/form.js +1 -1
- package/src/post-featured-image/edit.js +1 -0
- package/src/post-navigation-link/edit.js +96 -51
- package/src/rss/index.php +2 -1
- package/src/search/edit.js +1 -1
- package/src/site-logo/edit.js +90 -35
- package/src/social-link/edit.js +18 -7
- package/src/social-link/edit.native.js +10 -4
- package/src/social-link/index.php +13 -0
- package/src/social-link/social-list.js +15 -20
- package/src/social-links/edit.js +6 -7
- package/src/video/tracks-editor.js +18 -6
- package/build-style/post-author/editor-rtl.css +0 -140
- package/build-style/post-author/editor.css +0 -140
- package/src/post-author/editor.scss +0 -7
package/src/post-author/edit.js
CHANGED
|
@@ -15,22 +15,98 @@ import {
|
|
|
15
15
|
} from '@wordpress/block-editor';
|
|
16
16
|
import {
|
|
17
17
|
ComboboxControl,
|
|
18
|
-
PanelBody,
|
|
19
18
|
SelectControl,
|
|
20
19
|
ToggleControl,
|
|
21
|
-
|
|
20
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
21
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
22
22
|
} from '@wordpress/components';
|
|
23
|
+
import { debounce } from '@wordpress/compose';
|
|
24
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
23
25
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
24
26
|
import { __, sprintf } from '@wordpress/i18n';
|
|
27
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
25
28
|
import { store as coreStore } from '@wordpress/core-data';
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Internal dependencies
|
|
32
|
+
*/
|
|
33
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
28
34
|
|
|
29
35
|
const AUTHORS_QUERY = {
|
|
30
36
|
who: 'authors',
|
|
31
37
|
per_page: 100,
|
|
38
|
+
_fields: 'id,name',
|
|
39
|
+
context: 'view',
|
|
32
40
|
};
|
|
33
41
|
|
|
42
|
+
function AuthorCombobox( { value, onChange } ) {
|
|
43
|
+
const [ filterValue, setFilterValue ] = useState( '' );
|
|
44
|
+
const { authors, isLoading } = useSelect(
|
|
45
|
+
( select ) => {
|
|
46
|
+
const { getUsers, isResolving } = select( coreStore );
|
|
47
|
+
|
|
48
|
+
const query = { ...AUTHORS_QUERY };
|
|
49
|
+
if ( filterValue ) {
|
|
50
|
+
query.search = filterValue;
|
|
51
|
+
query.search_columns = [ 'name' ];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
authors: getUsers( query ),
|
|
56
|
+
isLoading: isResolving( 'getUsers', [ query ] ),
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
[ filterValue ]
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const authorOptions = useMemo( () => {
|
|
63
|
+
const fetchedAuthors = ( authors ?? [] ).map( ( author ) => {
|
|
64
|
+
return {
|
|
65
|
+
value: author.id,
|
|
66
|
+
label: decodeEntities( author.name ),
|
|
67
|
+
};
|
|
68
|
+
} );
|
|
69
|
+
|
|
70
|
+
// Ensure the current author is included in the list.
|
|
71
|
+
const foundAuthor = fetchedAuthors.findIndex(
|
|
72
|
+
( fetchedAuthor ) => value?.id === fetchedAuthor.value
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
let currentAuthor = [];
|
|
76
|
+
if ( foundAuthor < 0 && value ) {
|
|
77
|
+
currentAuthor = [
|
|
78
|
+
{
|
|
79
|
+
value: value.id,
|
|
80
|
+
label: decodeEntities( value.name ),
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
} else if ( foundAuthor < 0 && ! value ) {
|
|
84
|
+
currentAuthor = [
|
|
85
|
+
{
|
|
86
|
+
value: 0,
|
|
87
|
+
label: __( '(No author)' ),
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return [ ...currentAuthor, ...fetchedAuthors ];
|
|
93
|
+
}, [ authors, value ] );
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<ComboboxControl
|
|
97
|
+
__next40pxDefaultSize
|
|
98
|
+
__nextHasNoMarginBottom
|
|
99
|
+
label={ __( 'Author' ) }
|
|
100
|
+
options={ authorOptions }
|
|
101
|
+
value={ value?.id }
|
|
102
|
+
onFilterValueChange={ debounce( setFilterValue, 300 ) }
|
|
103
|
+
onChange={ onChange }
|
|
104
|
+
allowReset={ false }
|
|
105
|
+
isLoading={ isLoading }
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
34
110
|
function PostAuthorEdit( {
|
|
35
111
|
isSelected,
|
|
36
112
|
context: { postType, postId, queryId },
|
|
@@ -38,22 +114,30 @@ function PostAuthorEdit( {
|
|
|
38
114
|
setAttributes,
|
|
39
115
|
} ) {
|
|
40
116
|
const isDescendentOfQueryLoop = Number.isFinite( queryId );
|
|
41
|
-
const
|
|
117
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
118
|
+
|
|
119
|
+
const { authorDetails, canAssignAuthor, supportsAuthor } = useSelect(
|
|
42
120
|
( select ) => {
|
|
43
|
-
const { getEditedEntityRecord, getUser,
|
|
121
|
+
const { getEditedEntityRecord, getUser, getPostType } =
|
|
44
122
|
select( coreStore );
|
|
45
|
-
const
|
|
123
|
+
const currentPost = getEditedEntityRecord(
|
|
46
124
|
'postType',
|
|
47
125
|
postType,
|
|
48
126
|
postId
|
|
49
|
-
)
|
|
127
|
+
);
|
|
128
|
+
const authorId = currentPost?.author;
|
|
50
129
|
|
|
51
130
|
return {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
131
|
+
authorDetails: authorId
|
|
132
|
+
? getUser( authorId, { context: 'view' } )
|
|
133
|
+
: null,
|
|
55
134
|
supportsAuthor:
|
|
56
135
|
getPostType( postType )?.supports?.author ?? false,
|
|
136
|
+
canAssignAuthor: currentPost?._links?.[
|
|
137
|
+
'wp:action-assign-author'
|
|
138
|
+
]
|
|
139
|
+
? true
|
|
140
|
+
: false,
|
|
57
141
|
};
|
|
58
142
|
},
|
|
59
143
|
[ postType, postId ]
|
|
@@ -61,8 +145,15 @@ function PostAuthorEdit( {
|
|
|
61
145
|
|
|
62
146
|
const { editEntityRecord } = useDispatch( coreStore );
|
|
63
147
|
|
|
64
|
-
const {
|
|
65
|
-
|
|
148
|
+
const {
|
|
149
|
+
textAlign,
|
|
150
|
+
showAvatar,
|
|
151
|
+
showBio,
|
|
152
|
+
byline,
|
|
153
|
+
isLink,
|
|
154
|
+
linkTarget,
|
|
155
|
+
avatarSize,
|
|
156
|
+
} = attributes;
|
|
66
157
|
const avatarSizes = [];
|
|
67
158
|
const authorName = authorDetails?.name || __( 'Post Author' );
|
|
68
159
|
if ( authorDetails?.avatar_urls ) {
|
|
@@ -80,24 +171,14 @@ function PostAuthorEdit( {
|
|
|
80
171
|
} ),
|
|
81
172
|
} );
|
|
82
173
|
|
|
83
|
-
const authorOptions = authors?.length
|
|
84
|
-
? authors.map( ( { id, name } ) => {
|
|
85
|
-
return {
|
|
86
|
-
value: id,
|
|
87
|
-
label: name,
|
|
88
|
-
};
|
|
89
|
-
} )
|
|
90
|
-
: [];
|
|
91
|
-
|
|
92
174
|
const handleSelect = ( nextAuthorId ) => {
|
|
93
175
|
editEntityRecord( 'postType', postType, postId, {
|
|
94
176
|
author: nextAuthorId,
|
|
95
177
|
} );
|
|
96
178
|
};
|
|
97
179
|
|
|
98
|
-
const showCombobox = authorOptions.length >= minimumUsersForCombobox;
|
|
99
180
|
const showAuthorControl =
|
|
100
|
-
!! postId && ! isDescendentOfQueryLoop &&
|
|
181
|
+
!! postId && ! isDescendentOfQueryLoop && canAssignAuthor;
|
|
101
182
|
|
|
102
183
|
if ( ! supportsAuthor && postType !== undefined ) {
|
|
103
184
|
return (
|
|
@@ -114,46 +195,59 @@ function PostAuthorEdit( {
|
|
|
114
195
|
return (
|
|
115
196
|
<>
|
|
116
197
|
<InspectorControls>
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
198
|
+
<ToolsPanel
|
|
199
|
+
label={ __( 'Settings' ) }
|
|
200
|
+
resetAll={ () => {
|
|
201
|
+
setAttributes( {
|
|
202
|
+
avatarSize: 48,
|
|
203
|
+
showAvatar: true,
|
|
204
|
+
isLink: false,
|
|
205
|
+
linkTarget: '_self',
|
|
206
|
+
} );
|
|
207
|
+
} }
|
|
208
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
209
|
+
>
|
|
210
|
+
{ showAuthorControl && (
|
|
211
|
+
<div style={ { gridColumn: '1 / -1' } }>
|
|
212
|
+
<AuthorCombobox
|
|
213
|
+
value={ authorDetails }
|
|
214
|
+
onChange={ handleSelect }
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
) }
|
|
218
|
+
<ToolsPanelItem
|
|
219
|
+
label={ __( 'Show avatar' ) }
|
|
220
|
+
isShownByDefault
|
|
221
|
+
hasValue={ () => ! showAvatar }
|
|
222
|
+
onDeselect={ () =>
|
|
223
|
+
setAttributes( { showAvatar: true } )
|
|
224
|
+
}
|
|
121
225
|
>
|
|
122
|
-
{ showAuthorControl &&
|
|
123
|
-
( ( showCombobox && (
|
|
124
|
-
<ComboboxControl
|
|
125
|
-
__next40pxDefaultSize
|
|
126
|
-
__nextHasNoMarginBottom
|
|
127
|
-
label={ __( 'Author' ) }
|
|
128
|
-
options={ authorOptions }
|
|
129
|
-
value={ authorId }
|
|
130
|
-
onChange={ handleSelect }
|
|
131
|
-
allowReset={ false }
|
|
132
|
-
/>
|
|
133
|
-
) ) || (
|
|
134
|
-
<SelectControl
|
|
135
|
-
__next40pxDefaultSize
|
|
136
|
-
__nextHasNoMarginBottom
|
|
137
|
-
label={ __( 'Author' ) }
|
|
138
|
-
value={ authorId }
|
|
139
|
-
options={ authorOptions }
|
|
140
|
-
onChange={ handleSelect }
|
|
141
|
-
/>
|
|
142
|
-
) ) }
|
|
143
226
|
<ToggleControl
|
|
144
227
|
__nextHasNoMarginBottom
|
|
145
228
|
label={ __( 'Show avatar' ) }
|
|
146
229
|
checked={ showAvatar }
|
|
147
230
|
onChange={ () =>
|
|
148
|
-
setAttributes( {
|
|
231
|
+
setAttributes( {
|
|
232
|
+
showAvatar: ! showAvatar,
|
|
233
|
+
} )
|
|
149
234
|
}
|
|
150
235
|
/>
|
|
151
|
-
|
|
236
|
+
</ToolsPanelItem>
|
|
237
|
+
{ showAvatar && (
|
|
238
|
+
<ToolsPanelItem
|
|
239
|
+
label={ __( 'Avatar size' ) }
|
|
240
|
+
isShownByDefault
|
|
241
|
+
hasValue={ () => avatarSize !== 48 }
|
|
242
|
+
onDeselect={ () =>
|
|
243
|
+
setAttributes( { avatarSize: 48 } )
|
|
244
|
+
}
|
|
245
|
+
>
|
|
152
246
|
<SelectControl
|
|
153
247
|
__next40pxDefaultSize
|
|
154
248
|
__nextHasNoMarginBottom
|
|
155
249
|
label={ __( 'Avatar size' ) }
|
|
156
|
-
value={
|
|
250
|
+
value={ avatarSize }
|
|
157
251
|
options={ avatarSizes }
|
|
158
252
|
onChange={ ( size ) => {
|
|
159
253
|
setAttributes( {
|
|
@@ -161,15 +255,31 @@ function PostAuthorEdit( {
|
|
|
161
255
|
} );
|
|
162
256
|
} }
|
|
163
257
|
/>
|
|
164
|
-
|
|
258
|
+
</ToolsPanelItem>
|
|
259
|
+
) }
|
|
260
|
+
<ToolsPanelItem
|
|
261
|
+
label={ __( 'Show bio' ) }
|
|
262
|
+
isShownByDefault
|
|
263
|
+
hasValue={ () => !! showBio }
|
|
264
|
+
onDeselect={ () =>
|
|
265
|
+
setAttributes( { showBio: undefined } )
|
|
266
|
+
}
|
|
267
|
+
>
|
|
165
268
|
<ToggleControl
|
|
166
269
|
__nextHasNoMarginBottom
|
|
167
270
|
label={ __( 'Show bio' ) }
|
|
168
|
-
checked={ showBio }
|
|
271
|
+
checked={ !! showBio }
|
|
169
272
|
onChange={ () =>
|
|
170
273
|
setAttributes( { showBio: ! showBio } )
|
|
171
274
|
}
|
|
172
275
|
/>
|
|
276
|
+
</ToolsPanelItem>
|
|
277
|
+
<ToolsPanelItem
|
|
278
|
+
label={ __( 'Link author name to author page' ) }
|
|
279
|
+
isShownByDefault
|
|
280
|
+
hasValue={ () => !! isLink }
|
|
281
|
+
onDeselect={ () => setAttributes( { isLink: false } ) }
|
|
282
|
+
>
|
|
173
283
|
<ToggleControl
|
|
174
284
|
__nextHasNoMarginBottom
|
|
175
285
|
label={ __( 'Link author name to author page' ) }
|
|
@@ -178,7 +288,16 @@ function PostAuthorEdit( {
|
|
|
178
288
|
setAttributes( { isLink: ! isLink } )
|
|
179
289
|
}
|
|
180
290
|
/>
|
|
181
|
-
|
|
291
|
+
</ToolsPanelItem>
|
|
292
|
+
{ isLink && (
|
|
293
|
+
<ToolsPanelItem
|
|
294
|
+
label={ __( 'Link target' ) }
|
|
295
|
+
isShownByDefault
|
|
296
|
+
hasValue={ () => linkTarget !== '_self' }
|
|
297
|
+
onDeselect={ () =>
|
|
298
|
+
setAttributes( { linkTarget: '_self' } )
|
|
299
|
+
}
|
|
300
|
+
>
|
|
182
301
|
<ToggleControl
|
|
183
302
|
__nextHasNoMarginBottom
|
|
184
303
|
label={ __( 'Open in new tab' ) }
|
|
@@ -189,9 +308,9 @@ function PostAuthorEdit( {
|
|
|
189
308
|
}
|
|
190
309
|
checked={ linkTarget === '_blank' }
|
|
191
310
|
/>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
</
|
|
311
|
+
</ToolsPanelItem>
|
|
312
|
+
) }
|
|
313
|
+
</ToolsPanel>
|
|
195
314
|
</InspectorControls>
|
|
196
315
|
|
|
197
316
|
<BlockControls group="block">
|
|
@@ -207,12 +326,8 @@ function PostAuthorEdit( {
|
|
|
207
326
|
{ showAvatar && authorDetails?.avatar_urls && (
|
|
208
327
|
<div className="wp-block-post-author__avatar">
|
|
209
328
|
<img
|
|
210
|
-
width={
|
|
211
|
-
src={
|
|
212
|
-
authorDetails.avatar_urls[
|
|
213
|
-
attributes.avatarSize
|
|
214
|
-
]
|
|
215
|
-
}
|
|
329
|
+
width={ avatarSize }
|
|
330
|
+
src={ authorDetails.avatar_urls[ avatarSize ] }
|
|
216
331
|
alt={ authorDetails.name }
|
|
217
332
|
/>
|
|
218
333
|
</div>
|
|
@@ -106,7 +106,7 @@ const CommentsForm = ( { postId, postType } ) => {
|
|
|
106
106
|
return (
|
|
107
107
|
<Warning>
|
|
108
108
|
{ sprintf(
|
|
109
|
-
/* translators:
|
|
109
|
+
/* translators: %s: Post type (i.e. "post", "page") */
|
|
110
110
|
__(
|
|
111
111
|
'Post Comments Form block: Comments are not enabled for this post type (%s).'
|
|
112
112
|
),
|
|
@@ -9,9 +9,10 @@ import clsx from 'clsx';
|
|
|
9
9
|
import {
|
|
10
10
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
11
11
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
12
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
13
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
12
14
|
ToggleControl,
|
|
13
15
|
SelectControl,
|
|
14
|
-
PanelBody,
|
|
15
16
|
} from '@wordpress/components';
|
|
16
17
|
import {
|
|
17
18
|
InspectorControls,
|
|
@@ -25,6 +26,11 @@ import { __, _x } from '@wordpress/i18n';
|
|
|
25
26
|
import { useSelect } from '@wordpress/data';
|
|
26
27
|
import { store as coreStore } from '@wordpress/core-data';
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Internal dependencies
|
|
31
|
+
*/
|
|
32
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
33
|
+
|
|
28
34
|
export default function PostNavigationLinkEdit( {
|
|
29
35
|
context: { postType },
|
|
30
36
|
attributes: {
|
|
@@ -94,73 +100,112 @@ export default function PostNavigationLinkEdit( {
|
|
|
94
100
|
return [ selectOption, ...taxonomyOptions ];
|
|
95
101
|
};
|
|
96
102
|
|
|
103
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
104
|
+
|
|
97
105
|
return (
|
|
98
106
|
<>
|
|
99
107
|
<InspectorControls>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
<ToolsPanel
|
|
109
|
+
label={ __( 'Settings' ) }
|
|
110
|
+
resetAll={ () => {
|
|
111
|
+
setAttributes( {
|
|
112
|
+
showTitle: false,
|
|
113
|
+
linkLabel: false,
|
|
114
|
+
arrow: 'none',
|
|
115
|
+
} );
|
|
116
|
+
} }
|
|
117
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
118
|
+
>
|
|
119
|
+
<ToolsPanelItem
|
|
103
120
|
label={ __( 'Display the title as a link' ) }
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
onChange={ () =>
|
|
109
|
-
setAttributes( {
|
|
110
|
-
showTitle: ! showTitle,
|
|
111
|
-
} )
|
|
121
|
+
isShownByDefault
|
|
122
|
+
hasValue={ () => showTitle }
|
|
123
|
+
onDeselect={ () =>
|
|
124
|
+
setAttributes( { showTitle: false } )
|
|
112
125
|
}
|
|
113
|
-
|
|
114
|
-
{ showTitle && (
|
|
126
|
+
>
|
|
115
127
|
<ToggleControl
|
|
116
128
|
__nextHasNoMarginBottom
|
|
117
|
-
label={ __(
|
|
118
|
-
|
|
129
|
+
label={ __( 'Display the title as a link' ) }
|
|
130
|
+
help={ __(
|
|
131
|
+
'If you have entered a custom label, it will be prepended before the title.'
|
|
119
132
|
) }
|
|
120
|
-
checked={ !!
|
|
133
|
+
checked={ !! showTitle }
|
|
121
134
|
onChange={ () =>
|
|
122
135
|
setAttributes( {
|
|
123
|
-
|
|
136
|
+
showTitle: ! showTitle,
|
|
124
137
|
} )
|
|
125
138
|
}
|
|
126
139
|
/>
|
|
140
|
+
</ToolsPanelItem>
|
|
141
|
+
{ showTitle && (
|
|
142
|
+
<ToolsPanelItem
|
|
143
|
+
label={ __(
|
|
144
|
+
'Include the label as part of the link'
|
|
145
|
+
) }
|
|
146
|
+
isShownByDefault
|
|
147
|
+
hasValue={ () => !! linkLabel }
|
|
148
|
+
onDeselect={ () =>
|
|
149
|
+
setAttributes( { linkLabel: false } )
|
|
150
|
+
}
|
|
151
|
+
>
|
|
152
|
+
<ToggleControl
|
|
153
|
+
__nextHasNoMarginBottom
|
|
154
|
+
label={ __(
|
|
155
|
+
'Include the label as part of the link'
|
|
156
|
+
) }
|
|
157
|
+
checked={ !! linkLabel }
|
|
158
|
+
onChange={ () =>
|
|
159
|
+
setAttributes( {
|
|
160
|
+
linkLabel: ! linkLabel,
|
|
161
|
+
} )
|
|
162
|
+
}
|
|
163
|
+
/>
|
|
164
|
+
</ToolsPanelItem>
|
|
127
165
|
) }
|
|
128
|
-
<
|
|
129
|
-
__next40pxDefaultSize
|
|
130
|
-
__nextHasNoMarginBottom
|
|
166
|
+
<ToolsPanelItem
|
|
131
167
|
label={ __( 'Arrow' ) }
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} }
|
|
136
|
-
help={ __(
|
|
137
|
-
'A decorative arrow for the next and previous link.'
|
|
138
|
-
) }
|
|
139
|
-
isBlock
|
|
168
|
+
isShownByDefault
|
|
169
|
+
hasValue={ () => arrow !== 'none' }
|
|
170
|
+
onDeselect={ () => setAttributes( { arrow: 'none' } ) }
|
|
140
171
|
>
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
'Arrow',
|
|
152
|
-
'Arrow option for Next/Previous link'
|
|
153
|
-
) }
|
|
154
|
-
/>
|
|
155
|
-
<ToggleGroupControlOption
|
|
156
|
-
value="chevron"
|
|
157
|
-
label={ _x(
|
|
158
|
-
'Chevron',
|
|
159
|
-
'Arrow option for Next/Previous link'
|
|
172
|
+
<ToggleGroupControl
|
|
173
|
+
__next40pxDefaultSize
|
|
174
|
+
__nextHasNoMarginBottom
|
|
175
|
+
label={ __( 'Arrow' ) }
|
|
176
|
+
value={ arrow }
|
|
177
|
+
onChange={ ( value ) => {
|
|
178
|
+
setAttributes( { arrow: value } );
|
|
179
|
+
} }
|
|
180
|
+
help={ __(
|
|
181
|
+
'A decorative arrow for the next and previous link.'
|
|
160
182
|
) }
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
183
|
+
isBlock
|
|
184
|
+
>
|
|
185
|
+
<ToggleGroupControlOption
|
|
186
|
+
value="none"
|
|
187
|
+
label={ _x(
|
|
188
|
+
'None',
|
|
189
|
+
'Arrow option for Next/Previous link'
|
|
190
|
+
) }
|
|
191
|
+
/>
|
|
192
|
+
<ToggleGroupControlOption
|
|
193
|
+
value="arrow"
|
|
194
|
+
label={ _x(
|
|
195
|
+
'Arrow',
|
|
196
|
+
'Arrow option for Next/Previous link'
|
|
197
|
+
) }
|
|
198
|
+
/>
|
|
199
|
+
<ToggleGroupControlOption
|
|
200
|
+
value="chevron"
|
|
201
|
+
label={ _x(
|
|
202
|
+
'Chevron',
|
|
203
|
+
'Arrow option for Next/Previous link'
|
|
204
|
+
) }
|
|
205
|
+
/>
|
|
206
|
+
</ToggleGroupControl>
|
|
207
|
+
</ToolsPanelItem>
|
|
208
|
+
</ToolsPanel>
|
|
164
209
|
</InspectorControls>
|
|
165
210
|
<InspectorControls group="advanced">
|
|
166
211
|
<SelectControl
|
package/src/rss/index.php
CHANGED
|
@@ -46,7 +46,8 @@ function render_block_core_rss( $attributes ) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
foreach ( $rss_items as $item ) {
|
|
49
|
-
$title = esc_html( trim( strip_tags( $item->get_title() ) ) );
|
|
49
|
+
$title = esc_html( trim( strip_tags( html_entity_decode( $item->get_title() ) ) ) );
|
|
50
|
+
|
|
50
51
|
if ( empty( $title ) ) {
|
|
51
52
|
$title = __( '(no title)' );
|
|
52
53
|
}
|
package/src/search/edit.js
CHANGED