@wordpress/block-library 9.14.0 → 9.15.1
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/LICENSE.md +1 -1
- package/build/archives/edit.js +83 -36
- package/build/archives/edit.js.map +1 -1
- package/build/button/deprecated.js +182 -1
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +47 -25
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +8 -2
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +8 -5
- package/build/button/save.js.map +1 -1
- package/build/column/edit.js +33 -13
- package/build/column/edit.js.map +1 -1
- package/build/columns/edit.js +50 -27
- package/build/columns/edit.js.map +1 -1
- package/build/comments/index.js +1 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/edit/index.js +9 -3
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit.native.js +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/details/edit.js +29 -7
- package/build/details/edit.js.map +1 -1
- package/build/image/transforms.js +1 -0
- package/build/image/transforms.js.map +1 -1
- package/build/latest-posts/deprecated.js +12 -0
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/index.js +12 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/loginout/edit.js +42 -13
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +59 -31
- package/build/media-text/edit.js.map +1 -1
- package/build/more/edit.js +28 -7
- package/build/more/edit.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +5 -3
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation-link/edit.js +95 -55
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +105 -53
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +44 -25
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +14 -4
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-author/edit.js +15 -3
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +4 -2
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-name/edit.js +11 -5
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-author-name/index.js +4 -2
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-comments-form/index.js +6 -1
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +8 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-date/edit.js +58 -18
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +2 -1
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +42 -18
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +17 -19
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +45 -11
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +6 -3
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/index.js +11 -7
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-navigation-link/variations.js +2 -2
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-template/index.js +11 -1
- package/build/post-template/index.js.map +1 -1
- package/build/post-title/index.js +6 -3
- package/build/post-title/index.js.map +1 -1
- package/build/query-no-results/index.js +10 -9
- package/build/query-no-results/index.js.map +1 -1
- package/build/query-pagination/edit.js +47 -17
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination/query-pagination-label-control.js +1 -1
- package/build/query-pagination/query-pagination-label-control.js.map +1 -1
- package/build/query-pagination-numbers/edit.js +33 -15
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-total/edit.js +8 -10
- package/build/query-total/edit.js.map +1 -1
- package/build/query-total/index.js +8 -1
- package/build/query-total/index.js.map +1 -1
- package/build/read-more/index.js +7 -1
- package/build/read-more/index.js.map +1 -1
- package/build/site-logo/index.js +4 -2
- package/build/site-logo/index.js.map +1 -1
- package/build/site-title/edit.js +41 -12
- package/build/site-title/edit.js.map +1 -1
- package/build/site-title/index.js +4 -2
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +19 -3
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/edit.js +41 -12
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/controls.js +34 -12
- package/build/spacer/controls.js.map +1 -1
- package/build/table/edit.js +48 -15
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +4 -1
- package/build/table/index.js.map +1 -1
- package/build/table-of-contents/edit.js +1 -1
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +24 -23
- package/build/table-of-contents/index.js.map +1 -1
- package/build/tag-cloud/edit.js +56 -11
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/video/edit-common-settings.js +90 -30
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +20 -49
- package/build/video/edit.js.map +1 -1
- package/build/video/poster-image.js +81 -0
- package/build/video/poster-image.js.map +1 -0
- package/build/video/tracks-editor.js +1 -1
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/edit.js +84 -37
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/button/deprecated.js +183 -2
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +50 -28
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +8 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +9 -6
- package/build-module/button/save.js.map +1 -1
- package/build-module/column/edit.js +34 -14
- package/build-module/column/edit.js.map +1 -1
- package/build-module/columns/edit.js +52 -29
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/comments/index.js +1 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/edit/index.js +9 -3
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit.native.js +2 -2
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/details/edit.js +30 -8
- package/build-module/details/edit.js.map +1 -1
- package/build-module/image/transforms.js +1 -0
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +12 -0
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/index.js +12 -0
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/loginout/edit.js +42 -14
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +59 -31
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/more/edit.js +28 -8
- package/build-module/more/edit.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +5 -3
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation-link/edit.js +96 -56
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +106 -54
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +45 -26
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +15 -6
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-author/edit.js +16 -4
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +4 -2
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-name/edit.js +12 -6
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +4 -2
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +6 -1
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +8 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-date/edit.js +59 -19
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +2 -1
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +44 -20
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +18 -20
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +47 -13
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +6 -3
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +12 -7
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +2 -2
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-template/index.js +11 -1
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-title/index.js +6 -3
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query-no-results/index.js +10 -9
- package/build-module/query-no-results/index.js.map +1 -1
- package/build-module/query-pagination/edit.js +49 -19
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination/query-pagination-label-control.js +1 -1
- package/build-module/query-pagination/query-pagination-label-control.js.map +1 -1
- package/build-module/query-pagination-numbers/edit.js +34 -16
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-total/edit.js +8 -10
- package/build-module/query-total/edit.js.map +1 -1
- package/build-module/query-total/index.js +8 -1
- package/build-module/query-total/index.js.map +1 -1
- package/build-module/read-more/index.js +7 -1
- package/build-module/read-more/index.js.map +1 -1
- package/build-module/site-logo/index.js +4 -2
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-title/edit.js +42 -13
- package/build-module/site-title/edit.js.map +1 -1
- package/build-module/site-title/index.js +4 -2
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +20 -4
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/edit.js +42 -13
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/controls.js +35 -13
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/edit.js +49 -16
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +4 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table-of-contents/edit.js +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +26 -25
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/tag-cloud/edit.js +57 -12
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/video/edit-common-settings.js +91 -31
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +24 -53
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/poster-image.js +74 -0
- package/build-module/video/poster-image.js.map +1 -0
- package/build-module/video/tracks-editor.js +1 -1
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/comment-template/style-rtl.css +0 -1
- package/build-style/comment-template/style.css +0 -1
- package/build-style/editor-rtl.css +4 -19
- package/build-style/editor.css +4 -19
- package/build-style/form-input/style-rtl.css +0 -2
- package/build-style/form-input/style.css +0 -2
- package/build-style/freeform/editor-rtl.css +4 -8
- package/build-style/freeform/editor.css +4 -8
- package/build-style/{post-template/editor.css → post-comments-link/style-rtl.css} +2 -4
- package/build-style/{post-template/editor-rtl.css → post-comments-link/style.css} +2 -4
- package/build-style/post-template/style-rtl.css +1 -0
- package/build-style/post-template/style.css +1 -0
- package/build-style/query-total/style-rtl.css +103 -0
- package/build-style/query-total/style.css +103 -0
- package/build-style/read-more/style-rtl.css +0 -1
- package/build-style/read-more/style.css +0 -1
- package/build-style/style-rtl.css +9 -4
- package/build-style/style.css +9 -4
- package/build-style/tag-cloud/editor-rtl.css +0 -5
- package/build-style/tag-cloud/editor.css +0 -5
- package/package.json +35 -35
- package/src/archives/edit.js +94 -36
- package/src/audio/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/block/index.php +20 -0
- package/src/button/block.json +17 -2
- package/src/button/deprecated.js +189 -0
- package/src/button/edit.js +60 -31
- package/src/button/save.js +6 -1
- package/src/column/edit.js +34 -13
- package/src/columns/edit.js +71 -40
- package/src/comments/index.js +1 -0
- package/src/cover/edit/index.js +12 -5
- package/src/cover/edit.native.js +5 -2
- package/src/cover/test/edit.js +5 -7
- package/src/details/edit.js +40 -11
- package/src/editor.scss +0 -1
- package/src/file/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/image/transforms.js +1 -0
- package/src/latest-posts/block.json +12 -0
- package/src/loginout/edit.js +56 -20
- package/src/media-text/edit.js +57 -28
- package/src/more/edit.js +39 -12
- package/src/navigation/edit/navigation-menu-selector.js +9 -2
- package/src/navigation/index.php +2 -2
- package/src/navigation-link/edit.js +101 -61
- package/src/navigation-link/index.php +16 -1
- package/src/navigation-submenu/edit.js +113 -57
- package/src/page-list/edit.js +52 -31
- package/src/paragraph/edit.js +18 -4
- package/src/post-author/block.json +4 -2
- package/src/post-author/edit.js +17 -3
- package/src/post-author/index.php +4 -0
- package/src/post-author-name/block.json +4 -2
- package/src/post-author-name/edit.js +17 -4
- package/src/post-author-name/index.php +4 -0
- package/src/post-comments-form/block.json +6 -1
- package/src/post-comments-link/block.json +8 -1
- package/src/post-comments-link/style.scss +4 -0
- package/src/post-content/index.php +23 -0
- package/src/post-date/block.json +2 -1
- package/src/post-date/edit.js +79 -25
- package/src/post-excerpt/edit.js +59 -22
- package/src/post-featured-image/block.json +6 -3
- package/src/post-featured-image/dimension-controls.js +18 -21
- package/src/post-featured-image/edit.js +67 -10
- package/src/post-navigation-link/block.json +0 -6
- package/src/post-navigation-link/index.js +11 -0
- package/src/post-navigation-link/variations.js +2 -2
- package/src/post-template/block.json +11 -1
- package/src/post-template/style.scss +2 -0
- package/src/post-title/block.json +6 -3
- package/src/query-no-results/block.json +0 -10
- package/src/query-no-results/index.js +11 -0
- package/src/query-pagination/edit.js +57 -15
- package/src/query-pagination/query-pagination-label-control.js +1 -3
- package/src/query-pagination-numbers/edit.js +41 -19
- package/src/query-pagination-previous/index.php +21 -14
- package/src/query-total/block.json +8 -1
- package/src/query-total/edit.js +11 -13
- package/src/query-total/index.php +9 -13
- package/src/query-total/style.scss +4 -0
- package/src/read-more/index.js +6 -0
- package/src/site-logo/block.json +4 -2
- package/src/site-title/block.json +4 -2
- package/src/site-title/edit.js +52 -15
- package/src/social-link/edit.js +21 -6
- package/src/social-links/edit.js +52 -15
- package/src/spacer/controls.js +42 -15
- package/src/style.scss +2 -0
- package/src/table/block.json +4 -1
- package/src/table/edit.js +58 -20
- package/src/table-of-contents/block.json +0 -52
- package/src/table-of-contents/edit.js +1 -1
- package/src/table-of-contents/index.js +53 -0
- package/src/tag-cloud/edit.js +60 -8
- package/src/tag-cloud/editor.scss +0 -8
- package/src/video/edit-common-settings.js +97 -39
- package/src/video/edit.js +29 -75
- package/src/video/poster-image.js +86 -0
- package/src/video/tracks-editor.js +1 -1
- package/tsconfig.json +0 -2
- package/src/post-template/editor.scss +0 -7
|
@@ -11,11 +11,12 @@ import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
|
11
11
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
12
|
import {
|
|
13
13
|
ToggleControl,
|
|
14
|
-
PanelBody,
|
|
15
14
|
Placeholder,
|
|
16
15
|
Button,
|
|
17
16
|
Spinner,
|
|
18
17
|
TextControl,
|
|
18
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
19
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
19
20
|
} from '@wordpress/components';
|
|
20
21
|
import {
|
|
21
22
|
InspectorControls,
|
|
@@ -38,6 +39,7 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
38
39
|
import DimensionControls from './dimension-controls';
|
|
39
40
|
import OverlayControls from './overlay-controls';
|
|
40
41
|
import Overlay from './overlay';
|
|
42
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
41
43
|
|
|
42
44
|
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
43
45
|
|
|
@@ -183,6 +185,8 @@ export default function PostFeaturedImageEdit( {
|
|
|
183
185
|
setTemporaryURL();
|
|
184
186
|
};
|
|
185
187
|
|
|
188
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
189
|
+
|
|
186
190
|
const controls = blockEditingMode === 'default' && (
|
|
187
191
|
<>
|
|
188
192
|
<InspectorControls group="color">
|
|
@@ -201,9 +205,18 @@ export default function PostFeaturedImageEdit( {
|
|
|
201
205
|
/>
|
|
202
206
|
</InspectorControls>
|
|
203
207
|
<InspectorControls>
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
<ToolsPanel
|
|
209
|
+
label={ __( 'Settings' ) }
|
|
210
|
+
resetAll={ () => {
|
|
211
|
+
setAttributes( {
|
|
212
|
+
isLink: false,
|
|
213
|
+
linkTarget: '_self',
|
|
214
|
+
rel: '',
|
|
215
|
+
} );
|
|
216
|
+
} }
|
|
217
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
218
|
+
>
|
|
219
|
+
<ToolsPanelItem
|
|
207
220
|
label={
|
|
208
221
|
postType?.labels.singular_name
|
|
209
222
|
? sprintf(
|
|
@@ -213,11 +226,42 @@ export default function PostFeaturedImageEdit( {
|
|
|
213
226
|
)
|
|
214
227
|
: __( 'Link to post' )
|
|
215
228
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
229
|
+
isShownByDefault
|
|
230
|
+
hasValue={ () => !! isLink }
|
|
231
|
+
onDeselect={ () =>
|
|
232
|
+
setAttributes( {
|
|
233
|
+
isLink: false,
|
|
234
|
+
} )
|
|
235
|
+
}
|
|
236
|
+
>
|
|
237
|
+
<ToggleControl
|
|
238
|
+
__nextHasNoMarginBottom
|
|
239
|
+
label={
|
|
240
|
+
postType?.labels.singular_name
|
|
241
|
+
? sprintf(
|
|
242
|
+
// translators: %s: Name of the post type e.g: "post".
|
|
243
|
+
__( 'Link to %s' ),
|
|
244
|
+
postType.labels.singular_name
|
|
245
|
+
)
|
|
246
|
+
: __( 'Link to post' )
|
|
247
|
+
}
|
|
248
|
+
onChange={ () =>
|
|
249
|
+
setAttributes( { isLink: ! isLink } )
|
|
250
|
+
}
|
|
251
|
+
checked={ isLink }
|
|
252
|
+
/>
|
|
253
|
+
</ToolsPanelItem>
|
|
219
254
|
{ isLink && (
|
|
220
|
-
|
|
255
|
+
<ToolsPanelItem
|
|
256
|
+
label={ __( 'Open in new tab' ) }
|
|
257
|
+
isShownByDefault
|
|
258
|
+
hasValue={ () => '_self' !== linkTarget }
|
|
259
|
+
onDeselect={ () =>
|
|
260
|
+
setAttributes( {
|
|
261
|
+
linkTarget: '_self',
|
|
262
|
+
} )
|
|
263
|
+
}
|
|
264
|
+
>
|
|
221
265
|
<ToggleControl
|
|
222
266
|
__nextHasNoMarginBottom
|
|
223
267
|
label={ __( 'Open in new tab' ) }
|
|
@@ -228,6 +272,19 @@ export default function PostFeaturedImageEdit( {
|
|
|
228
272
|
}
|
|
229
273
|
checked={ linkTarget === '_blank' }
|
|
230
274
|
/>
|
|
275
|
+
</ToolsPanelItem>
|
|
276
|
+
) }
|
|
277
|
+
{ isLink && (
|
|
278
|
+
<ToolsPanelItem
|
|
279
|
+
label={ __( 'Link rel' ) }
|
|
280
|
+
isShownByDefault
|
|
281
|
+
hasValue={ () => !! rel }
|
|
282
|
+
onDeselect={ () =>
|
|
283
|
+
setAttributes( {
|
|
284
|
+
rel: '',
|
|
285
|
+
} )
|
|
286
|
+
}
|
|
287
|
+
>
|
|
231
288
|
<TextControl
|
|
232
289
|
__next40pxDefaultSize
|
|
233
290
|
__nextHasNoMarginBottom
|
|
@@ -237,9 +294,9 @@ export default function PostFeaturedImageEdit( {
|
|
|
237
294
|
setAttributes( { rel: newRel } )
|
|
238
295
|
}
|
|
239
296
|
/>
|
|
240
|
-
|
|
297
|
+
</ToolsPanelItem>
|
|
241
298
|
) }
|
|
242
|
-
</
|
|
299
|
+
</ToolsPanel>
|
|
243
300
|
</InspectorControls>
|
|
244
301
|
</>
|
|
245
302
|
);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
@@ -12,6 +17,12 @@ export { metadata, name };
|
|
|
12
17
|
export const settings = {
|
|
13
18
|
edit,
|
|
14
19
|
variations,
|
|
20
|
+
example: {
|
|
21
|
+
attributes: {
|
|
22
|
+
label: __( 'Next post' ),
|
|
23
|
+
arrow: 'arrow',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
15
26
|
};
|
|
16
27
|
|
|
17
28
|
export const init = () => initBlock( { name, metadata, settings } );
|
|
@@ -17,7 +17,7 @@ const variations = [
|
|
|
17
17
|
scope: [ 'inserter', 'transform' ],
|
|
18
18
|
example: {
|
|
19
19
|
attributes: {
|
|
20
|
-
label: 'Next post',
|
|
20
|
+
label: __( 'Next post' ),
|
|
21
21
|
arrow: 'arrow',
|
|
22
22
|
},
|
|
23
23
|
},
|
|
@@ -33,7 +33,7 @@ const variations = [
|
|
|
33
33
|
scope: [ 'inserter', 'transform' ],
|
|
34
34
|
example: {
|
|
35
35
|
attributes: {
|
|
36
|
-
label: 'Previous post',
|
|
36
|
+
label: __( 'Previous post' ),
|
|
37
37
|
arrow: 'arrow',
|
|
38
38
|
},
|
|
39
39
|
},
|
|
@@ -43,15 +43,25 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"spacing": {
|
|
46
|
+
"margin": true,
|
|
47
|
+
"padding": true,
|
|
46
48
|
"blockGap": {
|
|
47
49
|
"__experimentalDefault": "1.25em"
|
|
48
50
|
},
|
|
49
51
|
"__experimentalDefaultControls": {
|
|
50
|
-
"blockGap": true
|
|
52
|
+
"blockGap": true,
|
|
53
|
+
"padding": false,
|
|
54
|
+
"margin": false
|
|
51
55
|
}
|
|
52
56
|
},
|
|
53
57
|
"interactivity": {
|
|
54
58
|
"clientNavigation": true
|
|
59
|
+
},
|
|
60
|
+
"__experimentalBorder": {
|
|
61
|
+
"radius": true,
|
|
62
|
+
"color": true,
|
|
63
|
+
"width": true,
|
|
64
|
+
"style": true
|
|
55
65
|
}
|
|
56
66
|
},
|
|
57
67
|
"style": "wp-block-post-template",
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
max-width: 100%;
|
|
5
5
|
list-style: none;
|
|
6
6
|
padding: 0;
|
|
7
|
+
// This block has customizable padding, border-box makes that more predictable.
|
|
8
|
+
box-sizing: border-box;
|
|
7
9
|
|
|
8
10
|
// These rules no longer apply but should be kept for backwards compatibility.
|
|
9
11
|
&.is-flex-container {
|
|
@@ -20,16 +20,19 @@
|
|
|
20
20
|
},
|
|
21
21
|
"isLink": {
|
|
22
22
|
"type": "boolean",
|
|
23
|
-
"default": false
|
|
23
|
+
"default": false,
|
|
24
|
+
"role": "content"
|
|
24
25
|
},
|
|
25
26
|
"rel": {
|
|
26
27
|
"type": "string",
|
|
27
28
|
"attribute": "rel",
|
|
28
|
-
"default": ""
|
|
29
|
+
"default": "",
|
|
30
|
+
"role": "content"
|
|
29
31
|
},
|
|
30
32
|
"linkTarget": {
|
|
31
33
|
"type": "string",
|
|
32
|
-
"default": "_self"
|
|
34
|
+
"default": "_self",
|
|
35
|
+
"role": "content"
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
"example": {
|
|
@@ -8,16 +8,6 @@
|
|
|
8
8
|
"ancestor": [ "core/query" ],
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"usesContext": [ "queryId", "query" ],
|
|
11
|
-
"example": {
|
|
12
|
-
"innerBlocks": [
|
|
13
|
-
{
|
|
14
|
-
"name": "core/paragraph",
|
|
15
|
-
"attributes": {
|
|
16
|
-
"content": "No posts were found."
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
11
|
"supports": {
|
|
22
12
|
"align": true,
|
|
23
13
|
"reusable": false,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
4
5
|
import { loop as icon } from '@wordpress/icons';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -18,6 +19,16 @@ export const settings = {
|
|
|
18
19
|
icon,
|
|
19
20
|
edit,
|
|
20
21
|
save,
|
|
22
|
+
example: {
|
|
23
|
+
innerBlocks: [
|
|
24
|
+
{
|
|
25
|
+
name: 'core/paragraph',
|
|
26
|
+
attributes: {
|
|
27
|
+
content: __( 'No posts were found.' ),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
21
32
|
};
|
|
22
33
|
|
|
23
34
|
export const init = () => initBlock( { name, metadata, settings } );
|
|
@@ -8,8 +8,11 @@ import {
|
|
|
8
8
|
useInnerBlocksProps,
|
|
9
9
|
store as blockEditorStore,
|
|
10
10
|
} from '@wordpress/block-editor';
|
|
11
|
-
import { useSelect } from '@wordpress/data';
|
|
12
|
-
import {
|
|
11
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
|
+
import {
|
|
13
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
14
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
15
|
+
} from '@wordpress/components';
|
|
13
16
|
import { useEffect } from '@wordpress/element';
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -17,6 +20,7 @@ import { useEffect } from '@wordpress/element';
|
|
|
17
20
|
*/
|
|
18
21
|
import { QueryPaginationArrowControls } from './query-pagination-arrow-controls';
|
|
19
22
|
import { QueryPaginationLabelControl } from './query-pagination-label-control';
|
|
23
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
20
24
|
|
|
21
25
|
const TEMPLATE = [
|
|
22
26
|
[ 'core/query-pagination-previous' ],
|
|
@@ -46,36 +50,74 @@ export default function QueryPaginationEdit( {
|
|
|
46
50
|
},
|
|
47
51
|
[ clientId ]
|
|
48
52
|
);
|
|
53
|
+
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
54
|
+
useDispatch( blockEditorStore );
|
|
55
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
49
56
|
const blockProps = useBlockProps();
|
|
50
57
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
51
58
|
template: TEMPLATE,
|
|
52
59
|
} );
|
|
60
|
+
|
|
53
61
|
// Always show label text if paginationArrow is set to 'none'.
|
|
54
62
|
useEffect( () => {
|
|
55
63
|
if ( paginationArrow === 'none' && ! showLabel ) {
|
|
64
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
56
65
|
setAttributes( { showLabel: true } );
|
|
57
66
|
}
|
|
58
|
-
}, [
|
|
67
|
+
}, [
|
|
68
|
+
paginationArrow,
|
|
69
|
+
setAttributes,
|
|
70
|
+
showLabel,
|
|
71
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
72
|
+
] );
|
|
73
|
+
|
|
59
74
|
return (
|
|
60
75
|
<>
|
|
61
76
|
{ hasNextPreviousBlocks && (
|
|
62
77
|
<InspectorControls>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
<ToolsPanel
|
|
79
|
+
label={ __( 'Settings' ) }
|
|
80
|
+
resetAll={ () => {
|
|
81
|
+
setAttributes( {
|
|
82
|
+
paginationArrow: 'none',
|
|
83
|
+
showLabel: true,
|
|
84
|
+
} );
|
|
85
|
+
} }
|
|
86
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
87
|
+
>
|
|
88
|
+
<ToolsPanelItem
|
|
89
|
+
hasValue={ () => paginationArrow !== 'none' }
|
|
90
|
+
label={ __( 'Pagination arrow' ) }
|
|
91
|
+
onDeselect={ () =>
|
|
92
|
+
setAttributes( { paginationArrow: 'none' } )
|
|
93
|
+
}
|
|
94
|
+
isShownByDefault
|
|
95
|
+
>
|
|
96
|
+
<QueryPaginationArrowControls
|
|
97
|
+
value={ paginationArrow }
|
|
73
98
|
onChange={ ( value ) => {
|
|
74
|
-
setAttributes( {
|
|
99
|
+
setAttributes( { paginationArrow: value } );
|
|
75
100
|
} }
|
|
76
101
|
/>
|
|
102
|
+
</ToolsPanelItem>
|
|
103
|
+
{ paginationArrow !== 'none' && (
|
|
104
|
+
<ToolsPanelItem
|
|
105
|
+
hasValue={ () => ! showLabel }
|
|
106
|
+
label={ __( 'Show text' ) }
|
|
107
|
+
onDeselect={ () =>
|
|
108
|
+
setAttributes( { showLabel: true } )
|
|
109
|
+
}
|
|
110
|
+
isShownByDefault
|
|
111
|
+
>
|
|
112
|
+
<QueryPaginationLabelControl
|
|
113
|
+
value={ showLabel }
|
|
114
|
+
onChange={ ( value ) => {
|
|
115
|
+
setAttributes( { showLabel: value } );
|
|
116
|
+
} }
|
|
117
|
+
/>
|
|
118
|
+
</ToolsPanelItem>
|
|
77
119
|
) }
|
|
78
|
-
</
|
|
120
|
+
</ToolsPanel>
|
|
79
121
|
</InspectorControls>
|
|
80
122
|
) }
|
|
81
123
|
<nav { ...innerBlocksProps } />
|
|
@@ -9,9 +9,7 @@ export function QueryPaginationLabelControl( { value, onChange } ) {
|
|
|
9
9
|
<ToggleControl
|
|
10
10
|
__nextHasNoMarginBottom
|
|
11
11
|
label={ __( 'Show label text' ) }
|
|
12
|
-
help={ __(
|
|
13
|
-
'Toggle off to hide the label text, e.g. "Next Page".'
|
|
14
|
-
) }
|
|
12
|
+
help={ __( 'Make label text visible, e.g. "Next Page".' ) }
|
|
15
13
|
onChange={ onChange }
|
|
16
14
|
checked={ value === true }
|
|
17
15
|
/>
|
|
@@ -3,7 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
8
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
9
|
+
RangeControl,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
7
16
|
|
|
8
17
|
const createPaginationItem = ( content, Tag = 'a', extraClass = '' ) => (
|
|
9
18
|
<Tag key={ content } className={ `page-numbers ${ extraClass }` }>
|
|
@@ -46,28 +55,41 @@ export default function QueryPaginationNumbersEdit( {
|
|
|
46
55
|
const paginationNumbers = previewPaginationNumbers(
|
|
47
56
|
parseInt( midSize, 10 )
|
|
48
57
|
);
|
|
58
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
59
|
+
|
|
49
60
|
return (
|
|
50
61
|
<>
|
|
51
62
|
<InspectorControls>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
<ToolsPanel
|
|
64
|
+
label={ __( 'Settings' ) }
|
|
65
|
+
resetAll={ () => setAttributes( { midSize: 2 } ) }
|
|
66
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
67
|
+
>
|
|
68
|
+
<ToolsPanelItem
|
|
56
69
|
label={ __( 'Number of links' ) }
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
hasValue={ () => midSize !== undefined }
|
|
71
|
+
onDeselect={ () => setAttributes( { midSize: 2 } ) }
|
|
72
|
+
isShownByDefault
|
|
73
|
+
>
|
|
74
|
+
<RangeControl
|
|
75
|
+
__next40pxDefaultSize
|
|
76
|
+
__nextHasNoMarginBottom
|
|
77
|
+
label={ __( 'Number of links' ) }
|
|
78
|
+
help={ __(
|
|
79
|
+
'Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'
|
|
80
|
+
) }
|
|
81
|
+
value={ midSize }
|
|
82
|
+
onChange={ ( value ) => {
|
|
83
|
+
setAttributes( {
|
|
84
|
+
midSize: parseInt( value, 10 ),
|
|
85
|
+
} );
|
|
86
|
+
} }
|
|
87
|
+
min={ 0 }
|
|
88
|
+
max={ 5 }
|
|
89
|
+
withInputField={ false }
|
|
90
|
+
/>
|
|
91
|
+
</ToolsPanelItem>
|
|
92
|
+
</ToolsPanel>
|
|
71
93
|
</InspectorControls>
|
|
72
94
|
<div { ...useBlockProps() }>{ paginationNumbers }</div>
|
|
73
95
|
</>
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
function render_block_core_query_pagination_previous( $attributes, $content, $block ) {
|
|
20
20
|
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
|
|
21
21
|
$enhanced_pagination = isset( $block->context['enhancedPagination'] ) && $block->context['enhancedPagination'];
|
|
22
|
+
$max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0;
|
|
22
23
|
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
|
|
23
|
-
|
|
24
|
-
$
|
|
25
|
-
$
|
|
26
|
-
$
|
|
27
|
-
$
|
|
28
|
-
$
|
|
29
|
-
$pagination_arrow = get_query_pagination_arrow( $block, false );
|
|
24
|
+
$wrapper_attributes = get_block_wrapper_attributes();
|
|
25
|
+
$show_label = isset( $block->context['showLabel'] ) ? (bool) $block->context['showLabel'] : true;
|
|
26
|
+
$default_label = __( 'Previous Page' );
|
|
27
|
+
$label_text = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? esc_html( $attributes['label'] ) : $default_label;
|
|
28
|
+
$label = $show_label ? $label_text : '';
|
|
29
|
+
$pagination_arrow = get_query_pagination_arrow( $block, false );
|
|
30
30
|
if ( ! $label ) {
|
|
31
31
|
$wrapper_attributes .= ' aria-label="' . $label_text . '"';
|
|
32
32
|
}
|
|
@@ -44,13 +44,20 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
|
|
|
44
44
|
add_filter( 'previous_posts_link_attributes', $filter_link_attributes );
|
|
45
45
|
$content = get_previous_posts_link( $label );
|
|
46
46
|
remove_filter( 'previous_posts_link_attributes', $filter_link_attributes );
|
|
47
|
-
}
|
|
48
|
-
$
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)
|
|
47
|
+
} else {
|
|
48
|
+
$block_query = new WP_Query( build_query_vars_from_query_block( $block, $page ) );
|
|
49
|
+
$block_max_pages = $block_query->max_num_pages;
|
|
50
|
+
$total = ! $max_page || $max_page > $block_max_pages ? $block_max_pages : $max_page;
|
|
51
|
+
wp_reset_postdata();
|
|
52
|
+
|
|
53
|
+
if ( 1 < $page && $page <= $total ) {
|
|
54
|
+
$content = sprintf(
|
|
55
|
+
'<a href="%1$s" %2$s>%3$s</a>',
|
|
56
|
+
esc_url( add_query_arg( $page_key, $page - 1 ) ),
|
|
57
|
+
$wrapper_attributes,
|
|
58
|
+
$label
|
|
59
|
+
);
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
if ( $enhanced_pagination && isset( $content ) ) {
|
package/src/query-total/edit.js
CHANGED
|
@@ -48,27 +48,25 @@ export default function QueryTotalEdit( { attributes, setAttributes } ) {
|
|
|
48
48
|
|
|
49
49
|
// Controls for the block.
|
|
50
50
|
const controls = (
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</BlockControls>
|
|
61
|
-
</>
|
|
51
|
+
<BlockControls>
|
|
52
|
+
<ToolbarGroup>
|
|
53
|
+
<ToolbarDropdownMenu
|
|
54
|
+
icon={ getButtonPositionIcon() }
|
|
55
|
+
label={ __( 'Change display type' ) }
|
|
56
|
+
controls={ buttonPositionControls }
|
|
57
|
+
/>
|
|
58
|
+
</ToolbarGroup>
|
|
59
|
+
</BlockControls>
|
|
62
60
|
);
|
|
63
61
|
|
|
64
62
|
// Render output based on the selected display type.
|
|
65
63
|
const renderDisplay = () => {
|
|
66
64
|
if ( displayType === 'total-results' ) {
|
|
67
|
-
return
|
|
65
|
+
return <>{ __( '12 results found' ) }</>;
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
if ( displayType === 'range-display' ) {
|
|
71
|
-
return
|
|
69
|
+
return <>{ __( 'Displaying 1 – 10 of 12' ) }</>;
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
return null;
|
|
@@ -40,32 +40,28 @@ function render_block_core_query_total( $attributes, $content, $block ) {
|
|
|
40
40
|
switch ( $attributes['displayType'] ) {
|
|
41
41
|
case 'range-display':
|
|
42
42
|
if ( $start === $end ) {
|
|
43
|
-
$
|
|
43
|
+
$output = sprintf(
|
|
44
44
|
/* translators: 1: Start index of posts, 2: Total number of posts */
|
|
45
45
|
__( 'Displaying %1$s of %2$s' ),
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
$start,
|
|
47
|
+
$max_rows
|
|
48
48
|
);
|
|
49
49
|
} else {
|
|
50
|
-
$
|
|
50
|
+
$output = sprintf(
|
|
51
51
|
/* translators: 1: Start index of posts, 2: End index of posts, 3: Total number of posts */
|
|
52
52
|
__( 'Displaying %1$s – %2$s of %3$s' ),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
$start,
|
|
54
|
+
$end,
|
|
55
|
+
$max_rows
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
$output = sprintf( '<p>%s</p>', $range_text );
|
|
60
59
|
break;
|
|
61
60
|
|
|
62
61
|
case 'total-results':
|
|
63
62
|
default:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
$max_rows,
|
|
67
|
-
_n( 'result found', 'results found', $max_rows )
|
|
68
|
-
);
|
|
63
|
+
// translators: %d: number of results.
|
|
64
|
+
$output = sprintf( _n( '%d result found', '%d results found', $max_rows ), $max_rows );
|
|
69
65
|
break;
|
|
70
66
|
}
|
|
71
67
|
|
package/src/read-more/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
4
5
|
import { link as icon } from '@wordpress/icons';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -16,6 +17,11 @@ export { metadata, name };
|
|
|
16
17
|
export const settings = {
|
|
17
18
|
icon,
|
|
18
19
|
edit,
|
|
20
|
+
example: {
|
|
21
|
+
attributes: {
|
|
22
|
+
content: __( 'Read more' ),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
export const init = () => initBlock( { name, metadata, settings } );
|