@wordpress/block-library 9.26.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/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/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/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 +17 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-author/edit.js +78 -35
- 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/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +16 -5
- package/build/site-logo/edit.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/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/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 +18 -2
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-author/edit.js +78 -35
- 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/search/edit.js +1 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +17 -6
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-style/editor-rtl.css +0 -13
- package/build-style/editor.css +0 -13
- package/build-style/gallery/editor-rtl.css +0 -13
- package/build-style/gallery/editor.css +0 -13
- package/build-style/navigation/style-rtl.css +1 -0
- package/build-style/navigation/style.css +1 -0
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/package.json +35 -35
- package/src/button/edit.js +1 -1
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/details/index.js +1 -1
- 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/list/block.json +0 -1
- package/src/more/edit.native.js +19 -33
- package/src/navigation/style.scss +1 -0
- package/src/navigation-link/edit.js +18 -1
- package/src/post-author/edit.js +91 -40
- package/src/post-comments-form/form.js +1 -1
- package/src/post-featured-image/edit.js +1 -0
- package/src/rss/index.php +2 -1
- package/src/search/edit.js +1 -1
- package/src/site-logo/edit.js +22 -10
|
@@ -46,6 +46,7 @@ $navigation-icon-size: 24px;
|
|
|
46
46
|
// but still allow them to be overridden by user-set colors.
|
|
47
47
|
.wp-block-navigation-item__content {
|
|
48
48
|
display: block;
|
|
49
|
+
z-index: 1;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// This rule needs extra specificity so that it inherits the correct color from its parent.
|
|
@@ -11,6 +11,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
11
11
|
import {
|
|
12
12
|
__experimentalToolsPanel as ToolsPanel,
|
|
13
13
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
14
|
+
CheckboxControl,
|
|
14
15
|
TextControl,
|
|
15
16
|
TextareaControl,
|
|
16
17
|
ToolbarButton,
|
|
@@ -175,7 +176,7 @@ function getMissingText( type ) {
|
|
|
175
176
|
* Consider reusing this components for both blocks.
|
|
176
177
|
*/
|
|
177
178
|
function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
|
|
178
|
-
const { label, url, description, rel } = attributes;
|
|
179
|
+
const { label, url, description, rel, opensInNewTab } = attributes;
|
|
179
180
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
180
181
|
return (
|
|
181
182
|
<ToolsPanel
|
|
@@ -233,6 +234,22 @@ function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
|
|
|
233
234
|
/>
|
|
234
235
|
</ToolsPanelItem>
|
|
235
236
|
|
|
237
|
+
<ToolsPanelItem
|
|
238
|
+
hasValue={ () => !! opensInNewTab }
|
|
239
|
+
label={ __( 'Open in new tab' ) }
|
|
240
|
+
onDeselect={ () => setAttributes( { opensInNewTab: false } ) }
|
|
241
|
+
isShownByDefault
|
|
242
|
+
>
|
|
243
|
+
<CheckboxControl
|
|
244
|
+
__nextHasNoMarginBottom
|
|
245
|
+
label={ __( 'Open in new tab' ) }
|
|
246
|
+
checked={ opensInNewTab }
|
|
247
|
+
onChange={ ( value ) =>
|
|
248
|
+
setAttributes( { opensInNewTab: value } )
|
|
249
|
+
}
|
|
250
|
+
/>
|
|
251
|
+
</ToolsPanelItem>
|
|
252
|
+
|
|
236
253
|
<ToolsPanelItem
|
|
237
254
|
hasValue={ () => !! description }
|
|
238
255
|
label={ __( 'Description' ) }
|
package/src/post-author/edit.js
CHANGED
|
@@ -20,8 +20,11 @@ import {
|
|
|
20
20
|
__experimentalToolsPanel as ToolsPanel,
|
|
21
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
|
/**
|
|
@@ -29,13 +32,81 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
29
32
|
*/
|
|
30
33
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
31
34
|
|
|
32
|
-
const minimumUsersForCombobox = 25;
|
|
33
|
-
|
|
34
35
|
const AUTHORS_QUERY = {
|
|
35
36
|
who: 'authors',
|
|
36
37
|
per_page: 100,
|
|
38
|
+
_fields: 'id,name',
|
|
39
|
+
context: 'view',
|
|
37
40
|
};
|
|
38
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
|
+
|
|
39
110
|
function PostAuthorEdit( {
|
|
40
111
|
isSelected,
|
|
41
112
|
context: { postType, postId, queryId },
|
|
@@ -45,22 +116,28 @@ function PostAuthorEdit( {
|
|
|
45
116
|
const isDescendentOfQueryLoop = Number.isFinite( queryId );
|
|
46
117
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
47
118
|
|
|
48
|
-
const {
|
|
119
|
+
const { authorDetails, canAssignAuthor, supportsAuthor } = useSelect(
|
|
49
120
|
( select ) => {
|
|
50
|
-
const { getEditedEntityRecord, getUser,
|
|
121
|
+
const { getEditedEntityRecord, getUser, getPostType } =
|
|
51
122
|
select( coreStore );
|
|
52
|
-
const
|
|
123
|
+
const currentPost = getEditedEntityRecord(
|
|
53
124
|
'postType',
|
|
54
125
|
postType,
|
|
55
126
|
postId
|
|
56
|
-
)
|
|
127
|
+
);
|
|
128
|
+
const authorId = currentPost?.author;
|
|
57
129
|
|
|
58
130
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
131
|
+
authorDetails: authorId
|
|
132
|
+
? getUser( authorId, { context: 'view' } )
|
|
133
|
+
: null,
|
|
62
134
|
supportsAuthor:
|
|
63
135
|
getPostType( postType )?.supports?.author ?? false,
|
|
136
|
+
canAssignAuthor: currentPost?._links?.[
|
|
137
|
+
'wp:action-assign-author'
|
|
138
|
+
]
|
|
139
|
+
? true
|
|
140
|
+
: false,
|
|
64
141
|
};
|
|
65
142
|
},
|
|
66
143
|
[ postType, postId ]
|
|
@@ -94,24 +171,14 @@ function PostAuthorEdit( {
|
|
|
94
171
|
} ),
|
|
95
172
|
} );
|
|
96
173
|
|
|
97
|
-
const authorOptions = authors?.length
|
|
98
|
-
? authors.map( ( { id, name } ) => {
|
|
99
|
-
return {
|
|
100
|
-
value: id,
|
|
101
|
-
label: name,
|
|
102
|
-
};
|
|
103
|
-
} )
|
|
104
|
-
: [];
|
|
105
|
-
|
|
106
174
|
const handleSelect = ( nextAuthorId ) => {
|
|
107
175
|
editEntityRecord( 'postType', postType, postId, {
|
|
108
176
|
author: nextAuthorId,
|
|
109
177
|
} );
|
|
110
178
|
};
|
|
111
179
|
|
|
112
|
-
const showCombobox = authorOptions.length >= minimumUsersForCombobox;
|
|
113
180
|
const showAuthorControl =
|
|
114
|
-
!! postId && ! isDescendentOfQueryLoop &&
|
|
181
|
+
!! postId && ! isDescendentOfQueryLoop && canAssignAuthor;
|
|
115
182
|
|
|
116
183
|
if ( ! supportsAuthor && postType !== undefined ) {
|
|
117
184
|
return (
|
|
@@ -142,26 +209,10 @@ function PostAuthorEdit( {
|
|
|
142
209
|
>
|
|
143
210
|
{ showAuthorControl && (
|
|
144
211
|
<div style={ { gridColumn: '1 / -1' } }>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
label={ __( 'Author' ) }
|
|
150
|
-
options={ authorOptions }
|
|
151
|
-
value={ authorId }
|
|
152
|
-
onChange={ handleSelect }
|
|
153
|
-
allowReset={ false }
|
|
154
|
-
/>
|
|
155
|
-
) ) || (
|
|
156
|
-
<SelectControl
|
|
157
|
-
__next40pxDefaultSize
|
|
158
|
-
__nextHasNoMarginBottom
|
|
159
|
-
label={ __( 'Author' ) }
|
|
160
|
-
value={ authorId }
|
|
161
|
-
options={ authorOptions }
|
|
162
|
-
onChange={ handleSelect }
|
|
163
|
-
/>
|
|
164
|
-
) }
|
|
212
|
+
<AuthorCombobox
|
|
213
|
+
value={ authorDetails }
|
|
214
|
+
onChange={ handleSelect }
|
|
215
|
+
/>
|
|
165
216
|
</div>
|
|
166
217
|
) }
|
|
167
218
|
<ToolsPanelItem
|
|
@@ -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
|
),
|
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
package/src/site-logo/edit.js
CHANGED
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
Button,
|
|
24
24
|
DropZone,
|
|
25
25
|
FlexItem,
|
|
26
|
-
PanelBody,
|
|
27
26
|
__experimentalToolsPanel as ToolsPanel,
|
|
28
27
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
29
28
|
__experimentalItemGroup as ItemGroup,
|
|
@@ -476,6 +475,7 @@ export default function LogoEdit( {
|
|
|
476
475
|
}, [] );
|
|
477
476
|
const { getSettings } = useSelect( blockEditorStore );
|
|
478
477
|
const [ temporaryURL, setTemporaryURL ] = useState();
|
|
478
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
479
479
|
|
|
480
480
|
const { editEntityRecord } = useDispatch( coreStore );
|
|
481
481
|
|
|
@@ -633,9 +633,15 @@ export default function LogoEdit( {
|
|
|
633
633
|
|
|
634
634
|
const mediaInspectorPanel = ( canUserEdit || logoUrl ) && (
|
|
635
635
|
<InspectorControls>
|
|
636
|
-
<
|
|
637
|
-
|
|
638
|
-
|
|
636
|
+
<ToolsPanel
|
|
637
|
+
label={ __( 'Media' ) }
|
|
638
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
639
|
+
>
|
|
640
|
+
{ ! canUserEdit ? (
|
|
641
|
+
<div
|
|
642
|
+
className="block-library-site-logo__inspector-media-replace-container"
|
|
643
|
+
style={ { gridColumn: '1 / -1' } }
|
|
644
|
+
>
|
|
639
645
|
<InspectorLogoPreview
|
|
640
646
|
media={ mediaItemData }
|
|
641
647
|
itemGroupProps={ {
|
|
@@ -644,8 +650,14 @@ export default function LogoEdit( {
|
|
|
644
650
|
'block-library-site-logo__inspector-readonly-logo-preview',
|
|
645
651
|
} }
|
|
646
652
|
/>
|
|
647
|
-
|
|
648
|
-
|
|
653
|
+
</div>
|
|
654
|
+
) : (
|
|
655
|
+
<ToolsPanelItem
|
|
656
|
+
hasValue={ () => !! logoUrl }
|
|
657
|
+
label={ __( 'Logo' ) }
|
|
658
|
+
isShownByDefault
|
|
659
|
+
>
|
|
660
|
+
<div className="block-library-site-logo__inspector-media-replace-container">
|
|
649
661
|
<SiteLogoReplaceFlow
|
|
650
662
|
{ ...mediaReplaceFlowProps }
|
|
651
663
|
name={
|
|
@@ -668,10 +680,10 @@ export default function LogoEdit( {
|
|
|
668
680
|
) }
|
|
669
681
|
/>
|
|
670
682
|
<DropZone onFilesDrop={ onFilesDrop } />
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
</
|
|
683
|
+
</div>
|
|
684
|
+
</ToolsPanelItem>
|
|
685
|
+
) }
|
|
686
|
+
</ToolsPanel>
|
|
675
687
|
</InspectorControls>
|
|
676
688
|
);
|
|
677
689
|
|