@wordpress/block-library 8.18.0 → 8.19.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 +2 -0
- package/README.md +1 -1
- package/build/block/edit.js +53 -2
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.js +7 -4
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +11 -2
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +10 -4
- package/build/button/save.js.map +1 -1
- package/build/buttons/edit.js +12 -3
- package/build/buttons/edit.js.map +1 -1
- package/build/code/edit.js +8 -2
- package/build/code/edit.js.map +1 -1
- package/build/code/index.js +7 -1
- package/build/code/index.js.map +1 -1
- package/build/column/edit.native.js +5 -5
- package/build/column/edit.native.js.map +1 -1
- package/build/column/index.js +1 -0
- package/build/column/index.js.map +1 -1
- package/build/columns/index.js +2 -0
- package/build/columns/index.js.map +1 -1
- package/build/file/edit.native.js +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js +2 -1
- package/build/file/index.js.map +1 -1
- package/build/file/utils/index.js +1 -15
- package/build/file/utils/index.js.map +1 -1
- package/build/file/view.js +14 -1
- package/build/file/view.js.map +1 -1
- package/build/footnotes/edit.js +14 -5
- package/build/footnotes/edit.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/group/edit.js +0 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +5 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/edit.js +0 -1
- package/build/heading/edit.js.map +1 -1
- package/build/heading/index.js +2 -0
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +3 -6
- package/build/heading/transforms.js.map +1 -1
- package/build/image/deprecated.js +191 -7
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +27 -12
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +75 -40
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +7 -4
- package/build/image/index.js.map +1 -1
- package/build/image/{view-interactivity.js → view.js} +1 -1
- package/build/image/view.js.map +1 -0
- package/build/list/deprecated.js +93 -1
- package/build/list/deprecated.js.map +1 -1
- package/build/list/edit.js +10 -10
- package/build/list/edit.js.map +1 -1
- package/build/list/ordered-list-settings.js +10 -10
- package/build/list/ordered-list-settings.js.map +1 -1
- package/build/list/save.js +4 -2
- package/build/list/save.js.map +1 -1
- package/build/list/utils.js +21 -2
- package/build/list/utils.js.map +1 -1
- package/build/navigation/constants.js +1 -1
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/index.js +4 -2
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view.js +168 -82
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +3 -9
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/transforms.js +24 -0
- package/build/navigation-link/transforms.js.map +1 -1
- package/build/page-list/edit.js +2 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +10 -2
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +5 -3
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-content/edit.js +8 -7
- package/build/post-content/edit.js.map +1 -1
- package/build/post-content/index.js +3 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-featured-image/overlay.js +2 -1
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-terms/use-post-terms.js +3 -2
- package/build/post-terms/use-post-terms.js.map +1 -1
- package/build/preformatted/edit.js +4 -1
- package/build/preformatted/edit.js.map +1 -1
- package/build/preformatted/index.js +1 -1
- package/build/preformatted/index.js.map +1 -1
- package/build/pullquote/deprecated.js +6 -7
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +56 -0
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -0
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +42 -0
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +8 -25
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +8 -2
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/utils.js +19 -0
- package/build/query/utils.js.map +1 -1
- package/build/query/view.js +4 -5
- package/build/query/view.js.map +1 -1
- package/build/search/index.js +1 -0
- package/build/search/index.js.map +1 -1
- package/build/search/view.js +81 -150
- package/build/search/view.js.map +1 -1
- package/build/social-link/edit.native.js +3 -1
- package/build/social-link/edit.native.js.map +1 -1
- package/build/table/edit.js +7 -7
- package/build/table/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +2 -130
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/hooks.js +145 -0
- package/build/table-of-contents/hooks.js.map +1 -0
- package/build/table-of-contents/index.js +2 -1
- package/build/table-of-contents/index.js.map +1 -1
- package/build/verse/edit.js +4 -1
- package/build/verse/edit.js.map +1 -1
- package/build/verse/index.js +1 -1
- package/build/verse/index.js.map +1 -1
- package/build-module/block/edit.js +54 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.js +7 -4
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +11 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +10 -4
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/edit.js +12 -3
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/code/edit.js +8 -2
- package/build-module/code/edit.js.map +1 -1
- package/build-module/code/index.js +7 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/edit.native.js +5 -5
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/column/index.js +1 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/columns/index.js +2 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/file/edit.native.js +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js +2 -1
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/utils/index.js +0 -13
- package/build-module/file/utils/index.js.map +1 -1
- package/build-module/file/view.js +14 -2
- package/build-module/file/view.js.map +1 -1
- package/build-module/footnotes/edit.js +14 -5
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/group/edit.js +0 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +5 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/edit.js +0 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/index.js +2 -0
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +3 -6
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +191 -7
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +27 -12
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +77 -42
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +7 -4
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/{view-interactivity.js → view.js} +1 -1
- package/build-module/image/view.js.map +1 -0
- package/build-module/list/deprecated.js +95 -3
- package/build-module/list/deprecated.js.map +1 -1
- package/build-module/list/edit.js +10 -10
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list/ordered-list-settings.js +10 -10
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/list/save.js +4 -2
- package/build-module/list/save.js.map +1 -1
- package/build-module/list/utils.js +20 -2
- package/build-module/list/utils.js.map +1 -1
- package/build-module/navigation/constants.js +1 -1
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/index.js +4 -2
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view.js +168 -83
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +3 -9
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/transforms.js +24 -0
- package/build-module/navigation-link/transforms.js.map +1 -1
- package/build-module/page-list/edit.js +2 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +10 -2
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +5 -3
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-content/edit.js +8 -7
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-content/index.js +3 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +2 -1
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-terms/use-post-terms.js +3 -2
- package/build-module/post-terms/use-post-terms.js.map +1 -1
- package/build-module/preformatted/edit.js +4 -1
- package/build-module/preformatted/edit.js.map +1 -1
- package/build-module/preformatted/index.js +1 -1
- package/build-module/preformatted/index.js.map +1 -1
- package/build-module/pullquote/deprecated.js +6 -7
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +50 -0
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -0
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +35 -0
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +9 -26
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +8 -2
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/utils.js +17 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query/view.js +4 -5
- package/build-module/query/view.js.map +1 -1
- package/build-module/search/index.js +1 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/search/view.js +81 -151
- package/build-module/search/view.js.map +1 -1
- package/build-module/social-link/edit.native.js +3 -1
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/table/edit.js +7 -7
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +3 -131
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/hooks.js +137 -0
- package/build-module/table-of-contents/hooks.js.map +1 -0
- package/build-module/table-of-contents/index.js +2 -1
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/verse/edit.js +4 -1
- package/build-module/verse/edit.js.map +1 -1
- package/build-module/verse/index.js +1 -1
- package/build-module/verse/index.js.map +1 -1
- package/build-style/cover/style-rtl.css +9 -0
- package/build-style/cover/style.css +9 -0
- package/build-style/editor-rtl.css +15 -9
- package/build-style/editor.css +15 -9
- package/build-style/file/style-rtl.css +5 -0
- package/build-style/file/style.css +5 -0
- package/build-style/heading/style-rtl.css +13 -0
- package/build-style/heading/style.css +13 -0
- package/build-style/navigation-link/editor-rtl.css +0 -9
- package/build-style/navigation-link/editor.css +0 -9
- package/build-style/paragraph/editor-rtl.css +5 -0
- package/build-style/paragraph/editor.css +5 -0
- package/build-style/paragraph/style-rtl.css +5 -0
- package/build-style/paragraph/style.css +5 -0
- package/build-style/post-navigation-link/style-rtl.css +3 -0
- package/build-style/post-navigation-link/style.css +3 -0
- package/build-style/query/editor-rtl.css +10 -0
- package/build-style/query/editor.css +10 -0
- package/build-style/query/style-rtl.css +1 -1
- package/build-style/query/style.css +1 -1
- package/build-style/reset-rtl.css +27 -27
- package/build-style/reset.css +27 -27
- package/build-style/style-rtl.css +35 -0
- package/build-style/style.css +35 -0
- package/package.json +32 -33
- package/src/audio/test/__snapshots__/edit.native.js.snap +78 -106
- package/src/avatar/index.php +2 -2
- package/src/block/edit.js +58 -2
- package/src/block/test/edit.native.js +2 -3
- package/src/button/block.json +11 -2
- package/src/button/edit.js +27 -11
- package/src/button/save.js +10 -4
- package/src/buttons/edit.js +13 -3
- package/src/buttons/test/edit.native.js +28 -24
- package/src/calendar/index.php +2 -2
- package/src/code/block.json +2 -1
- package/src/code/edit.js +13 -1
- package/src/code/index.js +5 -0
- package/src/column/block.json +1 -0
- package/src/column/edit.native.js +4 -4
- package/src/columns/block.json +2 -0
- package/src/columns/test/__snapshots__/edit.native.js.snap +14 -0
- package/src/columns/test/edit.native.js +47 -17
- package/src/comment-template/index.php +1 -1
- package/src/comments-pagination-next/index.php +1 -1
- package/src/comments-pagination-previous/index.php +1 -1
- package/src/cover/style.scss +12 -1
- package/src/cover/test/edit.js +7 -7
- package/src/cover/test/edit.native.js +18 -27
- package/src/embed/test/index.native.js +30 -45
- package/src/file/block.json +2 -1
- package/src/file/edit.native.js +1 -1
- package/src/file/index.php +19 -21
- package/src/file/style.scss +6 -1
- package/src/file/test/__snapshots__/edit.native.js.snap +162 -218
- package/src/file/utils/index.js +0 -15
- package/src/file/view.js +14 -5
- package/src/footnotes/edit.js +16 -2
- package/src/gallery/edit.js +1 -1
- package/src/gallery/index.php +1 -1
- package/src/group/block.json +5 -0
- package/src/group/edit.js +0 -1
- package/src/heading/block.json +2 -0
- package/src/heading/edit.js +0 -1
- package/src/heading/style.scss +4 -0
- package/src/heading/transforms.js +1 -6
- package/src/image/block.json +7 -4
- package/src/image/deprecated.js +210 -7
- package/src/image/edit.js +43 -29
- package/src/image/image.js +86 -43
- package/src/image/index.php +251 -28
- package/src/latest-posts/index.php +1 -1
- package/src/list/deprecated.js +84 -3
- package/src/list/edit.js +6 -3
- package/src/list/ordered-list-settings.js +20 -5
- package/src/list/save.js +10 -1
- package/src/list/test/edit.native.js +2 -4
- package/src/list/utils.js +22 -1
- package/src/navigation/block.json +4 -2
- package/src/navigation/constants.js +1 -0
- package/src/navigation/index.php +85 -123
- package/src/navigation/view.js +192 -96
- package/src/navigation-link/edit.js +21 -36
- package/src/navigation-link/editor.scss +0 -8
- package/src/navigation-link/transforms.js +22 -0
- package/src/page-list/edit.js +2 -1
- package/src/paragraph/editor.scss +5 -0
- package/src/paragraph/style.scss +5 -0
- package/src/pattern/index.php +2 -2
- package/src/post-comments-form/edit.js +10 -0
- package/src/post-comments-form/form.js +7 -1
- package/src/post-content/block.json +3 -0
- package/src/post-content/edit.js +14 -6
- package/src/post-excerpt/index.php +2 -2
- package/src/post-featured-image/index.php +2 -2
- package/src/post-featured-image/overlay.js +1 -0
- package/src/post-navigation-link/index.php +5 -1
- package/src/post-navigation-link/style.scss +4 -0
- package/src/post-template/index.php +1 -1
- package/src/post-terms/index.php +5 -2
- package/src/post-terms/use-post-terms.js +4 -2
- package/src/preformatted/edit.js +5 -0
- package/src/preformatted/index.js +1 -1
- package/src/pullquote/deprecated.js +8 -13
- package/src/query/edit/enhanced-pagination-modal.js +65 -0
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +49 -0
- package/src/query/edit/inspector-controls/index.js +9 -45
- package/src/query/edit/query-content.js +8 -0
- package/src/query/editor.scss +10 -0
- package/src/query/index.php +29 -16
- package/src/query/style.scss +2 -2
- package/src/query/utils.js +22 -0
- package/src/query/view.js +5 -5
- package/src/query-pagination-next/index.php +1 -1
- package/src/query-pagination-previous/index.php +1 -1
- package/src/reset.scss +1 -1
- package/src/search/block.json +1 -0
- package/src/search/index.php +45 -4
- package/src/search/test/__snapshots__/edit.native.js.snap +265 -363
- package/src/search/view.js +70 -169
- package/src/social-link/edit.native.js +1 -1
- package/src/social-link/editor.native.scss +4 -0
- package/src/table/edit.js +21 -19
- package/src/table-of-contents/block.json +2 -1
- package/src/table-of-contents/edit.js +5 -162
- package/src/table-of-contents/hooks.js +156 -0
- package/src/verse/edit.js +5 -0
- package/src/verse/index.js +1 -1
- package/src/verse/test/edit.native.js +2 -3
- package/build/file/view-interactivity.js +0 -22
- package/build/file/view-interactivity.js.map +0 -1
- package/build/image/view-interactivity.js.map +0 -1
- package/build/navigation/view-interactivity.js +0 -172
- package/build/navigation/view-interactivity.js.map +0 -1
- package/build/navigation/view-modal.js +0 -115
- package/build/navigation/view-modal.js.map +0 -1
- package/build-module/file/view-interactivity.js +0 -18
- package/build-module/file/view-interactivity.js.map +0 -1
- package/build-module/image/view-interactivity.js.map +0 -1
- package/build-module/navigation/view-interactivity.js +0 -169
- package/build-module/navigation/view-interactivity.js.map +0 -1
- package/build-module/navigation/view-modal.js +0 -112
- package/build-module/navigation/view-modal.js.map +0 -1
- package/src/file/view-interactivity.js +0 -18
- package/src/navigation/view-interactivity.js +0 -196
- package/src/navigation/view-modal.js +0 -127
- /package/src/image/{view-interactivity.js → view.js} +0 -0
|
@@ -17,8 +17,7 @@ import {
|
|
|
17
17
|
privateApis as blockEditorPrivateApis,
|
|
18
18
|
} from '@wordpress/block-editor';
|
|
19
19
|
import { debounce } from '@wordpress/compose';
|
|
20
|
-
import { useEffect, useState, useCallback
|
|
21
|
-
import { speak } from '@wordpress/a11y';
|
|
20
|
+
import { useEffect, useState, useCallback } from '@wordpress/element';
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Internal dependencies
|
|
@@ -28,6 +27,7 @@ import AuthorControl from './author-control';
|
|
|
28
27
|
import ParentControl from './parent-control';
|
|
29
28
|
import { TaxonomyControls } from './taxonomy-controls';
|
|
30
29
|
import StickyControl from './sticky-control';
|
|
30
|
+
import EnhancedPaginationControl from './enhanced-pagination-control';
|
|
31
31
|
import CreateNewPostLink from './create-new-post-link';
|
|
32
32
|
import { unlock } from '../../../lock-unlock';
|
|
33
33
|
import {
|
|
@@ -41,7 +41,8 @@ import {
|
|
|
41
41
|
const { BlockInfo } = unlock( blockEditorPrivateApis );
|
|
42
42
|
|
|
43
43
|
export default function QueryInspectorControls( props ) {
|
|
44
|
-
const { attributes, setQuery, setDisplayLayout, setAttributes } =
|
|
44
|
+
const { attributes, setQuery, setDisplayLayout, setAttributes, clientId } =
|
|
45
|
+
props;
|
|
45
46
|
const { query, displayLayout, enhancedPagination } = attributes;
|
|
46
47
|
const {
|
|
47
48
|
order,
|
|
@@ -124,18 +125,6 @@ export default function QueryInspectorControls( props ) {
|
|
|
124
125
|
isControlAllowed( allowedControls, 'parents' ) &&
|
|
125
126
|
isPostTypeHierarchical;
|
|
126
127
|
|
|
127
|
-
const enhancedPaginationNotice = __(
|
|
128
|
-
'Enhanced Pagination might cause interactive blocks within the Post Template to stop working. Disable it if you experience any issues.'
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
const isFirstRender = useRef( true ); // Don't speak on first render.
|
|
132
|
-
useEffect( () => {
|
|
133
|
-
if ( ! isFirstRender.current && enhancedPagination ) {
|
|
134
|
-
speak( enhancedPaginationNotice );
|
|
135
|
-
}
|
|
136
|
-
isFirstRender.current = false;
|
|
137
|
-
}, [ enhancedPagination, enhancedPaginationNotice ] );
|
|
138
|
-
|
|
139
128
|
const showFiltersPanel =
|
|
140
129
|
showTaxControl ||
|
|
141
130
|
showAuthorControl ||
|
|
@@ -215,6 +204,11 @@ export default function QueryInspectorControls( props ) {
|
|
|
215
204
|
}
|
|
216
205
|
/>
|
|
217
206
|
) }
|
|
207
|
+
<EnhancedPaginationControl
|
|
208
|
+
enhancedPagination={ enhancedPagination }
|
|
209
|
+
setAttributes={ setAttributes }
|
|
210
|
+
clientId={ clientId }
|
|
211
|
+
/>
|
|
218
212
|
</PanelBody>
|
|
219
213
|
</InspectorControls>
|
|
220
214
|
) }
|
|
@@ -293,36 +287,6 @@ export default function QueryInspectorControls( props ) {
|
|
|
293
287
|
</ToolsPanel>
|
|
294
288
|
</InspectorControls>
|
|
295
289
|
) }
|
|
296
|
-
<InspectorControls>
|
|
297
|
-
<PanelBody
|
|
298
|
-
title={ __( 'User Experience' ) }
|
|
299
|
-
initialOpen={ false }
|
|
300
|
-
>
|
|
301
|
-
<ToggleControl
|
|
302
|
-
label={ __( 'Enhanced pagination' ) }
|
|
303
|
-
help={ __(
|
|
304
|
-
"Don't refresh the page when paginating to another page."
|
|
305
|
-
) }
|
|
306
|
-
checked={ !! enhancedPagination }
|
|
307
|
-
onChange={ ( value ) =>
|
|
308
|
-
setAttributes( {
|
|
309
|
-
enhancedPagination: !! value,
|
|
310
|
-
} )
|
|
311
|
-
}
|
|
312
|
-
/>
|
|
313
|
-
{ enhancedPagination && (
|
|
314
|
-
<div>
|
|
315
|
-
<Notice
|
|
316
|
-
spokenMessage={ null }
|
|
317
|
-
status="warning"
|
|
318
|
-
isDismissible={ false }
|
|
319
|
-
>
|
|
320
|
-
{ enhancedPaginationNotice }
|
|
321
|
-
</Notice>
|
|
322
|
-
</div>
|
|
323
|
-
) }
|
|
324
|
-
</PanelBody>
|
|
325
|
-
</InspectorControls>
|
|
326
290
|
</>
|
|
327
291
|
);
|
|
328
292
|
}
|
|
@@ -20,6 +20,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
20
20
|
*/
|
|
21
21
|
import QueryToolbar from './query-toolbar';
|
|
22
22
|
import QueryInspectorControls from './inspector-controls';
|
|
23
|
+
import EnhancedPaginationModal from './enhanced-pagination-modal';
|
|
23
24
|
|
|
24
25
|
const DEFAULTS_POSTS_PER_PAGE = 3;
|
|
25
26
|
|
|
@@ -103,13 +104,20 @@ export default function QueryContent( {
|
|
|
103
104
|
"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
|
|
104
105
|
),
|
|
105
106
|
};
|
|
107
|
+
|
|
106
108
|
return (
|
|
107
109
|
<>
|
|
110
|
+
<EnhancedPaginationModal
|
|
111
|
+
attributes={ attributes }
|
|
112
|
+
setAttributes={ setAttributes }
|
|
113
|
+
clientId={ clientId }
|
|
114
|
+
/>
|
|
108
115
|
<QueryInspectorControls
|
|
109
116
|
attributes={ attributes }
|
|
110
117
|
setQuery={ updateQuery }
|
|
111
118
|
setDisplayLayout={ updateDisplayLayout }
|
|
112
119
|
setAttributes={ setAttributes }
|
|
120
|
+
clientId={ clientId }
|
|
113
121
|
/>
|
|
114
122
|
<BlockControls>
|
|
115
123
|
<QueryToolbar
|
package/src/query/editor.scss
CHANGED
package/src/query/index.php
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Modifies the static `core/query` block on the server.
|
|
10
10
|
*
|
|
11
|
-
* @since
|
|
11
|
+
* @since 6.4.0
|
|
12
12
|
*
|
|
13
13
|
* @param array $attributes Block attributes.
|
|
14
14
|
* @param string $content Block default content.
|
|
@@ -23,9 +23,19 @@ function render_block_core_query( $attributes, $content, $block ) {
|
|
|
23
23
|
// Add the necessary directives.
|
|
24
24
|
$p->set_attribute( 'data-wp-interactive', true );
|
|
25
25
|
$p->set_attribute( 'data-wp-navigation-id', 'query-' . $attributes['queryId'] );
|
|
26
|
+
// Use context to send translated strings.
|
|
26
27
|
$p->set_attribute(
|
|
27
28
|
'data-wp-context',
|
|
28
|
-
wp_json_encode(
|
|
29
|
+
wp_json_encode(
|
|
30
|
+
array(
|
|
31
|
+
'core' => array(
|
|
32
|
+
'query' => array(
|
|
33
|
+
'loadingText' => __( 'Loading page, please wait.' ),
|
|
34
|
+
'loadedText' => __( 'Page Loaded.' ),
|
|
35
|
+
),
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
)
|
|
29
39
|
);
|
|
30
40
|
$content = $p->get_updated_html();
|
|
31
41
|
|
|
@@ -49,20 +59,6 @@ function render_block_core_query( $attributes, $content, $block ) {
|
|
|
49
59
|
$last_div_position,
|
|
50
60
|
0
|
|
51
61
|
);
|
|
52
|
-
|
|
53
|
-
// Use state to send translated strings.
|
|
54
|
-
wp_store(
|
|
55
|
-
array(
|
|
56
|
-
'state' => array(
|
|
57
|
-
'core' => array(
|
|
58
|
-
'query' => array(
|
|
59
|
-
'loadingText' => __( 'Loading page, please wait.' ),
|
|
60
|
-
'loadedText' => __( 'Page Loaded.' ),
|
|
61
|
-
),
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
)
|
|
65
|
-
);
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
64
|
|
|
@@ -95,6 +91,23 @@ function render_block_core_query( $attributes, $content, $block ) {
|
|
|
95
91
|
return $content;
|
|
96
92
|
}
|
|
97
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Ensure that the view script has the `wp-interactivity` dependency.
|
|
96
|
+
*
|
|
97
|
+
* @since 6.4.0
|
|
98
|
+
*/
|
|
99
|
+
function block_core_query_ensure_interactivity_dependency() {
|
|
100
|
+
global $wp_scripts;
|
|
101
|
+
if (
|
|
102
|
+
isset( $wp_scripts->registered['wp-block-query-view'] ) &&
|
|
103
|
+
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-query-view']->deps, true )
|
|
104
|
+
) {
|
|
105
|
+
$wp_scripts->registered['wp-block-query-view']->deps[] = 'wp-interactivity';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
add_action( 'wp_print_scripts', 'block_core_query_ensure_interactivity_dependency' );
|
|
110
|
+
|
|
98
111
|
/**
|
|
99
112
|
* Registers the `core/query` block on the server.
|
|
100
113
|
*/
|
package/src/query/style.scss
CHANGED
package/src/query/utils.js
CHANGED
|
@@ -344,3 +344,25 @@ export const usePatterns = ( clientId, name ) => {
|
|
|
344
344
|
[ name, clientId ]
|
|
345
345
|
);
|
|
346
346
|
};
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Hook that returns whether the Query Loop with the given `clientId` contains
|
|
350
|
+
* any third-party block.
|
|
351
|
+
*
|
|
352
|
+
* @param {string} clientId The block's client ID.
|
|
353
|
+
* @return {boolean} True if it contains third-party blocks.
|
|
354
|
+
*/
|
|
355
|
+
export const useContainsThirdPartyBlocks = ( clientId ) => {
|
|
356
|
+
return useSelect(
|
|
357
|
+
( select ) => {
|
|
358
|
+
const { getClientIdsOfDescendants, getBlockName } =
|
|
359
|
+
select( blockEditorStore );
|
|
360
|
+
|
|
361
|
+
return getClientIdsOfDescendants( clientId ).some(
|
|
362
|
+
( descendantClientId ) =>
|
|
363
|
+
! getBlockName( descendantClientId ).startsWith( 'core/' )
|
|
364
|
+
);
|
|
365
|
+
},
|
|
366
|
+
[ clientId ]
|
|
367
|
+
);
|
|
368
|
+
};
|
package/src/query/view.js
CHANGED
|
@@ -32,7 +32,7 @@ store( {
|
|
|
32
32
|
actions: {
|
|
33
33
|
core: {
|
|
34
34
|
query: {
|
|
35
|
-
navigate: async ( { event, ref, context
|
|
35
|
+
navigate: async ( { event, ref, context } ) => {
|
|
36
36
|
if ( isValidLink( ref ) && isValidEvent( event ) ) {
|
|
37
37
|
event.preventDefault();
|
|
38
38
|
|
|
@@ -42,9 +42,9 @@ store( {
|
|
|
42
42
|
// Don't announce the navigation immediately, wait 300 ms.
|
|
43
43
|
const timeout = setTimeout( () => {
|
|
44
44
|
context.core.query.message =
|
|
45
|
-
|
|
45
|
+
context.core.query.loadingText;
|
|
46
46
|
context.core.query.animation = 'start';
|
|
47
|
-
},
|
|
47
|
+
}, 400 );
|
|
48
48
|
|
|
49
49
|
await navigate( ref.href );
|
|
50
50
|
|
|
@@ -55,9 +55,9 @@ store( {
|
|
|
55
55
|
// same, we use a no-break space similar to the @wordpress/a11y
|
|
56
56
|
// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
|
|
57
57
|
context.core.query.message =
|
|
58
|
-
|
|
58
|
+
context.core.query.loadedText +
|
|
59
59
|
( context.core.query.message ===
|
|
60
|
-
|
|
60
|
+
context.core.query.loadedText
|
|
61
61
|
? '\u00A0'
|
|
62
62
|
: '' );
|
|
63
63
|
|
|
@@ -37,7 +37,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
|
|
|
37
37
|
|
|
38
38
|
// Check if the pagination is for Query that inherits the global context.
|
|
39
39
|
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
|
|
40
|
-
$filter_link_attributes = static function() use ( $wrapper_attributes ) {
|
|
40
|
+
$filter_link_attributes = static function () use ( $wrapper_attributes ) {
|
|
41
41
|
return $wrapper_attributes;
|
|
42
42
|
};
|
|
43
43
|
add_filter( 'next_posts_link_attributes', $filter_link_attributes );
|
|
@@ -35,7 +35,7 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
|
|
|
35
35
|
// Check if the pagination is for Query that inherits the global context
|
|
36
36
|
// and handle appropriately.
|
|
37
37
|
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
|
|
38
|
-
$filter_link_attributes = static function() use ( $wrapper_attributes ) {
|
|
38
|
+
$filter_link_attributes = static function () use ( $wrapper_attributes ) {
|
|
39
39
|
return $wrapper_attributes;
|
|
40
40
|
};
|
|
41
41
|
|
package/src/reset.scss
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
// We use :where to keep specificity minimal.
|
|
9
9
|
// https://css-tricks.com/almanac/selectors/w/where/
|
|
10
|
-
|
|
10
|
+
:where(.editor-styles-wrapper) {
|
|
11
11
|
/**
|
|
12
12
|
* The following styles revert to the browser defaults overriding the WPAdmin styles.
|
|
13
13
|
* This is only needed while the block editor is not being loaded in an iframe.
|
package/src/search/block.json
CHANGED
package/src/search/index.php
CHANGED
|
@@ -46,6 +46,9 @@ function render_block_core_search( $attributes, $content, $block ) {
|
|
|
46
46
|
'button-inside' === $attributes['buttonPosition'];
|
|
47
47
|
// Border color classes need to be applied to the elements that have a border color.
|
|
48
48
|
$border_color_classes = get_border_color_classes_for_block_core_search( $attributes );
|
|
49
|
+
// This variable is a constant and its value is always false at this moment.
|
|
50
|
+
// It is defined this way because some values depend on it, in case it changes in the future.
|
|
51
|
+
$open_by_default = 'false';
|
|
49
52
|
|
|
50
53
|
$label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] );
|
|
51
54
|
$label = new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) );
|
|
@@ -77,6 +80,9 @@ function render_block_core_search( $attributes, $content, $block ) {
|
|
|
77
80
|
|
|
78
81
|
$is_expandable_searchfield = 'button-only' === $button_position && 'expand-searchfield' === $button_behavior;
|
|
79
82
|
if ( $is_expandable_searchfield ) {
|
|
83
|
+
$input->set_attribute( 'data-wp-bind--aria-hidden', '!context.core.search.isSearchInputVisible' );
|
|
84
|
+
$input->set_attribute( 'data-wp-bind--tabindex', 'selectors.core.search.tabindex' );
|
|
85
|
+
// Adding these attributes manually is needed until the Interactivity API SSR logic is added to core.
|
|
80
86
|
$input->set_attribute( 'aria-hidden', 'true' );
|
|
81
87
|
$input->set_attribute( 'tabindex', '-1' );
|
|
82
88
|
}
|
|
@@ -139,11 +145,16 @@ function render_block_core_search( $attributes, $content, $block ) {
|
|
|
139
145
|
if ( $button->next_tag() ) {
|
|
140
146
|
$button->add_class( implode( ' ', $button_classes ) );
|
|
141
147
|
if ( 'expand-searchfield' === $attributes['buttonBehavior'] && 'button-only' === $attributes['buttonPosition'] ) {
|
|
148
|
+
$button->set_attribute( 'data-wp-bind--aria-label', 'selectors.core.search.ariaLabel' );
|
|
149
|
+
$button->set_attribute( 'data-wp-bind--aria-controls', 'selectors.core.search.ariaControls' );
|
|
150
|
+
$button->set_attribute( 'data-wp-bind--aria-expanded', 'context.core.search.isSearchInputVisible' );
|
|
151
|
+
$button->set_attribute( 'data-wp-bind--type', 'selectors.core.search.type' );
|
|
152
|
+
$button->set_attribute( 'data-wp-on--click', 'actions.core.search.openSearchInput' );
|
|
153
|
+
// Adding these attributes manually is needed until the Interactivity API SSR logic is added to core.
|
|
142
154
|
$button->set_attribute( 'aria-label', __( 'Expand search field' ) );
|
|
143
|
-
$button->set_attribute( 'data-toggled-aria-label', __( 'Submit Search' ) );
|
|
144
155
|
$button->set_attribute( 'aria-controls', 'wp-block-search__input-' . $input_id );
|
|
145
156
|
$button->set_attribute( 'aria-expanded', 'false' );
|
|
146
|
-
$button->set_attribute( 'type', 'button' );
|
|
157
|
+
$button->set_attribute( 'type', 'button' );
|
|
147
158
|
} else {
|
|
148
159
|
$button->set_attribute( 'aria-label', wp_strip_all_tags( $attributes['buttonText'] ) );
|
|
149
160
|
}
|
|
@@ -160,11 +171,24 @@ function render_block_core_search( $attributes, $content, $block ) {
|
|
|
160
171
|
$wrapper_attributes = get_block_wrapper_attributes(
|
|
161
172
|
array( 'class' => $classnames )
|
|
162
173
|
);
|
|
174
|
+
$form_directives = '';
|
|
175
|
+
if ( $is_expandable_searchfield ) {
|
|
176
|
+
$aria_label_expanded = __( 'Submit Search' );
|
|
177
|
+
$aria_label_collapsed = __( 'Expand search field' );
|
|
178
|
+
$form_directives = '
|
|
179
|
+
data-wp-interactive
|
|
180
|
+
data-wp-context=\'{ "core": { "search": { "isSearchInputVisible": ' . $open_by_default . ', "inputId": "' . $input_id . '", "ariaLabelExpanded": "' . $aria_label_expanded . '", "ariaLabelCollapsed": "' . $aria_label_collapsed . '" } } }\'
|
|
181
|
+
data-wp-class--wp-block-search__searchfield-hidden="!context.core.search.isSearchInputVisible"
|
|
182
|
+
data-wp-on--keydown="actions.core.search.handleSearchKeydown"
|
|
183
|
+
data-wp-on--focusout="actions.core.search.handleSearchFocusout"
|
|
184
|
+
';
|
|
185
|
+
}
|
|
163
186
|
|
|
164
187
|
return sprintf(
|
|
165
|
-
'<form role="search" method="get" action="%
|
|
188
|
+
'<form role="search" method="get" action="%1s" %2s %3s>%4s</form>',
|
|
166
189
|
esc_url( home_url( '/' ) ),
|
|
167
190
|
$wrapper_attributes,
|
|
191
|
+
$form_directives,
|
|
168
192
|
$label . $field_markup
|
|
169
193
|
);
|
|
170
194
|
}
|
|
@@ -182,6 +206,23 @@ function register_block_core_search() {
|
|
|
182
206
|
}
|
|
183
207
|
add_action( 'init', 'register_block_core_search' );
|
|
184
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Ensure that the view script has the `wp-interactivity` dependency.
|
|
211
|
+
*
|
|
212
|
+
* @since 6.4.0
|
|
213
|
+
*/
|
|
214
|
+
function block_core_search_ensure_interactivity_dependency() {
|
|
215
|
+
global $wp_scripts;
|
|
216
|
+
if (
|
|
217
|
+
isset( $wp_scripts->registered['wp-block-search-view'] ) &&
|
|
218
|
+
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-search-view']->deps, true )
|
|
219
|
+
) {
|
|
220
|
+
$wp_scripts->registered['wp-block-search-view']->deps[] = 'wp-interactivity';
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
add_action( 'wp_print_scripts', 'block_core_search_ensure_interactivity_dependency' );
|
|
225
|
+
|
|
185
226
|
/**
|
|
186
227
|
* Builds the correct top level classnames for the 'core/search' block.
|
|
187
228
|
*
|
|
@@ -242,7 +283,7 @@ function classnames_for_block_core_search( $attributes ) {
|
|
|
242
283
|
* @return void
|
|
243
284
|
*/
|
|
244
285
|
function apply_block_core_search_border_style( $attributes, $property, $side, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
|
245
|
-
$is_button_inside = 'button-inside' ===
|
|
286
|
+
$is_button_inside = isset( $attributes['buttonPosition'] ) && 'button-inside' === $attributes['buttonPosition'];
|
|
246
287
|
|
|
247
288
|
$path = array( 'style', 'border', $property );
|
|
248
289
|
|