@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/avatar/edit.js
CHANGED
|
@@ -12,10 +12,11 @@ import {
|
|
|
12
12
|
__experimentalUseBorderProps as useBorderProps,
|
|
13
13
|
} from '@wordpress/block-editor';
|
|
14
14
|
import {
|
|
15
|
-
PanelBody,
|
|
16
15
|
RangeControl,
|
|
17
16
|
ResizableBox,
|
|
18
17
|
ToggleControl,
|
|
18
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
19
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
19
20
|
} from '@wordpress/components';
|
|
20
21
|
import { __, isRTL } from '@wordpress/i18n';
|
|
21
22
|
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
@@ -23,7 +24,8 @@ import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
|
23
24
|
/**
|
|
24
25
|
* Internal dependencies
|
|
25
26
|
*/
|
|
26
|
-
import {
|
|
27
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
28
|
+
import { useCommentAvatar, useUserAvatar } from './hooks';
|
|
27
29
|
import UserControl from './user-control';
|
|
28
30
|
|
|
29
31
|
const AvatarInspectorControls = ( {
|
|
@@ -31,56 +33,102 @@ const AvatarInspectorControls = ( {
|
|
|
31
33
|
avatar,
|
|
32
34
|
attributes,
|
|
33
35
|
selectUser,
|
|
34
|
-
} ) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
onChange={ ( newSize ) =>
|
|
36
|
+
} ) => {
|
|
37
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
38
|
+
return (
|
|
39
|
+
<InspectorControls>
|
|
40
|
+
<ToolsPanel
|
|
41
|
+
label={ __( 'Settings' ) }
|
|
42
|
+
resetAll={ () => {
|
|
42
43
|
setAttributes( {
|
|
43
|
-
size:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
setAttributes( {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
44
|
+
size: 96,
|
|
45
|
+
isLink: false,
|
|
46
|
+
linkTarget: '_self',
|
|
47
|
+
userId: undefined,
|
|
48
|
+
} );
|
|
49
|
+
} }
|
|
50
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
51
|
+
>
|
|
52
|
+
<ToolsPanelItem
|
|
53
|
+
label={ __( 'Image size' ) }
|
|
54
|
+
isShownByDefault
|
|
55
|
+
hasValue={ () => attributes?.size !== 96 }
|
|
56
|
+
onDeselect={ () => setAttributes( { size: 96 } ) }
|
|
57
|
+
>
|
|
58
|
+
<RangeControl
|
|
59
|
+
__nextHasNoMarginBottom
|
|
60
|
+
__next40pxDefaultSize
|
|
61
|
+
label={ __( 'Image size' ) }
|
|
62
|
+
onChange={ ( newSize ) =>
|
|
63
|
+
setAttributes( {
|
|
64
|
+
size: newSize,
|
|
65
|
+
} )
|
|
66
|
+
}
|
|
67
|
+
min={ avatar.minSize }
|
|
68
|
+
max={ avatar.maxSize }
|
|
69
|
+
initialPosition={ attributes?.size }
|
|
70
|
+
value={ attributes?.size }
|
|
71
|
+
/>
|
|
72
|
+
</ToolsPanelItem>
|
|
73
|
+
<ToolsPanelItem
|
|
74
|
+
label={ __( 'Link to user profile' ) }
|
|
75
|
+
isShownByDefault
|
|
76
|
+
hasValue={ () => attributes?.isLink }
|
|
77
|
+
onDeselect={ () => setAttributes( { isLink: false } ) }
|
|
78
|
+
>
|
|
79
|
+
<ToggleControl
|
|
80
|
+
__nextHasNoMarginBottom
|
|
81
|
+
label={ __( 'Link to user profile' ) }
|
|
82
|
+
onChange={ () =>
|
|
83
|
+
setAttributes( { isLink: ! attributes.isLink } )
|
|
84
|
+
}
|
|
85
|
+
checked={ attributes.isLink }
|
|
86
|
+
/>
|
|
87
|
+
</ToolsPanelItem>
|
|
88
|
+
{ attributes.isLink && (
|
|
89
|
+
<ToolsPanelItem
|
|
90
|
+
label={ __( 'Open in new tab' ) }
|
|
91
|
+
isShownByDefault
|
|
92
|
+
hasValue={ () => attributes?.linkTarget !== '_self' }
|
|
93
|
+
onDeselect={ () =>
|
|
94
|
+
setAttributes( { linkTarget: '_self' } )
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<ToggleControl
|
|
98
|
+
__nextHasNoMarginBottom
|
|
99
|
+
label={ __( 'Open in new tab' ) }
|
|
100
|
+
onChange={ ( value ) =>
|
|
101
|
+
setAttributes( {
|
|
102
|
+
linkTarget: value ? '_blank' : '_self',
|
|
103
|
+
} )
|
|
104
|
+
}
|
|
105
|
+
checked={ attributes.linkTarget === '_blank' }
|
|
106
|
+
/>
|
|
107
|
+
</ToolsPanelItem>
|
|
108
|
+
) }
|
|
109
|
+
{ selectUser && (
|
|
110
|
+
<ToolsPanelItem
|
|
111
|
+
label={ __( 'User' ) }
|
|
112
|
+
isShownByDefault
|
|
113
|
+
hasValue={ () => !! attributes?.userId }
|
|
114
|
+
onDeselect={ () =>
|
|
115
|
+
setAttributes( { userId: undefined } )
|
|
116
|
+
}
|
|
117
|
+
>
|
|
118
|
+
<UserControl
|
|
119
|
+
value={ attributes?.userId }
|
|
120
|
+
onChange={ ( value ) => {
|
|
121
|
+
setAttributes( {
|
|
122
|
+
userId: value,
|
|
123
|
+
} );
|
|
124
|
+
} }
|
|
125
|
+
/>
|
|
126
|
+
</ToolsPanelItem>
|
|
127
|
+
) }
|
|
128
|
+
</ToolsPanel>
|
|
129
|
+
</InspectorControls>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
84
132
|
|
|
85
133
|
const ResizableAvatar = ( {
|
|
86
134
|
setAttributes,
|
|
@@ -5,31 +5,45 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import { ComboboxControl } from '@wordpress/components';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
import { useState } from '@wordpress/element';
|
|
8
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
9
|
+
import { debounce } from '@wordpress/compose';
|
|
10
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
11
|
|
|
10
12
|
const AUTHORS_QUERY = {
|
|
11
13
|
who: 'authors',
|
|
12
|
-
per_page:
|
|
14
|
+
per_page: 100,
|
|
13
15
|
_fields: 'id,name',
|
|
14
16
|
context: 'view',
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
function UserControl( { value, onChange } ) {
|
|
18
|
-
const [
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, [] );
|
|
23
|
-
if ( ! authorsList ) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
19
|
+
export default function UserControl( { value, onChange } ) {
|
|
20
|
+
const [ filterValue, setFilterValue ] = useState( '' );
|
|
21
|
+
const { authors, isLoading } = useSelect(
|
|
22
|
+
( select ) => {
|
|
23
|
+
const { getUsers, isResolving } = select( coreStore );
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
const query = { ...AUTHORS_QUERY };
|
|
26
|
+
if ( filterValue ) {
|
|
27
|
+
query.search = filterValue;
|
|
28
|
+
query.search_columns = [ 'name' ];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
authors: getUsers( query ),
|
|
33
|
+
isLoading: isResolving( 'getUsers', [ query ] ),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
[ filterValue ]
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const options = useMemo( () => {
|
|
40
|
+
return ( authors ?? [] ).map( ( author ) => {
|
|
41
|
+
return {
|
|
42
|
+
value: author.id,
|
|
43
|
+
label: decodeEntities( author.name ),
|
|
44
|
+
};
|
|
45
|
+
} );
|
|
46
|
+
}, [ authors ] );
|
|
33
47
|
|
|
34
48
|
return (
|
|
35
49
|
<ComboboxControl
|
|
@@ -41,18 +55,9 @@ function UserControl( { value, onChange } ) {
|
|
|
41
55
|
) }
|
|
42
56
|
value={ value }
|
|
43
57
|
onChange={ onChange }
|
|
44
|
-
options={
|
|
45
|
-
onFilterValueChange={ (
|
|
46
|
-
|
|
47
|
-
options.filter( ( option ) =>
|
|
48
|
-
option.label
|
|
49
|
-
.toLowerCase()
|
|
50
|
-
.startsWith( inputValue.toLowerCase() )
|
|
51
|
-
)
|
|
52
|
-
)
|
|
53
|
-
}
|
|
58
|
+
options={ options }
|
|
59
|
+
onFilterValueChange={ debounce( setFilterValue, 300 ) }
|
|
60
|
+
isLoading={ isLoading }
|
|
54
61
|
/>
|
|
55
62
|
);
|
|
56
63
|
}
|
|
57
|
-
|
|
58
|
-
export default UserControl;
|
package/src/button/edit.js
CHANGED
|
@@ -10,6 +10,7 @@ import { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';
|
|
|
10
10
|
import { getUpdatedLinkAttributes } from './get-updated-link-attributes';
|
|
11
11
|
import removeAnchorTag from '../utils/remove-anchor-tag';
|
|
12
12
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
13
|
+
import { unlock } from '../lock-unlock';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* WordPress dependencies
|
|
@@ -47,6 +48,7 @@ import {
|
|
|
47
48
|
useBlockEditingMode,
|
|
48
49
|
getTypographyClassesAndStyles as useTypographyProps,
|
|
49
50
|
useSettings,
|
|
51
|
+
privateApis as blockEditorPrivateApis,
|
|
50
52
|
} from '@wordpress/block-editor';
|
|
51
53
|
import { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';
|
|
52
54
|
import { link, linkOff } from '@wordpress/icons';
|
|
@@ -59,6 +61,8 @@ import {
|
|
|
59
61
|
import { useMergeRefs, useRefEffect } from '@wordpress/compose';
|
|
60
62
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
61
63
|
|
|
64
|
+
const { HTMLElementControl } = unlock( blockEditorPrivateApis );
|
|
65
|
+
|
|
62
66
|
const LINK_SETTINGS = [
|
|
63
67
|
...LinkControl.DEFAULT_LINK_SETTINGS,
|
|
64
68
|
{
|
|
@@ -325,6 +329,10 @@ function ButtonEdit( props ) {
|
|
|
325
329
|
},
|
|
326
330
|
} );
|
|
327
331
|
|
|
332
|
+
const hasNonContentControls = blockEditingMode === 'default';
|
|
333
|
+
const hasBlockControls =
|
|
334
|
+
hasNonContentControls || ( isLinkTag && ! lockUrlControls );
|
|
335
|
+
|
|
328
336
|
return (
|
|
329
337
|
<>
|
|
330
338
|
<div
|
|
@@ -374,35 +382,32 @@ function ButtonEdit( props ) {
|
|
|
374
382
|
identifier="text"
|
|
375
383
|
/>
|
|
376
384
|
</div>
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
/>
|
|
404
|
-
) }
|
|
405
|
-
</BlockControls>
|
|
385
|
+
{ hasBlockControls && (
|
|
386
|
+
<BlockControls group="block">
|
|
387
|
+
{ hasNonContentControls && (
|
|
388
|
+
<AlignmentControl
|
|
389
|
+
value={ textAlign }
|
|
390
|
+
onChange={ ( nextAlign ) => {
|
|
391
|
+
setAttributes( { textAlign: nextAlign } );
|
|
392
|
+
} }
|
|
393
|
+
/>
|
|
394
|
+
) }
|
|
395
|
+
{ isLinkTag && ! lockUrlControls && (
|
|
396
|
+
<ToolbarButton
|
|
397
|
+
name="link"
|
|
398
|
+
icon={ ! isURLSet ? link : linkOff }
|
|
399
|
+
title={ ! isURLSet ? __( 'Link' ) : __( 'Unlink' ) }
|
|
400
|
+
shortcut={
|
|
401
|
+
! isURLSet
|
|
402
|
+
? displayShortcut.primary( 'k' )
|
|
403
|
+
: displayShortcut.primaryShift( 'k' )
|
|
404
|
+
}
|
|
405
|
+
onClick={ ! isURLSet ? startEditing : unlink }
|
|
406
|
+
isActive={ isURLSet }
|
|
407
|
+
/>
|
|
408
|
+
) }
|
|
409
|
+
</BlockControls>
|
|
410
|
+
) }
|
|
406
411
|
{ isLinkTag &&
|
|
407
412
|
isSelected &&
|
|
408
413
|
( isEditingURL || isURLSet ) &&
|
|
@@ -455,6 +460,16 @@ function ButtonEdit( props ) {
|
|
|
455
460
|
/>
|
|
456
461
|
</InspectorControls>
|
|
457
462
|
<InspectorControls group="advanced">
|
|
463
|
+
<HTMLElementControl
|
|
464
|
+
tagName={ tagName }
|
|
465
|
+
onChange={ ( value ) =>
|
|
466
|
+
setAttributes( { tagName: value } )
|
|
467
|
+
}
|
|
468
|
+
options={ [
|
|
469
|
+
{ label: __( 'Default (<a>)' ), value: 'a' },
|
|
470
|
+
{ label: '<button>', value: 'button' },
|
|
471
|
+
] }
|
|
472
|
+
/>
|
|
458
473
|
{ isLinkTag && (
|
|
459
474
|
<TextControl
|
|
460
475
|
__next40pxDefaultSize
|
package/src/calendar/style.scss
CHANGED
|
@@ -19,16 +19,6 @@
|
|
|
19
19
|
width: 100%;
|
|
20
20
|
border-collapse: collapse;
|
|
21
21
|
|
|
22
|
-
&:where(:not(.has-text-color)) {
|
|
23
|
-
color: #40464d;
|
|
24
|
-
|
|
25
|
-
// Keep the hard-coded border color for backward compatibility.
|
|
26
|
-
th,
|
|
27
|
-
td {
|
|
28
|
-
border-color: $gray-300;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
22
|
&.has-background th {
|
|
33
23
|
background-color: inherit;
|
|
34
24
|
}
|
|
@@ -37,6 +27,16 @@
|
|
|
37
27
|
color: inherit;
|
|
38
28
|
}
|
|
39
29
|
}
|
|
30
|
+
|
|
31
|
+
:where(table:not(.has-text-color)) {
|
|
32
|
+
color: #40464d;
|
|
33
|
+
|
|
34
|
+
// Keep the hard-coded border color for backward compatibility.
|
|
35
|
+
th,
|
|
36
|
+
td {
|
|
37
|
+
border-color: $gray-300;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// Keep the hard-coded header background color for backward compatibility.
|
package/src/columns/edit.js
CHANGED
|
@@ -153,7 +153,6 @@ function ColumnInspectorControls( {
|
|
|
153
153
|
<ToolsPanel
|
|
154
154
|
label={ __( 'Settings' ) }
|
|
155
155
|
resetAll={ () => {
|
|
156
|
-
updateColumns( count, minCount );
|
|
157
156
|
setAttributes( {
|
|
158
157
|
isStackedOnMobile: true,
|
|
159
158
|
} );
|
|
@@ -161,36 +160,26 @@ function ColumnInspectorControls( {
|
|
|
161
160
|
dropdownMenuProps={ dropdownMenuProps }
|
|
162
161
|
>
|
|
163
162
|
{ canInsertColumnBlock && (
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
/>
|
|
185
|
-
{ count > 6 && (
|
|
186
|
-
<Notice status="warning" isDismissible={ false }>
|
|
187
|
-
{ __(
|
|
188
|
-
'This column count exceeds the recommended amount and may cause visual breakage.'
|
|
189
|
-
) }
|
|
190
|
-
</Notice>
|
|
191
|
-
) }
|
|
192
|
-
</VStack>
|
|
193
|
-
</ToolsPanelItem>
|
|
163
|
+
<VStack spacing={ 4 } style={ { gridColumn: '1 / -1' } }>
|
|
164
|
+
<RangeControl
|
|
165
|
+
__nextHasNoMarginBottom
|
|
166
|
+
__next40pxDefaultSize
|
|
167
|
+
label={ __( 'Columns' ) }
|
|
168
|
+
value={ count }
|
|
169
|
+
onChange={ ( value ) =>
|
|
170
|
+
updateColumns( count, Math.max( minCount, value ) )
|
|
171
|
+
}
|
|
172
|
+
min={ Math.max( 1, minCount ) }
|
|
173
|
+
max={ Math.max( 6, count ) }
|
|
174
|
+
/>
|
|
175
|
+
{ count > 6 && (
|
|
176
|
+
<Notice status="warning" isDismissible={ false }>
|
|
177
|
+
{ __(
|
|
178
|
+
'This column count exceeds the recommended amount and may cause visual breakage.'
|
|
179
|
+
) }
|
|
180
|
+
</Notice>
|
|
181
|
+
) }
|
|
182
|
+
</VStack>
|
|
194
183
|
) }
|
|
195
184
|
<ToolsPanelItem
|
|
196
185
|
label={ __( 'Stack on mobile' ) }
|
|
@@ -15,7 +15,16 @@ import {
|
|
|
15
15
|
useBlockProps,
|
|
16
16
|
} from '@wordpress/block-editor';
|
|
17
17
|
import { store as coreStore } from '@wordpress/core-data';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
ToggleControl,
|
|
20
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
21
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
22
|
+
} from '@wordpress/components';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
19
28
|
|
|
20
29
|
/**
|
|
21
30
|
* Renders the `core/comment-author-name` block on the editor.
|
|
@@ -36,6 +45,7 @@ export default function Edit( {
|
|
|
36
45
|
context: { commentId },
|
|
37
46
|
setAttributes,
|
|
38
47
|
} ) {
|
|
48
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
39
49
|
const blockProps = useBlockProps( {
|
|
40
50
|
className: clsx( {
|
|
41
51
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
@@ -70,26 +80,57 @@ export default function Edit( {
|
|
|
70
80
|
|
|
71
81
|
const inspectorControls = (
|
|
72
82
|
<InspectorControls>
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
<ToolsPanel
|
|
84
|
+
label={ __( 'Settings' ) }
|
|
85
|
+
resetAll={ () => {
|
|
86
|
+
setAttributes( {
|
|
87
|
+
isLink: true,
|
|
88
|
+
linkTarget: '_self',
|
|
89
|
+
} );
|
|
90
|
+
} }
|
|
91
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
92
|
+
>
|
|
93
|
+
<ToolsPanelItem
|
|
76
94
|
label={ __( 'Link to authors URL' ) }
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
95
|
+
isShownByDefault
|
|
96
|
+
hasValue={ () => ! isLink }
|
|
97
|
+
onDeselect={ () =>
|
|
98
|
+
setAttributes( {
|
|
99
|
+
isLink: true,
|
|
100
|
+
} )
|
|
101
|
+
}
|
|
102
|
+
>
|
|
81
103
|
<ToggleControl
|
|
82
104
|
__nextHasNoMarginBottom
|
|
105
|
+
label={ __( 'Link to authors URL' ) }
|
|
106
|
+
onChange={ () => setAttributes( { isLink: ! isLink } ) }
|
|
107
|
+
checked={ isLink }
|
|
108
|
+
/>
|
|
109
|
+
</ToolsPanelItem>
|
|
110
|
+
{ isLink && (
|
|
111
|
+
<ToolsPanelItem
|
|
83
112
|
label={ __( 'Open in new tab' ) }
|
|
84
|
-
|
|
113
|
+
isShownByDefault
|
|
114
|
+
hasValue={ () => linkTarget !== '_self' }
|
|
115
|
+
onDeselect={ () =>
|
|
85
116
|
setAttributes( {
|
|
86
|
-
linkTarget:
|
|
117
|
+
linkTarget: '_self',
|
|
87
118
|
} )
|
|
88
119
|
}
|
|
89
|
-
|
|
90
|
-
|
|
120
|
+
>
|
|
121
|
+
<ToggleControl
|
|
122
|
+
__nextHasNoMarginBottom
|
|
123
|
+
label={ __( 'Open in new tab' ) }
|
|
124
|
+
onChange={ ( value ) =>
|
|
125
|
+
setAttributes( {
|
|
126
|
+
linkTarget: value ? '_blank' : '_self',
|
|
127
|
+
} )
|
|
128
|
+
}
|
|
129
|
+
checked={ linkTarget === '_blank' }
|
|
130
|
+
/>
|
|
131
|
+
</ToolsPanelItem>
|
|
91
132
|
) }
|
|
92
|
-
</
|
|
133
|
+
</ToolsPanel>
|
|
93
134
|
</InspectorControls>
|
|
94
135
|
);
|
|
95
136
|
|
package/src/comment-date/edit.js
CHANGED
|
@@ -12,9 +12,18 @@ import {
|
|
|
12
12
|
useBlockProps,
|
|
13
13
|
__experimentalDateFormatPicker as DateFormatPicker,
|
|
14
14
|
} from '@wordpress/block-editor';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
17
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
18
|
+
ToggleControl,
|
|
19
|
+
} from '@wordpress/components';
|
|
16
20
|
import { __, _x } from '@wordpress/i18n';
|
|
17
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
26
|
+
|
|
18
27
|
/**
|
|
19
28
|
* Renders the `core/comment-date` block on the editor.
|
|
20
29
|
*
|
|
@@ -34,6 +43,8 @@ export default function Edit( {
|
|
|
34
43
|
setAttributes,
|
|
35
44
|
} ) {
|
|
36
45
|
const blockProps = useBlockProps();
|
|
46
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
47
|
+
|
|
37
48
|
let [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );
|
|
38
49
|
const [ siteFormat = getDateSettings().formats.date ] = useEntityProp(
|
|
39
50
|
'root',
|
|
@@ -43,21 +54,45 @@ export default function Edit( {
|
|
|
43
54
|
|
|
44
55
|
const inspectorControls = (
|
|
45
56
|
<InspectorControls>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
<ToolsPanel
|
|
58
|
+
label={ __( 'Settings' ) }
|
|
59
|
+
resetAll={ () => {
|
|
60
|
+
setAttributes( {
|
|
61
|
+
format: undefined,
|
|
62
|
+
isLink: true,
|
|
63
|
+
} );
|
|
64
|
+
} }
|
|
65
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
66
|
+
>
|
|
67
|
+
<ToolsPanelItem
|
|
68
|
+
label={ __( 'Date format' ) }
|
|
69
|
+
hasValue={ () => format !== undefined }
|
|
70
|
+
onDeselect={ () => setAttributes( { format: undefined } ) }
|
|
71
|
+
isShownByDefault
|
|
72
|
+
>
|
|
73
|
+
<DateFormatPicker
|
|
74
|
+
format={ format }
|
|
75
|
+
defaultFormat={ siteFormat }
|
|
76
|
+
onChange={ ( nextFormat ) =>
|
|
77
|
+
setAttributes( { format: nextFormat } )
|
|
78
|
+
}
|
|
79
|
+
/>
|
|
80
|
+
</ToolsPanelItem>
|
|
81
|
+
|
|
82
|
+
<ToolsPanelItem
|
|
56
83
|
label={ __( 'Link to comment' ) }
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
hasValue={ () => ! isLink }
|
|
85
|
+
onDeselect={ () => setAttributes( { isLink: true } ) }
|
|
86
|
+
isShownByDefault
|
|
87
|
+
>
|
|
88
|
+
<ToggleControl
|
|
89
|
+
__nextHasNoMarginBottom
|
|
90
|
+
label={ __( 'Link to comment' ) }
|
|
91
|
+
onChange={ () => setAttributes( { isLink: ! isLink } ) }
|
|
92
|
+
checked={ isLink }
|
|
93
|
+
/>
|
|
94
|
+
</ToolsPanelItem>
|
|
95
|
+
</ToolsPanel>
|
|
61
96
|
</InspectorControls>
|
|
62
97
|
);
|
|
63
98
|
|