@wordpress/block-library 7.3.5 → 7.5.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/archives/edit.js +1 -1
- package/build/archives/edit.js.map +1 -1
- package/build/audio/edit.js +4 -16
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/button/edit.native.js +7 -3
- package/build/button/edit.native.js.map +1 -1
- package/build/categories/edit.js +8 -3
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +4 -0
- package/build/categories/index.js.map +1 -1
- package/build/column/index.js +10 -0
- package/build/column/index.js.map +1 -1
- package/build/comment-template/edit.js +1 -3
- package/build/comment-template/edit.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/{build-module/comments-query-loop → build/comments}/edit/comments-inspector-controls.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit.js +2 -2
- package/build/comments/edit.js.map +1 -0
- package/build/{comments-query-loop → comments}/index.js +1 -1
- package/build/comments/index.js.map +1 -0
- package/build/{comments-query-loop → comments}/save.js +2 -2
- package/build/comments/save.js.map +1 -0
- package/build/cover/edit.js +4 -71
- package/build/cover/edit.js.map +1 -1
- package/build/cover/edit.native.js +36 -15
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/transforms.js +77 -6
- package/build/cover/transforms.js.map +1 -1
- package/build/cover/use-cover-is-dark.js +81 -0
- package/build/cover/use-cover-is-dark.js.map +1 -0
- package/build/cover/use-cover-is-dark.native.js +60 -0
- package/build/cover/use-cover-is-dark.native.js.map +1 -0
- package/build/embed/edit.js +12 -18
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -7
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/util.js +29 -4
- package/build/embed/util.js.map +1 -1
- package/build/file/inspector.js +2 -4
- package/build/file/inspector.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/transforms.js +8 -4
- package/build/heading/transforms.js.map +1 -1
- package/build/html/edit.js +2 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.js +4 -6
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +4 -6
- package/build/index.js.map +1 -1
- package/build/index.native.js +14 -3
- package/build/index.native.js.map +1 -1
- package/build/latest-comments/edit.js +1 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js +49 -0
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/loginout/edit.js +1 -1
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/navigation/edit/index.js +5 -28
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +1 -2
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view-modal.js +62 -0
- package/build/navigation/view-modal.js.map +1 -0
- package/build/navigation/view.js +1 -34
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/paragraph/edit.js +10 -0
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/edit.native.js +6 -2
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/paragraph/use-enter.js +94 -0
- package/build/paragraph/use-enter.js.map +1 -0
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comment/index.js +1 -1
- package/build/post-comments/edit.js +13 -34
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments/index.js +1 -1
- package/build/post-comments-form/edit.js +37 -24
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +48 -0
- package/build/post-comments-form/form.js.map +1 -0
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-terms/edit.js +25 -3
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/index.js +8 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/quote/index.js +7 -0
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +11 -3
- package/build/quote/v2/edit.js.map +1 -1
- package/build/rss/edit.js +1 -1
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +11 -9
- package/build/search/edit.js.map +1 -1
- package/build/separator/index.js +3 -0
- package/build/separator/index.js.map +1 -1
- package/build/spacer/constants.js +9 -0
- package/build/spacer/constants.js.map +1 -0
- package/build/spacer/controls.js +3 -3
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +2 -2
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +5 -6
- package/build/spacer/edit.js.map +1 -1
- package/build/table/edit.js +8 -2
- package/build/table/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/video/edit.js +4 -8
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build-module/archives/edit.js +1 -1
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/edit.js +4 -16
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +1 -1
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/button/edit.native.js +7 -3
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/categories/edit.js +8 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +4 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/column/index.js +10 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-template/edit.js +1 -3
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/edit.js +1 -1
- package/build-module/comments/edit.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/index.js +1 -1
- package/build-module/comments/index.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/save.js +1 -1
- package/build-module/comments/save.js.map +1 -0
- package/build-module/cover/edit.js +4 -71
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/edit.native.js +35 -16
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/transforms.js +74 -6
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/cover/use-cover-is-dark.js +70 -0
- package/build-module/cover/use-cover-is-dark.js.map +1 -0
- package/build-module/cover/use-cover-is-dark.native.js +51 -0
- package/build-module/cover/use-cover-is-dark.native.js.map +1 -0
- package/build-module/embed/edit.js +13 -19
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +2 -8
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/util.js +25 -3
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/inspector.js +2 -4
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/v1/edit.js +1 -1
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/transforms.js +8 -4
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/html/edit.js +2 -2
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.js +4 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +3 -4
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +14 -3
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +51 -2
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/loginout/edit.js +1 -1
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +6 -28
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +1 -2
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view-modal.js +56 -0
- package/build-module/navigation/view-modal.js.map +1 -0
- package/build-module/navigation/view.js +1 -30
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +1 -1
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +9 -0
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/edit.native.js +6 -2
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/paragraph/use-enter.js +81 -0
- package/build-module/paragraph/use-enter.js.map +1 -0
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comment/index.js +1 -1
- package/build-module/post-comments/edit.js +13 -35
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments/index.js +1 -1
- package/build-module/post-comments-form/edit.js +38 -26
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +39 -0
- package/build-module/post-comments-form/form.js.map +1 -0
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +26 -4
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/index.js +8 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/quote/index.js +2 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +10 -3
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/rss/edit.js +1 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +11 -9
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/index.js +3 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/spacer/constants.js +2 -0
- package/build-module/spacer/constants.js.map +1 -0
- package/build-module/spacer/controls.js +2 -2
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +1 -1
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/edit.js +9 -3
- package/build-module/table/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/video/edit.js +4 -8
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +1 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/{comments-query-loop → comments}/editor-rtl.css +0 -0
- package/build-style/{comments-query-loop → comments}/editor.css +0 -0
- package/build-style/common-rtl.css +32 -0
- package/build-style/common.css +32 -0
- package/build-style/cover/style-rtl.css +0 -4
- package/build-style/cover/style.css +0 -4
- package/build-style/editor-rtl.css +12 -4
- package/build-style/editor.css +12 -4
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/style-rtl.css +73 -4
- package/build-style/style.css +73 -4
- package/build-style/table/editor-rtl.css +8 -0
- package/build-style/table/editor.css +8 -0
- package/build-style/table/style-rtl.css +38 -0
- package/build-style/table/style.css +38 -0
- package/package.json +28 -28
- package/src/archives/edit.js +1 -1
- package/src/audio/edit.js +3 -8
- package/src/audio/edit.native.js +1 -1
- package/src/button/edit.native.js +6 -3
- package/src/categories/block.json +4 -0
- package/src/categories/edit.js +8 -2
- package/src/categories/index.php +1 -0
- package/src/column/block.json +10 -0
- package/src/comment-template/edit.js +1 -5
- package/src/comment-template/index.php +4 -0
- package/src/{comments-query-loop → comments}/block.json +1 -1
- package/src/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/src/{comments-query-loop → comments}/edit.js +1 -1
- package/src/{comments-query-loop → comments}/editor.scss +0 -0
- package/src/{comments-query-loop → comments}/index.js +0 -0
- package/src/{comments-query-loop → comments}/save.js +1 -3
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-title/index.php +4 -0
- package/src/common.scss +24 -1
- package/src/cover/edit.js +2 -67
- package/src/cover/edit.native.js +40 -13
- package/src/cover/style.native.scss +4 -0
- package/src/cover/style.scss +0 -4
- package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
- package/src/cover/test/transforms.js +301 -0
- package/src/cover/transforms.js +112 -7
- package/src/cover/use-cover-is-dark.js +71 -0
- package/src/cover/use-cover-is-dark.native.js +51 -0
- package/src/editor.scss +1 -1
- package/src/embed/edit.js +19 -24
- package/src/embed/edit.native.js +9 -14
- package/src/embed/util.js +34 -2
- package/src/file/inspector.js +1 -3
- package/src/gallery/edit.js +1 -1
- package/src/gallery/v1/edit.js +1 -1
- package/src/group/block.json +1 -0
- package/src/heading/transforms.js +4 -3
- package/src/html/edit.js +2 -2
- package/src/image/edit.js +2 -4
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +1 -1
- package/src/index.js +2 -5
- package/src/index.native.js +12 -2
- package/src/latest-comments/edit.js +1 -1
- package/src/latest-posts/edit.native.js +56 -1
- package/src/loginout/edit.js +1 -1
- package/src/media-text/edit.js +1 -2
- package/src/media-text/edit.native.js +1 -1
- package/src/navigation/block.json +1 -2
- package/src/navigation/edit/index.js +6 -36
- package/src/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/src/navigation/index.php +5 -0
- package/src/navigation/style.scss +3 -0
- package/src/navigation/view-modal.js +68 -0
- package/src/navigation/view.js +0 -35
- package/src/navigation-link/edit.js +1 -1
- package/src/paragraph/edit.js +6 -0
- package/src/paragraph/edit.native.js +13 -1
- package/src/paragraph/use-enter.js +103 -0
- package/src/post-author/edit.js +1 -1
- package/src/post-author/index.php +1 -1
- package/src/post-comment/block.json +1 -1
- package/src/post-comments/block.json +1 -1
- package/src/post-comments/edit.js +13 -43
- package/src/post-comments/index.php +2 -0
- package/src/post-comments-form/edit.js +50 -58
- package/src/post-comments-form/form.js +43 -0
- package/src/post-comments-form/index.php +5 -1
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-terms/block.json +8 -0
- package/src/post-terms/edit.js +28 -1
- package/src/post-terms/index.php +12 -2
- package/src/quote/block.json +1 -0
- package/src/quote/index.js +1 -1
- package/src/quote/v2/edit.js +3 -0
- package/src/rss/edit.js +1 -1
- package/src/search/edit.js +13 -7
- package/src/search/index.php +84 -33
- package/src/separator/block.json +3 -0
- package/src/spacer/constants.js +1 -0
- package/src/spacer/controls.js +2 -2
- package/src/spacer/controls.native.js +1 -1
- package/src/spacer/edit.js +1 -2
- package/src/table/edit.js +11 -2
- package/src/table/editor.scss +13 -0
- package/src/table/style.scss +52 -0
- package/src/tag-cloud/edit.js +1 -1
- package/src/video/edit.js +4 -5
- package/src/video/edit.native.js +1 -1
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +0 -1
- package/build/comments-query-loop/edit.js.map +0 -1
- package/build/comments-query-loop/index.js.map +0 -1
- package/build/comments-query-loop/save.js.map +0 -1
- package/build/navigation-area/edit.js +0 -110
- package/build/navigation-area/edit.js.map +0 -1
- package/build/navigation-area/index.js +0 -62
- package/build/navigation-area/index.js.map +0 -1
- package/build/navigation-area/inner-blocks.js +0 -34
- package/build/navigation-area/inner-blocks.js.map +0 -1
- package/build/navigation-area/save.js +0 -18
- package/build/navigation-area/save.js.map +0 -1
- package/build-module/comments-query-loop/edit.js.map +0 -1
- package/build-module/comments-query-loop/index.js.map +0 -1
- package/build-module/comments-query-loop/save.js.map +0 -1
- package/build-module/navigation-area/edit.js +0 -94
- package/build-module/navigation-area/edit.js.map +0 -1
- package/build-module/navigation-area/index.js +0 -48
- package/build-module/navigation-area/index.js.map +0 -1
- package/build-module/navigation-area/inner-blocks.js +0 -26
- package/build-module/navigation-area/inner-blocks.js.map +0 -1
- package/build-module/navigation-area/save.js +0 -10
- package/build-module/navigation-area/save.js.map +0 -1
- package/src/navigation-area/block.json +0 -23
- package/src/navigation-area/edit.js +0 -111
- package/src/navigation-area/index.js +0 -26
- package/src/navigation-area/index.php +0 -22
- package/src/navigation-area/inner-blocks.js +0 -24
- package/src/navigation-area/save.js +0 -8
|
@@ -16,10 +16,12 @@ import {
|
|
|
16
16
|
import { __, sprintf } from '@wordpress/i18n';
|
|
17
17
|
import { useSelect } from '@wordpress/data';
|
|
18
18
|
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
import { __experimentalUseDisabled as useDisabled } from '@wordpress/compose';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
import CommentsForm from '../post-comments-form/form';
|
|
23
25
|
|
|
24
26
|
export default function PostCommentsEdit( {
|
|
25
27
|
attributes: { textAlign },
|
|
@@ -51,9 +53,9 @@ export default function PostCommentsEdit( {
|
|
|
51
53
|
);
|
|
52
54
|
|
|
53
55
|
let warning = __(
|
|
54
|
-
'Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the "Comments
|
|
56
|
+
'Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the "Comments" block.'
|
|
55
57
|
);
|
|
56
|
-
let
|
|
58
|
+
let showPlaceholder = true;
|
|
57
59
|
|
|
58
60
|
if ( ! isSiteEditor && 'open' !== commentStatus ) {
|
|
59
61
|
if ( 'closed' === commentStatus ) {
|
|
@@ -64,7 +66,7 @@ export default function PostCommentsEdit( {
|
|
|
64
66
|
),
|
|
65
67
|
postType
|
|
66
68
|
);
|
|
67
|
-
|
|
69
|
+
showPlaceholder = false;
|
|
68
70
|
} else if ( ! postTypeSupportsComments ) {
|
|
69
71
|
warning = sprintf(
|
|
70
72
|
/* translators: 1: Post type (i.e. "post", "page") */
|
|
@@ -73,10 +75,10 @@ export default function PostCommentsEdit( {
|
|
|
73
75
|
),
|
|
74
76
|
postType
|
|
75
77
|
);
|
|
76
|
-
|
|
78
|
+
showPlaceholder = false;
|
|
77
79
|
} else if ( 'open' !== defaultCommentStatus ) {
|
|
78
80
|
warning = __( 'Post Comments block: Comments are not enabled.' );
|
|
79
|
-
|
|
81
|
+
showPlaceholder = false;
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
|
|
@@ -88,8 +90,6 @@ export default function PostCommentsEdit( {
|
|
|
88
90
|
|
|
89
91
|
const disabledRef = useDisabled();
|
|
90
92
|
|
|
91
|
-
const textareaId = useInstanceId( PostCommentsEdit );
|
|
92
|
-
|
|
93
93
|
return (
|
|
94
94
|
<>
|
|
95
95
|
<BlockControls group="block">
|
|
@@ -104,7 +104,7 @@ export default function PostCommentsEdit( {
|
|
|
104
104
|
<div { ...blockProps }>
|
|
105
105
|
<Warning>{ warning }</Warning>
|
|
106
106
|
|
|
107
|
-
{
|
|
107
|
+
{ showPlaceholder && (
|
|
108
108
|
<div
|
|
109
109
|
className="wp-block-post-comments__placeholder"
|
|
110
110
|
ref={ disabledRef }
|
|
@@ -206,37 +206,7 @@ export default function PostCommentsEdit( {
|
|
|
206
206
|
</div>
|
|
207
207
|
</div>
|
|
208
208
|
|
|
209
|
-
<
|
|
210
|
-
<h3 className="comment-reply-title">
|
|
211
|
-
{ __( 'Leave a Reply' ) }
|
|
212
|
-
</h3>
|
|
213
|
-
|
|
214
|
-
<form className="comment-form" noValidate>
|
|
215
|
-
<p className="comment-form-comment">
|
|
216
|
-
<label
|
|
217
|
-
htmlFor={ `comment-${ textareaId }` }
|
|
218
|
-
>
|
|
219
|
-
{ __( 'Comment' ) }{ ' ' }
|
|
220
|
-
<span className="required">*</span>
|
|
221
|
-
</label>
|
|
222
|
-
<textarea
|
|
223
|
-
id={ `comment-${ textareaId }` }
|
|
224
|
-
name="comment"
|
|
225
|
-
cols="45"
|
|
226
|
-
rows="8"
|
|
227
|
-
required
|
|
228
|
-
/>
|
|
229
|
-
</p>
|
|
230
|
-
<p className="form-submit wp-block-button">
|
|
231
|
-
<input
|
|
232
|
-
name="submit"
|
|
233
|
-
type="submit"
|
|
234
|
-
className="submit wp-block-button__link"
|
|
235
|
-
value={ __( 'Post Comment' ) }
|
|
236
|
-
/>
|
|
237
|
-
</p>
|
|
238
|
-
</form>
|
|
239
|
-
</div>
|
|
209
|
+
<CommentsForm />
|
|
240
210
|
</div>
|
|
241
211
|
) }
|
|
242
212
|
</div>
|
|
@@ -51,6 +51,8 @@ function render_block_core_post_comments( $attributes, $content, $block ) {
|
|
|
51
51
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
52
52
|
$output = ob_get_clean();
|
|
53
53
|
|
|
54
|
+
wp_enqueue_script( 'comment-reply' );
|
|
55
|
+
|
|
54
56
|
return sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $output );
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -11,13 +11,15 @@ import {
|
|
|
11
11
|
BlockControls,
|
|
12
12
|
Warning,
|
|
13
13
|
useBlockProps,
|
|
14
|
+
store as blockEditorStore,
|
|
14
15
|
} from '@wordpress/block-editor';
|
|
15
|
-
import { useEntityProp } from '@wordpress/core-data';
|
|
16
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
16
17
|
import { __, sprintf } from '@wordpress/i18n';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import { useSelect } from '@wordpress/data';
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
import CommentsForm from './form';
|
|
21
23
|
|
|
22
24
|
export default function PostCommentsFormEdit( {
|
|
23
25
|
attributes,
|
|
@@ -38,11 +40,49 @@ export default function PostCommentsFormEdit( {
|
|
|
38
40
|
} ),
|
|
39
41
|
} );
|
|
40
42
|
|
|
41
|
-
const
|
|
43
|
+
const isSiteEditor = postType === undefined || postId === undefined;
|
|
44
|
+
|
|
45
|
+
const { defaultCommentStatus } = useSelect(
|
|
46
|
+
( select ) =>
|
|
47
|
+
select( blockEditorStore ).getSettings()
|
|
48
|
+
.__experimentalDiscussionSettings
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const postTypeSupportsComments = useSelect( ( select ) =>
|
|
52
|
+
postType
|
|
53
|
+
? !! select( coreStore ).getPostType( postType )?.supports.comments
|
|
54
|
+
: false
|
|
55
|
+
);
|
|
42
56
|
|
|
43
|
-
|
|
57
|
+
let warning = false;
|
|
58
|
+
let showPlaceholder = true;
|
|
44
59
|
|
|
45
|
-
|
|
60
|
+
if ( ! isSiteEditor && 'open' !== commentStatus ) {
|
|
61
|
+
if ( 'closed' === commentStatus ) {
|
|
62
|
+
warning = sprintf(
|
|
63
|
+
/* translators: 1: Post type (i.e. "post", "page") */
|
|
64
|
+
__(
|
|
65
|
+
'Post Comments Form block: Comments on this %s are not allowed.'
|
|
66
|
+
),
|
|
67
|
+
postType
|
|
68
|
+
);
|
|
69
|
+
showPlaceholder = false;
|
|
70
|
+
} else if ( ! postTypeSupportsComments ) {
|
|
71
|
+
warning = sprintf(
|
|
72
|
+
/* translators: 1: Post type (i.e. "post", "page") */
|
|
73
|
+
__(
|
|
74
|
+
'Post Comments Form block: Comments for this post type (%s) are not enabled.'
|
|
75
|
+
),
|
|
76
|
+
postType
|
|
77
|
+
);
|
|
78
|
+
showPlaceholder = false;
|
|
79
|
+
} else if ( 'open' !== defaultCommentStatus ) {
|
|
80
|
+
warning = __(
|
|
81
|
+
'Post Comments Form block: Comments are not enabled.'
|
|
82
|
+
);
|
|
83
|
+
showPlaceholder = false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
46
86
|
|
|
47
87
|
return (
|
|
48
88
|
<>
|
|
@@ -55,57 +95,9 @@ export default function PostCommentsFormEdit( {
|
|
|
55
95
|
/>
|
|
56
96
|
</BlockControls>
|
|
57
97
|
<div { ...blockProps }>
|
|
58
|
-
{
|
|
59
|
-
<Warning>
|
|
60
|
-
{ __(
|
|
61
|
-
'Post Comments Form block: comments are not enabled for this post type.'
|
|
62
|
-
) }
|
|
63
|
-
</Warning>
|
|
64
|
-
) }
|
|
65
|
-
|
|
66
|
-
{ 'open' !== commentStatus && ! isInSiteEditor && (
|
|
67
|
-
<Warning>
|
|
68
|
-
{ sprintf(
|
|
69
|
-
/* translators: 1: Post type (i.e. "post", "page") */
|
|
70
|
-
__(
|
|
71
|
-
'Post Comments Form block: comments to this %s are not allowed.'
|
|
72
|
-
),
|
|
73
|
-
postType
|
|
74
|
-
) }
|
|
75
|
-
</Warning>
|
|
76
|
-
) }
|
|
98
|
+
{ warning && <Warning>{ warning }</Warning> }
|
|
77
99
|
|
|
78
|
-
{
|
|
79
|
-
<div>
|
|
80
|
-
<h3>{ __( 'Leave a Reply' ) }</h3>
|
|
81
|
-
<form
|
|
82
|
-
noValidate
|
|
83
|
-
className="comment-form"
|
|
84
|
-
ref={ disabledFormRef }
|
|
85
|
-
>
|
|
86
|
-
<p>
|
|
87
|
-
<label htmlFor={ `comment-${ instanceId }` }>
|
|
88
|
-
{ __( 'Comment' ) }
|
|
89
|
-
</label>
|
|
90
|
-
<textarea
|
|
91
|
-
id={ `comment-${ instanceId }` }
|
|
92
|
-
name="comment"
|
|
93
|
-
cols="45"
|
|
94
|
-
rows="8"
|
|
95
|
-
/>
|
|
96
|
-
</p>
|
|
97
|
-
<p>
|
|
98
|
-
<input
|
|
99
|
-
name="submit"
|
|
100
|
-
className="submit wp-block-button__link"
|
|
101
|
-
label={ __( 'Post Comment' ) }
|
|
102
|
-
value={ __( 'Post Comment' ) }
|
|
103
|
-
readOnly
|
|
104
|
-
/>
|
|
105
|
-
</p>
|
|
106
|
-
</form>
|
|
107
|
-
</div>
|
|
108
|
-
) }
|
|
100
|
+
{ showPlaceholder ? <CommentsForm /> : null }
|
|
109
101
|
</div>
|
|
110
102
|
</>
|
|
111
103
|
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalUseDisabled as useDisabled,
|
|
7
|
+
useInstanceId,
|
|
8
|
+
} from '@wordpress/compose';
|
|
9
|
+
|
|
10
|
+
const CommentsForm = () => {
|
|
11
|
+
const disabledFormRef = useDisabled();
|
|
12
|
+
const instanceId = useInstanceId( CommentsForm );
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="comment-respond">
|
|
16
|
+
<h3 className="comment-reply-title">{ __( 'Leave a Reply' ) }</h3>
|
|
17
|
+
<form noValidate className="comment-form" ref={ disabledFormRef }>
|
|
18
|
+
<p>
|
|
19
|
+
<label htmlFor={ `comment-${ instanceId }` }>
|
|
20
|
+
{ __( 'Comment' ) }
|
|
21
|
+
</label>
|
|
22
|
+
<textarea
|
|
23
|
+
id={ `comment-${ instanceId }` }
|
|
24
|
+
name="comment"
|
|
25
|
+
cols="45"
|
|
26
|
+
rows="8"
|
|
27
|
+
/>
|
|
28
|
+
</p>
|
|
29
|
+
<p className="form-submit wp-block-button">
|
|
30
|
+
<input
|
|
31
|
+
name="submit"
|
|
32
|
+
type="submit"
|
|
33
|
+
className="submit wp-block-button__link"
|
|
34
|
+
label={ __( 'Post Comment' ) }
|
|
35
|
+
value={ __( 'Post Comment' ) }
|
|
36
|
+
/>
|
|
37
|
+
</p>
|
|
38
|
+
</form>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default CommentsForm;
|
|
@@ -18,9 +18,13 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
|
|
|
18
18
|
return '';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
if ( post_password_required( $block->context['postId'] ) ) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
$classes = 'comment-respond'; // See comment further below.
|
|
22
26
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
23
|
-
$classes .= 'has-text-align-' . $attributes['textAlign'];
|
|
27
|
+
$classes .= ' has-text-align-' . $attributes['textAlign'];
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -127,7 +127,7 @@ export default function PostExcerptEditor( {
|
|
|
127
127
|
/>
|
|
128
128
|
</BlockControls>
|
|
129
129
|
<InspectorControls>
|
|
130
|
-
<PanelBody title={ __( '
|
|
130
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
131
131
|
<ToggleControl
|
|
132
132
|
label={ __( 'Show link on new line' ) }
|
|
133
133
|
checked={ showMoreOnNewLine }
|
package/src/post-terms/edit.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
BlockControls,
|
|
14
14
|
useBlockProps,
|
|
15
15
|
useBlockDisplayInformation,
|
|
16
|
+
RichText,
|
|
16
17
|
} from '@wordpress/block-editor';
|
|
17
18
|
import { Spinner, TextControl } from '@wordpress/components';
|
|
18
19
|
import { useSelect } from '@wordpress/data';
|
|
@@ -30,7 +31,7 @@ export default function PostTermsEdit( {
|
|
|
30
31
|
context,
|
|
31
32
|
setAttributes,
|
|
32
33
|
} ) {
|
|
33
|
-
const { term, textAlign, separator } = attributes;
|
|
34
|
+
const { term, textAlign, separator, prefix, suffix } = attributes;
|
|
34
35
|
const { postId, postType } = context;
|
|
35
36
|
|
|
36
37
|
const selectedTerm = useSelect(
|
|
@@ -83,6 +84,19 @@ export default function PostTermsEdit( {
|
|
|
83
84
|
</InspectorControls>
|
|
84
85
|
<div { ...blockProps }>
|
|
85
86
|
{ isLoading && <Spinner /> }
|
|
87
|
+
{ ! isLoading && hasPostTerms && (
|
|
88
|
+
<RichText
|
|
89
|
+
className="wp-block-post-terms__prefix"
|
|
90
|
+
multiline={ false }
|
|
91
|
+
aria-label={ __( 'Prefix' ) }
|
|
92
|
+
placeholder={ __( 'Prefix' ) + ' ' }
|
|
93
|
+
value={ prefix }
|
|
94
|
+
onChange={ ( value ) =>
|
|
95
|
+
setAttributes( { prefix: value } )
|
|
96
|
+
}
|
|
97
|
+
tagName="span"
|
|
98
|
+
/>
|
|
99
|
+
) }
|
|
86
100
|
{ ! isLoading &&
|
|
87
101
|
hasPostTerms &&
|
|
88
102
|
postTerms
|
|
@@ -108,6 +122,19 @@ export default function PostTermsEdit( {
|
|
|
108
122
|
! hasPostTerms &&
|
|
109
123
|
( selectedTerm?.labels?.no_terms ||
|
|
110
124
|
__( 'Term items not found.' ) ) }
|
|
125
|
+
{ ! isLoading && hasPostTerms && (
|
|
126
|
+
<RichText
|
|
127
|
+
className="wp-block-post-terms__suffix"
|
|
128
|
+
multiline={ false }
|
|
129
|
+
aria-label={ __( 'Suffix' ) }
|
|
130
|
+
placeholder={ ' ' + __( 'Suffix' ) }
|
|
131
|
+
value={ suffix }
|
|
132
|
+
onChange={ ( value ) =>
|
|
133
|
+
setAttributes( { suffix: value } )
|
|
134
|
+
}
|
|
135
|
+
tagName="span"
|
|
136
|
+
/>
|
|
137
|
+
) }
|
|
111
138
|
</div>
|
|
112
139
|
</>
|
|
113
140
|
);
|
package/src/post-terms/index.php
CHANGED
|
@@ -36,12 +36,22 @@ function render_block_core_post_terms( $attributes, $content, $block ) {
|
|
|
36
36
|
|
|
37
37
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
38
38
|
|
|
39
|
+
$prefix = "<div $wrapper_attributes>";
|
|
40
|
+
if ( isset( $attributes['prefix'] ) && $attributes['prefix'] ) {
|
|
41
|
+
$prefix .= '<span class="wp-block-post-terms__prefix">' . $attributes['prefix'] . '</span>';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
$suffix = '</div>';
|
|
45
|
+
if ( isset( $attributes['suffix'] ) && $attributes['suffix'] ) {
|
|
46
|
+
$suffix = '<span class="wp-block-post-terms__suffix">' . $attributes['suffix'] . '</span>' . $suffix;
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
return get_the_term_list(
|
|
40
50
|
$block->context['postId'],
|
|
41
51
|
$attributes['term'],
|
|
42
|
-
|
|
52
|
+
$prefix,
|
|
43
53
|
'<span class="wp-block-post-terms__separator">' . esc_html( $separator ) . '</span>',
|
|
44
|
-
|
|
54
|
+
$suffix
|
|
45
55
|
);
|
|
46
56
|
}
|
|
47
57
|
|
package/src/quote/block.json
CHANGED
package/src/quote/index.js
CHANGED
package/src/quote/v2/edit.js
CHANGED
|
@@ -74,6 +74,7 @@ export default function QuoteEdit( {
|
|
|
74
74
|
insertBlocksAfter,
|
|
75
75
|
clientId,
|
|
76
76
|
className,
|
|
77
|
+
style,
|
|
77
78
|
} ) {
|
|
78
79
|
const { citation, align } = attributes;
|
|
79
80
|
|
|
@@ -88,6 +89,7 @@ export default function QuoteEdit( {
|
|
|
88
89
|
className: classNames( className, {
|
|
89
90
|
[ `has-text-align-${ align }` ]: align,
|
|
90
91
|
} ),
|
|
92
|
+
...( ! isWebPlatform && { style } ),
|
|
91
93
|
} );
|
|
92
94
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
93
95
|
template: TEMPLATE,
|
|
@@ -128,6 +130,7 @@ export default function QuoteEdit( {
|
|
|
128
130
|
__unstableOnSplitAtEnd={ () =>
|
|
129
131
|
insertBlocksAfter( createBlock( 'core/paragraph' ) )
|
|
130
132
|
}
|
|
133
|
+
{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }
|
|
131
134
|
/>
|
|
132
135
|
) }
|
|
133
136
|
</BlockQuotation>
|
package/src/rss/edit.js
CHANGED
|
@@ -109,7 +109,7 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
109
109
|
<ToolbarGroup controls={ toolbarControls } />
|
|
110
110
|
</BlockControls>
|
|
111
111
|
<InspectorControls>
|
|
112
|
-
<PanelBody title={ __( '
|
|
112
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
113
113
|
<RangeControl
|
|
114
114
|
label={ __( 'Number of items' ) }
|
|
115
115
|
value={ itemsToShow }
|
package/src/search/edit.js
CHANGED
|
@@ -103,8 +103,6 @@ export default function SearchEdit( {
|
|
|
103
103
|
} );
|
|
104
104
|
}, [ insertedInNavigationBlock ] );
|
|
105
105
|
const borderRadius = style?.border?.radius;
|
|
106
|
-
const borderColor = style?.border?.color;
|
|
107
|
-
const borderWidth = style?.border?.width;
|
|
108
106
|
const borderProps = useBorderProps( attributes );
|
|
109
107
|
|
|
110
108
|
// Check for old deprecated numerical border radius. Done as a separate
|
|
@@ -392,10 +390,18 @@ export default function SearchEdit( {
|
|
|
392
390
|
radius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;
|
|
393
391
|
|
|
394
392
|
const getWrapperStyles = () => {
|
|
395
|
-
const styles =
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
393
|
+
const styles = isButtonPositionInside
|
|
394
|
+
? borderProps.style
|
|
395
|
+
: {
|
|
396
|
+
borderRadius: borderProps.style?.borderRadius,
|
|
397
|
+
borderTopLeftRadius: borderProps.style?.borderTopLeftRadius,
|
|
398
|
+
borderTopRightRadius:
|
|
399
|
+
borderProps.style?.borderTopRightRadius,
|
|
400
|
+
borderBottomLeftRadius:
|
|
401
|
+
borderProps.style?.borderBottomLeftRadius,
|
|
402
|
+
borderBottomRightRadius:
|
|
403
|
+
borderProps.style?.borderBottomRightRadius,
|
|
404
|
+
};
|
|
399
405
|
|
|
400
406
|
const isNonZeroBorderRadius =
|
|
401
407
|
borderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;
|
|
@@ -417,11 +423,11 @@ export default function SearchEdit( {
|
|
|
417
423
|
} = borderRadius;
|
|
418
424
|
|
|
419
425
|
return {
|
|
426
|
+
...styles,
|
|
420
427
|
borderTopLeftRadius: padBorderRadius( topLeft ),
|
|
421
428
|
borderTopRightRadius: padBorderRadius( topRight ),
|
|
422
429
|
borderBottomLeftRadius: padBorderRadius( bottomLeft ),
|
|
423
430
|
borderBottomRightRadius: padBorderRadius( bottomRight ),
|
|
424
|
-
...styles,
|
|
425
431
|
};
|
|
426
432
|
}
|
|
427
433
|
|
package/src/search/index.php
CHANGED
|
@@ -171,6 +171,75 @@ function classnames_for_block_core_search( $attributes ) {
|
|
|
171
171
|
return implode( ' ', $classnames );
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* This generates a CSS rule for the given border property and side if provided.
|
|
176
|
+
* Based on whether the Search block is configured to display the button inside
|
|
177
|
+
* or not, the generated rule is injected into the appropriate collection of
|
|
178
|
+
* styles for later application in the block's markup.
|
|
179
|
+
*
|
|
180
|
+
* @param array $attributes The block attributes.
|
|
181
|
+
* @param string $property Border property to generate rule for e.g. width or color.
|
|
182
|
+
* @param string $side Optional side border. The dictates the value retrieved and final CSS property.
|
|
183
|
+
* @param array $wrapper_styles Current collection of wrapper styles.
|
|
184
|
+
* @param array $button_styles Current collection of button styles.
|
|
185
|
+
* @param array $input_styles Current collection of input styles.
|
|
186
|
+
*
|
|
187
|
+
* @return void
|
|
188
|
+
*/
|
|
189
|
+
function apply_block_core_search_border_style( $attributes, $property, $side, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
|
190
|
+
$is_button_inside = 'button-inside' === _wp_array_get( $attributes, array( 'buttonPosition' ), false );
|
|
191
|
+
|
|
192
|
+
$path = array( 'style', 'border', $property );
|
|
193
|
+
|
|
194
|
+
if ( $side ) {
|
|
195
|
+
array_splice( $path, 2, 0, $side );
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
$value = _wp_array_get( $attributes, $path, false );
|
|
199
|
+
|
|
200
|
+
if ( empty( $value ) ) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if ( 'color' === $property && $side ) {
|
|
205
|
+
$has_color_preset = strpos( $value, 'var:preset|color|' ) !== false;
|
|
206
|
+
if ( $has_color_preset ) {
|
|
207
|
+
$named_color_value = substr( $value, strrpos( $value, '|' ) + 1 );
|
|
208
|
+
$value = sprintf( 'var(--wp--preset--color--%s)', $named_color_value );
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
$property_suffix = $side ? sprintf( '%s-%s', $side, $property ) : $property;
|
|
213
|
+
|
|
214
|
+
if ( $is_button_inside ) {
|
|
215
|
+
$wrapper_styles[] = sprintf( 'border-%s: %s;', $property_suffix, esc_attr( $value ) );
|
|
216
|
+
} else {
|
|
217
|
+
$button_styles[] = sprintf( 'border-%s: %s;', $property_suffix, esc_attr( $value ) );
|
|
218
|
+
$input_styles[] = sprintf( 'border-%s: %s;', $property_suffix, esc_attr( $value ) );
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* This adds CSS rules for a given border property e.g. width or color. It
|
|
224
|
+
* injects rules into the provided wrapper, button and input style arrays for
|
|
225
|
+
* uniform "flat" borders or those with individual sides configured.
|
|
226
|
+
*
|
|
227
|
+
* @param array $attributes The block attributes.
|
|
228
|
+
* @param string $property Border property to generate rule for e.g. width or color.
|
|
229
|
+
* @param array $wrapper_styles Current collection of wrapper styles.
|
|
230
|
+
* @param array $button_styles Current collection of button styles.
|
|
231
|
+
* @param array $input_styles Current collection of input styles.
|
|
232
|
+
*
|
|
233
|
+
* @return void
|
|
234
|
+
*/
|
|
235
|
+
function apply_block_core_search_border_styles( $attributes, $property, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
|
236
|
+
apply_block_core_search_border_style( $attributes, $property, null, $wrapper_styles, $button_styles, $input_styles );
|
|
237
|
+
apply_block_core_search_border_style( $attributes, $property, 'top', $wrapper_styles, $button_styles, $input_styles );
|
|
238
|
+
apply_block_core_search_border_style( $attributes, $property, 'right', $wrapper_styles, $button_styles, $input_styles );
|
|
239
|
+
apply_block_core_search_border_style( $attributes, $property, 'bottom', $wrapper_styles, $button_styles, $input_styles );
|
|
240
|
+
apply_block_core_search_border_style( $attributes, $property, 'left', $wrapper_styles, $button_styles, $input_styles );
|
|
241
|
+
}
|
|
242
|
+
|
|
174
243
|
/**
|
|
175
244
|
* Builds an array of inline styles for the search block.
|
|
176
245
|
*
|
|
@@ -201,19 +270,10 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
201
270
|
);
|
|
202
271
|
}
|
|
203
272
|
|
|
204
|
-
// Add border width styles.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
$border_width = $attributes['style']['border']['width'];
|
|
209
|
-
|
|
210
|
-
if ( $is_button_inside ) {
|
|
211
|
-
$wrapper_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
|
|
212
|
-
} else {
|
|
213
|
-
$button_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
|
|
214
|
-
$input_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
|
|
215
|
-
}
|
|
216
|
-
}
|
|
273
|
+
// Add border width and color styles.
|
|
274
|
+
apply_block_core_search_border_styles( $attributes, 'width', $wrapper_styles, $button_styles, $input_styles );
|
|
275
|
+
apply_block_core_search_border_styles( $attributes, 'color', $wrapper_styles, $button_styles, $input_styles );
|
|
276
|
+
apply_block_core_search_border_styles( $attributes, 'style', $wrapper_styles, $button_styles, $input_styles );
|
|
217
277
|
|
|
218
278
|
// Add border radius styles.
|
|
219
279
|
$has_border_radius = ! empty( $attributes['style']['border']['radius'] );
|
|
@@ -269,21 +329,6 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
269
329
|
}
|
|
270
330
|
}
|
|
271
331
|
|
|
272
|
-
// Add border color styles.
|
|
273
|
-
$has_border_color = ! empty( $attributes['style']['border']['color'] );
|
|
274
|
-
|
|
275
|
-
if ( $has_border_color ) {
|
|
276
|
-
$border_color = $attributes['style']['border']['color'];
|
|
277
|
-
|
|
278
|
-
// Apply wrapper border color if button placed inside.
|
|
279
|
-
if ( $is_button_inside ) {
|
|
280
|
-
$wrapper_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
|
281
|
-
} else {
|
|
282
|
-
$button_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
|
283
|
-
$input_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
332
|
// Add color styles.
|
|
288
333
|
$has_text_color = ! empty( $attributes['style']['color']['text'] );
|
|
289
334
|
if ( $has_text_color ) {
|
|
@@ -315,13 +360,19 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
315
360
|
* @return string The border color classnames to be applied to the block elements.
|
|
316
361
|
*/
|
|
317
362
|
function get_border_color_classes_for_block_core_search( $attributes ) {
|
|
363
|
+
$border_color_classes = array();
|
|
318
364
|
$has_custom_border_color = ! empty( $attributes['style']['border']['color'] );
|
|
319
|
-
$
|
|
320
|
-
|
|
321
|
-
if ( $has_custom_border_color
|
|
322
|
-
$border_color_classes = 'has-border-color';
|
|
365
|
+
$has_named_border_color = ! empty( $attributes['borderColor'] );
|
|
366
|
+
|
|
367
|
+
if ( $has_custom_border_color || $has_named_border_color ) {
|
|
368
|
+
$border_color_classes[] = 'has-border-color';
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if ( $has_named_border_color ) {
|
|
372
|
+
$border_color_classes[] = sprintf( 'has-%s-border-color', esc_attr( $attributes['borderColor'] ) );
|
|
323
373
|
}
|
|
324
|
-
|
|
374
|
+
|
|
375
|
+
return implode( ' ', $border_color_classes );
|
|
325
376
|
}
|
|
326
377
|
|
|
327
378
|
/**
|
package/src/separator/block.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MIN_SPACER_SIZE = 0;
|