@wordpress/block-library 9.24.0 → 9.25.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/button/edit.js +29 -17
- package/build/button/edit.js.map +1 -1
- package/build/columns/edit.js +18 -22
- package/build/columns/edit.js.map +1 -1
- package/build/comment-author-name/edit.js +41 -12
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-date/edit.js +41 -12
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-edit-link/edit.js +27 -7
- package/build/comment-edit-link/edit.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +1 -3
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-pagination/edit.js +23 -9
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-title/edit.js +41 -12
- package/build/comments-title/edit.js.map +1 -1
- package/build/details/edit.js +27 -3
- package/build/details/edit.js.map +1 -1
- package/build/embed/edit.js +2 -4
- package/build/embed/edit.js.map +1 -1
- package/build/embed/embed-controls.js +41 -22
- package/build/embed/embed-controls.js.map +1 -1
- package/build/file/inspector.js +73 -30
- package/build/file/inspector.js.map +1 -1
- package/build/form/edit.js +67 -37
- package/build/form/edit.js.map +1 -1
- package/build/form-input/edit.js +47 -18
- package/build/form-input/edit.js.map +1 -1
- package/build/latest-posts/edit.js +154 -82
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/ordered-list-settings.js +131 -52
- package/build/list/ordered-list-settings.js.map +1 -1
- package/build/navigation/edit/index.js +93 -51
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/overlay-menu-preview.js +43 -27
- package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build/navigation-link/index.js +3 -0
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-link/transforms.js +2 -0
- package/build/navigation-link/transforms.js.map +1 -1
- package/build/navigation-link/update-attributes.js +1 -0
- package/build/navigation-link/update-attributes.js.map +1 -1
- package/build/navigation-submenu/index.js +3 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/post-comments-count/index.js +3 -1
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-count/transforms.js +26 -0
- package/build/post-comments-count/transforms.js.map +1 -0
- package/build/post-comments-link/index.js +3 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-comments-link/transforms.js +26 -0
- package/build/post-comments-link/transforms.js.map +1 -0
- package/build/post-title/edit.js +56 -18
- package/build/post-title/edit.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +1 -1
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/rss/edit.js +120 -46
- package/build/rss/edit.js.map +1 -1
- package/build/separator/edit.js +52 -20
- package/build/separator/edit.js.map +1 -1
- package/build/shortcode/index.js +2 -1
- package/build/shortcode/index.js.map +1 -1
- package/build/social-link/variations.js +53 -48
- package/build/social-link/variations.js.map +1 -1
- package/build/social-links/edit.js +35 -45
- package/build/social-links/edit.js.map +1 -1
- package/build/video/tracks-editor.js +40 -12
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/button/edit.js +30 -18
- package/build-module/button/edit.js.map +1 -1
- package/build-module/columns/edit.js +18 -22
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/comment-author-name/edit.js +42 -13
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-date/edit.js +42 -13
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-edit-link/edit.js +28 -8
- package/build-module/comment-edit-link/edit.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +1 -3
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-pagination/edit.js +24 -10
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +42 -13
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/details/edit.js +29 -5
- package/build-module/details/edit.js.map +1 -1
- package/build-module/embed/edit.js +2 -4
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/embed-controls.js +42 -23
- package/build-module/embed/embed-controls.js.map +1 -1
- package/build-module/file/inspector.js +74 -31
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/form/edit.js +68 -38
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form-input/edit.js +48 -19
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +155 -83
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list/ordered-list-settings.js +132 -53
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/navigation/edit/index.js +94 -52
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js +44 -28
- package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build-module/navigation-link/index.js +3 -0
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-link/transforms.js +2 -0
- package/build-module/navigation-link/transforms.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +1 -0
- package/build-module/navigation-link/update-attributes.js.map +1 -1
- package/build-module/navigation-submenu/index.js +3 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/post-comments-count/index.js +3 -1
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-count/transforms.js +19 -0
- package/build-module/post-comments-count/transforms.js.map +1 -0
- package/build-module/post-comments-link/index.js +3 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-comments-link/transforms.js +19 -0
- package/build-module/post-comments-link/transforms.js.map +1 -0
- package/build-module/post-title/edit.js +57 -19
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/rss/edit.js +121 -47
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/separator/edit.js +54 -22
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/shortcode/index.js +2 -1
- package/build-module/shortcode/index.js.map +1 -1
- package/build-module/social-link/variations.js +53 -48
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/social-links/edit.js +37 -47
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +41 -13
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/editor-rtl.css +9 -4
- package/build-style/editor.css +9 -4
- package/build-style/gallery/style-rtl.css +1 -0
- package/build-style/gallery/style.css +1 -0
- package/build-style/navigation/editor-rtl.css +8 -3
- package/build-style/navigation/editor.css +8 -3
- package/build-style/pullquote/editor-rtl.css +1 -1
- package/build-style/pullquote/editor.css +1 -1
- package/build-style/pullquote/style-rtl.css +2 -3
- package/build-style/pullquote/style.css +2 -3
- package/build-style/pullquote/theme-rtl.css +2 -2
- package/build-style/pullquote/theme.css +2 -2
- package/build-style/style-rtl.css +3 -3
- package/build-style/style.css +3 -3
- package/build-style/theme-rtl.css +2 -2
- package/build-style/theme.css +2 -2
- package/package.json +35 -35
- package/src/button/edit.js +44 -29
- package/src/columns/edit.js +20 -31
- package/src/comment-author-name/edit.js +54 -13
- package/src/comment-date/edit.js +50 -15
- package/src/comment-edit-link/edit.js +39 -11
- package/src/comments/edit/comments-inspector-controls.js +0 -2
- package/src/comments-pagination/edit.js +29 -9
- package/src/comments-title/edit.js +53 -15
- package/src/details/edit.js +36 -4
- package/src/embed/edit.js +3 -5
- package/src/embed/embed-controls.js +55 -33
- package/src/file/inspector.js +99 -45
- package/src/form/edit.js +91 -46
- package/src/form-input/edit.js +56 -18
- package/src/gallery/style.scss +1 -0
- package/src/latest-posts/edit.js +206 -98
- package/src/list/ordered-list-settings.js +172 -62
- package/src/navigation/edit/index.js +127 -64
- package/src/navigation/edit/overlay-menu-preview.js +43 -26
- package/src/navigation/editor.scss +8 -4
- package/src/navigation-link/block.json +3 -0
- package/src/navigation-link/index.php +4 -0
- package/src/navigation-link/transforms.js +2 -1
- package/src/navigation-link/update-attributes.js +1 -0
- package/src/navigation-submenu/block.json +3 -0
- package/src/navigation-submenu/index.php +4 -0
- package/src/post-comments-count/index.js +2 -0
- package/src/post-comments-count/transforms.js +20 -0
- package/src/post-comments-link/index.js +2 -0
- package/src/post-comments-link/transforms.js +20 -0
- package/src/post-title/edit.js +76 -24
- package/src/pullquote/editor.scss +1 -1
- package/src/pullquote/style.scss +2 -3
- package/src/pullquote/theme.scss +2 -2
- package/src/query/edit/enhanced-pagination-modal.js +1 -5
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -13
- package/src/rss/edit.js +141 -55
- package/src/separator/edit.js +66 -21
- package/src/shortcode/block.json +2 -1
- package/src/site-title/index.php +1 -1
- package/src/social-link/index.php +49 -49
- package/src/social-link/variations.js +53 -48
- package/src/social-links/edit.js +39 -60
- package/src/video/tracks-editor.js +57 -16
|
@@ -9,6 +9,7 @@ import { postCommentsCount as icon } from '@wordpress/icons';
|
|
|
9
9
|
import initBlock from '../utils/init-block';
|
|
10
10
|
import metadata from './block.json';
|
|
11
11
|
import edit from './edit';
|
|
12
|
+
import transforms from './transforms';
|
|
12
13
|
|
|
13
14
|
const { name } = metadata;
|
|
14
15
|
export { metadata, name };
|
|
@@ -16,6 +17,7 @@ export { metadata, name };
|
|
|
16
17
|
export const settings = {
|
|
17
18
|
icon,
|
|
18
19
|
edit,
|
|
20
|
+
transforms,
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export const init = () => initBlock( { name, metadata, settings } );
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlock } from '@wordpress/blocks';
|
|
5
|
+
|
|
6
|
+
const transforms = {
|
|
7
|
+
to: [
|
|
8
|
+
{
|
|
9
|
+
type: 'block',
|
|
10
|
+
blocks: [ 'core/post-comments-link' ],
|
|
11
|
+
transform: ( { textAlign } ) => {
|
|
12
|
+
return createBlock( 'core/post-comments-link', {
|
|
13
|
+
textAlign,
|
|
14
|
+
} );
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default transforms;
|
|
@@ -9,6 +9,7 @@ import { postCommentsCount as icon } from '@wordpress/icons';
|
|
|
9
9
|
import initBlock from '../utils/init-block';
|
|
10
10
|
import metadata from './block.json';
|
|
11
11
|
import edit from './edit';
|
|
12
|
+
import transforms from './transforms';
|
|
12
13
|
|
|
13
14
|
const { name } = metadata;
|
|
14
15
|
export { metadata, name };
|
|
@@ -16,6 +17,7 @@ export { metadata, name };
|
|
|
16
17
|
export const settings = {
|
|
17
18
|
edit,
|
|
18
19
|
icon,
|
|
20
|
+
transforms,
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export const init = () => initBlock( { name, metadata, settings } );
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlock } from '@wordpress/blocks';
|
|
5
|
+
|
|
6
|
+
const transforms = {
|
|
7
|
+
to: [
|
|
8
|
+
{
|
|
9
|
+
type: 'block',
|
|
10
|
+
blocks: [ 'core/post-comments-count' ],
|
|
11
|
+
transform: ( { textAlign } ) => {
|
|
12
|
+
return createBlock( 'core/post-comments-count', {
|
|
13
|
+
textAlign,
|
|
14
|
+
} );
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default transforms;
|
package/src/post-title/edit.js
CHANGED
|
@@ -15,12 +15,22 @@ import {
|
|
|
15
15
|
HeadingLevelDropdown,
|
|
16
16
|
useBlockEditingMode,
|
|
17
17
|
} from '@wordpress/block-editor';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
ToggleControl,
|
|
20
|
+
TextControl,
|
|
21
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
22
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
23
|
+
} from '@wordpress/components';
|
|
19
24
|
import { __ } from '@wordpress/i18n';
|
|
20
25
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
21
26
|
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
22
27
|
import { useSelect } from '@wordpress/data';
|
|
23
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Internal dependencies
|
|
31
|
+
*/
|
|
32
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
33
|
+
|
|
24
34
|
export default function PostTitleEdit( {
|
|
25
35
|
attributes: { level, levelOptions, textAlign, isLink, rel, linkTarget },
|
|
26
36
|
setAttributes,
|
|
@@ -66,6 +76,7 @@ export default function PostTitleEdit( {
|
|
|
66
76
|
} ),
|
|
67
77
|
} );
|
|
68
78
|
const blockEditingMode = useBlockEditingMode();
|
|
79
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
69
80
|
|
|
70
81
|
let titleElement = <TagName { ...blockProps }>{ __( 'Title' ) }</TagName>;
|
|
71
82
|
|
|
@@ -138,41 +149,82 @@ export default function PostTitleEdit( {
|
|
|
138
149
|
/>
|
|
139
150
|
</BlockControls>
|
|
140
151
|
<InspectorControls>
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
152
|
+
<ToolsPanel
|
|
153
|
+
label={ __( 'Settings' ) }
|
|
154
|
+
resetAll={ () => {
|
|
155
|
+
setAttributes( {
|
|
156
|
+
rel: '',
|
|
157
|
+
linkTarget: '_self',
|
|
158
|
+
isLink: false,
|
|
159
|
+
} );
|
|
160
|
+
} }
|
|
161
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
162
|
+
>
|
|
163
|
+
<ToolsPanelItem
|
|
144
164
|
label={ __( 'Make title a link' ) }
|
|
145
|
-
|
|
146
|
-
|
|
165
|
+
isShownByDefault
|
|
166
|
+
hasValue={ () => isLink }
|
|
167
|
+
onDeselect={ () =>
|
|
168
|
+
setAttributes( { isLink: false } )
|
|
147
169
|
}
|
|
148
|
-
|
|
149
|
-
|
|
170
|
+
>
|
|
171
|
+
<ToggleControl
|
|
172
|
+
__nextHasNoMarginBottom
|
|
173
|
+
label={ __( 'Make title a link' ) }
|
|
174
|
+
onChange={ () =>
|
|
175
|
+
setAttributes( { isLink: ! isLink } )
|
|
176
|
+
}
|
|
177
|
+
checked={ isLink }
|
|
178
|
+
/>
|
|
179
|
+
</ToolsPanelItem>
|
|
150
180
|
{ isLink && (
|
|
151
181
|
<>
|
|
152
|
-
<
|
|
153
|
-
__nextHasNoMarginBottom
|
|
182
|
+
<ToolsPanelItem
|
|
154
183
|
label={ __( 'Open in new tab' ) }
|
|
155
|
-
|
|
184
|
+
isShownByDefault
|
|
185
|
+
hasValue={ () =>
|
|
186
|
+
linkTarget === '_blank'
|
|
187
|
+
}
|
|
188
|
+
onDeselect={ () =>
|
|
156
189
|
setAttributes( {
|
|
157
|
-
linkTarget:
|
|
158
|
-
? '_blank'
|
|
159
|
-
: '_self',
|
|
190
|
+
linkTarget: '_self',
|
|
160
191
|
} )
|
|
161
192
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
193
|
+
>
|
|
194
|
+
<ToggleControl
|
|
195
|
+
__nextHasNoMarginBottom
|
|
196
|
+
label={ __( 'Open in new tab' ) }
|
|
197
|
+
onChange={ ( value ) =>
|
|
198
|
+
setAttributes( {
|
|
199
|
+
linkTarget: value
|
|
200
|
+
? '_blank'
|
|
201
|
+
: '_self',
|
|
202
|
+
} )
|
|
203
|
+
}
|
|
204
|
+
checked={ linkTarget === '_blank' }
|
|
205
|
+
/>
|
|
206
|
+
</ToolsPanelItem>
|
|
207
|
+
<ToolsPanelItem
|
|
167
208
|
label={ __( 'Link rel' ) }
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
209
|
+
isShownByDefault
|
|
210
|
+
hasValue={ () => !! rel }
|
|
211
|
+
onDeselect={ () =>
|
|
212
|
+
setAttributes( { rel: '' } )
|
|
171
213
|
}
|
|
172
|
-
|
|
214
|
+
>
|
|
215
|
+
<TextControl
|
|
216
|
+
__next40pxDefaultSize
|
|
217
|
+
__nextHasNoMarginBottom
|
|
218
|
+
label={ __( 'Link rel' ) }
|
|
219
|
+
value={ rel }
|
|
220
|
+
onChange={ ( newRel ) =>
|
|
221
|
+
setAttributes( { rel: newRel } )
|
|
222
|
+
}
|
|
223
|
+
/>
|
|
224
|
+
</ToolsPanelItem>
|
|
173
225
|
</>
|
|
174
226
|
) }
|
|
175
|
-
</
|
|
227
|
+
</ToolsPanel>
|
|
176
228
|
</InspectorControls>
|
|
177
229
|
</>
|
|
178
230
|
) }
|
package/src/pullquote/style.scss
CHANGED
package/src/pullquote/theme.scss
CHANGED
|
@@ -27,11 +27,7 @@ export default function EnhancedPaginationModal( {
|
|
|
27
27
|
useUnsupportedBlocks( clientId );
|
|
28
28
|
|
|
29
29
|
useEffect( () => {
|
|
30
|
-
if (
|
|
31
|
-
enhancedPagination &&
|
|
32
|
-
hasUnsupportedBlocks &&
|
|
33
|
-
! window.__experimentalFullPageClientSideNavigation
|
|
34
|
-
) {
|
|
30
|
+
if ( enhancedPagination && hasUnsupportedBlocks ) {
|
|
35
31
|
setAttributes( { enhancedPagination: false } );
|
|
36
32
|
setOpen( true );
|
|
37
33
|
}
|
|
@@ -15,17 +15,11 @@ export default function EnhancedPaginationControl( {
|
|
|
15
15
|
clientId,
|
|
16
16
|
} ) {
|
|
17
17
|
const { hasUnsupportedBlocks } = useUnsupportedBlocks( clientId );
|
|
18
|
-
const fullPageClientSideNavigation =
|
|
19
|
-
window.__experimentalFullPageClientSideNavigation;
|
|
20
18
|
|
|
21
19
|
let help = __(
|
|
22
20
|
'Reload the full page—instead of just the posts list—when visitors navigate between pages.'
|
|
23
21
|
);
|
|
24
|
-
if (
|
|
25
|
-
help = __(
|
|
26
|
-
'Experimental full-page client-side navigation setting enabled.'
|
|
27
|
-
);
|
|
28
|
-
} else if ( hasUnsupportedBlocks ) {
|
|
22
|
+
if ( hasUnsupportedBlocks ) {
|
|
29
23
|
help = __(
|
|
30
24
|
'Enhancement disabled because there are non-compatible blocks inside the Query block.'
|
|
31
25
|
);
|
|
@@ -37,12 +31,8 @@ export default function EnhancedPaginationControl( {
|
|
|
37
31
|
__nextHasNoMarginBottom
|
|
38
32
|
label={ __( 'Reload full page' ) }
|
|
39
33
|
help={ help }
|
|
40
|
-
checked={
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
disabled={
|
|
44
|
-
hasUnsupportedBlocks || fullPageClientSideNavigation
|
|
45
|
-
}
|
|
34
|
+
checked={ ! enhancedPagination }
|
|
35
|
+
disabled={ hasUnsupportedBlocks }
|
|
46
36
|
onChange={ ( value ) => {
|
|
47
37
|
setAttributes( {
|
|
48
38
|
enhancedPagination: ! value,
|
package/src/rss/edit.js
CHANGED
|
@@ -9,13 +9,14 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
Button,
|
|
11
11
|
Disabled,
|
|
12
|
-
PanelBody,
|
|
13
12
|
Placeholder,
|
|
14
13
|
RangeControl,
|
|
15
14
|
ToggleControl,
|
|
16
15
|
ToolbarGroup,
|
|
17
16
|
TextControl,
|
|
18
17
|
__experimentalInputControl as InputControl,
|
|
18
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
19
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
19
20
|
} from '@wordpress/components';
|
|
20
21
|
import { useState } from '@wordpress/element';
|
|
21
22
|
import { grid, list, edit, rss } from '@wordpress/icons';
|
|
@@ -23,6 +24,11 @@ import { __, _x } from '@wordpress/i18n';
|
|
|
23
24
|
import { prependHTTP } from '@wordpress/url';
|
|
24
25
|
import ServerSideRender from '@wordpress/server-side-render';
|
|
25
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Internal dependencies
|
|
29
|
+
*/
|
|
30
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
31
|
+
|
|
26
32
|
const DEFAULT_MIN_ITEMS = 1;
|
|
27
33
|
const DEFAULT_MAX_ITEMS = 20;
|
|
28
34
|
|
|
@@ -42,6 +48,8 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
42
48
|
rel,
|
|
43
49
|
} = attributes;
|
|
44
50
|
|
|
51
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
52
|
+
|
|
45
53
|
function toggleAttribute( propName ) {
|
|
46
54
|
return () => {
|
|
47
55
|
const value = attributes[ propName ];
|
|
@@ -141,75 +149,153 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
141
149
|
<ToolbarGroup controls={ toolbarControls } />
|
|
142
150
|
</BlockControls>
|
|
143
151
|
<InspectorControls>
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
<ToolsPanel
|
|
153
|
+
label={ __( 'Settings' ) }
|
|
154
|
+
resetAll={ () => {
|
|
155
|
+
setAttributes( {
|
|
156
|
+
itemsToShow: 5,
|
|
157
|
+
displayAuthor: false,
|
|
158
|
+
displayDate: false,
|
|
159
|
+
displayExcerpt: false,
|
|
160
|
+
excerptLength: 55,
|
|
161
|
+
columns: 2,
|
|
162
|
+
openInNewTab: false,
|
|
163
|
+
} );
|
|
164
|
+
} }
|
|
165
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
166
|
+
>
|
|
167
|
+
<ToolsPanelItem
|
|
148
168
|
label={ __( 'Number of items' ) }
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
min={ DEFAULT_MIN_ITEMS }
|
|
154
|
-
max={ DEFAULT_MAX_ITEMS }
|
|
155
|
-
required
|
|
156
|
-
/>
|
|
157
|
-
<ToggleControl
|
|
158
|
-
__nextHasNoMarginBottom
|
|
159
|
-
label={ __( 'Display author' ) }
|
|
160
|
-
checked={ displayAuthor }
|
|
161
|
-
onChange={ toggleAttribute( 'displayAuthor' ) }
|
|
162
|
-
/>
|
|
163
|
-
<ToggleControl
|
|
164
|
-
__nextHasNoMarginBottom
|
|
165
|
-
label={ __( 'Display date' ) }
|
|
166
|
-
checked={ displayDate }
|
|
167
|
-
onChange={ toggleAttribute( 'displayDate' ) }
|
|
168
|
-
/>
|
|
169
|
-
<ToggleControl
|
|
170
|
-
__nextHasNoMarginBottom
|
|
171
|
-
label={ __( 'Display excerpt' ) }
|
|
172
|
-
checked={ displayExcerpt }
|
|
173
|
-
onChange={ toggleAttribute( 'displayExcerpt' ) }
|
|
174
|
-
/>
|
|
175
|
-
{ displayExcerpt && (
|
|
169
|
+
hasValue={ () => itemsToShow !== 5 }
|
|
170
|
+
onDeselect={ () => setAttributes( { itemsToShow: 5 } ) }
|
|
171
|
+
isShownByDefault
|
|
172
|
+
>
|
|
176
173
|
<RangeControl
|
|
177
174
|
__nextHasNoMarginBottom
|
|
178
175
|
__next40pxDefaultSize
|
|
179
|
-
label={ __( '
|
|
180
|
-
value={
|
|
176
|
+
label={ __( 'Number of items' ) }
|
|
177
|
+
value={ itemsToShow }
|
|
181
178
|
onChange={ ( value ) =>
|
|
182
|
-
setAttributes( {
|
|
179
|
+
setAttributes( { itemsToShow: value } )
|
|
183
180
|
}
|
|
184
|
-
min={
|
|
185
|
-
max={
|
|
181
|
+
min={ DEFAULT_MIN_ITEMS }
|
|
182
|
+
max={ DEFAULT_MAX_ITEMS }
|
|
186
183
|
required
|
|
187
184
|
/>
|
|
185
|
+
</ToolsPanelItem>
|
|
186
|
+
|
|
187
|
+
<ToolsPanelItem
|
|
188
|
+
label={ __( 'Display author' ) }
|
|
189
|
+
hasValue={ () => !! displayAuthor }
|
|
190
|
+
onDeselect={ () =>
|
|
191
|
+
setAttributes( { displayAuthor: false } )
|
|
192
|
+
}
|
|
193
|
+
isShownByDefault
|
|
194
|
+
>
|
|
195
|
+
<ToggleControl
|
|
196
|
+
__nextHasNoMarginBottom
|
|
197
|
+
label={ __( 'Display author' ) }
|
|
198
|
+
checked={ displayAuthor }
|
|
199
|
+
onChange={ toggleAttribute( 'displayAuthor' ) }
|
|
200
|
+
/>
|
|
201
|
+
</ToolsPanelItem>
|
|
202
|
+
|
|
203
|
+
<ToolsPanelItem
|
|
204
|
+
label={ __( 'Display date' ) }
|
|
205
|
+
hasValue={ () => !! displayDate }
|
|
206
|
+
onDeselect={ () =>
|
|
207
|
+
setAttributes( { displayDate: false } )
|
|
208
|
+
}
|
|
209
|
+
isShownByDefault
|
|
210
|
+
>
|
|
211
|
+
<ToggleControl
|
|
212
|
+
__nextHasNoMarginBottom
|
|
213
|
+
label={ __( 'Display date' ) }
|
|
214
|
+
checked={ displayDate }
|
|
215
|
+
onChange={ toggleAttribute( 'displayDate' ) }
|
|
216
|
+
/>
|
|
217
|
+
</ToolsPanelItem>
|
|
218
|
+
|
|
219
|
+
<ToolsPanelItem
|
|
220
|
+
label={ __( 'Display excerpt' ) }
|
|
221
|
+
hasValue={ () => !! displayExcerpt }
|
|
222
|
+
onDeselect={ () =>
|
|
223
|
+
setAttributes( { displayExcerpt: false } )
|
|
224
|
+
}
|
|
225
|
+
isShownByDefault
|
|
226
|
+
>
|
|
227
|
+
<ToggleControl
|
|
228
|
+
__nextHasNoMarginBottom
|
|
229
|
+
label={ __( 'Display excerpt' ) }
|
|
230
|
+
checked={ displayExcerpt }
|
|
231
|
+
onChange={ toggleAttribute( 'displayExcerpt' ) }
|
|
232
|
+
/>
|
|
233
|
+
</ToolsPanelItem>
|
|
234
|
+
|
|
235
|
+
{ displayExcerpt && (
|
|
236
|
+
<ToolsPanelItem
|
|
237
|
+
label={ __( 'Max number of words in excerpt' ) }
|
|
238
|
+
hasValue={ () => excerptLength !== 55 }
|
|
239
|
+
onDeselect={ () =>
|
|
240
|
+
setAttributes( { excerptLength: 55 } )
|
|
241
|
+
}
|
|
242
|
+
isShownByDefault
|
|
243
|
+
>
|
|
244
|
+
<RangeControl
|
|
245
|
+
__nextHasNoMarginBottom
|
|
246
|
+
__next40pxDefaultSize
|
|
247
|
+
label={ __( 'Max number of words in excerpt' ) }
|
|
248
|
+
value={ excerptLength }
|
|
249
|
+
onChange={ ( value ) =>
|
|
250
|
+
setAttributes( { excerptLength: value } )
|
|
251
|
+
}
|
|
252
|
+
min={ 10 }
|
|
253
|
+
max={ 100 }
|
|
254
|
+
required
|
|
255
|
+
/>
|
|
256
|
+
</ToolsPanelItem>
|
|
188
257
|
) }
|
|
258
|
+
|
|
189
259
|
{ blockLayout === 'grid' && (
|
|
190
|
-
<
|
|
191
|
-
__nextHasNoMarginBottom
|
|
192
|
-
__next40pxDefaultSize
|
|
260
|
+
<ToolsPanelItem
|
|
193
261
|
label={ __( 'Columns' ) }
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
262
|
+
hasValue={ () => columns !== 2 }
|
|
263
|
+
onDeselect={ () => setAttributes( { columns: 2 } ) }
|
|
264
|
+
isShownByDefault
|
|
265
|
+
>
|
|
266
|
+
<RangeControl
|
|
267
|
+
__nextHasNoMarginBottom
|
|
268
|
+
__next40pxDefaultSize
|
|
269
|
+
label={ __( 'Columns' ) }
|
|
270
|
+
value={ columns }
|
|
271
|
+
onChange={ ( value ) =>
|
|
272
|
+
setAttributes( { columns: value } )
|
|
273
|
+
}
|
|
274
|
+
min={ 2 }
|
|
275
|
+
max={ 6 }
|
|
276
|
+
required
|
|
277
|
+
/>
|
|
278
|
+
</ToolsPanelItem>
|
|
202
279
|
) }
|
|
203
280
|
|
|
204
|
-
<
|
|
205
|
-
__nextHasNoMarginBottom
|
|
281
|
+
<ToolsPanelItem
|
|
206
282
|
label={ __( 'Open links in new tab' ) }
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
setAttributes( { openInNewTab:
|
|
283
|
+
hasValue={ () => !! openInNewTab }
|
|
284
|
+
onDeselect={ () =>
|
|
285
|
+
setAttributes( { openInNewTab: false } )
|
|
210
286
|
}
|
|
211
|
-
|
|
212
|
-
|
|
287
|
+
isShownByDefault
|
|
288
|
+
>
|
|
289
|
+
<ToggleControl
|
|
290
|
+
__nextHasNoMarginBottom
|
|
291
|
+
label={ __( 'Open links in new tab' ) }
|
|
292
|
+
checked={ openInNewTab }
|
|
293
|
+
onChange={ ( value ) =>
|
|
294
|
+
setAttributes( { openInNewTab: value } )
|
|
295
|
+
}
|
|
296
|
+
/>
|
|
297
|
+
</ToolsPanelItem>
|
|
298
|
+
</ToolsPanel>
|
|
213
299
|
</InspectorControls>
|
|
214
300
|
<InspectorControls group="advanced">
|
|
215
301
|
<TextControl
|
package/src/separator/edit.js
CHANGED
|
@@ -6,33 +6,59 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
HorizontalRule,
|
|
11
|
+
SelectControl,
|
|
12
|
+
PanelBody,
|
|
13
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
14
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
15
|
+
} from '@wordpress/components';
|
|
10
16
|
import {
|
|
11
17
|
useBlockProps,
|
|
12
18
|
getColorClassName,
|
|
13
19
|
__experimentalUseColorProps as useColorProps,
|
|
14
20
|
InspectorControls,
|
|
15
|
-
privateApis as blockEditorPrivateApis,
|
|
16
21
|
} from '@wordpress/block-editor';
|
|
22
|
+
import { Platform } from '@wordpress/element';
|
|
17
23
|
import { __ } from '@wordpress/i18n';
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* Internal dependencies
|
|
21
27
|
*/
|
|
22
28
|
import useDeprecatedOpacity from './use-deprecated-opacity';
|
|
23
|
-
import {
|
|
29
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
24
30
|
|
|
25
|
-
const {
|
|
31
|
+
const HtmlElementControl = ( { tagName, setAttributes } ) => {
|
|
32
|
+
return (
|
|
33
|
+
<SelectControl
|
|
34
|
+
label={ __( 'HTML element' ) }
|
|
35
|
+
value={ tagName }
|
|
36
|
+
onChange={ ( newValue ) => setAttributes( { tagName: newValue } ) }
|
|
37
|
+
options={ [
|
|
38
|
+
{ label: __( 'Default (<hr>)' ), value: 'hr' },
|
|
39
|
+
{ label: '<div>', value: 'div' },
|
|
40
|
+
] }
|
|
41
|
+
help={
|
|
42
|
+
tagName === 'hr'
|
|
43
|
+
? __(
|
|
44
|
+
'Only select <hr> if the separator conveys important information and should be announced by screen readers.'
|
|
45
|
+
)
|
|
46
|
+
: __(
|
|
47
|
+
'The <div> element should only be used if the block is a design element with no semantic meaning.'
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
__next40pxDefaultSize
|
|
51
|
+
__nextHasNoMarginBottom
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
26
55
|
|
|
27
|
-
export default function SeparatorEdit( {
|
|
28
|
-
attributes,
|
|
29
|
-
setAttributes,
|
|
30
|
-
clientId,
|
|
31
|
-
} ) {
|
|
56
|
+
export default function SeparatorEdit( { attributes, setAttributes } ) {
|
|
32
57
|
const { backgroundColor, opacity, style, tagName } = attributes;
|
|
33
58
|
const colorProps = useColorProps( attributes );
|
|
34
59
|
const currentColor = colorProps?.style?.backgroundColor;
|
|
35
60
|
const hasCustomColor = !! style?.color?.background;
|
|
61
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
36
62
|
|
|
37
63
|
useDeprecatedOpacity( opacity, currentColor, setAttributes );
|
|
38
64
|
|
|
@@ -58,18 +84,37 @@ export default function SeparatorEdit( {
|
|
|
58
84
|
|
|
59
85
|
return (
|
|
60
86
|
<>
|
|
61
|
-
<InspectorControls
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
87
|
+
<InspectorControls>
|
|
88
|
+
{ Platform.isNative ? (
|
|
89
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
90
|
+
<HtmlElementControl
|
|
91
|
+
tagName={ tagName }
|
|
92
|
+
setAttributes={ setAttributes }
|
|
93
|
+
/>
|
|
94
|
+
</PanelBody>
|
|
95
|
+
) : (
|
|
96
|
+
<ToolsPanel
|
|
97
|
+
label={ __( 'Settings' ) }
|
|
98
|
+
resetAll={ () => {
|
|
99
|
+
setAttributes( { tagName: 'hr' } );
|
|
100
|
+
} }
|
|
101
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
102
|
+
>
|
|
103
|
+
<ToolsPanelItem
|
|
104
|
+
hasValue={ () => tagName !== 'hr' }
|
|
105
|
+
label={ __( 'HTML element' ) }
|
|
106
|
+
onDeselect={ () =>
|
|
107
|
+
setAttributes( { tagName: 'hr' } )
|
|
108
|
+
}
|
|
109
|
+
isShownByDefault
|
|
110
|
+
>
|
|
111
|
+
<HtmlElementControl
|
|
112
|
+
tagName={ tagName }
|
|
113
|
+
setAttributes={ setAttributes }
|
|
114
|
+
/>
|
|
115
|
+
</ToolsPanelItem>
|
|
116
|
+
</ToolsPanel>
|
|
117
|
+
) }
|
|
73
118
|
</InspectorControls>
|
|
74
119
|
<Wrapper
|
|
75
120
|
{ ...useBlockProps( {
|
package/src/shortcode/block.json
CHANGED