@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/file/inspector.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
|
-
PanelBody,
|
|
7
6
|
RangeControl,
|
|
8
7
|
SelectControl,
|
|
9
8
|
ToggleControl,
|
|
9
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
10
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
10
11
|
} from '@wordpress/components';
|
|
11
12
|
import { InspectorControls } from '@wordpress/block-editor';
|
|
12
13
|
|
|
@@ -14,6 +15,7 @@ import { InspectorControls } from '@wordpress/block-editor';
|
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
17
|
import { MIN_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT } from './edit';
|
|
18
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
17
19
|
|
|
18
20
|
export default function FileBlockInspector( {
|
|
19
21
|
hrefs,
|
|
@@ -28,6 +30,7 @@ export default function FileBlockInspector( {
|
|
|
28
30
|
changePreviewHeight,
|
|
29
31
|
} ) {
|
|
30
32
|
const { href, textLinkHref, attachmentPage } = hrefs;
|
|
33
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
31
34
|
|
|
32
35
|
let linkDestinationOptions = [ { value: href, label: __( 'URL' ) } ];
|
|
33
36
|
if ( attachmentPage ) {
|
|
@@ -41,58 +44,109 @@ export default function FileBlockInspector( {
|
|
|
41
44
|
<>
|
|
42
45
|
<InspectorControls>
|
|
43
46
|
{ href.endsWith( '.pdf' ) && (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
<ToolsPanel
|
|
48
|
+
label={ __( 'PDF settings' ) }
|
|
49
|
+
resetAll={ () => {
|
|
50
|
+
changeDisplayPreview( true );
|
|
51
|
+
changePreviewHeight( 600 );
|
|
52
|
+
} }
|
|
53
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
54
|
+
>
|
|
55
|
+
<ToolsPanelItem
|
|
47
56
|
label={ __( 'Show inline embed' ) }
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
: null
|
|
54
|
-
}
|
|
55
|
-
checked={ !! displayPreview }
|
|
56
|
-
onChange={ changeDisplayPreview }
|
|
57
|
-
/>
|
|
58
|
-
{ displayPreview && (
|
|
59
|
-
<RangeControl
|
|
57
|
+
isShownByDefault
|
|
58
|
+
hasValue={ () => ! displayPreview }
|
|
59
|
+
onDeselect={ () => changeDisplayPreview( true ) }
|
|
60
|
+
>
|
|
61
|
+
<ToggleControl
|
|
60
62
|
__nextHasNoMarginBottom
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
label={ __( 'Show inline embed' ) }
|
|
64
|
+
help={
|
|
65
|
+
displayPreview
|
|
66
|
+
? __(
|
|
67
|
+
"Note: Most phone and tablet browsers won't display embedded PDFs."
|
|
68
|
+
)
|
|
69
|
+
: null
|
|
70
|
+
}
|
|
71
|
+
checked={ !! displayPreview }
|
|
72
|
+
onChange={ changeDisplayPreview }
|
|
70
73
|
/>
|
|
74
|
+
</ToolsPanelItem>
|
|
75
|
+
{ displayPreview && (
|
|
76
|
+
<ToolsPanelItem
|
|
77
|
+
label={ __( 'Height in pixels' ) }
|
|
78
|
+
isShownByDefault
|
|
79
|
+
hasValue={ () => previewHeight !== 600 }
|
|
80
|
+
onDeselect={ () => changePreviewHeight( 600 ) }
|
|
81
|
+
>
|
|
82
|
+
<RangeControl
|
|
83
|
+
__nextHasNoMarginBottom
|
|
84
|
+
__next40pxDefaultSize
|
|
85
|
+
label={ __( 'Height in pixels' ) }
|
|
86
|
+
min={ MIN_PREVIEW_HEIGHT }
|
|
87
|
+
max={ Math.max(
|
|
88
|
+
MAX_PREVIEW_HEIGHT,
|
|
89
|
+
previewHeight
|
|
90
|
+
) }
|
|
91
|
+
value={ previewHeight }
|
|
92
|
+
onChange={ changePreviewHeight }
|
|
93
|
+
/>
|
|
94
|
+
</ToolsPanelItem>
|
|
71
95
|
) }
|
|
72
|
-
</
|
|
96
|
+
</ToolsPanel>
|
|
73
97
|
) }
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
98
|
+
|
|
99
|
+
<ToolsPanel
|
|
100
|
+
label={ __( 'Settings' ) }
|
|
101
|
+
resetAll={ () => {
|
|
102
|
+
changeLinkDestinationOption( href );
|
|
103
|
+
changeOpenInNewWindow( false );
|
|
104
|
+
changeShowDownloadButton( true );
|
|
105
|
+
} }
|
|
106
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
107
|
+
>
|
|
108
|
+
<ToolsPanelItem
|
|
78
109
|
label={ __( 'Link to' ) }
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
110
|
+
isShownByDefault
|
|
111
|
+
hasValue={ () => textLinkHref !== href }
|
|
112
|
+
onDeselect={ () => changeLinkDestinationOption( href ) }
|
|
113
|
+
>
|
|
114
|
+
<SelectControl
|
|
115
|
+
__next40pxDefaultSize
|
|
116
|
+
__nextHasNoMarginBottom
|
|
117
|
+
label={ __( 'Link to' ) }
|
|
118
|
+
value={ textLinkHref }
|
|
119
|
+
options={ linkDestinationOptions }
|
|
120
|
+
onChange={ changeLinkDestinationOption }
|
|
121
|
+
/>
|
|
122
|
+
</ToolsPanelItem>
|
|
123
|
+
<ToolsPanelItem
|
|
85
124
|
label={ __( 'Open in new tab' ) }
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
125
|
+
isShownByDefault
|
|
126
|
+
hasValue={ () => !! openInNewWindow }
|
|
127
|
+
onDeselect={ () => changeOpenInNewWindow( false ) }
|
|
128
|
+
>
|
|
129
|
+
<ToggleControl
|
|
130
|
+
__nextHasNoMarginBottom
|
|
131
|
+
label={ __( 'Open in new tab' ) }
|
|
132
|
+
checked={ openInNewWindow }
|
|
133
|
+
onChange={ changeOpenInNewWindow }
|
|
134
|
+
/>
|
|
135
|
+
</ToolsPanelItem>
|
|
136
|
+
<ToolsPanelItem
|
|
91
137
|
label={ __( 'Show download button' ) }
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
138
|
+
isShownByDefault
|
|
139
|
+
hasValue={ () => ! showDownloadButton }
|
|
140
|
+
onDeselect={ () => changeShowDownloadButton( true ) }
|
|
141
|
+
>
|
|
142
|
+
<ToggleControl
|
|
143
|
+
__nextHasNoMarginBottom
|
|
144
|
+
label={ __( 'Show download button' ) }
|
|
145
|
+
checked={ showDownloadButton }
|
|
146
|
+
onChange={ changeShowDownloadButton }
|
|
147
|
+
/>
|
|
148
|
+
</ToolsPanelItem>
|
|
149
|
+
</ToolsPanel>
|
|
96
150
|
</InspectorControls>
|
|
97
151
|
</>
|
|
98
152
|
);
|
package/src/form/block.json
CHANGED
package/src/form/edit.js
CHANGED
|
@@ -9,12 +9,18 @@ import {
|
|
|
9
9
|
InspectorControls,
|
|
10
10
|
store as blockEditorStore,
|
|
11
11
|
} from '@wordpress/block-editor';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
SelectControl,
|
|
14
|
+
TextControl,
|
|
15
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
16
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
17
|
+
} from '@wordpress/components';
|
|
13
18
|
import { useSelect } from '@wordpress/data';
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* Internal dependencies
|
|
17
22
|
*/
|
|
23
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
18
24
|
import {
|
|
19
25
|
formSubmissionNotificationSuccess,
|
|
20
26
|
formSubmissionNotificationError,
|
|
@@ -51,6 +57,17 @@ const TEMPLATE = [
|
|
|
51
57
|
];
|
|
52
58
|
|
|
53
59
|
const Edit = ( { attributes, setAttributes, clientId } ) => {
|
|
60
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
61
|
+
|
|
62
|
+
const resetAllSettings = () => {
|
|
63
|
+
setAttributes( {
|
|
64
|
+
submissionMethod: 'email',
|
|
65
|
+
email: undefined,
|
|
66
|
+
action: undefined,
|
|
67
|
+
method: 'post',
|
|
68
|
+
} );
|
|
69
|
+
};
|
|
70
|
+
|
|
54
71
|
const { action, method, email, submissionMethod } = attributes;
|
|
55
72
|
const blockProps = useBlockProps();
|
|
56
73
|
|
|
@@ -75,58 +92,86 @@ const Edit = ( { attributes, setAttributes, clientId } ) => {
|
|
|
75
92
|
return (
|
|
76
93
|
<>
|
|
77
94
|
<InspectorControls>
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
<ToolsPanel
|
|
96
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
97
|
+
label={ __( 'Settings' ) }
|
|
98
|
+
resetAll={ resetAllSettings }
|
|
99
|
+
>
|
|
100
|
+
<ToolsPanelItem
|
|
101
|
+
hasValue={ () => submissionMethod !== 'email' }
|
|
82
102
|
label={ __( 'Submissions method' ) }
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
value: 'email',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
label: __( '- Custom -' ),
|
|
91
|
-
value: 'custom',
|
|
92
|
-
},
|
|
93
|
-
] }
|
|
94
|
-
value={ submissionMethod }
|
|
95
|
-
onChange={ ( value ) =>
|
|
96
|
-
setAttributes( { submissionMethod: value } )
|
|
97
|
-
}
|
|
98
|
-
help={
|
|
99
|
-
submissionMethod === 'custom'
|
|
100
|
-
? __(
|
|
101
|
-
'Select the method to use for form submissions. Additional options for the "custom" mode can be found in the "Advanced" section.'
|
|
102
|
-
)
|
|
103
|
-
: __(
|
|
104
|
-
'Select the method to use for form submissions.'
|
|
105
|
-
)
|
|
103
|
+
onDeselect={ () =>
|
|
104
|
+
setAttributes( {
|
|
105
|
+
submissionMethod: 'email',
|
|
106
|
+
} )
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<
|
|
108
|
+
isShownByDefault
|
|
109
|
+
>
|
|
110
|
+
<SelectControl
|
|
110
111
|
__nextHasNoMarginBottom
|
|
111
112
|
__next40pxDefaultSize
|
|
112
|
-
|
|
113
|
+
label={ __( 'Submissions method' ) }
|
|
114
|
+
options={ [
|
|
115
|
+
// TODO: Allow plugins to add their own submission methods.
|
|
116
|
+
{
|
|
117
|
+
label: __( 'Send email' ),
|
|
118
|
+
value: 'email',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: __( '- Custom -' ),
|
|
122
|
+
value: 'custom',
|
|
123
|
+
},
|
|
124
|
+
] }
|
|
125
|
+
value={ submissionMethod }
|
|
126
|
+
onChange={ ( value ) =>
|
|
127
|
+
setAttributes( { submissionMethod: value } )
|
|
128
|
+
}
|
|
129
|
+
help={
|
|
130
|
+
submissionMethod === 'custom'
|
|
131
|
+
? __(
|
|
132
|
+
'Select the method to use for form submissions. Additional options for the "custom" mode can be found in the "Advanced" section.'
|
|
133
|
+
)
|
|
134
|
+
: __(
|
|
135
|
+
'Select the method to use for form submissions.'
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
/>
|
|
139
|
+
</ToolsPanelItem>
|
|
140
|
+
{ submissionMethod === 'email' && (
|
|
141
|
+
<ToolsPanelItem
|
|
142
|
+
hasValue={ () => !! email }
|
|
113
143
|
label={ __( 'Email for form submissions' ) }
|
|
114
|
-
|
|
115
|
-
required
|
|
116
|
-
onChange={ ( value ) => {
|
|
117
|
-
setAttributes( { email: value } );
|
|
144
|
+
onDeselect={ () =>
|
|
118
145
|
setAttributes( {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
146
|
+
email: undefined,
|
|
147
|
+
action: undefined,
|
|
148
|
+
method: 'post',
|
|
149
|
+
} )
|
|
150
|
+
}
|
|
151
|
+
isShownByDefault
|
|
152
|
+
>
|
|
153
|
+
<TextControl
|
|
154
|
+
__nextHasNoMarginBottom
|
|
155
|
+
__next40pxDefaultSize
|
|
156
|
+
autoComplete="off"
|
|
157
|
+
label={ __( 'Email for form submissions' ) }
|
|
158
|
+
value={ email || '' }
|
|
159
|
+
required
|
|
160
|
+
onChange={ ( value ) => {
|
|
161
|
+
setAttributes( { email: value } );
|
|
162
|
+
setAttributes( {
|
|
163
|
+
action: `mailto:${ value }`,
|
|
164
|
+
} );
|
|
165
|
+
setAttributes( { method: 'post' } );
|
|
166
|
+
} }
|
|
167
|
+
help={ __(
|
|
168
|
+
'The email address where form submissions will be sent. Separate multiple email addresses with a comma.'
|
|
169
|
+
) }
|
|
170
|
+
type="email"
|
|
171
|
+
/>
|
|
172
|
+
</ToolsPanelItem>
|
|
128
173
|
) }
|
|
129
|
-
</
|
|
174
|
+
</ToolsPanel>
|
|
130
175
|
</InspectorControls>
|
|
131
176
|
{ submissionMethod !== 'email' && (
|
|
132
177
|
<InspectorControls group="advanced">
|
|
@@ -166,7 +211,6 @@ const Edit = ( { attributes, setAttributes, clientId } ) => {
|
|
|
166
211
|
) }
|
|
167
212
|
<form
|
|
168
213
|
{ ...innerBlocksProps }
|
|
169
|
-
className="wp-block-form"
|
|
170
214
|
encType={ submissionMethod === 'email' ? 'text/plain' : null }
|
|
171
215
|
/>
|
|
172
216
|
</>
|
package/src/form/index.js
CHANGED
package/src/form-input/edit.js
CHANGED
|
@@ -14,14 +14,24 @@ import {
|
|
|
14
14
|
__experimentalUseBorderProps as useBorderProps,
|
|
15
15
|
__experimentalUseColorProps as useColorProps,
|
|
16
16
|
} from '@wordpress/block-editor';
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import {
|
|
18
|
+
TextControl,
|
|
19
|
+
CheckboxControl,
|
|
20
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
21
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
22
|
+
} from '@wordpress/components';
|
|
19
23
|
import { useRef } from '@wordpress/element';
|
|
20
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
29
|
+
|
|
21
30
|
function InputFieldBlock( { attributes, setAttributes, className } ) {
|
|
22
31
|
const { type, name, label, inlineLabel, required, placeholder, value } =
|
|
23
32
|
attributes;
|
|
24
33
|
const blockProps = useBlockProps();
|
|
34
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
25
35
|
const ref = useRef();
|
|
26
36
|
const TagName = type === 'textarea' ? 'textarea' : 'input';
|
|
27
37
|
|
|
@@ -38,30 +48,58 @@ function InputFieldBlock( { attributes, setAttributes, className } ) {
|
|
|
38
48
|
<>
|
|
39
49
|
{ 'hidden' !== type && (
|
|
40
50
|
<InspectorControls>
|
|
41
|
-
<
|
|
51
|
+
<ToolsPanel
|
|
52
|
+
label={ __( 'Settings' ) }
|
|
53
|
+
resetAll={ () => {
|
|
54
|
+
setAttributes( {
|
|
55
|
+
inlineLabel: false,
|
|
56
|
+
required: false,
|
|
57
|
+
} );
|
|
58
|
+
} }
|
|
59
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
60
|
+
>
|
|
42
61
|
{ 'checkbox' !== type && (
|
|
62
|
+
<ToolsPanelItem
|
|
63
|
+
label={ __( 'Inline label' ) }
|
|
64
|
+
hasValue={ () => !! inlineLabel }
|
|
65
|
+
onDeselect={ () =>
|
|
66
|
+
setAttributes( { inlineLabel: false } )
|
|
67
|
+
}
|
|
68
|
+
isShownByDefault
|
|
69
|
+
>
|
|
70
|
+
<CheckboxControl
|
|
71
|
+
__nextHasNoMarginBottom
|
|
72
|
+
label={ __( 'Inline label' ) }
|
|
73
|
+
checked={ inlineLabel }
|
|
74
|
+
onChange={ ( newVal ) => {
|
|
75
|
+
setAttributes( {
|
|
76
|
+
inlineLabel: newVal,
|
|
77
|
+
} );
|
|
78
|
+
} }
|
|
79
|
+
/>
|
|
80
|
+
</ToolsPanelItem>
|
|
81
|
+
) }
|
|
82
|
+
|
|
83
|
+
<ToolsPanelItem
|
|
84
|
+
label={ __( 'Required' ) }
|
|
85
|
+
hasValue={ () => !! required }
|
|
86
|
+
onDeselect={ () =>
|
|
87
|
+
setAttributes( { required: false } )
|
|
88
|
+
}
|
|
89
|
+
isShownByDefault
|
|
90
|
+
>
|
|
43
91
|
<CheckboxControl
|
|
44
92
|
__nextHasNoMarginBottom
|
|
45
|
-
label={ __( '
|
|
46
|
-
checked={
|
|
93
|
+
label={ __( 'Required' ) }
|
|
94
|
+
checked={ required }
|
|
47
95
|
onChange={ ( newVal ) => {
|
|
48
96
|
setAttributes( {
|
|
49
|
-
|
|
97
|
+
required: newVal,
|
|
50
98
|
} );
|
|
51
99
|
} }
|
|
52
100
|
/>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
__nextHasNoMarginBottom
|
|
56
|
-
label={ __( 'Required' ) }
|
|
57
|
-
checked={ required }
|
|
58
|
-
onChange={ ( newVal ) => {
|
|
59
|
-
setAttributes( {
|
|
60
|
-
required: newVal,
|
|
61
|
-
} );
|
|
62
|
-
} }
|
|
63
|
-
/>
|
|
64
|
-
</PanelBody>
|
|
101
|
+
</ToolsPanelItem>
|
|
102
|
+
</ToolsPanel>
|
|
65
103
|
</InspectorControls>
|
|
66
104
|
) }
|
|
67
105
|
<InspectorControls group="advanced">
|
package/src/form-input/index.js
CHANGED
package/src/gallery/style.scss
CHANGED
package/src/image/image.js
CHANGED
package/src/image/index.php
CHANGED
|
@@ -204,6 +204,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
204
204
|
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
|
|
205
205
|
)
|
|
206
206
|
);
|
|
207
|
+
$p->set_attribute( 'data-wp-key', $unique_image_id );
|
|
207
208
|
|
|
208
209
|
// Image.
|
|
209
210
|
$p->next_tag( 'img' );
|
|
@@ -272,12 +273,14 @@ function block_core_image_print_lightbox_overlay() {
|
|
|
272
273
|
<div
|
|
273
274
|
class="wp-lightbox-overlay zoom"
|
|
274
275
|
data-wp-interactive="core/image"
|
|
276
|
+
data-wp-router-region='{ "id": "core/image-overlay", "attachTo": "body" }'
|
|
277
|
+
data-wp-key="wp-lightbox-overlay"
|
|
275
278
|
data-wp-context='{}'
|
|
276
279
|
data-wp-bind--role="state.roleAttribute"
|
|
277
280
|
data-wp-bind--aria-label="state.currentImage.ariaLabel"
|
|
278
281
|
data-wp-bind--aria-modal="state.ariaModal"
|
|
279
282
|
data-wp-class--active="state.overlayEnabled"
|
|
280
|
-
data-wp-class--show-closing-animation="state.
|
|
283
|
+
data-wp-class--show-closing-animation="state.overlayOpened"
|
|
281
284
|
data-wp-watch="callbacks.setOverlayFocus"
|
|
282
285
|
data-wp-on--keydown="actions.handleKeydown"
|
|
283
286
|
data-wp-on-async--touchstart="actions.handleTouchStart"
|
package/src/image/view.js
CHANGED
|
@@ -110,9 +110,6 @@ const { state, actions, callbacks } = store(
|
|
|
110
110
|
},
|
|
111
111
|
hideLightbox() {
|
|
112
112
|
if ( state.overlayEnabled ) {
|
|
113
|
-
// Starts the overlay closing animation. The showClosingAnimation
|
|
114
|
-
// class is used to avoid showing it on page load.
|
|
115
|
-
state.showClosingAnimation = true;
|
|
116
113
|
state.overlayEnabled = false;
|
|
117
114
|
|
|
118
115
|
// Waits until the close animation has completed before allowing a
|