@wordpress/block-library 9.10.0 → 9.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +10 -5
- package/build/archives/index.js +6 -0
- package/build/archives/index.js.map +1 -1
- package/build/avatar/hooks.js +2 -3
- package/build/avatar/hooks.js.map +1 -1
- package/build/button/get-updated-link-attributes.js +1 -1
- package/build/button/get-updated-link-attributes.js.map +1 -1
- package/build/button/index.js +1 -1
- package/build/button/index.js.map +1 -1
- package/build/comments/index.js +12 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/constants.js +8 -0
- package/build/cover/constants.js.map +1 -0
- package/build/cover/deprecated.js +140 -4
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +1 -1
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +1 -2
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +42 -21
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +40 -2
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/index.js +3 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +16 -14
- package/build/cover/save.js.map +1 -1
- package/build/details/index.js +1 -0
- package/build/details/index.js.map +1 -1
- package/build/file/edit.js +2 -3
- package/build/file/edit.js.map +1 -1
- package/build/gallery/constants.js +2 -1
- package/build/gallery/constants.js.map +1 -1
- package/build/gallery/edit.js +12 -3
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/utils.js +26 -5
- package/build/gallery/utils.js.map +1 -1
- package/build/html/edit.js +5 -1
- package/build/html/edit.js.map +1 -1
- package/build/html/preview.js +2 -2
- package/build/html/preview.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +144 -78
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/latest-posts/edit.js +3 -9
- package/build/latest-posts/edit.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +1 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +2 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/paragraph/edit.js +2 -2
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-content/index.js +13 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-featured-image/edit.js +1 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-template/edit.js +11 -0
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/post-time-to-read/edit.js +2 -2
- package/build/post-time-to-read/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +2 -2
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/order-control.js +2 -2
- package/build/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +0 -3
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/edit/query-content.js +10 -12
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +1 -1
- package/build/query/utils.js +32 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-title/edit.js +1 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/search/edit.js +19 -14
- package/build/search/edit.js.map +1 -1
- package/build/separator/transforms.js +12 -0
- package/build/separator/transforms.js.map +1 -1
- package/build/social-links/edit.js +0 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/index.js +2 -0
- package/build/spacer/index.js.map +1 -1
- package/build/spacer/transforms.js +27 -0
- package/build/spacer/transforms.js.map +1 -0
- package/build/table/edit.js +0 -1
- package/build/table/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +2 -7
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/template-part/edit/index.js +2 -5
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +0 -3
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +1 -3
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/index.js +6 -0
- package/build-module/archives/index.js.map +1 -1
- package/build-module/avatar/hooks.js +2 -3
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/button/get-updated-link-attributes.js +1 -1
- package/build-module/button/get-updated-link-attributes.js.map +1 -1
- package/build-module/button/index.js +1 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/comments/index.js +12 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/constants.js +2 -0
- package/build-module/cover/constants.js.map +1 -0
- package/build-module/cover/deprecated.js +140 -4
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +1 -1
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +1 -2
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +42 -21
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +41 -3
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/index.js +3 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +16 -14
- package/build-module/cover/save.js.map +1 -1
- package/build-module/details/index.js +1 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/file/edit.js +2 -3
- package/build-module/file/edit.js.map +1 -1
- package/build-module/gallery/constants.js +1 -0
- package/build-module/gallery/constants.js.map +1 -1
- package/build-module/gallery/edit.js +15 -6
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/utils.js +27 -6
- package/build-module/gallery/utils.js.map +1 -1
- package/build-module/html/edit.js +6 -2
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/preview.js +2 -2
- package/build-module/html/preview.js.map +1 -1
- package/build-module/image/edit.js +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +149 -83
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/latest-posts/edit.js +3 -9
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +1 -3
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/paragraph/edit.js +2 -2
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-content/index.js +13 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-template/edit.js +11 -0
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/post-time-to-read/edit.js +2 -2
- package/build-module/post-time-to-read/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -2
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/order-control.js +2 -2
- package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +0 -3
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/edit/query-content.js +10 -12
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +1 -1
- package/build-module/query/utils.js +29 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-title/edit.js +2 -2
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/search/edit.js +20 -15
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/transforms.js +12 -0
- package/build-module/separator/transforms.js.map +1 -1
- package/build-module/social-links/edit.js +0 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/index.js +2 -0
- package/build-module/spacer/index.js.map +1 -1
- package/build-module/spacer/transforms.js +20 -0
- package/build-module/spacer/transforms.js.map +1 -0
- package/build-module/table/edit.js +0 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +2 -7
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +2 -5
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +0 -3
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +2 -4
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/archives/editor-rtl.css +5 -0
- package/build-style/archives/editor.css +5 -0
- package/build-style/button/style-rtl.css +3 -0
- package/build-style/button/style.css +3 -0
- package/build-style/comments/editor-rtl.css +4 -0
- package/build-style/comments/editor.css +4 -0
- package/build-style/comments/style-rtl.css +4 -0
- package/build-style/comments/style.css +4 -0
- package/build-style/cover/editor-rtl.css +3 -5
- package/build-style/cover/editor.css +3 -5
- package/build-style/cover/style-rtl.css +19 -10
- package/build-style/cover/style.css +19 -10
- package/build-style/editor-rtl.css +17 -12
- package/build-style/editor.css +17 -12
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/latest-posts/editor-rtl.css +0 -7
- package/build-style/latest-posts/editor.css +0 -7
- package/build-style/media-text/style-rtl.css +1 -1
- package/build-style/media-text/style.css +1 -1
- package/build-style/navigation/editor-rtl.css +1 -0
- package/build-style/navigation/editor.css +1 -0
- package/build-style/style-rtl.css +27 -11
- package/build-style/style.css +27 -11
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/package.json +41 -40
- package/src/archives/block.json +6 -0
- package/src/archives/editor.scss +8 -0
- package/src/avatar/hooks.js +2 -3
- package/src/avatar/index.php +4 -5
- package/src/button/get-updated-link-attributes.js +1 -1
- package/src/button/index.js +1 -1
- package/src/button/style.scss +3 -0
- package/src/button/test/get-updated-link-attributes.js +15 -0
- package/src/comment-author-avatar/index.php +1 -1
- package/src/comments/block.json +12 -0
- package/src/comments/style.scss +4 -1
- package/src/cover/block.json +3 -0
- package/src/cover/constants.js +1 -0
- package/src/cover/deprecated.js +182 -4
- package/src/cover/edit/block-controls.js +1 -1
- package/src/cover/edit/cover-placeholder.js +0 -3
- package/src/cover/edit/index.js +57 -24
- package/src/cover/edit/inspector-controls.js +46 -1
- package/src/cover/editor.scss +4 -5
- package/src/cover/save.js +29 -20
- package/src/cover/style.scss +40 -10
- package/src/cover/test/__snapshots__/edit.native.js.snap +9 -9
- package/src/cover/test/__snapshots__/transforms.native.js.snap +4 -4
- package/src/cover/test/edit.js +1 -3
- package/src/cover/test/edit.native.js +4 -4
- package/src/cover/test/transforms.native.js +4 -4
- package/src/details/block.json +1 -0
- package/src/file/edit.js +2 -3
- package/src/gallery/constants.js +1 -0
- package/src/gallery/edit.js +26 -3
- package/src/gallery/utils.js +23 -2
- package/src/html/edit.js +7 -1
- package/src/html/preview.js +3 -2
- package/src/image/block.json +1 -1
- package/src/image/edit.js +1 -1
- package/src/image/editor.scss +4 -0
- package/src/image/image.js +200 -109
- package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/latest-posts/edit.js +3 -8
- package/src/latest-posts/editor.scss +0 -11
- package/src/latest-posts/index.php +1 -1
- package/src/media-text/style.scss +1 -1
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/navigation/edit/menu-inspector-controls.js +2 -2
- package/src/navigation/edit/navigation-menu-selector.js +2 -2
- package/src/navigation/editor.scss +1 -0
- package/src/navigation/index.php +1 -1
- package/src/paragraph/edit.js +2 -2
- package/src/post-content/block.json +14 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-template/block.json +2 -1
- package/src/post-template/edit.js +19 -0
- package/src/post-time-to-read/edit.js +2 -2
- package/src/post-time-to-read/index.php +1 -1
- package/src/query/block.json +1 -1
- package/src/query/edit/inspector-controls/index.js +2 -2
- package/src/query/edit/inspector-controls/order-control.js +2 -2
- package/src/query/edit/pattern-selection-modal.js +0 -3
- package/src/query/edit/query-content.js +9 -17
- package/src/query/test/utils.js +59 -1
- package/src/query/utils.js +29 -0
- package/src/query-title/edit.js +2 -2
- package/src/rss/index.php +1 -1
- package/src/search/edit.js +28 -25
- package/src/search/index.php +2 -2
- package/src/separator/test/__snapshots__/transforms.native.js.snap +6 -0
- package/src/separator/test/transforms.native.js +1 -1
- package/src/separator/transforms.js +11 -0
- package/src/social-links/edit.js +0 -1
- package/src/spacer/index.js +2 -0
- package/src/spacer/test/__snapshots__/transforms.native.js.snap +6 -0
- package/src/spacer/test/transforms.native.js +1 -1
- package/src/spacer/transforms.js +20 -0
- package/src/table/edit.js +0 -1
- package/src/table-of-contents/edit.js +2 -6
- package/src/template-part/edit/index.js +2 -5
- package/src/template-part/edit/selection-modal.js +0 -3
- package/src/video/edit.js +1 -1
- package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/video/tracks-editor.js +2 -4
- package/tsconfig.tsbuildinfo +1 -1
- /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
package/src/image/image.js
CHANGED
|
@@ -10,11 +10,14 @@ import {
|
|
|
10
10
|
TextControl,
|
|
11
11
|
ToolbarButton,
|
|
12
12
|
ToolbarGroup,
|
|
13
|
-
Dropdown,
|
|
14
13
|
__experimentalToolsPanel as ToolsPanel,
|
|
15
14
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
15
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
17
16
|
Placeholder,
|
|
17
|
+
MenuItem,
|
|
18
|
+
ToolbarItem,
|
|
19
|
+
DropdownMenu,
|
|
20
|
+
Popover,
|
|
18
21
|
} from '@wordpress/components';
|
|
19
22
|
import { useViewportMatch } from '@wordpress/compose';
|
|
20
23
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -29,15 +32,15 @@ import {
|
|
|
29
32
|
__experimentalUseBorderProps as useBorderProps,
|
|
30
33
|
__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
|
|
31
34
|
privateApis as blockEditorPrivateApis,
|
|
35
|
+
BlockSettingsMenuControls,
|
|
32
36
|
} from '@wordpress/block-editor';
|
|
33
37
|
import { useEffect, useMemo, useState, useRef } from '@wordpress/element';
|
|
34
38
|
import { __, _x, sprintf, isRTL } from '@wordpress/i18n';
|
|
35
|
-
import { DOWN } from '@wordpress/keycodes';
|
|
36
39
|
import { getFilename } from '@wordpress/url';
|
|
37
40
|
import { getBlockBindingsSource, switchToBlockType } from '@wordpress/blocks';
|
|
38
|
-
import { crop, overlayText, upload } from '@wordpress/icons';
|
|
41
|
+
import { crop, overlayText, upload, chevronDown } from '@wordpress/icons';
|
|
39
42
|
import { store as noticesStore } from '@wordpress/notices';
|
|
40
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
43
|
+
import { store as coreStore, useEntityProp } from '@wordpress/core-data';
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
46
|
* Internal dependencies
|
|
@@ -69,6 +72,10 @@ const scaleOptions = [
|
|
|
69
72
|
},
|
|
70
73
|
];
|
|
71
74
|
|
|
75
|
+
const WRITEMODE_POPOVER_PROPS = {
|
|
76
|
+
placement: 'bottom-start',
|
|
77
|
+
};
|
|
78
|
+
|
|
72
79
|
// If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles.
|
|
73
80
|
const ImageWrapper = ( { href, children } ) => {
|
|
74
81
|
if ( ! href ) {
|
|
@@ -94,6 +101,150 @@ const ImageWrapper = ( { href, children } ) => {
|
|
|
94
101
|
);
|
|
95
102
|
};
|
|
96
103
|
|
|
104
|
+
function ContentOnlyControls( {
|
|
105
|
+
attributes,
|
|
106
|
+
setAttributes,
|
|
107
|
+
lockAltControls,
|
|
108
|
+
lockAltControlsMessage,
|
|
109
|
+
lockTitleControls,
|
|
110
|
+
lockTitleControlsMessage,
|
|
111
|
+
} ) {
|
|
112
|
+
// Use internal state instead of a ref to make sure that the component
|
|
113
|
+
// re-renders when the popover's anchor updates.
|
|
114
|
+
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
115
|
+
const [ isAltDialogOpen, setIsAltDialogOpen ] = useState( false );
|
|
116
|
+
const [ isTitleDialogOpen, setIsTitleDialogOpen ] = useState( false );
|
|
117
|
+
return (
|
|
118
|
+
<>
|
|
119
|
+
<ToolbarItem ref={ setPopoverAnchor }>
|
|
120
|
+
{ ( toggleProps ) => (
|
|
121
|
+
<DropdownMenu
|
|
122
|
+
icon={ chevronDown }
|
|
123
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
124
|
+
label={ __( 'More' ) }
|
|
125
|
+
toggleProps={ {
|
|
126
|
+
...toggleProps,
|
|
127
|
+
description: __( 'Displays more controls.' ),
|
|
128
|
+
} }
|
|
129
|
+
popoverProps={ WRITEMODE_POPOVER_PROPS }
|
|
130
|
+
>
|
|
131
|
+
{ ( { onClose } ) => (
|
|
132
|
+
<>
|
|
133
|
+
<MenuItem
|
|
134
|
+
onClick={ () => {
|
|
135
|
+
setIsAltDialogOpen( true );
|
|
136
|
+
onClose();
|
|
137
|
+
} }
|
|
138
|
+
aria-haspopup="dialog"
|
|
139
|
+
>
|
|
140
|
+
{ _x(
|
|
141
|
+
'Alternative text',
|
|
142
|
+
'Alternative text for an image. Block toolbar label, a low character count is preferred.'
|
|
143
|
+
) }
|
|
144
|
+
</MenuItem>
|
|
145
|
+
<MenuItem
|
|
146
|
+
onClick={ () => {
|
|
147
|
+
setIsTitleDialogOpen( true );
|
|
148
|
+
onClose();
|
|
149
|
+
} }
|
|
150
|
+
aria-haspopup="dialog"
|
|
151
|
+
>
|
|
152
|
+
{ __( 'Title text' ) }
|
|
153
|
+
</MenuItem>
|
|
154
|
+
</>
|
|
155
|
+
) }
|
|
156
|
+
</DropdownMenu>
|
|
157
|
+
) }
|
|
158
|
+
</ToolbarItem>
|
|
159
|
+
{ isAltDialogOpen && (
|
|
160
|
+
<Popover
|
|
161
|
+
placement="bottom-start"
|
|
162
|
+
anchor={ popoverAnchor }
|
|
163
|
+
onClose={ () => setIsAltDialogOpen( false ) }
|
|
164
|
+
offset={ 13 }
|
|
165
|
+
variant="toolbar"
|
|
166
|
+
>
|
|
167
|
+
<div className="wp-block-image__toolbar_content_textarea__container">
|
|
168
|
+
<TextareaControl
|
|
169
|
+
className="wp-block-image__toolbar_content_textarea"
|
|
170
|
+
label={ __( 'Alternative text' ) }
|
|
171
|
+
value={ attributes.alt || '' }
|
|
172
|
+
onChange={ ( value ) =>
|
|
173
|
+
setAttributes( { alt: value } )
|
|
174
|
+
}
|
|
175
|
+
disabled={ lockAltControls }
|
|
176
|
+
help={
|
|
177
|
+
lockAltControls ? (
|
|
178
|
+
<>{ lockAltControlsMessage }</>
|
|
179
|
+
) : (
|
|
180
|
+
<>
|
|
181
|
+
<ExternalLink
|
|
182
|
+
href={
|
|
183
|
+
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
|
|
184
|
+
__(
|
|
185
|
+
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
>
|
|
189
|
+
{ __(
|
|
190
|
+
'Describe the purpose of the image.'
|
|
191
|
+
) }
|
|
192
|
+
</ExternalLink>
|
|
193
|
+
<br />
|
|
194
|
+
{ __( 'Leave empty if decorative.' ) }
|
|
195
|
+
</>
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
__nextHasNoMarginBottom
|
|
199
|
+
/>
|
|
200
|
+
</div>
|
|
201
|
+
</Popover>
|
|
202
|
+
) }
|
|
203
|
+
{ isTitleDialogOpen && (
|
|
204
|
+
<Popover
|
|
205
|
+
placement="bottom-start"
|
|
206
|
+
anchor={ popoverAnchor }
|
|
207
|
+
onClose={ () => setIsTitleDialogOpen( false ) }
|
|
208
|
+
offset={ 13 }
|
|
209
|
+
variant="toolbar"
|
|
210
|
+
>
|
|
211
|
+
<div className="wp-block-image__toolbar_content_textarea__container">
|
|
212
|
+
<TextControl
|
|
213
|
+
__next40pxDefaultSize
|
|
214
|
+
className="wp-block-image__toolbar_content_textarea"
|
|
215
|
+
__nextHasNoMarginBottom
|
|
216
|
+
label={ __( 'Title attribute' ) }
|
|
217
|
+
value={ attributes.title || '' }
|
|
218
|
+
onChange={ ( value ) =>
|
|
219
|
+
setAttributes( {
|
|
220
|
+
title: value,
|
|
221
|
+
} )
|
|
222
|
+
}
|
|
223
|
+
disabled={ lockTitleControls }
|
|
224
|
+
help={
|
|
225
|
+
lockTitleControls ? (
|
|
226
|
+
<>{ lockTitleControlsMessage }</>
|
|
227
|
+
) : (
|
|
228
|
+
<>
|
|
229
|
+
{ __(
|
|
230
|
+
'Describe the role of this image on the page.'
|
|
231
|
+
) }
|
|
232
|
+
<ExternalLink href="https://www.w3.org/TR/html52/dom.html#the-title-attribute">
|
|
233
|
+
{ __(
|
|
234
|
+
'(Note: many devices and browsers do not display this text.)'
|
|
235
|
+
) }
|
|
236
|
+
</ExternalLink>
|
|
237
|
+
</>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
/>
|
|
241
|
+
</div>
|
|
242
|
+
</Popover>
|
|
243
|
+
) }
|
|
244
|
+
</>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
97
248
|
export default function Image( {
|
|
98
249
|
temporaryURL,
|
|
99
250
|
attributes,
|
|
@@ -625,112 +776,15 @@ export default function Image( {
|
|
|
625
776
|
// Add some extra controls for content attributes when content only mode is active.
|
|
626
777
|
// With content only mode active, the inspector is hidden, so users need another way
|
|
627
778
|
// to edit these attributes.
|
|
628
|
-
<BlockControls group="
|
|
629
|
-
<
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
onKeyDown={ ( event ) => {
|
|
637
|
-
if ( ! isOpen && event.keyCode === DOWN ) {
|
|
638
|
-
event.preventDefault();
|
|
639
|
-
onToggle();
|
|
640
|
-
}
|
|
641
|
-
} }
|
|
642
|
-
>
|
|
643
|
-
{ _x(
|
|
644
|
-
'Alternative text',
|
|
645
|
-
'Alternative text for an image. Block toolbar label, a low character count is preferred.'
|
|
646
|
-
) }
|
|
647
|
-
</ToolbarButton>
|
|
648
|
-
) }
|
|
649
|
-
renderContent={ () => (
|
|
650
|
-
<TextareaControl
|
|
651
|
-
className="wp-block-image__toolbar_content_textarea"
|
|
652
|
-
label={ __( 'Alternative text' ) }
|
|
653
|
-
value={ alt || '' }
|
|
654
|
-
onChange={ updateAlt }
|
|
655
|
-
disabled={ lockAltControls }
|
|
656
|
-
help={
|
|
657
|
-
lockAltControls ? (
|
|
658
|
-
<>{ lockAltControlsMessage }</>
|
|
659
|
-
) : (
|
|
660
|
-
<>
|
|
661
|
-
<ExternalLink
|
|
662
|
-
href={
|
|
663
|
-
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
|
|
664
|
-
__(
|
|
665
|
-
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
|
|
666
|
-
)
|
|
667
|
-
}
|
|
668
|
-
>
|
|
669
|
-
{ __(
|
|
670
|
-
'Describe the purpose of the image.'
|
|
671
|
-
) }
|
|
672
|
-
</ExternalLink>
|
|
673
|
-
<br />
|
|
674
|
-
{ __(
|
|
675
|
-
'Leave empty if decorative.'
|
|
676
|
-
) }
|
|
677
|
-
</>
|
|
678
|
-
)
|
|
679
|
-
}
|
|
680
|
-
__nextHasNoMarginBottom
|
|
681
|
-
/>
|
|
682
|
-
) }
|
|
779
|
+
<BlockControls group="block">
|
|
780
|
+
<ContentOnlyControls
|
|
781
|
+
attributes={ attributes }
|
|
782
|
+
setAttributes={ setAttributes }
|
|
783
|
+
lockAltControls={ lockAltControls }
|
|
784
|
+
lockAltControlsMessage={ lockAltControlsMessage }
|
|
785
|
+
lockTitleControls={ lockTitleControls }
|
|
786
|
+
lockTitleControlsMessage={ lockTitleControlsMessage }
|
|
683
787
|
/>
|
|
684
|
-
{ title && (
|
|
685
|
-
<Dropdown
|
|
686
|
-
popoverProps={ { position: 'bottom right' } }
|
|
687
|
-
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
688
|
-
<ToolbarButton
|
|
689
|
-
onClick={ onToggle }
|
|
690
|
-
aria-haspopup="true"
|
|
691
|
-
aria-expanded={ isOpen }
|
|
692
|
-
onKeyDown={ ( event ) => {
|
|
693
|
-
if (
|
|
694
|
-
! isOpen &&
|
|
695
|
-
event.keyCode === DOWN
|
|
696
|
-
) {
|
|
697
|
-
event.preventDefault();
|
|
698
|
-
onToggle();
|
|
699
|
-
}
|
|
700
|
-
} }
|
|
701
|
-
>
|
|
702
|
-
{ __( 'Title' ) }
|
|
703
|
-
</ToolbarButton>
|
|
704
|
-
) }
|
|
705
|
-
renderContent={ () => (
|
|
706
|
-
<TextControl
|
|
707
|
-
__next40pxDefaultSize
|
|
708
|
-
className="wp-block-image__toolbar_content_textarea"
|
|
709
|
-
__nextHasNoMarginBottom
|
|
710
|
-
label={ __( 'Title attribute' ) }
|
|
711
|
-
value={ title || '' }
|
|
712
|
-
onChange={ onSetTitle }
|
|
713
|
-
disabled={ lockTitleControls }
|
|
714
|
-
help={
|
|
715
|
-
lockTitleControls ? (
|
|
716
|
-
<>{ lockTitleControlsMessage }</>
|
|
717
|
-
) : (
|
|
718
|
-
<>
|
|
719
|
-
{ __(
|
|
720
|
-
'Describe the role of this image on the page.'
|
|
721
|
-
) }
|
|
722
|
-
<ExternalLink href="https://www.w3.org/TR/html52/dom.html#the-title-attribute">
|
|
723
|
-
{ __(
|
|
724
|
-
'(Note: many devices and browsers do not display this text.)'
|
|
725
|
-
) }
|
|
726
|
-
</ExternalLink>
|
|
727
|
-
</>
|
|
728
|
-
)
|
|
729
|
-
}
|
|
730
|
-
/>
|
|
731
|
-
) }
|
|
732
|
-
/>
|
|
733
|
-
) }
|
|
734
788
|
</BlockControls>
|
|
735
789
|
) }
|
|
736
790
|
<InspectorControls>
|
|
@@ -842,6 +896,16 @@ export default function Image( {
|
|
|
842
896
|
const shadowProps = getShadowClassesAndStyles( attributes );
|
|
843
897
|
const isRounded = attributes.className?.includes( 'is-style-rounded' );
|
|
844
898
|
|
|
899
|
+
const { postType, postId, queryId } = context;
|
|
900
|
+
const isDescendentOfQueryLoop = Number.isFinite( queryId );
|
|
901
|
+
|
|
902
|
+
const [ , setFeaturedImage ] = useEntityProp(
|
|
903
|
+
'postType',
|
|
904
|
+
postType,
|
|
905
|
+
'featured_media',
|
|
906
|
+
postId
|
|
907
|
+
);
|
|
908
|
+
|
|
845
909
|
let img =
|
|
846
910
|
temporaryURL && hasImageErrored ? (
|
|
847
911
|
// Show a placeholder during upload when the blob URL can't be loaded. This can
|
|
@@ -1043,10 +1107,37 @@ export default function Image( {
|
|
|
1043
1107
|
);
|
|
1044
1108
|
}
|
|
1045
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* Set the post's featured image with the current image.
|
|
1112
|
+
*/
|
|
1113
|
+
const setPostFeatureImage = () => {
|
|
1114
|
+
setFeaturedImage( id );
|
|
1115
|
+
createSuccessNotice( __( 'Post featured image updated.' ), {
|
|
1116
|
+
type: 'snackbar',
|
|
1117
|
+
} );
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
const featuredImageControl = (
|
|
1121
|
+
<BlockSettingsMenuControls>
|
|
1122
|
+
{ ( { selectedClientIds } ) =>
|
|
1123
|
+
selectedClientIds.length === 1 &&
|
|
1124
|
+
! isDescendentOfQueryLoop &&
|
|
1125
|
+
postId &&
|
|
1126
|
+
id &&
|
|
1127
|
+
clientId === selectedClientIds[ 0 ] && (
|
|
1128
|
+
<MenuItem onClick={ setPostFeatureImage }>
|
|
1129
|
+
{ __( 'Set featured image' ) }
|
|
1130
|
+
</MenuItem>
|
|
1131
|
+
)
|
|
1132
|
+
}
|
|
1133
|
+
</BlockSettingsMenuControls>
|
|
1134
|
+
);
|
|
1135
|
+
|
|
1046
1136
|
return (
|
|
1047
1137
|
<>
|
|
1048
1138
|
{ mediaReplaceFlow }
|
|
1049
1139
|
{ controls }
|
|
1140
|
+
{ featuredImageControl }
|
|
1050
1141
|
{ img }
|
|
1051
1142
|
|
|
1052
1143
|
<Caption
|
|
@@ -12,7 +12,7 @@ exports[`Image block transformations to Columns block 1`] = `
|
|
|
12
12
|
|
|
13
13
|
exports[`Image block transformations to Cover block 1`] = `
|
|
14
14
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":1,"dimRatio":50,"style":{"color":{}}} -->
|
|
15
|
-
<div class="wp-block-cover"><
|
|
15
|
+
<div class="wp-block-cover"><img class="wp-block-cover__image-background wp-image-1" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","fontSize":"large"} -->
|
|
16
16
|
<p class="has-text-align-center has-large-font-size">Mountain</p>
|
|
17
17
|
<!-- /wp:paragraph --></div></div>
|
|
18
18
|
<!-- /wp:cover -->"
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -155,15 +155,11 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
155
155
|
);
|
|
156
156
|
|
|
157
157
|
// If a user clicks to a link prevent redirection and show a warning.
|
|
158
|
-
const { createWarningNotice
|
|
159
|
-
let noticeId;
|
|
158
|
+
const { createWarningNotice } = useDispatch( noticeStore );
|
|
160
159
|
const showRedirectionPreventedNotice = ( event ) => {
|
|
161
160
|
event.preventDefault();
|
|
162
|
-
// Remove previous warning if any, to show one at a time per block.
|
|
163
|
-
removeNotice( noticeId );
|
|
164
|
-
noticeId = `block-library/core/latest-posts/redirection-prevented/${ instanceId }`;
|
|
165
161
|
createWarningNotice( __( 'Links are disabled in the editor.' ), {
|
|
166
|
-
id:
|
|
162
|
+
id: `block-library/core/latest-posts/redirection-prevented/${ instanceId }`,
|
|
167
163
|
type: 'snackbar',
|
|
168
164
|
} );
|
|
169
165
|
};
|
|
@@ -242,7 +238,6 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
242
238
|
/>
|
|
243
239
|
{ displayPostContent && (
|
|
244
240
|
<RadioControl
|
|
245
|
-
className="wp-block-latest-posts__post-content-radio"
|
|
246
241
|
label={ __( 'Show' ) }
|
|
247
242
|
selected={ displayPostContentRadio }
|
|
248
243
|
options={ [
|
|
@@ -593,7 +588,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
593
588
|
{ displayAuthor && currentAuthor && (
|
|
594
589
|
<div className="wp-block-latest-posts__post-author">
|
|
595
590
|
{ sprintf(
|
|
596
|
-
/* translators: byline. %s:
|
|
591
|
+
/* translators: byline. %s: author. */
|
|
597
592
|
__( 'by %s' ),
|
|
598
593
|
currentAuthor.name
|
|
599
594
|
) }
|
|
@@ -18,14 +18,3 @@
|
|
|
18
18
|
padding-left: 0;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
// Apply the same styles that would be applied to
|
|
23
|
-
// ".block-editor-block-inspector .components-base-control"
|
|
24
|
-
// (see packages/block-editor/src/components/block-inspector/style.scss)
|
|
25
|
-
.wp-block-latest-posts__post-content-radio {
|
|
26
|
-
margin-bottom: #{ $grid-unit-30 };
|
|
27
|
-
|
|
28
|
-
&:last-child {
|
|
29
|
-
margin-bottom: $grid-unit-10;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -123,7 +123,7 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
123
123
|
if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) {
|
|
124
124
|
$author_display_name = get_the_author_meta( 'display_name', $post->post_author );
|
|
125
125
|
|
|
126
|
-
/* translators: byline. %s:
|
|
126
|
+
/* translators: byline. %s: author. */
|
|
127
127
|
$byline = sprintf( __( 'by %s' ), $author_display_name );
|
|
128
128
|
|
|
129
129
|
if ( ! empty( $author_display_name ) ) {
|
|
@@ -14,7 +14,7 @@ exports[`Media & Text block transformations with Image to Columns block 1`] = `
|
|
|
14
14
|
|
|
15
15
|
exports[`Media & Text block transformations with Image to Cover block 1`] = `
|
|
16
16
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":4674,"dimRatio":50,"align":"wide"} -->
|
|
17
|
-
<div class="wp-block-cover alignwide"><
|
|
17
|
+
<div class="wp-block-cover alignwide"><img class="wp-block-cover__image-background wp-image-4674" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"className":"has-large-font-size"} -->
|
|
18
18
|
<p class="has-large-font-size">Mountain</p>
|
|
19
19
|
<!-- /wp:paragraph --></div></div>
|
|
20
20
|
<!-- /wp:cover -->"
|
|
@@ -50,7 +50,7 @@ exports[`Media & Text block transformations with Video to Columns block 1`] = `
|
|
|
50
50
|
|
|
51
51
|
exports[`Media & Text block transformations with Video to Cover block 1`] = `
|
|
52
52
|
"<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":4675,"dimRatio":50,"backgroundType":"video","align":"wide"} -->
|
|
53
|
-
<div class="wp-block-cover alignwide"><
|
|
53
|
+
<div class="wp-block-cover alignwide"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" data-object-fit="cover"></video><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"className":"has-large-font-size"} -->
|
|
54
54
|
<p class="has-large-font-size">Cloudup</p>
|
|
55
55
|
<!-- /wp:paragraph --></div></div>
|
|
56
56
|
<!-- /wp:cover -->"
|
|
@@ -26,8 +26,8 @@ import LeafMoreMenu from './leaf-more-menu';
|
|
|
26
26
|
import { updateAttributes } from '../../navigation-link/update-attributes';
|
|
27
27
|
import { LinkUI } from '../../navigation-link/link-ui';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const actionLabel =
|
|
30
|
+
/* translators: %s: The name of a menu. */ __( "Switch to '%s'" );
|
|
31
31
|
const BLOCKS_WITH_LINK_UI_SUPPORT = [
|
|
32
32
|
'core/navigation-link',
|
|
33
33
|
'core/navigation-submenu',
|
|
@@ -21,7 +21,7 @@ import useNavigationEntities from '../use-navigation-entities';
|
|
|
21
21
|
|
|
22
22
|
function buildMenuLabel( title, id, status ) {
|
|
23
23
|
if ( ! title ) {
|
|
24
|
-
/* translators: %s
|
|
24
|
+
/* translators: %s: the index of the menu in the list of menus. */
|
|
25
25
|
return sprintf( __( '(no title %s)' ), id );
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ function buildMenuLabel( title, id, status ) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return sprintf(
|
|
33
|
-
// translators:
|
|
33
|
+
// translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
|
|
34
34
|
__( '%1$s (%2$s)' ),
|
|
35
35
|
decodeEntities( title ),
|
|
36
36
|
status
|
|
@@ -203,6 +203,7 @@ $color-control-label-height: 20px;
|
|
|
203
203
|
.wp-block-navigation .wp-block + .block-list-appender .block-editor-button-block-appender {
|
|
204
204
|
background-color: $gray-900;
|
|
205
205
|
color: $white;
|
|
206
|
+
height: $button-size-small;
|
|
206
207
|
|
|
207
208
|
// This needs specificity to override an inherited padding.
|
|
208
209
|
// That source padding in turn has high specificity to protect
|
package/src/navigation/index.php
CHANGED
|
@@ -813,7 +813,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
|
|
|
813
813
|
) ) {
|
|
814
814
|
// Add directives to the parent `<li>`.
|
|
815
815
|
$tags->set_attribute( 'data-wp-interactive', 'core/navigation' );
|
|
816
|
-
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": { "click": false, "hover": false, "focus": false }, "type": "submenu" }' );
|
|
816
|
+
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": { "click": false, "hover": false, "focus": false }, "type": "submenu", "modal": null }' );
|
|
817
817
|
$tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' );
|
|
818
818
|
$tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );
|
|
819
819
|
$tags->set_attribute( 'data-wp-on--keydown', 'actions.handleMenuKeydown' );
|
package/src/paragraph/edit.js
CHANGED
|
@@ -66,7 +66,7 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
|
|
|
66
66
|
} else if ( dropCap ) {
|
|
67
67
|
helpText = __( 'Showing large initial letter.' );
|
|
68
68
|
} else {
|
|
69
|
-
helpText = __( '
|
|
69
|
+
helpText = __( 'Show a large initial letter.' );
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -83,7 +83,7 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
|
|
|
83
83
|
checked={ !! dropCap }
|
|
84
84
|
onChange={ () => setAttributes( { dropCap: ! dropCap } ) }
|
|
85
85
|
help={ helpText }
|
|
86
|
-
disabled={ hasDropCapDisabled( align )
|
|
86
|
+
disabled={ hasDropCapDisabled( align ) }
|
|
87
87
|
/>
|
|
88
88
|
</ToolsPanelItem>
|
|
89
89
|
);
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"spacing": {
|
|
28
28
|
"blockGap": true,
|
|
29
29
|
"padding": true,
|
|
30
|
+
"margin": true,
|
|
30
31
|
"__experimentalDefaultControls": {
|
|
31
32
|
"margin": false,
|
|
32
33
|
"padding": false
|
|
@@ -52,8 +53,20 @@
|
|
|
52
53
|
"__experimentalDefaultControls": {
|
|
53
54
|
"fontSize": true
|
|
54
55
|
}
|
|
56
|
+
},
|
|
57
|
+
"__experimentalBorder": {
|
|
58
|
+
"radius": true,
|
|
59
|
+
"color": true,
|
|
60
|
+
"width": true,
|
|
61
|
+
"style": true,
|
|
62
|
+
"__experimentalDefaultControls": {
|
|
63
|
+
"radius": true,
|
|
64
|
+
"color": true,
|
|
65
|
+
"width": true,
|
|
66
|
+
"style": true
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
},
|
|
57
70
|
"style": "wp-block-post-content",
|
|
58
71
|
"editorStyle": "wp-block-post-content-editor"
|
|
59
|
-
}
|
|
72
|
+
}
|
|
@@ -207,7 +207,7 @@ export default function PostFeaturedImageEdit( {
|
|
|
207
207
|
label={
|
|
208
208
|
postType?.labels.singular_name
|
|
209
209
|
? sprintf(
|
|
210
|
-
// translators: %s: Name of the post type e.g: "
|
|
210
|
+
// translators: %s: Name of the post type e.g: "post".
|
|
211
211
|
__( 'Link to %s' ),
|
|
212
212
|
postType.labels.singular_name
|
|
213
213
|
)
|
|
@@ -119,6 +119,15 @@ export default function PostTemplateEdit( {
|
|
|
119
119
|
_fields: [ 'id' ],
|
|
120
120
|
slug: templateSlug.replace( 'category-', '' ),
|
|
121
121
|
} );
|
|
122
|
+
const templateTag =
|
|
123
|
+
inherit &&
|
|
124
|
+
templateSlug?.startsWith( 'tag-' ) &&
|
|
125
|
+
getEntityRecords( 'taxonomy', 'post_tag', {
|
|
126
|
+
context: 'view',
|
|
127
|
+
per_page: 1,
|
|
128
|
+
_fields: [ 'id' ],
|
|
129
|
+
slug: templateSlug.replace( 'tag-', '' ),
|
|
130
|
+
} );
|
|
122
131
|
const query = {
|
|
123
132
|
offset: offset || 0,
|
|
124
133
|
order,
|
|
@@ -182,6 +191,16 @@ export default function PostTemplateEdit( {
|
|
|
182
191
|
postType = query.postType;
|
|
183
192
|
} else if ( templateCategory ) {
|
|
184
193
|
query.categories = templateCategory[ 0 ]?.id;
|
|
194
|
+
} else if ( templateTag ) {
|
|
195
|
+
query.tags = templateTag[ 0 ]?.id;
|
|
196
|
+
} else if (
|
|
197
|
+
templateSlug?.startsWith( 'taxonomy-post_format' )
|
|
198
|
+
) {
|
|
199
|
+
// Get the post format slug from the template slug by removing the prefix.
|
|
200
|
+
query.format = templateSlug.replace(
|
|
201
|
+
'taxonomy-post_format-post-format-',
|
|
202
|
+
''
|
|
203
|
+
);
|
|
185
204
|
}
|
|
186
205
|
}
|
|
187
206
|
// When we preview Query Loop blocks we should prefer the current
|
|
@@ -71,8 +71,8 @@ function PostTimeToReadEdit( { attributes, setAttributes, context } ) {
|
|
|
71
71
|
);
|
|
72
72
|
|
|
73
73
|
return sprintf(
|
|
74
|
-
/* translators: %
|
|
75
|
-
_n( '%
|
|
74
|
+
/* translators: %s: the number of minutes to read the post. */
|
|
75
|
+
_n( '%s minute', '%s minutes', minutesToRead ),
|
|
76
76
|
minutesToRead
|
|
77
77
|
);
|
|
78
78
|
}, [ contentStructure, blocks ] );
|
|
@@ -32,7 +32,7 @@ function render_block_core_post_time_to_read( $attributes, $content, $block ) {
|
|
|
32
32
|
$minutes_to_read = max( 1, (int) round( wp_word_count( $content, $word_count_type ) / $average_reading_rate ) );
|
|
33
33
|
|
|
34
34
|
$minutes_to_read_string = sprintf(
|
|
35
|
-
/* translators: %s
|
|
35
|
+
/* translators: %s: the number of minutes to read the post. */
|
|
36
36
|
_n( '%s minute', '%s minutes', $minutes_to_read ),
|
|
37
37
|
$minutes_to_read
|
|
38
38
|
);
|