@wordpress/block-library 8.20.1 → 8.21.1-next.f8d8eceb.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 +7 -0
- package/README.md +12 -0
- package/build/avatar/index.js +5 -1
- package/build/avatar/index.js.map +1 -1
- package/build/block/edit-title.native.js +11 -3
- package/build/block/edit-title.native.js.map +1 -1
- package/build/block/index.js +2 -1
- package/build/block/index.js.map +1 -1
- package/build/code/edit.native.js +8 -2
- package/build/code/edit.native.js.map +1 -1
- package/build/column/edit.js +2 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +2 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/edit.native.js +2 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/cover/controls.native.js +2 -1
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js +110 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/index.js +11 -4
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +3 -3
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/index.js +0 -3
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +2 -1
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +1 -1
- package/build/cover/shared.js.map +1 -1
- package/build/file/view.js +1 -1
- package/build/file/view.js.map +1 -1
- package/build/footnotes/index.js +1 -0
- package/build/footnotes/index.js.map +1 -1
- package/build/form/edit.js +138 -0
- package/build/form/edit.js.map +1 -0
- package/build/form/index.js +92 -0
- package/build/form/index.js.map +1 -0
- package/build/form/init.js +13 -0
- package/build/form/init.js.map +1 -0
- package/build/form/save.js +28 -0
- package/build/form/save.js.map +1 -0
- package/build/form/utils.js +24 -0
- package/build/form/utils.js.map +1 -0
- package/build/form/variations.js +95 -0
- package/build/form/variations.js.map +1 -0
- package/build/form/view.js +42 -0
- package/build/form/view.js.map +1 -0
- package/build/form-input/edit.js +124 -0
- package/build/form-input/edit.js.map +1 -0
- package/build/form-input/index.js +105 -0
- package/build/form-input/index.js.map +1 -0
- package/build/form-input/init.js +13 -0
- package/build/form-input/init.js.map +1 -0
- package/build/form-input/save.js +87 -0
- package/build/form-input/save.js.map +1 -0
- package/build/form-input/variations.js +93 -0
- package/build/form-input/variations.js.map +1 -0
- package/build/form-submission-notification/edit.js +59 -0
- package/build/form-submission-notification/edit.js.map +1 -0
- package/build/form-submission-notification/index.js +56 -0
- package/build/form-submission-notification/index.js.map +1 -0
- package/build/form-submission-notification/init.js +13 -0
- package/build/form-submission-notification/init.js.map +1 -0
- package/build/form-submission-notification/save.js +33 -0
- package/build/form-submission-notification/save.js.map +1 -0
- package/build/form-submission-notification/variations.js +63 -0
- package/build/form-submission-notification/variations.js.map +1 -0
- package/build/form-submit-button/edit.js +32 -0
- package/build/form-submit-button/edit.js.map +1 -0
- package/build/form-submit-button/index.js +44 -0
- package/build/form-submit-button/index.js.map +1 -0
- package/build/form-submit-button/init.js +13 -0
- package/build/form-submit-button/init.js.map +1 -0
- package/build/form-submit-button/save.js +22 -0
- package/build/form-submit-button/save.js.map +1 -0
- package/build/group/edit.js +2 -11
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +0 -1
- package/build/group/index.js.map +1 -1
- package/build/heading/index.js +3 -2
- package/build/heading/index.js.map +1 -1
- package/build/html/preview.js +2 -4
- package/build/html/preview.js.map +1 -1
- package/build/image/image.js +15 -6
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +71 -39
- package/build/image/view.js.map +1 -1
- package/build/index.js +10 -0
- package/build/index.js.map +1 -1
- package/build/latest-posts/edit.js +6 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +15 -15
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/missing/edit.native.js +54 -64
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/edit/index.js +0 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/index.js +2 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view.js +27 -5
- package/build/navigation/view.js.map +1 -1
- package/build/page-list-item/edit.js +3 -1
- package/build/page-list-item/edit.js.map +1 -1
- package/build/paragraph/edit.js +1 -1
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/index.js +7 -0
- package/build/paragraph/index.js.map +1 -1
- package/build/pattern/index.js +2 -1
- package/build/pattern/index.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +2 -2
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +27 -13
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +15 -12
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/utils.js +29 -8
- package/build/query/utils.js.map +1 -1
- package/build/query/view.js +4 -2
- package/build/query/view.js.map +1 -1
- package/build/search/edit.js +1 -2
- package/build/search/edit.js.map +1 -1
- package/build/social-link/edit.native.js +7 -19
- package/build/social-link/edit.native.js.map +1 -1
- package/build/spacer/controls.js +3 -3
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +2 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +1 -1
- package/build/spacer/edit.js.map +1 -1
- package/build/spacer/edit.native.js +5 -1
- package/build/spacer/edit.native.js.map +1 -1
- package/build/tag-cloud/edit.js +2 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +2 -2
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/index.js +2 -1
- package/build/template-part/index.js.map +1 -1
- package/build/term-description/index.js +0 -1
- package/build/term-description/index.js.map +1 -1
- package/build-module/avatar/index.js +5 -1
- package/build-module/avatar/index.js.map +1 -1
- package/build-module/block/edit-title.native.js +12 -4
- package/build-module/block/edit-title.native.js.map +1 -1
- package/build-module/block/index.js +2 -1
- package/build-module/block/index.js.map +1 -1
- package/build-module/code/edit.native.js +8 -2
- package/build-module/code/edit.native.js.map +1 -1
- package/build-module/column/edit.js +3 -2
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +3 -2
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/edit.native.js +3 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/cover/controls.native.js +3 -2
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +110 -1
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/index.js +12 -5
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +4 -4
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/index.js +0 -3
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +2 -1
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +1 -1
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/file/view.js +2 -2
- package/build-module/file/view.js.map +1 -1
- package/build-module/footnotes/index.js +1 -0
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/form/edit.js +130 -0
- package/build-module/form/edit.js.map +1 -0
- package/build-module/form/index.js +82 -0
- package/build-module/form/index.js.map +1 -0
- package/build-module/form/init.js +6 -0
- package/build-module/form/init.js.map +1 -0
- package/build-module/form/save.js +20 -0
- package/build-module/form/save.js.map +1 -0
- package/build-module/form/utils.js +15 -0
- package/build-module/form/utils.js.map +1 -0
- package/build-module/form/variations.js +86 -0
- package/build-module/form/variations.js.map +1 -0
- package/build-module/form/view.js +40 -0
- package/build-module/form/view.js.map +1 -0
- package/build-module/form-input/edit.js +115 -0
- package/build-module/form-input/edit.js.map +1 -0
- package/build-module/form-input/index.js +95 -0
- package/build-module/form-input/index.js.map +1 -0
- package/build-module/form-input/init.js +6 -0
- package/build-module/form-input/init.js.map +1 -0
- package/build-module/form-input/save.js +80 -0
- package/build-module/form-input/save.js.map +1 -0
- package/build-module/form-input/variations.js +85 -0
- package/build-module/form-input/variations.js.map +1 -0
- package/build-module/form-submission-notification/edit.js +50 -0
- package/build-module/form-submission-notification/edit.js.map +1 -0
- package/build-module/form-submission-notification/index.js +47 -0
- package/build-module/form-submission-notification/index.js.map +1 -0
- package/build-module/form-submission-notification/init.js +6 -0
- package/build-module/form-submission-notification/init.js.map +1 -0
- package/build-module/form-submission-notification/save.js +25 -0
- package/build-module/form-submission-notification/save.js.map +1 -0
- package/build-module/form-submission-notification/variations.js +55 -0
- package/build-module/form-submission-notification/variations.js.map +1 -0
- package/build-module/form-submit-button/edit.js +24 -0
- package/build-module/form-submit-button/edit.js.map +1 -0
- package/build-module/form-submit-button/index.js +34 -0
- package/build-module/form-submit-button/index.js.map +1 -0
- package/build-module/form-submit-button/init.js +6 -0
- package/build-module/form-submit-button/init.js.map +1 -0
- package/build-module/form-submit-button/save.js +14 -0
- package/build-module/form-submit-button/save.js.map +1 -0
- package/build-module/group/edit.js +3 -12
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +0 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/index.js +3 -2
- package/build-module/heading/index.js.map +1 -1
- package/build-module/html/preview.js +2 -4
- package/build-module/html/preview.js.map +1 -1
- package/build-module/image/image.js +16 -7
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +71 -39
- package/build-module/image/view.js.map +1 -1
- package/build-module/index.js +10 -0
- package/build-module/index.js.map +1 -1
- package/build-module/latest-posts/edit.js +6 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +15 -15
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/missing/edit.native.js +58 -68
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +0 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/index.js +2 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view.js +27 -5
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/page-list-item/edit.js +3 -1
- package/build-module/page-list-item/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +2 -2
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/index.js +7 -0
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/pattern/index.js +2 -1
- package/build-module/pattern/index.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +3 -3
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +28 -14
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +17 -14
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/utils.js +27 -5
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query/view.js +4 -2
- package/build-module/query/view.js.map +1 -1
- package/build-module/search/edit.js +2 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +8 -20
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/spacer/controls.js +4 -4
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +3 -2
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +2 -2
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/spacer/edit.native.js +6 -2
- package/build-module/spacer/edit.native.js.map +1 -1
- package/build-module/tag-cloud/edit.js +3 -2
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +3 -3
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/index.js +2 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/term-description/index.js +0 -1
- package/build-module/term-description/index.js.map +1 -1
- package/build-style/editor-rtl.css +50 -0
- package/build-style/editor.css +50 -0
- package/build-style/file/style-rtl.css +0 -5
- package/build-style/file/style.css +0 -5
- package/build-style/form-input/editor-rtl.css +106 -0
- package/build-style/form-input/editor.css +106 -0
- package/build-style/form-input/style-rtl.css +135 -0
- package/build-style/form-input/style.css +135 -0
- package/build-style/form-submission-notification/editor-rtl.css +118 -0
- package/build-style/form-submission-notification/editor.css +118 -0
- package/build-style/form-submit-button/style-rtl.css +91 -0
- package/build-style/form-submit-button/style.css +91 -0
- package/build-style/image/style-rtl.css +39 -5
- package/build-style/image/style.css +39 -5
- package/build-style/navigation/style-rtl.css +5 -0
- package/build-style/navigation/style.css +5 -0
- package/build-style/query/style-rtl.css +0 -10
- package/build-style/query/style.css +0 -10
- package/build-style/style-rtl.css +92 -10
- package/build-style/style.css +92 -10
- package/package.json +32 -32
- package/src/avatar/block.json +5 -1
- package/src/block/block.json +2 -1
- package/src/block/edit-title.native.js +16 -13
- package/src/calendar/index.php +2 -6
- package/src/code/edit.native.js +15 -1
- package/src/column/edit.js +3 -8
- package/src/column/edit.native.js +3 -8
- package/src/columns/edit.native.js +3 -8
- package/src/comment-author-avatar/index.php +1 -1
- package/src/cover/block.json +0 -3
- package/src/cover/controls.native.js +3 -8
- package/src/cover/deprecated.js +151 -1
- package/src/cover/edit/index.js +15 -5
- package/src/cover/edit/inspector-controls.js +22 -33
- package/src/cover/save.js +2 -1
- package/src/cover/shared.js +1 -1
- package/src/editor.scss +2 -0
- package/src/file/index.php +2 -1
- package/src/file/style.scss +0 -6
- package/src/file/view.js +2 -2
- package/src/footnotes/block.json +1 -0
- package/src/form/block.json +60 -0
- package/src/form/edit.js +179 -0
- package/src/form/index.js +20 -0
- package/src/form/index.php +214 -0
- package/src/form/init.js +6 -0
- package/src/form/save.js +20 -0
- package/src/form/utils.js +39 -0
- package/src/form/variations.js +139 -0
- package/src/form/view.js +41 -0
- package/src/form-input/block.json +73 -0
- package/src/form-input/edit.js +151 -0
- package/src/form-input/editor.scss +24 -0
- package/src/form-input/index.js +20 -0
- package/src/form-input/index.php +45 -0
- package/src/form-input/init.js +6 -0
- package/src/form-input/save.js +83 -0
- package/src/form-input/style.scss +61 -0
- package/src/form-input/variations.js +82 -0
- package/src/form-submission-notification/block.json +19 -0
- package/src/form-submission-notification/edit.js +63 -0
- package/src/form-submission-notification/editor.scss +45 -0
- package/src/form-submission-notification/index.js +26 -0
- package/src/form-submission-notification/index.php +48 -0
- package/src/form-submission-notification/init.js +6 -0
- package/src/form-submission-notification/save.js +28 -0
- package/src/form-submission-notification/variations.js +59 -0
- package/src/form-submit-button/block.json +14 -0
- package/src/form-submit-button/edit.js +33 -0
- package/src/form-submit-button/index.js +18 -0
- package/src/form-submit-button/init.js +6 -0
- package/src/form-submit-button/save.js +14 -0
- package/src/form-submit-button/style.scss +3 -0
- package/src/freeform/test/__snapshots__/index.native.js.snap +7 -0
- package/src/freeform/test/index.native.js +57 -0
- package/src/group/block.json +0 -1
- package/src/group/edit.js +2 -7
- package/src/heading/index.js +4 -2
- package/src/html/preview.js +9 -4
- package/src/image/image.js +27 -6
- package/src/image/index.php +128 -83
- package/src/image/style.scss +49 -5
- package/src/image/view.js +93 -51
- package/src/index.js +10 -0
- package/src/latest-posts/edit.js +11 -2
- package/src/latest-posts/index.php +17 -8
- package/src/list-item/hooks/use-merge.js +20 -23
- package/src/lock-unlock.js +1 -1
- package/src/missing/edit.native.js +56 -117
- package/src/missing/style.native.scss +0 -67
- package/src/missing/test/edit-integration.native.js +135 -49
- package/src/missing/test/edit.native.js +0 -41
- package/src/navigation/block.json +2 -1
- package/src/navigation/edit/index.js +0 -1
- package/src/navigation/index.php +28 -8
- package/src/navigation/style.scss +6 -1
- package/src/navigation/view.js +25 -6
- package/src/page-list-item/edit.js +2 -0
- package/src/paragraph/edit.js +2 -2
- package/src/paragraph/index.js +10 -0
- package/src/pattern/block.json +2 -1
- package/src/pattern/index.php +0 -3
- package/src/post-featured-image/dimension-controls.js +3 -3
- package/src/post-navigation-link/index.php +2 -1
- package/src/preformatted/test/edit.native.js +38 -0
- package/src/query/edit/enhanced-pagination-modal.js +37 -21
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +18 -22
- package/src/query/index.php +100 -10
- package/src/query/style.scss +0 -11
- package/src/query/utils.js +29 -8
- package/src/query/view.js +11 -2
- package/src/query-pagination-next/index.php +1 -1
- package/src/query-pagination-previous/index.php +1 -1
- package/src/search/edit.js +5 -3
- package/src/search/index.php +0 -4
- package/src/social-link/edit.native.js +12 -26
- package/src/social-link/editor.native.scss +0 -9
- package/src/social-link/index.php +2 -2
- package/src/spacer/controls.js +9 -12
- package/src/spacer/controls.native.js +3 -8
- package/src/spacer/edit.js +2 -2
- package/src/spacer/edit.native.js +6 -5
- package/src/style.scss +1 -0
- package/src/tag-cloud/edit.js +3 -7
- package/src/template-part/block.json +2 -1
- package/src/template-part/edit/inner-blocks.js +3 -3
- package/src/template-part/index.php +4 -7
- package/src/term-description/block.json +0 -1
- package/src/verse/test/edit.native.js +37 -0
package/src/cover/block.json
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { plus } from '@wordpress/icons';
|
|
23
23
|
import { useState, useCallback, useRef } from '@wordpress/element';
|
|
24
24
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
25
|
-
import {
|
|
25
|
+
import { useSettings, MediaUpload } from '@wordpress/block-editor';
|
|
26
26
|
import { __ } from '@wordpress/i18n';
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -68,14 +68,9 @@ function Controls( {
|
|
|
68
68
|
[ minHeight ]
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
+
const [ availableUnits ] = useSettings( 'spacing.units' );
|
|
71
72
|
const units = useCustomUnits( {
|
|
72
|
-
availableUnits:
|
|
73
|
-
'px',
|
|
74
|
-
'em',
|
|
75
|
-
'rem',
|
|
76
|
-
'vw',
|
|
77
|
-
'vh',
|
|
78
|
-
],
|
|
73
|
+
availableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],
|
|
79
74
|
defaultValues: { px: 430, em: 20, rem: 20, vw: 20, vh: 50 },
|
|
80
75
|
} );
|
|
81
76
|
|
package/src/cover/deprecated.js
CHANGED
|
@@ -244,6 +244,156 @@ const v12BlockSupports = {
|
|
|
244
244
|
},
|
|
245
245
|
};
|
|
246
246
|
|
|
247
|
+
// Deprecation for blocks that does not have the aria-label when the image background is fixed or repeated.
|
|
248
|
+
const v13 = {
|
|
249
|
+
attributes: v12BlockAttributes,
|
|
250
|
+
supports: v12BlockSupports,
|
|
251
|
+
save( { attributes } ) {
|
|
252
|
+
const {
|
|
253
|
+
backgroundType,
|
|
254
|
+
gradient,
|
|
255
|
+
contentPosition,
|
|
256
|
+
customGradient,
|
|
257
|
+
customOverlayColor,
|
|
258
|
+
dimRatio,
|
|
259
|
+
focalPoint,
|
|
260
|
+
useFeaturedImage,
|
|
261
|
+
hasParallax,
|
|
262
|
+
isDark,
|
|
263
|
+
isRepeated,
|
|
264
|
+
overlayColor,
|
|
265
|
+
url,
|
|
266
|
+
alt,
|
|
267
|
+
id,
|
|
268
|
+
minHeight: minHeightProp,
|
|
269
|
+
minHeightUnit,
|
|
270
|
+
tagName: Tag,
|
|
271
|
+
} = attributes;
|
|
272
|
+
const overlayColorClass = getColorClassName(
|
|
273
|
+
'background-color',
|
|
274
|
+
overlayColor
|
|
275
|
+
);
|
|
276
|
+
const gradientClass = __experimentalGetGradientClass( gradient );
|
|
277
|
+
const minHeight =
|
|
278
|
+
minHeightProp && minHeightUnit
|
|
279
|
+
? `${ minHeightProp }${ minHeightUnit }`
|
|
280
|
+
: minHeightProp;
|
|
281
|
+
|
|
282
|
+
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
283
|
+
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
284
|
+
|
|
285
|
+
const isImgElement = ! ( hasParallax || isRepeated );
|
|
286
|
+
|
|
287
|
+
const style = {
|
|
288
|
+
minHeight: minHeight || undefined,
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const bgStyle = {
|
|
292
|
+
backgroundColor: ! overlayColorClass
|
|
293
|
+
? customOverlayColor
|
|
294
|
+
: undefined,
|
|
295
|
+
background: customGradient ? customGradient : undefined,
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const objectPosition =
|
|
299
|
+
// prettier-ignore
|
|
300
|
+
focalPoint && isImgElement
|
|
301
|
+
? mediaPosition(focalPoint)
|
|
302
|
+
: undefined;
|
|
303
|
+
|
|
304
|
+
const backgroundImage = url ? `url(${ url })` : undefined;
|
|
305
|
+
|
|
306
|
+
const backgroundPosition = mediaPosition( focalPoint );
|
|
307
|
+
|
|
308
|
+
const classes = classnames(
|
|
309
|
+
{
|
|
310
|
+
'is-light': ! isDark,
|
|
311
|
+
'has-parallax': hasParallax,
|
|
312
|
+
'is-repeated': isRepeated,
|
|
313
|
+
'has-custom-content-position':
|
|
314
|
+
! isContentPositionCenter( contentPosition ),
|
|
315
|
+
},
|
|
316
|
+
getPositionClassName( contentPosition )
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
const imgClasses = classnames(
|
|
320
|
+
'wp-block-cover__image-background',
|
|
321
|
+
id ? `wp-image-${ id }` : null,
|
|
322
|
+
{
|
|
323
|
+
'has-parallax': hasParallax,
|
|
324
|
+
'is-repeated': isRepeated,
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
const gradientValue = gradient || customGradient;
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<Tag { ...useBlockProps.save( { className: classes, style } ) }>
|
|
332
|
+
<span
|
|
333
|
+
aria-hidden="true"
|
|
334
|
+
className={ classnames(
|
|
335
|
+
'wp-block-cover__background',
|
|
336
|
+
overlayColorClass,
|
|
337
|
+
dimRatioToClass( dimRatio ),
|
|
338
|
+
{
|
|
339
|
+
'has-background-dim': dimRatio !== undefined,
|
|
340
|
+
// For backwards compatibility. Former versions of the Cover Block applied
|
|
341
|
+
// `.wp-block-cover__gradient-background` in the presence of
|
|
342
|
+
// media, a gradient and a dim.
|
|
343
|
+
'wp-block-cover__gradient-background':
|
|
344
|
+
url && gradientValue && dimRatio !== 0,
|
|
345
|
+
'has-background-gradient': gradientValue,
|
|
346
|
+
[ gradientClass ]: gradientClass,
|
|
347
|
+
}
|
|
348
|
+
) }
|
|
349
|
+
style={ bgStyle }
|
|
350
|
+
/>
|
|
351
|
+
|
|
352
|
+
{ ! useFeaturedImage &&
|
|
353
|
+
isImageBackground &&
|
|
354
|
+
url &&
|
|
355
|
+
( isImgElement ? (
|
|
356
|
+
<img
|
|
357
|
+
className={ imgClasses }
|
|
358
|
+
alt={ alt }
|
|
359
|
+
src={ url }
|
|
360
|
+
style={ { objectPosition } }
|
|
361
|
+
data-object-fit="cover"
|
|
362
|
+
data-object-position={ objectPosition }
|
|
363
|
+
/>
|
|
364
|
+
) : (
|
|
365
|
+
<div
|
|
366
|
+
role="img"
|
|
367
|
+
className={ imgClasses }
|
|
368
|
+
style={ { backgroundPosition, backgroundImage } }
|
|
369
|
+
/>
|
|
370
|
+
) ) }
|
|
371
|
+
{ isVideoBackground && url && (
|
|
372
|
+
<video
|
|
373
|
+
className={ classnames(
|
|
374
|
+
'wp-block-cover__video-background',
|
|
375
|
+
'intrinsic-ignore'
|
|
376
|
+
) }
|
|
377
|
+
autoPlay
|
|
378
|
+
muted
|
|
379
|
+
loop
|
|
380
|
+
playsInline
|
|
381
|
+
src={ url }
|
|
382
|
+
style={ { objectPosition } }
|
|
383
|
+
data-object-fit="cover"
|
|
384
|
+
data-object-position={ objectPosition }
|
|
385
|
+
/>
|
|
386
|
+
) }
|
|
387
|
+
<div
|
|
388
|
+
{ ...useInnerBlocksProps.save( {
|
|
389
|
+
className: 'wp-block-cover__inner-container',
|
|
390
|
+
} ) }
|
|
391
|
+
/>
|
|
392
|
+
</Tag>
|
|
393
|
+
);
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
|
|
247
397
|
// Deprecation for blocks to prevent auto overlay color from overriding previously set values.
|
|
248
398
|
const v12 = {
|
|
249
399
|
attributes: v12BlockAttributes,
|
|
@@ -1673,4 +1823,4 @@ const v1 = {
|
|
|
1673
1823
|
},
|
|
1674
1824
|
};
|
|
1675
1825
|
|
|
1676
|
-
export default [ v12, v11, v10, v9, v8, v7, v6, v5, v4, v3, v2, v1 ];
|
|
1826
|
+
export default [ v13, v12, v11, v10, v9, v8, v7, v6, v5, v4, v3, v2, v1 ];
|
package/src/cover/edit/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
withColors,
|
|
15
15
|
ColorPalette,
|
|
16
16
|
useBlockProps,
|
|
17
|
-
|
|
17
|
+
useSettings,
|
|
18
18
|
useInnerBlocksProps,
|
|
19
19
|
__experimentalUseGradient,
|
|
20
20
|
store as blockEditorStore,
|
|
@@ -166,9 +166,12 @@ function CoverEdit( {
|
|
|
166
166
|
|
|
167
167
|
const onSelectMedia = async ( newMedia ) => {
|
|
168
168
|
const mediaAttributes = attributesFromMedia( newMedia );
|
|
169
|
+
const isImage = [ newMedia?.type, newMedia?.media_type ].includes(
|
|
170
|
+
IMAGE_BACKGROUND_TYPE
|
|
171
|
+
);
|
|
169
172
|
|
|
170
173
|
const averageBackgroundColor = await getMediaColor(
|
|
171
|
-
|
|
174
|
+
isImage ? newMedia?.url : undefined
|
|
172
175
|
);
|
|
173
176
|
|
|
174
177
|
let newOverlayColor = overlayColor.color;
|
|
@@ -180,7 +183,12 @@ function CoverEdit( {
|
|
|
180
183
|
__unstableMarkNextChangeAsNotPersistent();
|
|
181
184
|
}
|
|
182
185
|
|
|
183
|
-
|
|
186
|
+
// Only set a new dimRatio if there was no previous media selected
|
|
187
|
+
// to avoid resetting to 50 if it has been explicitly set to 100.
|
|
188
|
+
// See issue #52835 for context.
|
|
189
|
+
const newDimRatio =
|
|
190
|
+
originalUrl === undefined && dimRatio === 100 ? 50 : dimRatio;
|
|
191
|
+
|
|
184
192
|
const newIsDark = compositeIsDark(
|
|
185
193
|
newDimRatio,
|
|
186
194
|
newOverlayColor,
|
|
@@ -310,7 +318,8 @@ function CoverEdit( {
|
|
|
310
318
|
const blockProps = useBlockProps( { ref } );
|
|
311
319
|
|
|
312
320
|
// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.
|
|
313
|
-
const
|
|
321
|
+
const [ fontSizes ] = useSettings( 'typography.fontSizes' );
|
|
322
|
+
const hasFontSizes = fontSizes?.length > 0;
|
|
314
323
|
const innerBlocksTemplate = getInnerBlocksTemplate( {
|
|
315
324
|
fontSize: hasFontSizes ? 'large' : undefined,
|
|
316
325
|
} );
|
|
@@ -531,7 +540,8 @@ function CoverEdit( {
|
|
|
531
540
|
) : (
|
|
532
541
|
<div
|
|
533
542
|
ref={ mediaElement }
|
|
534
|
-
role=
|
|
543
|
+
role={ alt ? 'img' : undefined }
|
|
544
|
+
aria-label={ alt ? alt : undefined }
|
|
535
545
|
className={ classnames(
|
|
536
546
|
classes,
|
|
537
547
|
'wp-block-cover__image-background'
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { useInstanceId } from '@wordpress/compose';
|
|
21
21
|
import {
|
|
22
22
|
InspectorControls,
|
|
23
|
-
|
|
23
|
+
useSettings,
|
|
24
24
|
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
|
|
25
25
|
__experimentalUseGradient,
|
|
26
26
|
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
@@ -42,14 +42,9 @@ function CoverHeightInput( {
|
|
|
42
42
|
const inputId = `block-cover-height-input-${ instanceId }`;
|
|
43
43
|
const isPx = unit === 'px';
|
|
44
44
|
|
|
45
|
+
const [ availableUnits ] = useSettings( 'spacing.units' );
|
|
45
46
|
const units = useCustomUnits( {
|
|
46
|
-
availableUnits:
|
|
47
|
-
'px',
|
|
48
|
-
'em',
|
|
49
|
-
'rem',
|
|
50
|
-
'vw',
|
|
51
|
-
'vh',
|
|
52
|
-
],
|
|
47
|
+
availableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],
|
|
53
48
|
defaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },
|
|
54
49
|
} );
|
|
55
50
|
|
|
@@ -112,7 +107,6 @@ export default function CoverInspectorControls( {
|
|
|
112
107
|
isImageBackground,
|
|
113
108
|
mediaElement,
|
|
114
109
|
url,
|
|
115
|
-
isImgElement,
|
|
116
110
|
overlayColor,
|
|
117
111
|
} = currentSettings;
|
|
118
112
|
|
|
@@ -202,32 +196,27 @@ export default function CoverInspectorControls( {
|
|
|
202
196
|
}
|
|
203
197
|
/>
|
|
204
198
|
) }
|
|
205
|
-
{ ! useFeaturedImage &&
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
help={
|
|
217
|
-
<>
|
|
218
|
-
<ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
|
|
219
|
-
{ __(
|
|
220
|
-
'Describe the purpose of the image.'
|
|
221
|
-
) }
|
|
222
|
-
</ExternalLink>
|
|
223
|
-
<br />
|
|
199
|
+
{ ! useFeaturedImage && url && ! isVideoBackground && (
|
|
200
|
+
<TextareaControl
|
|
201
|
+
__nextHasNoMarginBottom
|
|
202
|
+
label={ __( 'Alternative text' ) }
|
|
203
|
+
value={ alt }
|
|
204
|
+
onChange={ ( newAlt ) =>
|
|
205
|
+
setAttributes( { alt: newAlt } )
|
|
206
|
+
}
|
|
207
|
+
help={
|
|
208
|
+
<>
|
|
209
|
+
<ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
|
|
224
210
|
{ __(
|
|
225
|
-
'
|
|
211
|
+
'Describe the purpose of the image.'
|
|
226
212
|
) }
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
213
|
+
</ExternalLink>
|
|
214
|
+
<br />
|
|
215
|
+
{ __( 'Leave empty if decorative.' ) }
|
|
216
|
+
</>
|
|
217
|
+
}
|
|
218
|
+
/>
|
|
219
|
+
) }
|
|
231
220
|
<PanelRow>
|
|
232
221
|
<Button
|
|
233
222
|
variant="secondary"
|
package/src/cover/save.js
CHANGED
|
@@ -138,7 +138,8 @@ export default function save( { attributes } ) {
|
|
|
138
138
|
/>
|
|
139
139
|
) : (
|
|
140
140
|
<div
|
|
141
|
-
role=
|
|
141
|
+
role={ alt ? 'img' : undefined }
|
|
142
|
+
aria-label={ alt ? alt : undefined }
|
|
142
143
|
className={ imgClasses }
|
|
143
144
|
style={ { backgroundPosition, backgroundImage } }
|
|
144
145
|
/>
|
package/src/cover/shared.js
CHANGED
|
@@ -29,7 +29,7 @@ export function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function dimRatioToClass( ratio ) {
|
|
32
|
-
return ratio === 50 ||
|
|
32
|
+
return ratio === 50 || ratio === undefined
|
|
33
33
|
? null
|
|
34
34
|
: 'has-background-dim-' + 10 * Math.round( ratio / 10 );
|
|
35
35
|
}
|
package/src/editor.scss
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
@import "./details/editor.scss";
|
|
17
17
|
@import "./embed/editor.scss";
|
|
18
18
|
@import "./file/editor.scss";
|
|
19
|
+
@import "./form-input/editor.scss";
|
|
20
|
+
@import "./form-submission-notification/editor.scss";
|
|
19
21
|
@import "./freeform/editor.scss";
|
|
20
22
|
@import "./gallery/editor.scss";
|
|
21
23
|
@import "./group/editor.scss";
|
package/src/file/index.php
CHANGED
|
@@ -59,7 +59,8 @@ function render_block_core_file( $attributes, $content, $block ) {
|
|
|
59
59
|
$processor->next_tag();
|
|
60
60
|
$processor->set_attribute( 'data-wp-interactive', '' );
|
|
61
61
|
$processor->next_tag( 'object' );
|
|
62
|
-
$processor->set_attribute( 'data-wp-
|
|
62
|
+
$processor->set_attribute( 'data-wp-bind--hidden', '!selectors.core.file.hasPdfPreview' );
|
|
63
|
+
$processor->set_attribute( 'hidden', true );
|
|
63
64
|
return $processor->get_updated_html();
|
|
64
65
|
}
|
|
65
66
|
|
package/src/file/style.scss
CHANGED
|
@@ -29,12 +29,6 @@
|
|
|
29
29
|
margin-bottom: 1em;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
@media (max-width: 768px) {
|
|
33
|
-
.wp-block-file__embed {
|
|
34
|
-
display: none;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
32
|
//This needs a low specificity so it won't override the rules from the button element if defined in theme.json.
|
|
39
33
|
:where(.wp-block-file__button) {
|
|
40
34
|
border-radius: 2em;
|
package/src/file/view.js
CHANGED
|
@@ -5,13 +5,13 @@ import { store } from '@wordpress/interactivity';
|
|
|
5
5
|
/**
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
|
-
import { browserSupportsPdfs } from './utils';
|
|
8
|
+
import { browserSupportsPdfs as hasPdfPreview } from './utils';
|
|
9
9
|
|
|
10
10
|
store( {
|
|
11
11
|
selectors: {
|
|
12
12
|
core: {
|
|
13
13
|
file: {
|
|
14
|
-
hasPdfPreview
|
|
14
|
+
hasPdfPreview,
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
},
|
package/src/footnotes/block.json
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
+
"apiVersion": 3,
|
|
4
|
+
"__experimental": true,
|
|
5
|
+
"name": "core/form",
|
|
6
|
+
"title": "Form",
|
|
7
|
+
"category": "common",
|
|
8
|
+
"description": "A form.",
|
|
9
|
+
"keywords": [ "container", "wrapper", "row", "section" ],
|
|
10
|
+
"textdomain": "default",
|
|
11
|
+
"icon": "feedback",
|
|
12
|
+
"attributes": {
|
|
13
|
+
"submissionMethod": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"default": "email"
|
|
16
|
+
},
|
|
17
|
+
"method": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "post"
|
|
20
|
+
},
|
|
21
|
+
"action": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"email": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"supports": {
|
|
29
|
+
"anchor": true,
|
|
30
|
+
"className": false,
|
|
31
|
+
"color": {
|
|
32
|
+
"gradients": true,
|
|
33
|
+
"link": true,
|
|
34
|
+
"__experimentalDefaultControls": {
|
|
35
|
+
"background": true,
|
|
36
|
+
"text": true,
|
|
37
|
+
"link": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"spacing": {
|
|
41
|
+
"margin": true,
|
|
42
|
+
"padding": true
|
|
43
|
+
},
|
|
44
|
+
"typography": {
|
|
45
|
+
"fontSize": true,
|
|
46
|
+
"lineHeight": true,
|
|
47
|
+
"__experimentalFontFamily": true,
|
|
48
|
+
"__experimentalTextDecoration": true,
|
|
49
|
+
"__experimentalFontStyle": true,
|
|
50
|
+
"__experimentalFontWeight": true,
|
|
51
|
+
"__experimentalLetterSpacing": true,
|
|
52
|
+
"__experimentalTextTransform": true,
|
|
53
|
+
"__experimentalDefaultControls": {
|
|
54
|
+
"fontSize": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"__experimentalSelector": "form"
|
|
58
|
+
},
|
|
59
|
+
"viewScript": "file:./view.min.js"
|
|
60
|
+
}
|
package/src/form/edit.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
InnerBlocks,
|
|
7
|
+
useBlockProps,
|
|
8
|
+
useInnerBlocksProps,
|
|
9
|
+
InspectorControls,
|
|
10
|
+
store as blockEditorStore,
|
|
11
|
+
} from '@wordpress/block-editor';
|
|
12
|
+
import { TextControl, SelectControl, PanelBody } from '@wordpress/components';
|
|
13
|
+
import { useSelect } from '@wordpress/data';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import {
|
|
19
|
+
formSubmissionNotificationSuccess,
|
|
20
|
+
formSubmissionNotificationError,
|
|
21
|
+
} from './utils.js';
|
|
22
|
+
|
|
23
|
+
const ALLOWED_BLOCKS = [
|
|
24
|
+
'core/paragraph',
|
|
25
|
+
'core/heading',
|
|
26
|
+
'core/form-input',
|
|
27
|
+
'core/form-submit-button',
|
|
28
|
+
'core/form-submission-notification',
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const TEMPLATE = [
|
|
32
|
+
formSubmissionNotificationSuccess,
|
|
33
|
+
formSubmissionNotificationError,
|
|
34
|
+
[
|
|
35
|
+
'core/form-input',
|
|
36
|
+
{
|
|
37
|
+
type: 'text',
|
|
38
|
+
label: __( 'Name' ),
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
'core/form-input',
|
|
44
|
+
{
|
|
45
|
+
type: 'email',
|
|
46
|
+
label: __( 'Email' ),
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
'core/form-input',
|
|
52
|
+
{
|
|
53
|
+
type: 'textarea',
|
|
54
|
+
label: __( 'Comment' ),
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
[ 'core/form-submit-button', {} ],
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
const Edit = ( { attributes, setAttributes, clientId } ) => {
|
|
62
|
+
const { action, method, email, submissionMethod } = attributes;
|
|
63
|
+
const blockProps = useBlockProps();
|
|
64
|
+
|
|
65
|
+
const { hasInnerBlocks } = useSelect(
|
|
66
|
+
( select ) => {
|
|
67
|
+
const { getBlock } = select( blockEditorStore );
|
|
68
|
+
const block = getBlock( clientId );
|
|
69
|
+
return {
|
|
70
|
+
hasInnerBlocks: !! ( block && block.innerBlocks.length ),
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
[ clientId ]
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
77
|
+
allowedBlocks: ALLOWED_BLOCKS,
|
|
78
|
+
template: TEMPLATE,
|
|
79
|
+
renderAppender: hasInnerBlocks
|
|
80
|
+
? undefined
|
|
81
|
+
: InnerBlocks.ButtonBlockAppender,
|
|
82
|
+
} );
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<InspectorControls>
|
|
87
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
88
|
+
<SelectControl
|
|
89
|
+
// __nextHasNoMarginBottom
|
|
90
|
+
// size={ '__unstable-large' }
|
|
91
|
+
label={ __( 'Submissions method' ) }
|
|
92
|
+
options={ [
|
|
93
|
+
// TODO: Allow plugins to add their own submission methods.
|
|
94
|
+
{
|
|
95
|
+
label: __( 'Send email' ),
|
|
96
|
+
value: 'email',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: __( '- Custom -' ),
|
|
100
|
+
value: 'custom',
|
|
101
|
+
},
|
|
102
|
+
] }
|
|
103
|
+
value={ submissionMethod }
|
|
104
|
+
onChange={ ( value ) =>
|
|
105
|
+
setAttributes( { submissionMethod: value } )
|
|
106
|
+
}
|
|
107
|
+
help={
|
|
108
|
+
submissionMethod === 'custom'
|
|
109
|
+
? __(
|
|
110
|
+
'Select the method to use for form submissions. Additional options for the "custom" mode can be found in the "Advanced" section.'
|
|
111
|
+
)
|
|
112
|
+
: __(
|
|
113
|
+
'Select the method to use for form submissions.'
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
/>
|
|
117
|
+
{ submissionMethod === 'email' && (
|
|
118
|
+
<TextControl
|
|
119
|
+
__nextHasNoMarginBottom
|
|
120
|
+
autoComplete="off"
|
|
121
|
+
label={ __( 'Email for form submissions' ) }
|
|
122
|
+
value={ email }
|
|
123
|
+
required
|
|
124
|
+
onChange={ ( value ) => {
|
|
125
|
+
setAttributes( { email: value } );
|
|
126
|
+
setAttributes( {
|
|
127
|
+
action: `mailto:${ value }`,
|
|
128
|
+
} );
|
|
129
|
+
setAttributes( { method: 'post' } );
|
|
130
|
+
} }
|
|
131
|
+
help={ __(
|
|
132
|
+
'The email address where form submissions will be sent. Separate multiple email addresses with a comma.'
|
|
133
|
+
) }
|
|
134
|
+
/>
|
|
135
|
+
) }
|
|
136
|
+
</PanelBody>
|
|
137
|
+
</InspectorControls>
|
|
138
|
+
{ submissionMethod !== 'email' && (
|
|
139
|
+
<InspectorControls group="advanced">
|
|
140
|
+
<SelectControl
|
|
141
|
+
__nextHasNoMarginBottom
|
|
142
|
+
label={ __( 'Method' ) }
|
|
143
|
+
options={ [
|
|
144
|
+
{ label: 'Get', value: 'get' },
|
|
145
|
+
{ label: 'Post', value: 'post' },
|
|
146
|
+
] }
|
|
147
|
+
value={ method }
|
|
148
|
+
onChange={ ( value ) =>
|
|
149
|
+
setAttributes( { method: value } )
|
|
150
|
+
}
|
|
151
|
+
help={ __(
|
|
152
|
+
'Select the method to use for form submissions.'
|
|
153
|
+
) }
|
|
154
|
+
/>
|
|
155
|
+
<TextControl
|
|
156
|
+
__nextHasNoMarginBottom
|
|
157
|
+
autoComplete="off"
|
|
158
|
+
label={ __( 'Form action' ) }
|
|
159
|
+
value={ action }
|
|
160
|
+
onChange={ ( newVal ) => {
|
|
161
|
+
setAttributes( {
|
|
162
|
+
action: newVal,
|
|
163
|
+
} );
|
|
164
|
+
} }
|
|
165
|
+
help={ __(
|
|
166
|
+
'The URL where the form should be submitted.'
|
|
167
|
+
) }
|
|
168
|
+
/>
|
|
169
|
+
</InspectorControls>
|
|
170
|
+
) }
|
|
171
|
+
<form
|
|
172
|
+
{ ...innerBlocksProps }
|
|
173
|
+
className="wp-block-form"
|
|
174
|
+
encType={ submissionMethod === 'email' ? 'text/plain' : null }
|
|
175
|
+
/>
|
|
176
|
+
</>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
export default Edit;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import initBlock from '../utils/init-block';
|
|
5
|
+
import edit from './edit';
|
|
6
|
+
import metadata from './block.json';
|
|
7
|
+
import save from './save';
|
|
8
|
+
import variations from './variations';
|
|
9
|
+
|
|
10
|
+
const { name } = metadata;
|
|
11
|
+
|
|
12
|
+
export { metadata, name };
|
|
13
|
+
|
|
14
|
+
export const settings = {
|
|
15
|
+
edit,
|
|
16
|
+
save,
|
|
17
|
+
variations,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const init = () => initBlock( { name, metadata, settings } );
|