@wordpress/block-library 7.15.1-next.4d3b314fd5.0 → 7.17.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 -1
- package/build/archives/edit.js +1 -0
- package/build/archives/edit.js.map +1 -1
- package/build/code/utils.js +3 -3
- package/build/code/utils.js.map +1 -1
- package/build/comment-template/edit.js +40 -32
- package/build/comment-template/edit.js.map +1 -1
- package/build/comments/edit/placeholder.js +1 -4
- package/build/comments/edit/placeholder.js.map +1 -1
- package/build/comments/index.js +5 -1
- package/build/comments/index.js.map +1 -1
- package/build/comments-title/edit.js +18 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/edit/index.js +2 -2
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/use-cover-is-dark.js +8 -7
- package/build/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/transforms.js +3 -3
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/group/edit.js +1 -1
- package/build/group/edit.js.map +1 -1
- package/build/image/image.js +34 -10
- package/build/image/image.js.map +1 -1
- package/build/image/transforms.js +1 -7
- package/build/image/transforms.js.map +1 -1
- package/build/list/transforms.js +9 -1
- package/build/list/transforms.js.map +1 -1
- package/build/list-item/edit.js +3 -2
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/edit.native.js +3 -2
- package/build/list-item/edit.native.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +19 -22
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +19 -3
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/index.js +14 -1
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/utils.js +14 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/navigation/edit/index.js +46 -33
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +3 -5
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build/navigation/index.js +4 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/page-list/index.js +1 -5
- package/build/page-list/index.js.map +1 -1
- package/build/paragraph/deprecated.js +49 -10
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/paragraph/edit.js +22 -14
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/save.js +3 -1
- package/build/paragraph/save.js.map +1 -1
- package/build/pattern/edit.js +11 -4
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js +20 -2
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +8 -0
- package/build/post-author/index.js.map +1 -1
- package/build/post-comments-form/form.js +1 -2
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-featured-image/index.js +1 -1
- package/build/post-featured-image/overlay.js +2 -2
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-terms/index.js +4 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +2 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +3 -3
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +2 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +79 -103
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/utils.js +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/quote/index.js +0 -1
- package/build/quote/index.js.map +1 -1
- package/build/search/edit.js +2 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +6 -9
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/index.js +2 -1
- package/build/site-title/index.js.map +1 -1
- package/build/table/state.js +1 -1
- package/build/table/state.js.map +1 -1
- package/build/table-of-contents/edit.js +1 -4
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +8 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/index.js +2 -2
- package/build/template-part/index.js.map +1 -1
- package/build/video/edit.js +13 -1
- package/build/video/edit.js.map +1 -1
- package/build-module/archives/edit.js +1 -0
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/code/utils.js +3 -3
- package/build-module/code/utils.js.map +1 -1
- package/build-module/comment-template/edit.js +38 -30
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comments/edit/placeholder.js +1 -3
- package/build-module/comments/edit/placeholder.js.map +1 -1
- package/build-module/comments/index.js +5 -1
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments-title/edit.js +18 -2
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +2 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/use-cover-is-dark.js +7 -7
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/transforms.js +4 -4
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/v1/edit.js +2 -2
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/group/edit.js +1 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/image/image.js +35 -11
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/transforms.js +1 -6
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/list/transforms.js +9 -1
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +3 -2
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +3 -2
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +19 -21
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +19 -3
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/index.js +14 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/utils.js +14 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/navigation/edit/index.js +46 -33
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +3 -5
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build-module/navigation/index.js +4 -1
- package/build-module/navigation/index.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/page-list/index.js +1 -5
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/paragraph/deprecated.js +49 -11
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/paragraph/edit.js +22 -13
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/save.js +2 -1
- package/build-module/paragraph/save.js.map +1 -1
- package/build-module/pattern/edit.js +10 -3
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js +21 -2
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +8 -0
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-comments-form/form.js +2 -3
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -1
- package/build-module/post-featured-image/overlay.js +2 -2
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-terms/index.js +4 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +2 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +5 -5
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +81 -101
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/utils.js +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/quote/index.js +0 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/search/edit.js +3 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +6 -9
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/index.js +2 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/table/state.js +2 -2
- package/build-module/table/state.js.map +1 -1
- package/build-module/table-of-contents/edit.js +1 -3
- package/build-module/table-of-contents/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/tag-cloud/index.js +8 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/video/edit.js +15 -3
- package/build-module/video/edit.js.map +1 -1
- package/build-style/archives/style-rtl.css +4 -0
- package/build-style/archives/style.css +4 -0
- package/build-style/code/style-rtl.css +3 -0
- package/build-style/code/style.css +3 -0
- package/build-style/comments/editor-rtl.css +1 -0
- package/build-style/comments/editor.css +1 -0
- package/build-style/comments/style-rtl.css +1 -0
- package/build-style/comments/style.css +1 -0
- package/build-style/cover/editor-rtl.css +4 -0
- package/build-style/cover/editor.css +4 -0
- package/build-style/editor-rtl.css +78 -46
- package/build-style/editor.css +78 -46
- package/build-style/group/editor-rtl.css +1 -0
- package/build-style/group/editor.css +1 -0
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/navigation/editor-rtl.css +5 -0
- package/build-style/navigation/editor.css +5 -0
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/paragraph/editor-rtl.css +0 -16
- package/build-style/paragraph/editor.css +0 -16
- package/build-style/paragraph/style-rtl.css +5 -0
- package/build-style/paragraph/style.css +5 -0
- package/build-style/post-featured-image/editor-rtl.css +39 -29
- package/build-style/post-featured-image/editor.css +39 -29
- package/build-style/post-terms/style-rtl.css +4 -1
- package/build-style/post-terms/style.css +4 -1
- package/build-style/site-logo/editor-rtl.css +1 -0
- package/build-style/site-logo/editor.css +1 -0
- package/build-style/site-title/editor-rtl.css +4 -0
- package/build-style/site-title/editor.css +4 -0
- package/build-style/site-title/style-rtl.css +79 -0
- package/build-style/site-title/style.css +79 -0
- package/build-style/style-rtl.css +27 -1
- package/build-style/style.css +27 -1
- package/build-style/tag-cloud/style-rtl.css +3 -0
- package/build-style/tag-cloud/style.css +3 -0
- package/build-style/video/editor-rtl.css +22 -0
- package/build-style/video/editor.css +22 -0
- package/package.json +28 -28
- package/src/archives/edit.js +1 -0
- package/src/archives/style.scss +5 -0
- package/src/avatar/index.php +1 -1
- package/src/categories/index.php +1 -1
- package/src/code/style.scss +12 -7
- package/src/code/test/__snapshots__/edit.native.js.snap +13 -0
- package/src/code/test/edit.native.js +46 -32
- package/src/code/utils.js +3 -3
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-reply-link/index.php +1 -1
- package/src/comment-template/edit.js +47 -34
- package/src/comment-template/index.php +2 -3
- package/src/comments/block.json +5 -1
- package/src/comments/edit/placeholder.js +1 -7
- package/src/comments/style.scss +2 -0
- package/src/comments-title/edit.js +24 -1
- package/src/cover/edit/index.js +2 -7
- package/src/cover/edit/use-cover-is-dark.js +11 -11
- package/src/cover/editor.scss +7 -0
- package/src/cover/index.php +1 -1
- package/src/embed/variations.js +1 -1
- package/src/gallery/transforms.js +8 -5
- package/src/gallery/v1/edit.js +2 -2
- package/src/group/edit.js +1 -1
- package/src/group/editor.scss +1 -0
- package/src/image/editor.scss +4 -1
- package/src/image/image.js +59 -29
- package/src/image/transforms.js +1 -7
- package/src/latest-posts/index.php +1 -1
- package/src/list/test/edit.native.js +102 -3
- package/src/list/transforms.js +11 -0
- package/src/list-item/block.json +14 -1
- package/src/list-item/edit.js +2 -1
- package/src/list-item/edit.native.js +2 -1
- package/src/list-item/hooks/use-merge.js +4 -23
- package/src/list-item/hooks/use-outdent-list-item.js +6 -2
- package/src/navigation/block.json +4 -1
- package/src/navigation/edit/index.js +60 -32
- package/src/navigation/edit/inner-blocks.js +2 -5
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +32 -5
- package/src/navigation/edit/use-create-navigation-menu.js +2 -5
- package/src/navigation/editor.scss +7 -0
- package/src/navigation/index.php +103 -6
- package/src/navigation/style.scss +8 -0
- package/src/navigation-link/edit.js +1 -1
- package/src/navigation-link/index.php +8 -1
- package/src/navigation-submenu/index.php +8 -1
- package/src/page-list/block.json +1 -5
- package/src/page-list/index.php +10 -8
- package/src/paragraph/deprecated.js +36 -0
- package/src/paragraph/edit.js +24 -22
- package/src/paragraph/editor.scss +0 -20
- package/src/paragraph/save.js +5 -1
- package/src/paragraph/style.scss +5 -0
- package/src/pattern/edit.js +10 -3
- package/src/post-author/block.json +8 -0
- package/src/post-author/edit.js +29 -3
- package/src/post-author/index.php +7 -1
- package/src/post-comments-form/form.js +2 -3
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/editor.scss +79 -72
- package/src/post-featured-image/index.php +18 -24
- package/src/post-featured-image/overlay.js +17 -14
- package/src/post-terms/block.json +4 -0
- package/src/post-terms/style.scss +7 -2
- package/src/query/edit/inspector-controls/author-control.js +1 -0
- package/src/query/edit/inspector-controls/index.js +5 -7
- package/src/query/edit/inspector-controls/parent-control.js +1 -0
- package/src/query/edit/inspector-controls/taxonomy-controls.js +82 -86
- package/src/query/utils.js +1 -1
- package/src/quote/block.json +0 -1
- package/src/rss/index.php +3 -3
- package/src/search/edit.js +6 -1
- package/src/search/index.php +21 -13
- package/src/site-logo/edit.js +10 -8
- package/src/site-logo/editor.scss +1 -0
- package/src/site-title/block.json +2 -1
- package/src/site-title/editor.scss +6 -0
- package/src/site-title/style.scss +5 -0
- package/src/style.scss +1 -0
- package/src/table/state.js +2 -2
- package/src/table-of-contents/edit.js +1 -3
- package/src/tag-cloud/block.json +8 -0
- package/src/tag-cloud/edit.js +1 -1
- package/src/tag-cloud/style.scss +3 -0
- package/src/template-part/index.js +2 -2
- package/src/template-part/index.php +4 -0
- package/src/video/edit.js +19 -0
- package/src/video/editor.scss +37 -0
- package/build/navigation-submenu/view.js +0 -56
- package/build/navigation-submenu/view.js.map +0 -1
- package/build/paragraph/drop-zone.js +0 -99
- package/build/paragraph/drop-zone.js.map +0 -1
- package/build-module/navigation-submenu/view.js +0 -54
- package/build-module/navigation-submenu/view.js.map +0 -1
- package/build-module/paragraph/drop-zone.js +0 -88
- package/build-module/paragraph/drop-zone.js.map +0 -1
- package/src/navigation-submenu/view.js +0 -67
- package/src/paragraph/drop-zone.js +0 -105
|
@@ -8,14 +8,18 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { useTaxonomies } from '../../utils';
|
|
12
12
|
import { MAX_FETCHED_TERMS } from '../../constants';
|
|
13
13
|
|
|
14
14
|
// Helper function to get the term id based on user input in terms `FormTokenField`.
|
|
15
|
-
const getTermIdByTermValue = (
|
|
15
|
+
const getTermIdByTermValue = ( terms, termValue ) => {
|
|
16
16
|
// First we check for exact match by `term.id` or case sensitive `term.name` match.
|
|
17
|
-
const termId =
|
|
18
|
-
|
|
17
|
+
const termId =
|
|
18
|
+
termValue?.id || terms.find( ( term ) => term.name === termValue )?.id;
|
|
19
|
+
if ( termId ) {
|
|
20
|
+
return termId;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
/**
|
|
20
24
|
* Here we make an extra check for entered terms in a non case sensitive way,
|
|
21
25
|
* to match user expectations, due to `FormTokenField` behaviour that shows
|
|
@@ -26,100 +30,92 @@ const getTermIdByTermValue = ( termsMappedByName, termValue ) => {
|
|
|
26
30
|
* In this edge case we always apply the first match from the terms list.
|
|
27
31
|
*/
|
|
28
32
|
const termValueLower = termValue.toLocaleLowerCase();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}
|
|
33
|
+
return terms.find(
|
|
34
|
+
( term ) => term.name.toLocaleLowerCase() === termValueLower
|
|
35
|
+
)?.id;
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const taxonomiesInfo = useSelect(
|
|
38
|
+
const useTaxonomyTerms = ( slug ) => {
|
|
39
|
+
return useSelect(
|
|
39
40
|
( select ) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
name,
|
|
47
|
-
terms: getEntitiesInfo( _terms ),
|
|
48
|
-
};
|
|
49
|
-
} );
|
|
50
|
-
return _taxonomiesInfo;
|
|
41
|
+
const terms = select( coreStore ).getEntityRecords(
|
|
42
|
+
'taxonomy',
|
|
43
|
+
slug,
|
|
44
|
+
{ context: 'view', per_page: MAX_FETCHED_TERMS }
|
|
45
|
+
);
|
|
46
|
+
return { terms };
|
|
51
47
|
},
|
|
52
|
-
[
|
|
48
|
+
[ slug ]
|
|
53
49
|
);
|
|
54
|
-
return taxonomiesInfo;
|
|
55
50
|
};
|
|
56
51
|
|
|
57
52
|
export function TaxonomyControls( { onChange, query } ) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
const { postType, taxQuery } = query;
|
|
54
|
+
|
|
55
|
+
const taxonomies = useTaxonomies( postType );
|
|
56
|
+
if ( ! taxonomies || taxonomies.length === 0 ) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
{ taxonomies.map( ( taxonomy ) => {
|
|
63
|
+
const value = taxQuery?.[ taxonomy.slug ] || [];
|
|
64
|
+
const handleChange = ( newTermIds ) =>
|
|
65
|
+
onChange( {
|
|
66
|
+
taxQuery: {
|
|
67
|
+
...taxQuery,
|
|
68
|
+
[ taxonomy.slug ]: newTermIds,
|
|
69
|
+
},
|
|
70
|
+
} );
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<TaxonomyItem
|
|
74
|
+
key={ taxonomy.slug }
|
|
75
|
+
taxonomy={ taxonomy }
|
|
76
|
+
value={ value }
|
|
77
|
+
onChange={ handleChange }
|
|
78
|
+
/>
|
|
69
79
|
);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
} ) }
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
function TaxonomyItem( { taxonomy, value, onChange } ) {
|
|
85
|
+
const { terms } = useTaxonomyTerms( taxonomy.slug );
|
|
86
|
+
if ( ! terms?.length ) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const onTermsChange = ( newTermValues ) => {
|
|
91
|
+
const termIds = new Set();
|
|
92
|
+
for ( const termValue of newTermValues ) {
|
|
93
|
+
const termId = getTermIdByTermValue( terms, termValue );
|
|
94
|
+
if ( termId ) {
|
|
95
|
+
termIds.add( termId );
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onChange( Array.from( termIds ) );
|
|
79
100
|
};
|
|
80
|
-
|
|
101
|
+
|
|
102
|
+
// Selects only the existing term ids in proper format to be
|
|
81
103
|
// used in `FormTokenField`. This prevents the component from
|
|
82
104
|
// crashing in the editor, when non existing term ids were provided.
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
return ( query.taxQuery?.[ taxonomySlug ] || [] ).reduce(
|
|
89
|
-
( accumulator, termId ) => {
|
|
90
|
-
const term = taxonomyInfo.terms.mapById[ termId ];
|
|
91
|
-
if ( term ) {
|
|
92
|
-
accumulator.push( {
|
|
93
|
-
id: termId,
|
|
94
|
-
value: term.name,
|
|
95
|
-
} );
|
|
96
|
-
}
|
|
97
|
-
return accumulator;
|
|
98
|
-
},
|
|
99
|
-
[]
|
|
100
|
-
);
|
|
101
|
-
};
|
|
105
|
+
const taxQueryValue = value
|
|
106
|
+
.map( ( termId ) => terms.find( ( t ) => t.id === termId ) )
|
|
107
|
+
.filter( Boolean )
|
|
108
|
+
.map( ( term ) => ( { id: term.id, value: term.name } ) );
|
|
109
|
+
|
|
102
110
|
return (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
className="block-library-query-inspector__taxonomy-control"
|
|
113
|
-
>
|
|
114
|
-
<FormTokenField
|
|
115
|
-
label={ name }
|
|
116
|
-
value={ getExistingTaxQueryValue( slug ) }
|
|
117
|
-
suggestions={ terms.names }
|
|
118
|
-
onChange={ onTermsChange( slug ) }
|
|
119
|
-
/>
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
} ) }
|
|
123
|
-
</>
|
|
111
|
+
<div className="block-library-query-inspector__taxonomy-control">
|
|
112
|
+
<FormTokenField
|
|
113
|
+
label={ taxonomy.name }
|
|
114
|
+
value={ taxQueryValue }
|
|
115
|
+
suggestions={ terms.map( ( t ) => t.name ) }
|
|
116
|
+
onChange={ onTermsChange }
|
|
117
|
+
__experimentalShowHowTo={ false }
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
124
120
|
);
|
|
125
121
|
}
|
package/src/query/utils.js
CHANGED
package/src/quote/block.json
CHANGED
package/src/rss/index.php
CHANGED
|
@@ -20,7 +20,7 @@ function render_block_core_rss( $attributes ) {
|
|
|
20
20
|
$rss = fetch_feed( $attributes['feedURL'] );
|
|
21
21
|
|
|
22
22
|
if ( is_wp_error( $rss ) ) {
|
|
23
|
-
return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</div></div>';
|
|
23
|
+
return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if ( ! $rss->get_item_quantity() ) {
|
|
@@ -48,8 +48,8 @@ function render_block_core_rss( $attributes ) {
|
|
|
48
48
|
if ( $date ) {
|
|
49
49
|
$date = sprintf(
|
|
50
50
|
'<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ',
|
|
51
|
-
date_i18n( get_option( 'c' ), $date ),
|
|
52
|
-
date_i18n( get_option( 'date_format' ), $date )
|
|
51
|
+
esc_attr( date_i18n( get_option( 'c' ), $date ) ),
|
|
52
|
+
esc_attr( date_i18n( get_option( 'date_format' ), $date ) )
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/search/edit.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getTypographyClassesAndStyles as useTypographyProps,
|
|
17
17
|
store as blockEditorStore,
|
|
18
18
|
__experimentalGetElementClassName,
|
|
19
|
+
useSetting,
|
|
19
20
|
} from '@wordpress/block-editor';
|
|
20
21
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
21
22
|
import { useEffect } from '@wordpress/element';
|
|
@@ -113,7 +114,11 @@ export default function SearchEdit( {
|
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
const colorProps = useColorProps( attributes );
|
|
116
|
-
const
|
|
117
|
+
const fluidTypographyEnabled = useSetting( 'typography.fluid' );
|
|
118
|
+
const typographyProps = useTypographyProps(
|
|
119
|
+
attributes,
|
|
120
|
+
fluidTypographyEnabled
|
|
121
|
+
);
|
|
117
122
|
const unitControlInstanceId = useInstanceId( UnitControl );
|
|
118
123
|
const unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;
|
|
119
124
|
const isButtonPositionInside = 'button-inside' === buttonPosition;
|
package/src/search/index.php
CHANGED
|
@@ -367,12 +367,12 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
367
367
|
// Add color styles.
|
|
368
368
|
$has_text_color = ! empty( $attributes['style']['color']['text'] );
|
|
369
369
|
if ( $has_text_color ) {
|
|
370
|
-
$button_styles[] = sprintf( 'color: %s;',
|
|
370
|
+
$button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
$has_background_color = ! empty( $attributes['style']['color']['background'] );
|
|
374
374
|
if ( $has_background_color ) {
|
|
375
|
-
$button_styles[] = sprintf( 'background-color: %s;',
|
|
375
|
+
$button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
$has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
|
|
@@ -381,7 +381,7 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
// Get typography styles to be shared across inner elements.
|
|
384
|
-
$typography_styles = get_typography_styles_for_block_core_search( $attributes );
|
|
384
|
+
$typography_styles = esc_attr( get_typography_styles_for_block_core_search( $attributes ) );
|
|
385
385
|
if ( ! empty( $typography_styles ) ) {
|
|
386
386
|
$label_styles [] = $typography_styles;
|
|
387
387
|
$button_styles[] = $typography_styles;
|
|
@@ -399,9 +399,9 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
return array(
|
|
402
|
-
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '',
|
|
403
|
-
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '',
|
|
404
|
-
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '',
|
|
402
|
+
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $input_styles ) ) ) ) : '',
|
|
403
|
+
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $button_styles ) ) ) ) : '',
|
|
404
|
+
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) ) : '',
|
|
405
405
|
'label' => ! empty( $label_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $label_styles ) ) ) ) : '',
|
|
406
406
|
);
|
|
407
407
|
}
|
|
@@ -442,31 +442,39 @@ function get_typography_styles_for_block_core_search( $attributes ) {
|
|
|
442
442
|
|
|
443
443
|
// Add typography styles.
|
|
444
444
|
if ( ! empty( $attributes['style']['typography']['fontSize'] ) ) {
|
|
445
|
-
$typography_styles[] = sprintf(
|
|
445
|
+
$typography_styles[] = sprintf(
|
|
446
|
+
'font-size: %s;',
|
|
447
|
+
wp_get_typography_font_size_value(
|
|
448
|
+
array(
|
|
449
|
+
'size' => $attributes['style']['typography']['fontSize'],
|
|
450
|
+
)
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
|
|
446
454
|
}
|
|
447
455
|
|
|
448
456
|
if ( ! empty( $attributes['style']['typography']['fontFamily'] ) ) {
|
|
449
|
-
$typography_styles[] = sprintf( 'font-family: %s;',
|
|
457
|
+
$typography_styles[] = sprintf( 'font-family: %s;', $attributes['style']['typography']['fontFamily'] );
|
|
450
458
|
}
|
|
451
459
|
|
|
452
460
|
if ( ! empty( $attributes['style']['typography']['letterSpacing'] ) ) {
|
|
453
|
-
$typography_styles[] = sprintf( 'letter-spacing: %s;',
|
|
461
|
+
$typography_styles[] = sprintf( 'letter-spacing: %s;', $attributes['style']['typography']['letterSpacing'] );
|
|
454
462
|
}
|
|
455
463
|
|
|
456
464
|
if ( ! empty( $attributes['style']['typography']['fontWeight'] ) ) {
|
|
457
|
-
$typography_styles[] = sprintf( 'font-weight: %s;',
|
|
465
|
+
$typography_styles[] = sprintf( 'font-weight: %s;', $attributes['style']['typography']['fontWeight'] );
|
|
458
466
|
}
|
|
459
467
|
|
|
460
468
|
if ( ! empty( $attributes['style']['typography']['fontStyle'] ) ) {
|
|
461
|
-
$typography_styles[] = sprintf( 'font-style: %s;',
|
|
469
|
+
$typography_styles[] = sprintf( 'font-style: %s;', $attributes['style']['typography']['fontStyle'] );
|
|
462
470
|
}
|
|
463
471
|
|
|
464
472
|
if ( ! empty( $attributes['style']['typography']['lineHeight'] ) ) {
|
|
465
|
-
$typography_styles[] = sprintf( 'line-height: %s;',
|
|
473
|
+
$typography_styles[] = sprintf( 'line-height: %s;', $attributes['style']['typography']['lineHeight'] );
|
|
466
474
|
}
|
|
467
475
|
|
|
468
476
|
if ( ! empty( $attributes['style']['typography']['textTransform'] ) ) {
|
|
469
|
-
$typography_styles[] = sprintf( 'text-transform: %s;',
|
|
477
|
+
$typography_styles[] = sprintf( 'text-transform: %s;', $attributes['style']['typography']['textTransform'] );
|
|
470
478
|
}
|
|
471
479
|
|
|
472
480
|
return implode( '', $typography_styles );
|
package/src/site-logo/edit.js
CHANGED
|
@@ -81,12 +81,12 @@ const SiteLogo = ( {
|
|
|
81
81
|
} );
|
|
82
82
|
const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
|
|
83
83
|
const { getSettings } = select( blockEditorStore );
|
|
84
|
-
const siteEntities = select( coreStore ).
|
|
84
|
+
const siteEntities = select( coreStore ).getEntityRecord(
|
|
85
85
|
'root',
|
|
86
|
-
'
|
|
86
|
+
'__unstableBase'
|
|
87
87
|
);
|
|
88
88
|
return {
|
|
89
|
-
title: siteEntities
|
|
89
|
+
title: siteEntities?.name,
|
|
90
90
|
...pick( getSettings(), [ 'imageEditing', 'maxWidth' ] ),
|
|
91
91
|
};
|
|
92
92
|
}, [] );
|
|
@@ -370,12 +370,14 @@ export default function LogoEdit( {
|
|
|
370
370
|
} = useSelect( ( select ) => {
|
|
371
371
|
const { canUser, getEntityRecord, getEditedEntityRecord } =
|
|
372
372
|
select( coreStore );
|
|
373
|
-
const siteSettings = getEditedEntityRecord( 'root', 'site' );
|
|
374
|
-
const siteData = getEntityRecord( 'root', '__unstableBase' );
|
|
375
|
-
const _siteLogo = siteSettings?.site_logo;
|
|
376
|
-
const _readOnlyLogo = siteData?.site_logo;
|
|
377
373
|
const _canUserEdit = canUser( 'update', 'settings' );
|
|
378
|
-
const
|
|
374
|
+
const siteSettings = _canUserEdit
|
|
375
|
+
? getEditedEntityRecord( 'root', 'site' )
|
|
376
|
+
: undefined;
|
|
377
|
+
const siteData = getEntityRecord( 'root', '__unstableBase' );
|
|
378
|
+
const _siteLogoId = _canUserEdit
|
|
379
|
+
? siteSettings?.site_logo
|
|
380
|
+
: siteData?.site_logo;
|
|
379
381
|
const _siteIconId = siteSettings?.site_icon;
|
|
380
382
|
const mediaItem =
|
|
381
383
|
_siteLogoId &&
|
package/src/style.scss
CHANGED
package/src/table/state.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get, mapValues,
|
|
4
|
+
import { get, mapValues, pick } from 'lodash';
|
|
5
5
|
|
|
6
6
|
const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];
|
|
7
7
|
|
|
@@ -309,7 +309,7 @@ export function toggleSection( state, sectionName ) {
|
|
|
309
309
|
* @return {boolean} True if the table section is empty, false otherwise.
|
|
310
310
|
*/
|
|
311
311
|
export function isEmptyTableSection( section ) {
|
|
312
|
-
return ! section || ! section.length || every(
|
|
312
|
+
return ! section || ! section.length || section.every( isEmptyRow );
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
/**
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
ToolbarButton,
|
|
22
22
|
ToolbarGroup,
|
|
23
23
|
} from '@wordpress/components';
|
|
24
|
-
import { useDisabled } from '@wordpress/compose';
|
|
25
24
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
26
25
|
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
27
26
|
import { renderToString, useEffect } from '@wordpress/element';
|
|
@@ -55,7 +54,6 @@ export default function TableOfContentsEdit( {
|
|
|
55
54
|
setAttributes,
|
|
56
55
|
} ) {
|
|
57
56
|
const blockProps = useBlockProps();
|
|
58
|
-
const disabledRef = useDisabled();
|
|
59
57
|
|
|
60
58
|
const canInsertList = useSelect(
|
|
61
59
|
( select ) => {
|
|
@@ -295,7 +293,7 @@ export default function TableOfContentsEdit( {
|
|
|
295
293
|
return (
|
|
296
294
|
<>
|
|
297
295
|
<nav { ...blockProps }>
|
|
298
|
-
<ol
|
|
296
|
+
<ol inert="true">
|
|
299
297
|
<TableOfContentsList nestedHeadingList={ headingTree } />
|
|
300
298
|
</ol>
|
|
301
299
|
</nav>
|
package/src/tag-cloud/block.json
CHANGED
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"spacing": {
|
|
41
41
|
"margin": true,
|
|
42
42
|
"padding": true
|
|
43
|
+
},
|
|
44
|
+
"typography": {
|
|
45
|
+
"lineHeight": true,
|
|
46
|
+
"__experimentalFontFamily": true,
|
|
47
|
+
"__experimentalFontWeight": true,
|
|
48
|
+
"__experimentalFontStyle": true,
|
|
49
|
+
"__experimentalTextTransform": true,
|
|
50
|
+
"__experimentalLetterSpacing": true
|
|
43
51
|
}
|
|
44
52
|
},
|
|
45
53
|
"editorStyle": "wp-block-tag-cloud-editor"
|
package/src/tag-cloud/edit.js
CHANGED
|
@@ -168,7 +168,7 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
|
|
|
168
168
|
{ inspectorControls }
|
|
169
169
|
<div { ...useBlockProps() }>
|
|
170
170
|
<ServerSideRender
|
|
171
|
-
|
|
171
|
+
skipBlockSupportAttributes
|
|
172
172
|
block="core/tag-cloud"
|
|
173
173
|
attributes={ attributes }
|
|
174
174
|
/>
|
package/src/tag-cloud/style.scss
CHANGED
|
@@ -62,13 +62,13 @@ export const init = () => {
|
|
|
62
62
|
'blockEditor.__unstableCanInsertBlockType',
|
|
63
63
|
'removeTemplatePartsFromPostTemplates',
|
|
64
64
|
(
|
|
65
|
-
|
|
65
|
+
canInsert,
|
|
66
66
|
blockType,
|
|
67
67
|
rootClientId,
|
|
68
68
|
{ getBlock, getBlockParentsByBlockName }
|
|
69
69
|
) => {
|
|
70
70
|
if ( blockType.name !== 'core/template-part' ) {
|
|
71
|
-
return
|
|
71
|
+
return canInsert;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
for ( const disallowedParentType of DISALLOWED_PARENTS ) {
|
|
@@ -189,6 +189,10 @@ function build_template_part_block_area_variations() {
|
|
|
189
189
|
* @return array Array containing the block variation objects.
|
|
190
190
|
*/
|
|
191
191
|
function build_template_part_block_instance_variations() {
|
|
192
|
+
// Block themes are unavailable during installation.
|
|
193
|
+
if ( wp_installing() ) {
|
|
194
|
+
return array();
|
|
195
|
+
}
|
|
192
196
|
$variations = array();
|
|
193
197
|
$template_parts = get_block_templates(
|
|
194
198
|
array(
|
package/src/video/edit.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Disabled,
|
|
14
14
|
PanelBody,
|
|
15
15
|
Spinner,
|
|
16
|
+
Placeholder,
|
|
16
17
|
} from '@wordpress/components';
|
|
17
18
|
import {
|
|
18
19
|
BlockControls,
|
|
@@ -43,6 +44,23 @@ import VideoCommonSettings from './edit-common-settings';
|
|
|
43
44
|
import TracksEditor from './tracks-editor';
|
|
44
45
|
import Tracks from './tracks';
|
|
45
46
|
|
|
47
|
+
// Much of this description is duplicated from MediaPlaceholder.
|
|
48
|
+
const placeholder = ( content ) => {
|
|
49
|
+
return (
|
|
50
|
+
<Placeholder
|
|
51
|
+
className="block-editor-media-placeholder"
|
|
52
|
+
withIllustration={ true }
|
|
53
|
+
icon={ icon }
|
|
54
|
+
label={ __( 'Video' ) }
|
|
55
|
+
instructions={ __(
|
|
56
|
+
'Upload a video file, pick one from your media library, or add one with a URL.'
|
|
57
|
+
) }
|
|
58
|
+
>
|
|
59
|
+
{ content }
|
|
60
|
+
</Placeholder>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
46
64
|
const ALLOWED_MEDIA_TYPES = [ 'video' ];
|
|
47
65
|
const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
48
66
|
|
|
@@ -146,6 +164,7 @@ function VideoEdit( {
|
|
|
146
164
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
147
165
|
value={ attributes }
|
|
148
166
|
onError={ onUploadError }
|
|
167
|
+
placeholder={ placeholder }
|
|
149
168
|
/>
|
|
150
169
|
</div>
|
|
151
170
|
);
|
package/src/video/editor.scss
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
// Provide special styling for the placeholder.
|
|
2
|
+
// @todo: this particular minimal style of placeholder could be componentized further.
|
|
3
|
+
.wp-block-video.wp-block-video {
|
|
4
|
+
// Show Placeholder style on-select.
|
|
5
|
+
&.is-selected .components-placeholder {
|
|
6
|
+
// Block UI appearance.
|
|
7
|
+
color: $gray-900;
|
|
8
|
+
background-color: $white;
|
|
9
|
+
box-shadow: inset 0 0 0 $border-width $gray-900;
|
|
10
|
+
border: none;
|
|
11
|
+
|
|
12
|
+
// @todo: this should eventually be overridden by a custom border-radius set in the inspector.
|
|
13
|
+
border-radius: $radius-block-ui;
|
|
14
|
+
|
|
15
|
+
> svg {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.components-placeholder__illustration {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&::before {
|
|
24
|
+
opacity: 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Remove the transition while we still have a legacy placeholder style.
|
|
29
|
+
// Otherwise the content jumps between the 1px placeholder border, and any inherited custom
|
|
30
|
+
// parent border that may get applied when you deselect.
|
|
31
|
+
.components-placeholder__label,
|
|
32
|
+
.components-placeholder__instructions,
|
|
33
|
+
.components-button {
|
|
34
|
+
transition: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
1
38
|
.wp-block[data-align="center"] > .wp-block-video {
|
|
2
39
|
text-align: center;
|
|
3
40
|
}
|