@wordpress/block-library 9.24.0 → 9.26.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 +4 -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 +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/embed/variations.js +0 -10
- package/build/embed/variations.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 -38
- 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/edit.js +47 -18
- package/build/form-input/edit.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/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/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/edit.js +11 -0
- package/build/navigation-link/edit.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-author/edit.js +75 -18
- package/build/post-author/edit.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-navigation-link/edit.js +72 -33
- package/build/post-navigation-link/edit.js.map +1 -1
- 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/site-logo/edit.js +53 -19
- 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-link/variations.js +53 -48
- package/build/social-link/variations.js.map +1 -1
- package/build/social-links/edit.js +38 -45
- package/build/social-links/edit.js.map +1 -1
- package/build/video/tracks-editor.js +63 -21
- 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 +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/embed/variations.js +0 -10
- package/build-module/embed/variations.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 -39
- 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/edit.js +48 -19
- package/build-module/form-input/edit.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/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/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/edit.js +11 -0
- package/build-module/navigation-link/edit.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-author/edit.js +76 -19
- package/build-module/post-author/edit.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-navigation-link/edit.js +73 -34
- package/build-module/post-navigation-link/edit.js.map +1 -1
- 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/site-logo/edit.js +54 -20
- 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-link/variations.js +53 -48
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/social-links/edit.js +40 -47
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +65 -23
- 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 +9 -21
- package/build-style/editor.css +9 -23
- 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/navigation/style-rtl.css +4 -0
- package/build-style/navigation/style.css +4 -0
- 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 +14 -17
- package/build-style/style.css +14 -19
- package/build-style/theme-rtl.css +2 -2
- package/build-style/theme.css +2 -2
- 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 +44 -29
- package/src/calendar/style.scss +10 -10
- 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-pagination/editor.scss +0 -15
- package/src/comments-pagination/style.scss +0 -8
- package/src/comments-title/edit.js +53 -15
- package/src/details/edit.js +36 -4
- package/src/editor.scss +0 -1
- package/src/embed/edit.js +3 -5
- package/src/embed/embed-controls.js +55 -33
- package/src/embed/variations.js +0 -8
- package/src/file/inspector.js +99 -45
- package/src/form/block.json +1 -2
- package/src/form/edit.js +91 -47
- package/src/form/index.js +1 -0
- package/src/form-input/edit.js +56 -18
- 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/style.scss +1 -0
- package/src/image/image.js +1 -0
- package/src/image/index.php +4 -1
- package/src/image/view.js +0 -3
- 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/style.scss +8 -0
- package/src/navigation-link/block.json +3 -0
- package/src/navigation-link/edit.js +14 -1
- 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-author/edit.js +91 -27
- 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-navigation-link/edit.js +96 -51
- 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-logo/edit.js +69 -26
- package/src/site-title/index.php +1 -1
- package/src/social-link/edit.js +18 -7
- package/src/social-link/edit.native.js +10 -4
- package/src/social-link/index.php +62 -49
- package/src/social-link/social-list.js +15 -20
- package/src/social-link/variations.js +53 -48
- package/src/social-links/edit.js +38 -60
- package/src/video/tracks-editor.js +75 -22
- 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/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
package/src/site-logo/edit.js
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
} from '@wordpress/element';
|
|
15
15
|
import { __, isRTL } from '@wordpress/i18n';
|
|
16
16
|
import {
|
|
17
|
-
PanelBody,
|
|
18
17
|
RangeControl,
|
|
19
18
|
ResizableBox,
|
|
20
19
|
Spinner,
|
|
@@ -24,6 +23,9 @@ import {
|
|
|
24
23
|
Button,
|
|
25
24
|
DropZone,
|
|
26
25
|
FlexItem,
|
|
26
|
+
PanelBody,
|
|
27
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
28
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
27
29
|
__experimentalItemGroup as ItemGroup,
|
|
28
30
|
__experimentalHStack as HStack,
|
|
29
31
|
__experimentalTruncate as Truncate,
|
|
@@ -47,6 +49,7 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
47
49
|
* Internal dependencies
|
|
48
50
|
*/
|
|
49
51
|
import { MIN_SIZE } from '../image/constants';
|
|
52
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
50
53
|
|
|
51
54
|
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
52
55
|
const ACCEPT_MEDIA_STRING = 'image/*';
|
|
@@ -70,6 +73,7 @@ const SiteLogo = ( {
|
|
|
70
73
|
const [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );
|
|
71
74
|
const [ isEditingImage, setIsEditingImage ] = useState( false );
|
|
72
75
|
const { toggleSelection } = useDispatch( blockEditorStore );
|
|
76
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
73
77
|
const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
|
|
74
78
|
const settings = select( blockEditorStore ).getSettings();
|
|
75
79
|
const siteEntities = select( coreStore ).getEntityRecord(
|
|
@@ -276,31 +280,61 @@ const SiteLogo = ( {
|
|
|
276
280
|
return (
|
|
277
281
|
<>
|
|
278
282
|
<InspectorControls>
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
+
<ToolsPanel
|
|
284
|
+
label={ __( 'Settings' ) }
|
|
285
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
286
|
+
>
|
|
287
|
+
<ToolsPanelItem
|
|
288
|
+
isShownByDefault
|
|
289
|
+
hasValue={ () => !! width }
|
|
283
290
|
label={ __( 'Image width' ) }
|
|
284
|
-
|
|
285
|
-
setAttributes( { width:
|
|
291
|
+
onDeselect={ () =>
|
|
292
|
+
setAttributes( { width: undefined } )
|
|
286
293
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
>
|
|
295
|
+
<RangeControl
|
|
296
|
+
__nextHasNoMarginBottom
|
|
297
|
+
__next40pxDefaultSize
|
|
298
|
+
label={ __( 'Image width' ) }
|
|
299
|
+
onChange={ ( newWidth ) =>
|
|
300
|
+
setAttributes( { width: newWidth } )
|
|
301
|
+
}
|
|
302
|
+
min={ minWidth }
|
|
303
|
+
max={ maxWidthBuffer }
|
|
304
|
+
initialPosition={ Math.min(
|
|
305
|
+
defaultWidth,
|
|
306
|
+
maxWidthBuffer
|
|
307
|
+
) }
|
|
308
|
+
value={ width || '' }
|
|
309
|
+
disabled={ ! isResizable }
|
|
310
|
+
/>
|
|
311
|
+
</ToolsPanelItem>
|
|
312
|
+
|
|
313
|
+
<ToolsPanelItem
|
|
314
|
+
isShownByDefault
|
|
315
|
+
hasValue={ () => ! isLink }
|
|
298
316
|
label={ __( 'Link image to home' ) }
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
317
|
+
onDeselect={ () => setAttributes( { isLink: true } ) }
|
|
318
|
+
>
|
|
319
|
+
<ToggleControl
|
|
320
|
+
__nextHasNoMarginBottom
|
|
321
|
+
label={ __( 'Link image to home' ) }
|
|
322
|
+
onChange={ () =>
|
|
323
|
+
setAttributes( { isLink: ! isLink } )
|
|
324
|
+
}
|
|
325
|
+
checked={ isLink }
|
|
326
|
+
/>
|
|
327
|
+
</ToolsPanelItem>
|
|
328
|
+
|
|
302
329
|
{ isLink && (
|
|
303
|
-
|
|
330
|
+
<ToolsPanelItem
|
|
331
|
+
isShownByDefault
|
|
332
|
+
hasValue={ () => linkTarget === '_blank' }
|
|
333
|
+
label={ __( 'Open in new tab' ) }
|
|
334
|
+
onDeselect={ () =>
|
|
335
|
+
setAttributes( { linkTarget: '_self' } )
|
|
336
|
+
}
|
|
337
|
+
>
|
|
304
338
|
<ToggleControl
|
|
305
339
|
__nextHasNoMarginBottom
|
|
306
340
|
label={ __( 'Open in new tab' ) }
|
|
@@ -311,10 +345,19 @@ const SiteLogo = ( {
|
|
|
311
345
|
}
|
|
312
346
|
checked={ linkTarget === '_blank' }
|
|
313
347
|
/>
|
|
314
|
-
|
|
348
|
+
</ToolsPanelItem>
|
|
315
349
|
) }
|
|
350
|
+
|
|
316
351
|
{ canUserEdit && (
|
|
317
|
-
|
|
352
|
+
<ToolsPanelItem
|
|
353
|
+
isShownByDefault
|
|
354
|
+
hasValue={ () => !! shouldSyncIcon }
|
|
355
|
+
label={ __( 'Use as Site Icon' ) }
|
|
356
|
+
onDeselect={ () => {
|
|
357
|
+
setAttributes( { shouldSyncIcon: false } );
|
|
358
|
+
setIcon( undefined );
|
|
359
|
+
} }
|
|
360
|
+
>
|
|
318
361
|
<ToggleControl
|
|
319
362
|
__nextHasNoMarginBottom
|
|
320
363
|
label={ __( 'Use as Site Icon' ) }
|
|
@@ -325,9 +368,9 @@ const SiteLogo = ( {
|
|
|
325
368
|
checked={ !! shouldSyncIcon }
|
|
326
369
|
help={ syncSiteIconHelpText }
|
|
327
370
|
/>
|
|
328
|
-
|
|
371
|
+
</ToolsPanelItem>
|
|
329
372
|
) }
|
|
330
|
-
</
|
|
373
|
+
</ToolsPanel>
|
|
331
374
|
</InspectorControls>
|
|
332
375
|
<BlockControls group="block">
|
|
333
376
|
{ canEditImage && ! isEditingImage && (
|
package/src/site-title/index.php
CHANGED
package/src/social-link/edit.js
CHANGED
|
@@ -7,8 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { DELETE, BACKSPACE, ENTER } from '@wordpress/keycodes';
|
|
10
|
-
import { useDispatch } from '@wordpress/data';
|
|
11
|
-
|
|
10
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
11
|
import {
|
|
13
12
|
BlockControls,
|
|
14
13
|
InspectorControls,
|
|
@@ -20,6 +19,7 @@ import {
|
|
|
20
19
|
} from '@wordpress/block-editor';
|
|
21
20
|
import { useState, useRef } from '@wordpress/element';
|
|
22
21
|
import {
|
|
22
|
+
Icon,
|
|
23
23
|
Button,
|
|
24
24
|
Dropdown,
|
|
25
25
|
TextControl,
|
|
@@ -31,11 +31,12 @@ import {
|
|
|
31
31
|
import { useMergeRefs } from '@wordpress/compose';
|
|
32
32
|
import { __ } from '@wordpress/i18n';
|
|
33
33
|
import { keyboardReturn } from '@wordpress/icons';
|
|
34
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Internal dependencies
|
|
37
38
|
*/
|
|
38
|
-
import {
|
|
39
|
+
import { getSocialService } from './social-list';
|
|
39
40
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
40
41
|
|
|
41
42
|
const SocialLinkURLPopover = ( {
|
|
@@ -108,6 +109,7 @@ const SocialLinkEdit = ( {
|
|
|
108
109
|
isSelected,
|
|
109
110
|
setAttributes,
|
|
110
111
|
clientId,
|
|
112
|
+
name,
|
|
111
113
|
} ) => {
|
|
112
114
|
const { url, service, label = '', rel } = attributes;
|
|
113
115
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
@@ -138,8 +140,17 @@ const SocialLinkEdit = ( {
|
|
|
138
140
|
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
139
141
|
const isContentOnlyMode = useBlockEditingMode() === 'contentOnly';
|
|
140
142
|
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
+
const { activeVariation } = useSelect(
|
|
144
|
+
( select ) => {
|
|
145
|
+
const { getActiveBlockVariation } = select( blocksStore );
|
|
146
|
+
return {
|
|
147
|
+
activeVariation: getActiveBlockVariation( name, attributes ),
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
[ name, attributes ]
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const { icon, label: socialLinkName } = getSocialService( activeVariation );
|
|
143
154
|
// The initial label (ie. the link text) is an empty string.
|
|
144
155
|
// We want to prevent empty links so that the link text always fallbacks to
|
|
145
156
|
// the social name, even when users enter and save an empty string or only
|
|
@@ -167,7 +178,7 @@ const SocialLinkEdit = ( {
|
|
|
167
178
|
// to edit this attribute.
|
|
168
179
|
<BlockControls group="other">
|
|
169
180
|
<Dropdown
|
|
170
|
-
popoverProps={ {
|
|
181
|
+
popoverProps={ { placement: 'bottom-start' } }
|
|
171
182
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
172
183
|
<ToolbarButton
|
|
173
184
|
onClick={ onToggle }
|
|
@@ -258,7 +269,7 @@ const SocialLinkEdit = ( {
|
|
|
258
269
|
*/
|
|
259
270
|
/* eslint-disable jsx-a11y/no-redundant-roles */ }
|
|
260
271
|
<button aria-haspopup="dialog" { ...blockProps } role="button">
|
|
261
|
-
<
|
|
272
|
+
<Icon icon={ icon } />
|
|
262
273
|
<span
|
|
263
274
|
className={ clsx( 'wp-block-social-link-label', {
|
|
264
275
|
'screen-reader-text': ! showLabels,
|
|
@@ -20,10 +20,12 @@ import { compose } from '@wordpress/compose';
|
|
|
20
20
|
import { __, sprintf } from '@wordpress/i18n';
|
|
21
21
|
import { link, Icon } from '@wordpress/icons';
|
|
22
22
|
import { withSelect } from '@wordpress/data';
|
|
23
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
24
|
+
|
|
23
25
|
/**
|
|
24
26
|
* Internal dependencies
|
|
25
27
|
*/
|
|
26
|
-
import {
|
|
28
|
+
import { getSocialService } from './social-list';
|
|
27
29
|
import styles from './editor.scss';
|
|
28
30
|
|
|
29
31
|
const DEFAULT_ACTIVE_ICON_STYLES = {
|
|
@@ -54,6 +56,7 @@ const SocialLinkEdit = ( {
|
|
|
54
56
|
isSelected,
|
|
55
57
|
onFocus,
|
|
56
58
|
name,
|
|
59
|
+
activeVariation,
|
|
57
60
|
} ) => {
|
|
58
61
|
const { url, service = name } = attributes;
|
|
59
62
|
const [ isLinkSheetVisible, setIsLinkSheetVisible ] = useState( false );
|
|
@@ -64,8 +67,7 @@ const SocialLinkEdit = ( {
|
|
|
64
67
|
DEFAULT_ACTIVE_ICON_STYLES;
|
|
65
68
|
const animatedValue = useRef( new Animated.Value( 0 ) ).current;
|
|
66
69
|
|
|
67
|
-
const
|
|
68
|
-
const socialLinkName = getNameBySite( service );
|
|
70
|
+
const { icon, label: socialLinkName } = getSocialService( activeVariation );
|
|
69
71
|
|
|
70
72
|
// When new social icon is added link sheet is opened automatically.
|
|
71
73
|
useEffect( () => {
|
|
@@ -190,7 +192,7 @@ const SocialLinkEdit = ( {
|
|
|
190
192
|
>
|
|
191
193
|
<Icon
|
|
192
194
|
animated
|
|
193
|
-
icon={
|
|
195
|
+
icon={ icon() }
|
|
194
196
|
style={ { color: activeIcon.color } }
|
|
195
197
|
/>
|
|
196
198
|
</Animated.View>
|
|
@@ -202,12 +204,16 @@ const SocialLinkEdit = ( {
|
|
|
202
204
|
export default compose( [
|
|
203
205
|
withSelect( ( select, { clientId } ) => {
|
|
204
206
|
const { getBlock } = select( blockEditorStore );
|
|
207
|
+
const { getActiveBlockVariation } = select( blocksStore );
|
|
205
208
|
|
|
206
209
|
const block = getBlock( clientId );
|
|
207
210
|
const name = block?.name.substring( 17 );
|
|
208
211
|
|
|
209
212
|
return {
|
|
210
213
|
name,
|
|
214
|
+
activeVariation: block
|
|
215
|
+
? getActiveBlockVariation( block.name, block.attributes )
|
|
216
|
+
: undefined,
|
|
211
217
|
};
|
|
212
218
|
} ),
|
|
213
219
|
] )( SocialLinkEdit );
|