@wordpress/block-library 9.10.0 → 9.11.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 +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/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/edit/index.js +24 -3
- 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 +3 -1
- package/build/cover/save.js.map +1 -1
- package/build/file/edit.js +1 -2
- 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 +11 -2
- 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/latest-posts/edit.js +3 -8
- package/build/latest-posts/edit.js.map +1 -1
- package/build/navigation/edit/index.js +23 -2
- package/build/navigation/edit/index.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 +1 -1
- package/build/paragraph/edit.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-time-to-read/edit.js +2 -2
- package/build/post-time-to-read/edit.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-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 +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/video/tracks-editor.js +1 -1
- 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/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/edit/index.js +24 -3
- 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 +3 -1
- package/build-module/cover/save.js.map +1 -1
- package/build-module/file/edit.js +1 -2
- 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 +14 -5
- 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/latest-posts/edit.js +3 -8
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +23 -2
- package/build-module/navigation/edit/index.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 +1 -1
- package/build-module/paragraph/edit.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-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/order-control.js +2 -2
- package/build-module/query/edit/inspector-controls/order-control.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 +1 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/video/tracks-editor.js +2 -2
- 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/style-rtl.css +5 -0
- package/build-style/cover/style.css +5 -0
- package/build-style/editor-rtl.css +20 -0
- package/build-style/editor.css +20 -0
- package/build-style/group/editor-rtl.css +10 -0
- package/build-style/group/editor.css +10 -0
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/navigation/editor-rtl.css +1 -0
- package/build-style/navigation/editor.css +1 -0
- package/build-style/style-rtl.css +14 -0
- package/build-style/style.css +14 -0
- package/package.json +36 -35
- 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/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 +21 -3
- package/src/comments/style.scss +4 -1
- package/src/cover/block.json +3 -0
- package/src/cover/constants.js +1 -0
- package/src/cover/edit/index.js +20 -2
- package/src/cover/edit/inspector-controls.js +46 -1
- package/src/cover/save.js +2 -0
- package/src/cover/style.scss +6 -0
- package/src/cover/test/edit.js +1 -3
- package/src/file/edit.js +1 -2
- package/src/gallery/constants.js +1 -0
- package/src/gallery/edit.js +25 -2
- package/src/gallery/utils.js +23 -2
- package/src/group/editor.scss +12 -0
- package/src/html/edit.js +7 -1
- package/src/html/preview.js +3 -2
- package/src/image/style.scss +1 -0
- package/src/latest-posts/edit.js +3 -7
- package/src/latest-posts/index.php +1 -1
- package/src/navigation/edit/index.js +30 -3
- 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/paragraph/edit.js +1 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-time-to-read/edit.js +2 -2
- package/src/post-time-to-read/index.php +1 -1
- package/src/query/edit/inspector-controls/order-control.js +2 -2
- package/src/query-title/edit.js +2 -2
- package/src/rss/index.php +1 -1
- package/src/search/edit.js +28 -25
- 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 +1 -1
- package/src/video/tracks-editor.js +2 -2
package/src/group/editor.scss
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
// Reset user select, but the next rule should take precedence for nested
|
|
14
|
+
// groups.
|
|
15
|
+
:where([data-has-multi-selection]:not([contenteditable="true"]) .wp-block-group > *) {
|
|
16
|
+
user-select: initial;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// When we are not multi-selecting, prevent children from capturing the
|
|
20
|
+
// selection, which happens when the group is flex and children inlined.
|
|
21
|
+
:where([data-has-multi-selection]:not([contenteditable="true"]) .wp-block-group) {
|
|
22
|
+
user-select: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
13
25
|
// Place block list appender in the same place content will appear.
|
|
14
26
|
[data-type="core/group"].is-selected {
|
|
15
27
|
.block-list-appender {
|
package/src/html/edit.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
BlockControls,
|
|
8
8
|
PlainText,
|
|
9
9
|
useBlockProps,
|
|
10
|
+
store as blockEditorStore,
|
|
10
11
|
} from '@wordpress/block-editor';
|
|
11
12
|
import {
|
|
12
13
|
ToolbarButton,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
ToolbarGroup,
|
|
15
16
|
VisuallyHidden,
|
|
16
17
|
} from '@wordpress/components';
|
|
18
|
+
import { useSelect } from '@wordpress/data';
|
|
17
19
|
import { useInstanceId } from '@wordpress/compose';
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -27,6 +29,10 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
27
29
|
|
|
28
30
|
const instanceId = useInstanceId( HTMLEdit, 'html-edit-desc' );
|
|
29
31
|
|
|
32
|
+
const isPreviewMode = useSelect( ( select ) => {
|
|
33
|
+
return select( blockEditorStore ).getSettings().isPreviewMode;
|
|
34
|
+
}, [] );
|
|
35
|
+
|
|
30
36
|
function switchToPreview() {
|
|
31
37
|
setIsPreview( true );
|
|
32
38
|
}
|
|
@@ -58,7 +64,7 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
58
64
|
</ToolbarButton>
|
|
59
65
|
</ToolbarGroup>
|
|
60
66
|
</BlockControls>
|
|
61
|
-
{ isPreview || isDisabled ? (
|
|
67
|
+
{ isPreview || isPreviewMode || isDisabled ? (
|
|
62
68
|
<>
|
|
63
69
|
<Preview
|
|
64
70
|
content={ attributes.content }
|
package/src/html/preview.js
CHANGED
|
@@ -23,14 +23,15 @@ const DEFAULT_STYLES = `
|
|
|
23
23
|
|
|
24
24
|
export default function HTMLEditPreview( { content, isSelected } ) {
|
|
25
25
|
const settingStyles = useSelect(
|
|
26
|
-
( select ) => select( blockEditorStore ).getSettings().styles
|
|
26
|
+
( select ) => select( blockEditorStore ).getSettings().styles,
|
|
27
|
+
[]
|
|
27
28
|
);
|
|
28
29
|
|
|
29
30
|
const styles = useMemo(
|
|
30
31
|
() => [
|
|
31
32
|
DEFAULT_STYLES,
|
|
32
33
|
...transformStyles(
|
|
33
|
-
settingStyles.filter( ( style ) => style.css )
|
|
34
|
+
( settingStyles ?? [] ).filter( ( style ) => style.css )
|
|
34
35
|
),
|
|
35
36
|
],
|
|
36
37
|
[ settingStyles ]
|
package/src/image/style.scss
CHANGED
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
|
};
|
|
@@ -593,7 +589,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
593
589
|
{ displayAuthor && currentAuthor && (
|
|
594
590
|
<div className="wp-block-latest-posts__post-author">
|
|
595
591
|
{ sprintf(
|
|
596
|
-
/* translators: byline. %s:
|
|
592
|
+
/* translators: byline. %s: author. */
|
|
597
593
|
__( 'by %s' ),
|
|
598
594
|
currentAuthor.name
|
|
599
595
|
) }
|
|
@@ -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 ) ) {
|
|
@@ -73,6 +73,33 @@ import AccessibleDescription from './accessible-description';
|
|
|
73
73
|
import AccessibleMenuDescription from './accessible-menu-description';
|
|
74
74
|
import { unlock } from '../../lock-unlock';
|
|
75
75
|
|
|
76
|
+
function useResponsiveMenu( navRef ) {
|
|
77
|
+
const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] =
|
|
78
|
+
useState( false );
|
|
79
|
+
|
|
80
|
+
useEffect( () => {
|
|
81
|
+
if ( ! navRef.current ) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const htmlElement = navRef.current.ownerDocument.documentElement;
|
|
86
|
+
|
|
87
|
+
// Add a `has-modal-open` class to the <html> when the responsive
|
|
88
|
+
// menu is open. This reproduces the same behavior of the frontend.
|
|
89
|
+
if ( isResponsiveMenuOpen ) {
|
|
90
|
+
htmlElement.classList.add( 'has-modal-open' );
|
|
91
|
+
} else {
|
|
92
|
+
htmlElement.classList.remove( 'has-modal-open' );
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return () => {
|
|
96
|
+
htmlElement?.classList.remove( 'has-modal-open' );
|
|
97
|
+
};
|
|
98
|
+
}, [ navRef, isResponsiveMenuOpen ] );
|
|
99
|
+
|
|
100
|
+
return [ isResponsiveMenuOpen, setResponsiveMenuVisibility ];
|
|
101
|
+
}
|
|
102
|
+
|
|
76
103
|
function ColorTools( {
|
|
77
104
|
textColor,
|
|
78
105
|
setTextColor,
|
|
@@ -284,8 +311,10 @@ function Navigation( {
|
|
|
284
311
|
__unstableMarkNextChangeAsNotPersistent,
|
|
285
312
|
} = useDispatch( blockEditorStore );
|
|
286
313
|
|
|
314
|
+
const navRef = useRef();
|
|
315
|
+
|
|
287
316
|
const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] =
|
|
288
|
-
|
|
317
|
+
useResponsiveMenu( navRef );
|
|
289
318
|
|
|
290
319
|
const [ overlayMenuPreview, setOverlayMenuPreview ] = useState( false );
|
|
291
320
|
|
|
@@ -367,8 +396,6 @@ function Navigation( {
|
|
|
367
396
|
__unstableMarkNextChangeAsNotPersistent,
|
|
368
397
|
] );
|
|
369
398
|
|
|
370
|
-
const navRef = useRef();
|
|
371
|
-
|
|
372
399
|
// The standard HTML5 tag for the block wrapper.
|
|
373
400
|
const TagName = 'nav';
|
|
374
401
|
|
|
@@ -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/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 (
|
|
@@ -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
|
)
|
|
@@ -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
|
);
|
|
@@ -14,12 +14,12 @@ const orderOptions = [
|
|
|
14
14
|
value: 'date/asc',
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
/* translators:
|
|
17
|
+
/* translators: Label for ordering posts by title in ascending order. */
|
|
18
18
|
label: __( 'A → Z' ),
|
|
19
19
|
value: 'title/asc',
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
/* translators:
|
|
22
|
+
/* translators: Label for ordering posts by title in descending order. */
|
|
23
23
|
label: __( 'Z → A' ),
|
|
24
24
|
value: 'title/desc',
|
|
25
25
|
},
|
package/src/query-title/edit.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
HeadingLevelDropdown,
|
|
16
16
|
} from '@wordpress/block-editor';
|
|
17
17
|
import { ToggleControl, PanelBody } from '@wordpress/components';
|
|
18
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
18
|
+
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
@@ -60,7 +60,7 @@ export default function QueryTitleEdit( {
|
|
|
60
60
|
if ( archiveNameLabel ) {
|
|
61
61
|
title = sprintf(
|
|
62
62
|
/* translators: 1: Archive type title e.g: "Category", 2: Label of the archive e.g: "Shoes" */
|
|
63
|
-
|
|
63
|
+
_x( '%1$s: %2$s', 'archive label' ),
|
|
64
64
|
archiveTypeLabel,
|
|
65
65
|
archiveNameLabel
|
|
66
66
|
);
|
package/src/rss/index.php
CHANGED
|
@@ -62,7 +62,7 @@ function render_block_core_rss( $attributes ) {
|
|
|
62
62
|
if ( is_object( $author ) ) {
|
|
63
63
|
$author = $author->get_name();
|
|
64
64
|
$author = '<span class="wp-block-rss__item-author">' . sprintf(
|
|
65
|
-
/* translators: %s:
|
|
65
|
+
/* translators: byline. %s: author. */
|
|
66
66
|
__( 'by %s' ),
|
|
67
67
|
esc_html( strip_tags( $author ) )
|
|
68
68
|
) . '</span>';
|
package/src/search/edit.js
CHANGED
|
@@ -23,14 +23,14 @@ import { useEffect, useRef } from '@wordpress/element';
|
|
|
23
23
|
import {
|
|
24
24
|
ToolbarDropdownMenu,
|
|
25
25
|
ToolbarGroup,
|
|
26
|
-
Button,
|
|
27
|
-
ButtonGroup,
|
|
28
26
|
ToolbarButton,
|
|
29
27
|
ResizableBox,
|
|
30
28
|
PanelBody,
|
|
31
29
|
__experimentalVStack as VStack,
|
|
32
30
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
33
31
|
__experimentalUnitControl as UnitControl,
|
|
32
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
33
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
34
34
|
} from '@wordpress/components';
|
|
35
35
|
import { useInstanceId } from '@wordpress/compose';
|
|
36
36
|
import { Icon, search } from '@wordpress/icons';
|
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
// Used to calculate border radius adjustment to avoid "fat" corners when
|
|
59
59
|
// button is placed inside wrapper.
|
|
60
60
|
const DEFAULT_INNER_PADDING = '4px';
|
|
61
|
+
const PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];
|
|
61
62
|
|
|
62
63
|
export default function SearchEdit( {
|
|
63
64
|
className,
|
|
@@ -375,7 +376,7 @@ export default function SearchEdit( {
|
|
|
375
376
|
<BlockControls>
|
|
376
377
|
<ToolbarGroup>
|
|
377
378
|
<ToolbarButton
|
|
378
|
-
title={ __( '
|
|
379
|
+
title={ __( 'Show search label' ) }
|
|
379
380
|
icon={ toggleLabel }
|
|
380
381
|
onClick={ () => {
|
|
381
382
|
setAttributes( {
|
|
@@ -445,33 +446,35 @@ export default function SearchEdit( {
|
|
|
445
446
|
value={ `${ width }${ widthUnit }` }
|
|
446
447
|
units={ units }
|
|
447
448
|
/>
|
|
448
|
-
<
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
<ToggleGroupControl
|
|
450
|
+
label={ __( 'Percentage Width' ) }
|
|
451
|
+
value={
|
|
452
|
+
PERCENTAGE_WIDTHS.includes( width ) &&
|
|
453
|
+
widthUnit === '%'
|
|
454
|
+
? width
|
|
455
|
+
: undefined
|
|
456
|
+
}
|
|
457
|
+
hideLabelFromVision
|
|
458
|
+
onChange={ ( newWidth ) => {
|
|
459
|
+
setAttributes( {
|
|
460
|
+
width: newWidth,
|
|
461
|
+
widthUnit: '%',
|
|
462
|
+
} );
|
|
463
|
+
} }
|
|
464
|
+
isBlock
|
|
465
|
+
__next40pxDefaultSize
|
|
466
|
+
__nextHasNoMarginBottom
|
|
451
467
|
>
|
|
452
|
-
{
|
|
468
|
+
{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {
|
|
453
469
|
return (
|
|
454
|
-
<
|
|
470
|
+
<ToggleGroupControlOption
|
|
455
471
|
key={ widthValue }
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
widthUnit === '%'
|
|
460
|
-
? 'primary'
|
|
461
|
-
: undefined
|
|
462
|
-
}
|
|
463
|
-
onClick={ () =>
|
|
464
|
-
setAttributes( {
|
|
465
|
-
width: widthValue,
|
|
466
|
-
widthUnit: '%',
|
|
467
|
-
} )
|
|
468
|
-
}
|
|
469
|
-
>
|
|
470
|
-
{ widthValue }%
|
|
471
|
-
</Button>
|
|
472
|
+
value={ widthValue }
|
|
473
|
+
label={ `${ widthValue }%` }
|
|
474
|
+
/>
|
|
472
475
|
);
|
|
473
476
|
} ) }
|
|
474
|
-
</
|
|
477
|
+
</ToggleGroupControl>
|
|
475
478
|
</VStack>
|
|
476
479
|
</PanelBody>
|
|
477
480
|
</InspectorControls>
|
|
@@ -17,3 +17,9 @@ exports[`Separator block transforms to Group block 1`] = `
|
|
|
17
17
|
<!-- /wp:separator --></div>
|
|
18
18
|
<!-- /wp:group -->"
|
|
19
19
|
`;
|
|
20
|
+
|
|
21
|
+
exports[`Separator block transforms to Spacer block 1`] = `
|
|
22
|
+
"<!-- wp:spacer -->
|
|
23
|
+
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
24
|
+
<!-- /wp:spacer -->"
|
|
25
|
+
`;
|
|
@@ -16,7 +16,7 @@ const initialHtml = `
|
|
|
16
16
|
<!-- /wp:separator -->`;
|
|
17
17
|
|
|
18
18
|
const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
|
|
19
|
-
const blockTransforms = [ ...transformsWithInnerBlocks ];
|
|
19
|
+
const blockTransforms = [ 'Spacer', ...transformsWithInnerBlocks ];
|
|
20
20
|
|
|
21
21
|
setupCoreBlocks();
|
|
22
22
|
|
|
@@ -18,6 +18,17 @@ const transforms = {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
],
|
|
21
|
+
to: [
|
|
22
|
+
{
|
|
23
|
+
type: 'block',
|
|
24
|
+
blocks: [ 'core/spacer' ], // Transform to Spacer.
|
|
25
|
+
transform: ( { anchor } ) => {
|
|
26
|
+
return createBlock( 'core/spacer', {
|
|
27
|
+
anchor: anchor || '',
|
|
28
|
+
} );
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
21
32
|
};
|
|
22
33
|
|
|
23
34
|
export default transforms;
|
package/src/social-links/edit.js
CHANGED
package/src/spacer/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import initBlock from '../utils/init-block';
|
|
|
10
10
|
import deprecated from './deprecated';
|
|
11
11
|
import edit from './edit';
|
|
12
12
|
import metadata from './block.json';
|
|
13
|
+
import transforms from './transforms';
|
|
13
14
|
import save from './save';
|
|
14
15
|
|
|
15
16
|
const { name } = metadata;
|
|
@@ -18,6 +19,7 @@ export { metadata, name };
|
|
|
18
19
|
|
|
19
20
|
export const settings = {
|
|
20
21
|
icon,
|
|
22
|
+
transforms,
|
|
21
23
|
edit,
|
|
22
24
|
save,
|
|
23
25
|
deprecated,
|
|
@@ -17,3 +17,9 @@ exports[`Spacer block transforms to Group block 1`] = `
|
|
|
17
17
|
<!-- /wp:spacer --></div>
|
|
18
18
|
<!-- /wp:group -->"
|
|
19
19
|
`;
|
|
20
|
+
|
|
21
|
+
exports[`Spacer block transforms to Separator block 1`] = `
|
|
22
|
+
"<!-- wp:separator -->
|
|
23
|
+
<hr class="wp-block-separator has-alpha-channel-opacity"/>
|
|
24
|
+
<!-- /wp:separator -->"
|
|
25
|
+
`;
|
|
@@ -16,7 +16,7 @@ const initialHtml = `
|
|
|
16
16
|
<!-- /wp:spacer -->`;
|
|
17
17
|
|
|
18
18
|
const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
|
|
19
|
-
const blockTransforms = [ ...transformsWithInnerBlocks ];
|
|
19
|
+
const blockTransforms = [ 'Separator', ...transformsWithInnerBlocks ];
|
|
20
20
|
|
|
21
21
|
setupCoreBlocks();
|
|
22
22
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlock } from '@wordpress/blocks';
|
|
5
|
+
|
|
6
|
+
const transforms = {
|
|
7
|
+
to: [
|
|
8
|
+
{
|
|
9
|
+
type: 'block',
|
|
10
|
+
blocks: [ 'core/separator' ], // Transform to Separator.
|
|
11
|
+
transform: ( { anchor } ) => {
|
|
12
|
+
return createBlock( 'core/separator', {
|
|
13
|
+
anchor: anchor || '',
|
|
14
|
+
} );
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default transforms;
|
package/src/table/edit.js
CHANGED
|
@@ -58,15 +58,11 @@ export default function TableOfContentsEdit( {
|
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
// If a user clicks to a link prevent redirection and show a warning.
|
|
61
|
-
const { createWarningNotice
|
|
62
|
-
let noticeId;
|
|
61
|
+
const { createWarningNotice } = useDispatch( noticeStore );
|
|
63
62
|
const showRedirectionPreventedNotice = ( event ) => {
|
|
64
63
|
event.preventDefault();
|
|
65
|
-
// Remove previous warning if any, to show one at a time per block.
|
|
66
|
-
removeNotice( noticeId );
|
|
67
|
-
noticeId = `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`;
|
|
68
64
|
createWarningNotice( __( 'Links are disabled in the editor.' ), {
|
|
69
|
-
id:
|
|
65
|
+
id: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,
|
|
70
66
|
type: 'snackbar',
|
|
71
67
|
} );
|
|
72
68
|
};
|
|
@@ -214,7 +214,7 @@ export default function TemplatePartEdit( {
|
|
|
214
214
|
<TagName { ...blockProps }>
|
|
215
215
|
<Warning>
|
|
216
216
|
{ sprintf(
|
|
217
|
-
/* translators: %s: Template part slug */
|
|
217
|
+
/* translators: %s: Template part slug. */
|
|
218
218
|
__(
|
|
219
219
|
'Template part has been deleted or is unavailable: %s'
|
|
220
220
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
4
|
+
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
NavigableMenu,
|
|
7
7
|
MenuItem,
|
|
@@ -63,7 +63,7 @@ function TrackList( { tracks, onEditPress } ) {
|
|
|
63
63
|
onClick={ () => onEditPress( index ) }
|
|
64
64
|
aria-label={ sprintf(
|
|
65
65
|
/* translators: %s: Label of the video text track e.g: "French subtitles" */
|
|
66
|
-
|
|
66
|
+
_x( 'Edit %s', 'text tracks' ),
|
|
67
67
|
track.label
|
|
68
68
|
) }
|
|
69
69
|
>
|