@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
package/src/cover/transforms.js
CHANGED
|
@@ -7,6 +7,7 @@ import { createBlock } from '@wordpress/blocks';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';
|
|
10
|
+
import cleanEmptyObject from '../utils/clean-empty-object';
|
|
10
11
|
|
|
11
12
|
const transforms = {
|
|
12
13
|
from: [
|
|
@@ -73,6 +74,19 @@ const transforms = {
|
|
|
73
74
|
style,
|
|
74
75
|
} = attributes;
|
|
75
76
|
|
|
77
|
+
// If the Group block being transformed has a Cover block as its
|
|
78
|
+
// only child return that Cover block.
|
|
79
|
+
if (
|
|
80
|
+
innerBlocks?.length === 1 &&
|
|
81
|
+
innerBlocks[ 0 ]?.name === 'core/cover'
|
|
82
|
+
) {
|
|
83
|
+
return createBlock(
|
|
84
|
+
'core/cover',
|
|
85
|
+
innerBlocks[ 0 ].attributes,
|
|
86
|
+
innerBlocks[ 0 ].innerBlocks
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
76
90
|
// If no background or gradient color is provided, default to 50% opacity.
|
|
77
91
|
// This matches the styling of a Cover block with a background image,
|
|
78
92
|
// in the state where a background image has been removed.
|
|
@@ -99,14 +113,16 @@ const transforms = {
|
|
|
99
113
|
...attributes,
|
|
100
114
|
backgroundColor: undefined,
|
|
101
115
|
gradient: undefined,
|
|
102
|
-
style: {
|
|
116
|
+
style: cleanEmptyObject( {
|
|
103
117
|
...attributes?.style,
|
|
104
|
-
color:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
color: style?.color
|
|
119
|
+
? {
|
|
120
|
+
...style?.color,
|
|
121
|
+
background: undefined,
|
|
122
|
+
gradient: undefined,
|
|
123
|
+
}
|
|
124
|
+
: undefined,
|
|
125
|
+
} ),
|
|
110
126
|
};
|
|
111
127
|
|
|
112
128
|
// Preserve the block by nesting it within the Cover block,
|
|
@@ -192,6 +208,95 @@ const transforms = {
|
|
|
192
208
|
anchor,
|
|
193
209
|
} ),
|
|
194
210
|
},
|
|
211
|
+
{
|
|
212
|
+
type: 'block',
|
|
213
|
+
blocks: [ 'core/group' ],
|
|
214
|
+
isMatch: ( { url } ) => {
|
|
215
|
+
// If the Cover block uses background media, skip this transform,
|
|
216
|
+
// and instead use the Group block's default transform.
|
|
217
|
+
if ( url ) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
},
|
|
222
|
+
transform: ( attributes, innerBlocks ) => {
|
|
223
|
+
// Convert Cover overlay colors to comparable Group background colors.
|
|
224
|
+
const transformedColorAttributes = {
|
|
225
|
+
backgroundColor: attributes?.overlayColor,
|
|
226
|
+
gradient: attributes?.gradient,
|
|
227
|
+
style: cleanEmptyObject( {
|
|
228
|
+
...attributes?.style,
|
|
229
|
+
color:
|
|
230
|
+
attributes?.customOverlayColor ||
|
|
231
|
+
attributes?.customGradient ||
|
|
232
|
+
attributes?.style?.color
|
|
233
|
+
? {
|
|
234
|
+
background:
|
|
235
|
+
attributes?.customOverlayColor,
|
|
236
|
+
gradient: attributes?.customGradient,
|
|
237
|
+
...attributes?.style?.color,
|
|
238
|
+
}
|
|
239
|
+
: undefined,
|
|
240
|
+
} ),
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
// If the Cover block contains only a single Group block as a direct child,
|
|
244
|
+
// then attempt to merge the Cover's background colors with the child Group block,
|
|
245
|
+
// and remove the Cover block as the wrapper.
|
|
246
|
+
if (
|
|
247
|
+
innerBlocks?.length === 1 &&
|
|
248
|
+
innerBlocks[ 0 ]?.name === 'core/group'
|
|
249
|
+
) {
|
|
250
|
+
const groupAttributes = cleanEmptyObject(
|
|
251
|
+
innerBlocks[ 0 ].attributes || {}
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
// If the Group block contains any kind of background color or gradient,
|
|
255
|
+
// skip merging Cover background colors, and preserve the Group block's colors.
|
|
256
|
+
if (
|
|
257
|
+
groupAttributes?.backgroundColor ||
|
|
258
|
+
groupAttributes?.gradient ||
|
|
259
|
+
groupAttributes?.style?.color?.background ||
|
|
260
|
+
groupAttributes?.style?.color?.gradient
|
|
261
|
+
) {
|
|
262
|
+
return createBlock(
|
|
263
|
+
'core/group',
|
|
264
|
+
groupAttributes,
|
|
265
|
+
innerBlocks[ 0 ]?.innerBlocks
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return createBlock(
|
|
270
|
+
'core/group',
|
|
271
|
+
{
|
|
272
|
+
...transformedColorAttributes,
|
|
273
|
+
...groupAttributes,
|
|
274
|
+
style: cleanEmptyObject( {
|
|
275
|
+
...groupAttributes?.style,
|
|
276
|
+
color:
|
|
277
|
+
transformedColorAttributes?.style?.color ||
|
|
278
|
+
groupAttributes?.style?.color
|
|
279
|
+
? {
|
|
280
|
+
...transformedColorAttributes
|
|
281
|
+
?.style?.color,
|
|
282
|
+
...groupAttributes?.style
|
|
283
|
+
?.color,
|
|
284
|
+
}
|
|
285
|
+
: undefined,
|
|
286
|
+
} ),
|
|
287
|
+
},
|
|
288
|
+
innerBlocks[ 0 ]?.innerBlocks
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// In all other cases, transform the Cover block directly to a Group block.
|
|
293
|
+
return createBlock(
|
|
294
|
+
'core/group',
|
|
295
|
+
{ ...attributes, ...transformedColorAttributes },
|
|
296
|
+
innerBlocks
|
|
297
|
+
);
|
|
298
|
+
},
|
|
299
|
+
},
|
|
195
300
|
],
|
|
196
301
|
};
|
|
197
302
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import FastAverageColor from 'fast-average-color';
|
|
5
|
+
import { colord } from 'colord';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
11
|
+
|
|
12
|
+
function retrieveFastAverageColor() {
|
|
13
|
+
if ( ! retrieveFastAverageColor.fastAverageColor ) {
|
|
14
|
+
retrieveFastAverageColor.fastAverageColor = new FastAverageColor();
|
|
15
|
+
}
|
|
16
|
+
return retrieveFastAverageColor.fastAverageColor;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* useCoverIsDark is a hook that returns a boolean variable specifying if the cover
|
|
21
|
+
* background is dark or not.
|
|
22
|
+
*
|
|
23
|
+
* @param {?string} url Url of the media background.
|
|
24
|
+
* @param {?number} dimRatio Transparency of the overlay color. If an image and
|
|
25
|
+
* color are set, dimRatio is used to decide what is used
|
|
26
|
+
* for background darkness checking purposes.
|
|
27
|
+
* @param {?string} overlayColor String containing the overlay color value if one exists.
|
|
28
|
+
* @param {?Object} elementRef If a media background is set, elementRef should contain a reference to a
|
|
29
|
+
* dom element that renders that media.
|
|
30
|
+
*
|
|
31
|
+
* @return {boolean} True if the cover background is considered "dark" and false otherwise.
|
|
32
|
+
*/
|
|
33
|
+
export default function useCoverIsDark(
|
|
34
|
+
url,
|
|
35
|
+
dimRatio = 50,
|
|
36
|
+
overlayColor,
|
|
37
|
+
elementRef
|
|
38
|
+
) {
|
|
39
|
+
const [ isDark, setIsDark ] = useState( false );
|
|
40
|
+
useEffect( () => {
|
|
41
|
+
// If opacity is lower than 50 the dominant color is the image or video color,
|
|
42
|
+
// so use that color for the dark mode computation.
|
|
43
|
+
if ( url && dimRatio <= 50 && elementRef.current ) {
|
|
44
|
+
retrieveFastAverageColor().getColorAsync(
|
|
45
|
+
elementRef.current,
|
|
46
|
+
( color ) => {
|
|
47
|
+
setIsDark( color.isDark );
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}, [ url, url && dimRatio <= 50 && elementRef.current, setIsDark ] );
|
|
52
|
+
useEffect( () => {
|
|
53
|
+
// If opacity is greater than 50 the dominant color is the overlay color,
|
|
54
|
+
// so use that color for the dark mode computation.
|
|
55
|
+
if ( dimRatio > 50 || ! url ) {
|
|
56
|
+
if ( ! overlayColor ) {
|
|
57
|
+
// If no overlay color exists the overlay color is black (isDark )
|
|
58
|
+
setIsDark( true );
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setIsDark( colord( overlayColor ).isDark() );
|
|
62
|
+
}
|
|
63
|
+
}, [ overlayColor, dimRatio > 50 || ! url, setIsDark ] );
|
|
64
|
+
useEffect( () => {
|
|
65
|
+
if ( ! url && ! overlayColor ) {
|
|
66
|
+
// Reset isDark.
|
|
67
|
+
setIsDark( false );
|
|
68
|
+
}
|
|
69
|
+
}, [ ! url && ! overlayColor, setIsDark ] );
|
|
70
|
+
return isDark;
|
|
71
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { colord } from 'colord';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* useCoverIsDark is a hook that returns a boolean variable specifying if the cover
|
|
14
|
+
* background is dark or not.
|
|
15
|
+
*
|
|
16
|
+
* @param {?boolean} initialValue Initial value.
|
|
17
|
+
* @param {?string} url Url of the media background.
|
|
18
|
+
* @param {?number} dimRatio Transparency of the overlay color. If an image and
|
|
19
|
+
* color are set, dimRatio is used to decide what is used
|
|
20
|
+
* for background darkness checking purposes.
|
|
21
|
+
* @param {?string} overlayColor String containing the overlay color value if one exists.
|
|
22
|
+
*
|
|
23
|
+
* @return {boolean} True if the cover background is considered "dark" and false otherwise.
|
|
24
|
+
*/
|
|
25
|
+
export default function useCoverIsDark(
|
|
26
|
+
initialValue = false,
|
|
27
|
+
url,
|
|
28
|
+
dimRatio = 50,
|
|
29
|
+
overlayColor
|
|
30
|
+
) {
|
|
31
|
+
const [ isDark, setIsDark ] = useState( initialValue );
|
|
32
|
+
useEffect( () => {
|
|
33
|
+
// If opacity is greater than 50 the dominant color is the overlay color,
|
|
34
|
+
// so use that color for the dark mode computation.
|
|
35
|
+
if ( dimRatio > 50 || ! url ) {
|
|
36
|
+
if ( ! overlayColor ) {
|
|
37
|
+
// If no overlay color exists the overlay color is black (isDark )
|
|
38
|
+
setIsDark( true );
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setIsDark( colord( overlayColor ).isDark() );
|
|
42
|
+
}
|
|
43
|
+
}, [ overlayColor, dimRatio > 50 || ! url, setIsDark ] );
|
|
44
|
+
useEffect( () => {
|
|
45
|
+
if ( ! url && ! overlayColor ) {
|
|
46
|
+
// Reset isDark.
|
|
47
|
+
setIsDark( false );
|
|
48
|
+
}
|
|
49
|
+
}, [ ! url && ! overlayColor, setIsDark ] );
|
|
50
|
+
return isDark;
|
|
51
|
+
}
|
package/src/editor.scss
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
@import "./buttons/editor.scss";
|
|
7
7
|
@import "./categories/editor.scss";
|
|
8
8
|
@import "./columns/editor.scss";
|
|
9
|
+
@import "./comments/editor.scss";
|
|
9
10
|
@import "./comment-author-avatar/editor.scss";
|
|
10
|
-
@import "./comments-query-loop/editor.scss";
|
|
11
11
|
@import "./comments-pagination/editor.scss";
|
|
12
12
|
@import "./comments-pagination-numbers/editor.scss";
|
|
13
13
|
@import "./comments-title/editor.scss";
|
package/src/embed/edit.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createUpgradedEmbedBlock,
|
|
6
6
|
getClassNames,
|
|
7
7
|
fallback,
|
|
8
|
-
getAttributesFromPreview,
|
|
9
8
|
getEmbedInfoByProvider,
|
|
9
|
+
getMergedAttributesWithPreview,
|
|
10
10
|
} from './util';
|
|
11
11
|
import EmbedControls from './embed-controls';
|
|
12
12
|
import { embedContentIcon } from './icons';
|
|
@@ -99,21 +99,19 @@ const EmbedEdit = ( props ) => {
|
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Returns the attributes derived from the preview, merged with the current attributes.
|
|
103
|
+
*
|
|
104
|
+
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
105
|
+
* @return {Object} Merged attributes.
|
|
103
106
|
*/
|
|
104
|
-
const getMergedAttributes = () =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
responsive,
|
|
113
|
-
allowResponsive
|
|
114
|
-
),
|
|
115
|
-
};
|
|
116
|
-
};
|
|
107
|
+
const getMergedAttributes = ( ignorePreviousClassName = false ) =>
|
|
108
|
+
getMergedAttributesWithPreview(
|
|
109
|
+
attributes,
|
|
110
|
+
preview,
|
|
111
|
+
title,
|
|
112
|
+
responsive,
|
|
113
|
+
ignorePreviousClassName
|
|
114
|
+
);
|
|
117
115
|
|
|
118
116
|
const toggleResponsive = () => {
|
|
119
117
|
const { allowResponsive, className } = attributes;
|
|
@@ -145,15 +143,12 @@ const EmbedEdit = ( props ) => {
|
|
|
145
143
|
// Handle incoming preview.
|
|
146
144
|
useEffect( () => {
|
|
147
145
|
if ( preview && ! isEditingURL ) {
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
// the
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// that `getMergedAttributes` uses is memoized so that we're not
|
|
155
|
-
// calculating them on every render.
|
|
156
|
-
setAttributes( getMergedAttributes() );
|
|
146
|
+
// When obtaining an incoming preview, we set the attributes derived from
|
|
147
|
+
// the preview data. In this case when getting the merged attributes,
|
|
148
|
+
// we ignore the previous classname because it might not match the expected
|
|
149
|
+
// classes by the new preview.
|
|
150
|
+
setAttributes( getMergedAttributes( true ) );
|
|
151
|
+
|
|
157
152
|
if ( onReplace ) {
|
|
158
153
|
const upgradedBlock = createUpgradedEmbedBlock(
|
|
159
154
|
props,
|
package/src/embed/edit.native.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createUpgradedEmbedBlock,
|
|
6
6
|
getClassNames,
|
|
7
7
|
fallback,
|
|
8
|
-
getAttributesFromPreview,
|
|
9
8
|
getEmbedInfoByProvider,
|
|
9
|
+
getMergedAttributesWithPreview,
|
|
10
10
|
} from './util';
|
|
11
11
|
import EmbedControls from './embed-controls';
|
|
12
12
|
import { embedContentIcon } from './icons';
|
|
@@ -130,19 +130,14 @@ const EmbedEdit = ( props ) => {
|
|
|
130
130
|
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
131
131
|
* @return {Object} Merged attributes.
|
|
132
132
|
*/
|
|
133
|
-
const getMergedAttributes = ( ignorePreviousClassName = false ) =>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
responsive,
|
|
142
|
-
allowResponsive
|
|
143
|
-
),
|
|
144
|
-
};
|
|
145
|
-
};
|
|
133
|
+
const getMergedAttributes = ( ignorePreviousClassName = false ) =>
|
|
134
|
+
getMergedAttributesWithPreview(
|
|
135
|
+
attributes,
|
|
136
|
+
preview,
|
|
137
|
+
title,
|
|
138
|
+
responsive,
|
|
139
|
+
ignorePreviousClassName
|
|
140
|
+
);
|
|
146
141
|
|
|
147
142
|
const toggleResponsive = () => {
|
|
148
143
|
const { allowResponsive, className } = attributes;
|
package/src/embed/util.js
CHANGED
|
@@ -66,9 +66,11 @@ export const isFromWordPress = ( html ) =>
|
|
|
66
66
|
html && html.includes( 'class="wp-embedded-content"' );
|
|
67
67
|
|
|
68
68
|
export const getPhotoHtml = ( photo ) => {
|
|
69
|
+
// If full image url not found use thumbnail.
|
|
70
|
+
const imageUrl = photo.url || photo.thumbnail_url;
|
|
71
|
+
|
|
69
72
|
// 100% width for the preview so it fits nicely into the document, some "thumbnails" are
|
|
70
|
-
// actually the full size photo.
|
|
71
|
-
const imageUrl = photo.thumbnail_url || photo.url;
|
|
73
|
+
// actually the full size photo.
|
|
72
74
|
const photoPreview = (
|
|
73
75
|
<p>
|
|
74
76
|
<img src={ imageUrl } alt={ photo.title } width="100%" />
|
|
@@ -290,3 +292,33 @@ export const getAttributesFromPreview = memoize(
|
|
|
290
292
|
return attributes;
|
|
291
293
|
}
|
|
292
294
|
);
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Returns the attributes derived from the preview, merged with the current attributes.
|
|
298
|
+
*
|
|
299
|
+
* @param {Object} currentAttributes The current attributes of the block.
|
|
300
|
+
* @param {Object} preview The preview data.
|
|
301
|
+
* @param {string} title The block's title, e.g. Twitter.
|
|
302
|
+
* @param {boolean} isResponsive Boolean indicating if the block supports responsive content.
|
|
303
|
+
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
304
|
+
* @return {Object} Merged attributes.
|
|
305
|
+
*/
|
|
306
|
+
export const getMergedAttributesWithPreview = (
|
|
307
|
+
currentAttributes,
|
|
308
|
+
preview,
|
|
309
|
+
title,
|
|
310
|
+
isResponsive,
|
|
311
|
+
ignorePreviousClassName = false
|
|
312
|
+
) => {
|
|
313
|
+
const { allowResponsive, className } = currentAttributes;
|
|
314
|
+
return {
|
|
315
|
+
...currentAttributes,
|
|
316
|
+
...getAttributesFromPreview(
|
|
317
|
+
preview,
|
|
318
|
+
title,
|
|
319
|
+
ignorePreviousClassName ? undefined : className,
|
|
320
|
+
isResponsive,
|
|
321
|
+
allowResponsive
|
|
322
|
+
),
|
|
323
|
+
};
|
|
324
|
+
};
|
package/src/file/inspector.js
CHANGED
|
@@ -68,7 +68,7 @@ export default function FileBlockInspector( {
|
|
|
68
68
|
) }
|
|
69
69
|
</PanelBody>
|
|
70
70
|
) }
|
|
71
|
-
<PanelBody title={ __( '
|
|
71
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
72
72
|
<SelectControl
|
|
73
73
|
label={ __( 'Link to' ) }
|
|
74
74
|
value={ textLinkHref }
|
|
@@ -80,8 +80,6 @@ export default function FileBlockInspector( {
|
|
|
80
80
|
checked={ openInNewWindow }
|
|
81
81
|
onChange={ changeOpenInNewWindow }
|
|
82
82
|
/>
|
|
83
|
-
</PanelBody>
|
|
84
|
-
<PanelBody title={ __( 'Download button settings' ) }>
|
|
85
83
|
<ToggleControl
|
|
86
84
|
label={ __( 'Show download button' ) }
|
|
87
85
|
checked={ showDownloadButton }
|
package/src/gallery/edit.js
CHANGED
package/src/gallery/v1/edit.js
CHANGED
package/src/group/block.json
CHANGED
|
@@ -16,10 +16,11 @@ const transforms = {
|
|
|
16
16
|
isMultiBlock: true,
|
|
17
17
|
blocks: [ 'core/paragraph' ],
|
|
18
18
|
transform: ( attributes ) =>
|
|
19
|
-
attributes.map( ( { content, anchor } ) =>
|
|
19
|
+
attributes.map( ( { content, anchor, align: textAlign } ) =>
|
|
20
20
|
createBlock( name, {
|
|
21
21
|
content,
|
|
22
22
|
anchor,
|
|
23
|
+
textAlign,
|
|
23
24
|
} )
|
|
24
25
|
),
|
|
25
26
|
},
|
|
@@ -84,8 +85,8 @@ const transforms = {
|
|
|
84
85
|
isMultiBlock: true,
|
|
85
86
|
blocks: [ 'core/paragraph' ],
|
|
86
87
|
transform: ( attributes ) =>
|
|
87
|
-
attributes.map( ( { content } ) =>
|
|
88
|
-
createBlock( 'core/paragraph', { content } )
|
|
88
|
+
attributes.map( ( { content, textAlign: align } ) =>
|
|
89
|
+
createBlock( 'core/paragraph', { content, align } )
|
|
89
90
|
),
|
|
90
91
|
},
|
|
91
92
|
],
|
package/src/html/edit.js
CHANGED
|
@@ -59,14 +59,14 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
59
59
|
isPressed={ ! isPreview }
|
|
60
60
|
onClick={ switchToHTML }
|
|
61
61
|
>
|
|
62
|
-
|
|
62
|
+
HTML
|
|
63
63
|
</ToolbarButton>
|
|
64
64
|
<ToolbarButton
|
|
65
65
|
className="components-tab-button"
|
|
66
66
|
isPressed={ isPreview }
|
|
67
67
|
onClick={ switchToPreview }
|
|
68
68
|
>
|
|
69
|
-
|
|
69
|
+
{ __( 'Preview' ) }
|
|
70
70
|
</ToolbarButton>
|
|
71
71
|
</ToolbarGroup>
|
|
72
72
|
</BlockControls>
|
package/src/image/edit.js
CHANGED
|
@@ -22,8 +22,6 @@ import { useEffect, useRef, useState } from '@wordpress/element';
|
|
|
22
22
|
import { __ } from '@wordpress/i18n';
|
|
23
23
|
import { image as icon } from '@wordpress/icons';
|
|
24
24
|
|
|
25
|
-
/* global wp */
|
|
26
|
-
|
|
27
25
|
/**
|
|
28
26
|
* Internal dependencies
|
|
29
27
|
*/
|
|
@@ -97,7 +95,7 @@ function hasDefaultSize( image, defaultSize ) {
|
|
|
97
95
|
* @return {boolean} Whether the image has been destroyed.
|
|
98
96
|
*/
|
|
99
97
|
export function isMediaDestroyed( id ) {
|
|
100
|
-
const attachment = wp?.media?.attachment( id ) || {};
|
|
98
|
+
const attachment = window?.wp?.media?.attachment( id ) || {};
|
|
101
99
|
return attachment.destroyed;
|
|
102
100
|
}
|
|
103
101
|
|
|
@@ -232,7 +230,7 @@ export function ImageEdit( {
|
|
|
232
230
|
// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.
|
|
233
231
|
// TODO: fix this in a follow up PR, requires updating media-text and ui component.
|
|
234
232
|
switch (
|
|
235
|
-
wp?.media?.view?.settings?.defaultProps?.link ||
|
|
233
|
+
window?.wp?.media?.view?.settings?.defaultProps?.link ||
|
|
236
234
|
LINK_DESTINATION_NONE
|
|
237
235
|
) {
|
|
238
236
|
case 'file':
|
package/src/image/edit.native.js
CHANGED
|
@@ -670,7 +670,7 @@ export class ImageEdit extends Component {
|
|
|
670
670
|
|
|
671
671
|
const getInspectorControls = () => (
|
|
672
672
|
<InspectorControls>
|
|
673
|
-
<PanelBody title={ __( '
|
|
673
|
+
<PanelBody title={ __( 'Settings' ) } />
|
|
674
674
|
<PanelBody style={ styles.panelBody }>
|
|
675
675
|
<BlockStyles clientId={ clientId } url={ url } />
|
|
676
676
|
</PanelBody>
|
package/src/image/image.js
CHANGED
|
@@ -370,7 +370,7 @@ export default function Image( {
|
|
|
370
370
|
</BlockControls>
|
|
371
371
|
) }
|
|
372
372
|
<InspectorControls>
|
|
373
|
-
<PanelBody title={ __( '
|
|
373
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
374
374
|
{ ! multiImageSelection && (
|
|
375
375
|
<TextareaControl
|
|
376
376
|
label={ __( 'Alt text (alternative text)' ) }
|
package/src/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import * as classic from './freeform';
|
|
|
23
23
|
import * as code from './code';
|
|
24
24
|
import * as column from './column';
|
|
25
25
|
import * as columns from './columns';
|
|
26
|
+
import * as comments from './comments';
|
|
26
27
|
import * as commentAuthorAvatar from './comment-author-avatar';
|
|
27
28
|
import * as commentAuthorName from './comment-author-name';
|
|
28
29
|
import * as commentContent from './comment-content';
|
|
@@ -31,7 +32,6 @@ import * as commentEditLink from './comment-edit-link';
|
|
|
31
32
|
import * as commentReplyLink from './comment-reply-link';
|
|
32
33
|
import * as commentTemplate from './comment-template';
|
|
33
34
|
import * as commentsPaginationPrevious from './comments-pagination-previous';
|
|
34
|
-
import * as commentsQueryLoop from './comments-query-loop';
|
|
35
35
|
import * as commentsPagination from './comments-pagination';
|
|
36
36
|
import * as commentsPaginationNext from './comments-pagination-next';
|
|
37
37
|
import * as commentsPaginationNumbers from './comments-pagination-numbers';
|
|
@@ -54,7 +54,6 @@ import * as mediaText from './media-text';
|
|
|
54
54
|
import * as missing from './missing';
|
|
55
55
|
import * as more from './more';
|
|
56
56
|
import * as navigation from './navigation';
|
|
57
|
-
import * as navigationArea from './navigation-area';
|
|
58
57
|
import * as navigationLink from './navigation-link';
|
|
59
58
|
import * as navigationSubmenu from './navigation-submenu';
|
|
60
59
|
import * as nextpage from './nextpage';
|
|
@@ -207,6 +206,7 @@ export const __experimentalGetCoreBlocks = () => [
|
|
|
207
206
|
queryPaginationPrevious,
|
|
208
207
|
queryNoResults,
|
|
209
208
|
readMore,
|
|
209
|
+
comments,
|
|
210
210
|
commentAuthorName,
|
|
211
211
|
commentContent,
|
|
212
212
|
commentDate,
|
|
@@ -214,12 +214,10 @@ export const __experimentalGetCoreBlocks = () => [
|
|
|
214
214
|
commentReplyLink,
|
|
215
215
|
commentTemplate,
|
|
216
216
|
commentsTitle,
|
|
217
|
-
commentsQueryLoop,
|
|
218
217
|
commentsPagination,
|
|
219
218
|
commentsPaginationNext,
|
|
220
219
|
commentsPaginationNumbers,
|
|
221
220
|
commentsPaginationPrevious,
|
|
222
|
-
|
|
223
221
|
postComments,
|
|
224
222
|
postCommentsForm,
|
|
225
223
|
homeLink,
|
|
@@ -279,7 +277,6 @@ export const __experimentalRegisterExperimentalCoreBlocks = process.env
|
|
|
279
277
|
...( enableFSEBlocks
|
|
280
278
|
? [
|
|
281
279
|
commentAuthorAvatar,
|
|
282
|
-
navigationArea,
|
|
283
280
|
postComment,
|
|
284
281
|
postCommentsCount,
|
|
285
282
|
postCommentsLink,
|
package/src/index.native.js
CHANGED
|
@@ -179,6 +179,14 @@ const devOnly = ( block ) => ( !! __DEV__ ? block : null );
|
|
|
179
179
|
const iOSOnly = ( block ) =>
|
|
180
180
|
Platform.OS === 'ios' ? block : devOnly( block );
|
|
181
181
|
|
|
182
|
+
// To be removed once Quote V2 is released on the web editor.
|
|
183
|
+
function quoteCheck( quoteBlock, blocksFlags ) {
|
|
184
|
+
if ( blocksFlags?.__experimentalEnableQuoteBlockV2 ) {
|
|
185
|
+
quoteBlock.settings = quoteBlock?.settingsV2;
|
|
186
|
+
}
|
|
187
|
+
return quoteBlock;
|
|
188
|
+
}
|
|
189
|
+
|
|
182
190
|
// Hide the Classic block and SocialLink block
|
|
183
191
|
addFilter(
|
|
184
192
|
'blocks.registerBlockType',
|
|
@@ -230,8 +238,10 @@ addFilter(
|
|
|
230
238
|
*
|
|
231
239
|
* registerCoreBlocks();
|
|
232
240
|
* ```
|
|
241
|
+
* @param {Object} [blocksFlags] Experimental flags
|
|
242
|
+
*
|
|
233
243
|
*/
|
|
234
|
-
export const registerCoreBlocks = () => {
|
|
244
|
+
export const registerCoreBlocks = ( blocksFlags ) => {
|
|
235
245
|
// When adding new blocks to this list please also consider updating /src/block-support/supported-blocks.json in the Gutenberg-Mobile repo
|
|
236
246
|
[
|
|
237
247
|
paragraph,
|
|
@@ -244,7 +254,7 @@ export const registerCoreBlocks = () => {
|
|
|
244
254
|
nextpage,
|
|
245
255
|
separator,
|
|
246
256
|
list,
|
|
247
|
-
quote,
|
|
257
|
+
quoteCheck( quote, blocksFlags ),
|
|
248
258
|
mediaText,
|
|
249
259
|
preformatted,
|
|
250
260
|
gallery,
|
|
@@ -35,7 +35,7 @@ export default function LatestComments( { attributes, setAttributes } ) {
|
|
|
35
35
|
return (
|
|
36
36
|
<div { ...useBlockProps() }>
|
|
37
37
|
<InspectorControls>
|
|
38
|
-
<PanelBody title={ __( '
|
|
38
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
39
39
|
<ToggleControl
|
|
40
40
|
label={ __( 'Display avatar' ) }
|
|
41
41
|
checked={ displayAvatar }
|