@wordpress/block-library 8.19.3 → 8.19.5
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 +7 -0
- package/build/cover/edit/inspector-controls.js +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/embed/edit.js +17 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +17 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +25 -6
- package/build/image/view.js.map +1 -1
- package/build/latest-posts/edit.js +6 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +6 -4
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/index.js +3 -3
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +2 -1
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/view.js +7 -0
- package/build/navigation/view.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/embed/edit.js +17 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +17 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +25 -6
- package/build-module/image/view.js.map +1 -1
- package/build-module/latest-posts/edit.js +6 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +7 -4
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/index.js +3 -3
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -1
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/view.js +7 -0
- package/build-module/navigation/view.js.map +1 -1
- package/build-style/image/style-rtl.css +17 -2
- package/build-style/image/style.css +17 -2
- package/build-style/post-featured-image/style-rtl.css +3 -0
- package/build-style/post-featured-image/style.css +3 -0
- package/build-style/post-template/style-rtl.css +25 -0
- package/build-style/post-template/style.css +25 -0
- package/build-style/style-rtl.css +46 -2
- package/build-style/style.css +46 -2
- package/package.json +32 -32
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/embed/edit.js +15 -0
- package/src/embed/edit.native.js +15 -0
- package/src/image/image.js +1 -1
- package/src/image/index.php +65 -46
- package/src/image/style.scss +23 -2
- package/src/image/view.js +28 -7
- package/src/latest-posts/edit.js +11 -2
- package/src/latest-posts/index.php +17 -8
- package/src/media-text/edit.js +1 -1
- package/src/navigation/edit/deleted-navigation-warning.js +9 -4
- package/src/navigation/edit/index.js +26 -18
- package/src/navigation/edit/inner-blocks.js +1 -0
- package/src/navigation/index.php +19 -6
- package/src/navigation/view.js +7 -0
- package/src/post-featured-image/style.scss +4 -0
- package/src/post-template/style.scss +20 -0
- package/src/query/index.php +2 -1
package/src/image/view.js
CHANGED
|
@@ -105,7 +105,10 @@ store(
|
|
|
105
105
|
context.core.image.scrollDelta = 0;
|
|
106
106
|
|
|
107
107
|
context.core.image.lightboxEnabled = true;
|
|
108
|
-
setStyles(
|
|
108
|
+
setStyles(
|
|
109
|
+
context,
|
|
110
|
+
event.target.previousElementSibling
|
|
111
|
+
);
|
|
109
112
|
|
|
110
113
|
context.core.image.scrollTopReset =
|
|
111
114
|
window.pageYOffset ||
|
|
@@ -227,7 +230,17 @@ store(
|
|
|
227
230
|
roleAttribute: ( { context } ) => {
|
|
228
231
|
return context.core.image.lightboxEnabled
|
|
229
232
|
? 'dialog'
|
|
230
|
-
:
|
|
233
|
+
: null;
|
|
234
|
+
},
|
|
235
|
+
ariaModal: ( { context } ) => {
|
|
236
|
+
return context.core.image.lightboxEnabled
|
|
237
|
+
? 'true'
|
|
238
|
+
: null;
|
|
239
|
+
},
|
|
240
|
+
dialogLabel: ( { context } ) => {
|
|
241
|
+
return context.core.image.lightboxEnabled
|
|
242
|
+
? context.core.image.dialogLabel
|
|
243
|
+
: null;
|
|
231
244
|
},
|
|
232
245
|
lightboxObjectFit: ( { context } ) => {
|
|
233
246
|
if ( context.core.image.initialized ) {
|
|
@@ -237,7 +250,7 @@ store(
|
|
|
237
250
|
enlargedImgSrc: ( { context } ) => {
|
|
238
251
|
return context.core.image.initialized
|
|
239
252
|
? context.core.image.imageUploadedSrc
|
|
240
|
-
: '';
|
|
253
|
+
: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
|
|
241
254
|
},
|
|
242
255
|
},
|
|
243
256
|
},
|
|
@@ -328,6 +341,15 @@ store(
|
|
|
328
341
|
context.core.image.imageButtonHeight = offsetHeight;
|
|
329
342
|
}
|
|
330
343
|
},
|
|
344
|
+
setStylesOnResize: ( { state, context, ref } ) => {
|
|
345
|
+
if (
|
|
346
|
+
context.core.image.lightboxEnabled &&
|
|
347
|
+
( state.core.image.windowWidth ||
|
|
348
|
+
state.core.image.windowHeight )
|
|
349
|
+
) {
|
|
350
|
+
setStyles( context, ref );
|
|
351
|
+
}
|
|
352
|
+
},
|
|
331
353
|
},
|
|
332
354
|
},
|
|
333
355
|
},
|
|
@@ -352,7 +374,7 @@ store(
|
|
|
352
374
|
* @param {Object} context - An Interactivity API context
|
|
353
375
|
* @param {Object} event - A triggering event
|
|
354
376
|
*/
|
|
355
|
-
function setStyles( context,
|
|
377
|
+
function setStyles( context, ref ) {
|
|
356
378
|
// The reference img element lies adjacent
|
|
357
379
|
// to the event target button in the DOM.
|
|
358
380
|
let {
|
|
@@ -360,9 +382,8 @@ function setStyles( context, event ) {
|
|
|
360
382
|
naturalHeight,
|
|
361
383
|
offsetWidth: originalWidth,
|
|
362
384
|
offsetHeight: originalHeight,
|
|
363
|
-
} =
|
|
364
|
-
let { x: screenPosX, y: screenPosY } =
|
|
365
|
-
event.target.nextElementSibling.getBoundingClientRect();
|
|
385
|
+
} = ref;
|
|
386
|
+
let { x: screenPosX, y: screenPosY } = ref.getBoundingClientRect();
|
|
366
387
|
|
|
367
388
|
// Natural ratio of the image clicked to open the lightbox.
|
|
368
389
|
const naturalRatio = naturalWidth / naturalHeight;
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -483,12 +483,18 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
483
483
|
.split( ' ', excerptLength )
|
|
484
484
|
.join( ' ' ) }
|
|
485
485
|
{ createInterpolateElement(
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
sprintf(
|
|
487
|
+
/* translators: 1: Hidden accessibility text: Post title */
|
|
488
|
+
__(
|
|
489
|
+
'… <a>Read more<span>: %1$s</span></a>'
|
|
490
|
+
),
|
|
491
|
+
titleTrimmed || __( '(no title)' )
|
|
492
|
+
),
|
|
488
493
|
{
|
|
489
494
|
a: (
|
|
490
495
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
491
496
|
<a
|
|
497
|
+
className="wp-block-latest-posts__read-more"
|
|
492
498
|
href={ post.link }
|
|
493
499
|
rel="noopener noreferrer"
|
|
494
500
|
onClick={
|
|
@@ -496,6 +502,9 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
496
502
|
}
|
|
497
503
|
/>
|
|
498
504
|
),
|
|
505
|
+
span: (
|
|
506
|
+
<span className="screen-reader-text" />
|
|
507
|
+
),
|
|
499
508
|
}
|
|
500
509
|
) }
|
|
501
510
|
</>
|
|
@@ -48,14 +48,6 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
48
48
|
$block_core_latest_posts_excerpt_length = $attributes['excerptLength'];
|
|
49
49
|
add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );
|
|
50
50
|
|
|
51
|
-
$filter_latest_posts_excerpt_more = static function ( $more ) use ( $attributes ) {
|
|
52
|
-
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
|
|
53
|
-
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */
|
|
54
|
-
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
add_filter( 'excerpt_more', $filter_latest_posts_excerpt_more );
|
|
58
|
-
|
|
59
51
|
if ( ! empty( $attributes['categories'] ) ) {
|
|
60
52
|
$args['category__in'] = array_column( $attributes['categories'], 'id' );
|
|
61
53
|
}
|
|
@@ -151,6 +143,23 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
151
143
|
|
|
152
144
|
$trimmed_excerpt = get_the_excerpt( $post );
|
|
153
145
|
|
|
146
|
+
/*
|
|
147
|
+
* Adds a "Read more" link with screen reader text.
|
|
148
|
+
* […] is the default excerpt ending from wp_trim_excerpt() in Core.
|
|
149
|
+
*/
|
|
150
|
+
if ( str_ends_with( $trimmed_excerpt, ' […]' ) ) {
|
|
151
|
+
$excerpt_length = (int) apply_filters( 'excerpt_length', $block_core_latest_posts_excerpt_length );
|
|
152
|
+
if ( $excerpt_length <= $block_core_latest_posts_excerpt_length ) {
|
|
153
|
+
$trimmed_excerpt = substr( $trimmed_excerpt, 0, -11 );
|
|
154
|
+
$trimmed_excerpt .= sprintf(
|
|
155
|
+
/* translators: 1: A URL to a post, 2: Hidden accessibility text: Post title */
|
|
156
|
+
__( '… <a href="%1$s" rel="noopener noreferrer">Read more<span class="screen-reader-text">: %2$s</span></a>' ),
|
|
157
|
+
esc_url( $post_link ),
|
|
158
|
+
esc_html( $title )
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
154
163
|
if ( post_password_required( $post ) ) {
|
|
155
164
|
$trimmed_excerpt = __( 'This content is password protected.' );
|
|
156
165
|
}
|
package/src/media-text/edit.js
CHANGED
|
@@ -244,7 +244,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
244
244
|
<ToggleControl
|
|
245
245
|
__nextHasNoMarginBottom
|
|
246
246
|
label={ __( 'Crop image to fill entire column' ) }
|
|
247
|
-
checked={ imageFill }
|
|
247
|
+
checked={ !! imageFill }
|
|
248
248
|
onChange={ () =>
|
|
249
249
|
setAttributes( {
|
|
250
250
|
imageFill: ! imageFill,
|
|
@@ -4,14 +4,19 @@
|
|
|
4
4
|
import { Warning } from '@wordpress/block-editor';
|
|
5
5
|
import { Button } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { createInterpolateElement } from '@wordpress/element';
|
|
7
8
|
|
|
8
9
|
function DeletedNavigationWarning( { onCreateNew } ) {
|
|
9
10
|
return (
|
|
10
11
|
<Warning>
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
{ createInterpolateElement(
|
|
13
|
+
__(
|
|
14
|
+
'Navigation menu has been deleted or is unavailable. <button>Create a new menu?</button>'
|
|
15
|
+
),
|
|
16
|
+
{
|
|
17
|
+
button: <Button onClick={ onCreateNew } variant="link" />,
|
|
18
|
+
}
|
|
19
|
+
) }
|
|
15
20
|
</Warning>
|
|
16
21
|
);
|
|
17
22
|
}
|
|
@@ -93,6 +93,7 @@ function Navigation( {
|
|
|
93
93
|
// navigation block settings.
|
|
94
94
|
hasSubmenuIndicatorSetting = true,
|
|
95
95
|
customPlaceholder: CustomPlaceholder = null,
|
|
96
|
+
__unstableLayoutClassNames: layoutClassNames,
|
|
96
97
|
} ) {
|
|
97
98
|
const {
|
|
98
99
|
openSubmenusOnClick,
|
|
@@ -293,23 +294,31 @@ function Navigation( {
|
|
|
293
294
|
const isResponsive = 'never' !== overlayMenu;
|
|
294
295
|
const blockProps = useBlockProps( {
|
|
295
296
|
ref: navRef,
|
|
296
|
-
className: classnames(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
297
|
+
className: classnames(
|
|
298
|
+
className,
|
|
299
|
+
{
|
|
300
|
+
'items-justified-right': justifyContent === 'right',
|
|
301
|
+
'items-justified-space-between':
|
|
302
|
+
justifyContent === 'space-between',
|
|
303
|
+
'items-justified-left': justifyContent === 'left',
|
|
304
|
+
'items-justified-center': justifyContent === 'center',
|
|
305
|
+
'is-vertical': orientation === 'vertical',
|
|
306
|
+
'no-wrap': flexWrap === 'nowrap',
|
|
307
|
+
'is-responsive': isResponsive,
|
|
308
|
+
'has-text-color': !! textColor.color || !! textColor?.class,
|
|
309
|
+
[ getColorClassName( 'color', textColor?.slug ) ]:
|
|
310
|
+
!! textColor?.slug,
|
|
311
|
+
'has-background':
|
|
312
|
+
!! backgroundColor.color || backgroundColor.class,
|
|
313
|
+
[ getColorClassName(
|
|
314
|
+
'background-color',
|
|
315
|
+
backgroundColor?.slug
|
|
316
|
+
) ]: !! backgroundColor?.slug,
|
|
317
|
+
[ `has-text-decoration-${ textDecoration }` ]: textDecoration,
|
|
318
|
+
'block-editor-block-content-overlay': hasBlockOverlay,
|
|
319
|
+
},
|
|
320
|
+
layoutClassNames
|
|
321
|
+
),
|
|
313
322
|
style: {
|
|
314
323
|
color: ! textColor?.slug && textColor?.color,
|
|
315
324
|
backgroundColor: ! backgroundColor?.slug && backgroundColor?.color,
|
|
@@ -875,7 +884,6 @@ function Navigation( {
|
|
|
875
884
|
<ResponsiveWrapper
|
|
876
885
|
id={ clientId }
|
|
877
886
|
onToggle={ setResponsiveMenuVisibility }
|
|
878
|
-
label={ __( 'Menu' ) }
|
|
879
887
|
hasIcon={ hasIcon }
|
|
880
888
|
icon={ icon }
|
|
881
889
|
isOpen={ isResponsiveMenuOpen }
|
package/src/navigation/index.php
CHANGED
|
@@ -696,9 +696,22 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
696
696
|
$responsive_dialog_directives = '';
|
|
697
697
|
$close_button_directives = '';
|
|
698
698
|
if ( $should_load_view_script ) {
|
|
699
|
+
$nav_element_context = wp_json_encode(
|
|
700
|
+
array(
|
|
701
|
+
'core' => array(
|
|
702
|
+
'navigation' => array(
|
|
703
|
+
'overlayOpenedBy' => array(),
|
|
704
|
+
'type' => 'overlay',
|
|
705
|
+
'roleAttribute' => '',
|
|
706
|
+
'ariaLabel' => __( 'Menu' ),
|
|
707
|
+
),
|
|
708
|
+
),
|
|
709
|
+
),
|
|
710
|
+
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
|
|
711
|
+
);
|
|
699
712
|
$nav_element_directives = '
|
|
700
713
|
data-wp-interactive
|
|
701
|
-
data-wp-context=\'
|
|
714
|
+
data-wp-context=\'' . $nav_element_context . '\'
|
|
702
715
|
';
|
|
703
716
|
$open_button_directives = '
|
|
704
717
|
data-wp-on--click="actions.core.navigation.openMenuOnClick"
|
|
@@ -714,6 +727,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
714
727
|
';
|
|
715
728
|
$responsive_dialog_directives = '
|
|
716
729
|
data-wp-bind--aria-modal="selectors.core.navigation.ariaModal"
|
|
730
|
+
data-wp-bind--aria-label="selectors.core.navigation.ariaLabel"
|
|
717
731
|
data-wp-bind--role="selectors.core.navigation.roleAttribute"
|
|
718
732
|
data-wp-effect="effects.core.navigation.focusFirstElement"
|
|
719
733
|
';
|
|
@@ -723,11 +737,11 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
723
737
|
}
|
|
724
738
|
|
|
725
739
|
$responsive_container_markup = sprintf(
|
|
726
|
-
'<button aria-haspopup="true" %3$s class="%6$s" %
|
|
727
|
-
<div class="%5$s" style="%7$s" id="%1$s" %
|
|
740
|
+
'<button aria-haspopup="true" %3$s class="%6$s" %10$s>%8$s</button>
|
|
741
|
+
<div class="%5$s" style="%7$s" id="%1$s" %11$s>
|
|
728
742
|
<div class="wp-block-navigation__responsive-close" tabindex="-1">
|
|
729
|
-
<div class="wp-block-navigation__responsive-dialog"
|
|
730
|
-
<button %4$s class="wp-block-navigation__responsive-container-close" %
|
|
743
|
+
<div class="wp-block-navigation__responsive-dialog" %12$s>
|
|
744
|
+
<button %4$s class="wp-block-navigation__responsive-container-close" %13$s>%9$s</button>
|
|
731
745
|
<div class="wp-block-navigation__responsive-container-content" id="%1$s-content">
|
|
732
746
|
%2$s
|
|
733
747
|
</div>
|
|
@@ -741,7 +755,6 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
741
755
|
esc_attr( implode( ' ', $responsive_container_classes ) ),
|
|
742
756
|
esc_attr( implode( ' ', $open_button_classes ) ),
|
|
743
757
|
esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
|
|
744
|
-
__( 'Menu' ),
|
|
745
758
|
$toggle_button_content,
|
|
746
759
|
$toggle_close_button_content,
|
|
747
760
|
$open_button_directives,
|
package/src/navigation/view.js
CHANGED
|
@@ -87,6 +87,13 @@ wpStore( {
|
|
|
87
87
|
? 'true'
|
|
88
88
|
: null;
|
|
89
89
|
},
|
|
90
|
+
ariaLabel: ( store ) => {
|
|
91
|
+
const { context, selectors } = store;
|
|
92
|
+
return context.core.navigation.type === 'overlay' &&
|
|
93
|
+
selectors.core.navigation.isMenuOpen( store )
|
|
94
|
+
? context.core.navigation.ariaLabel
|
|
95
|
+
: null;
|
|
96
|
+
},
|
|
90
97
|
isMenuOpen: ( { context } ) =>
|
|
91
98
|
// The menu is opened if either `click`, `hover` or `focus` is true.
|
|
92
99
|
Object.values(
|
|
@@ -37,3 +37,23 @@
|
|
|
37
37
|
grid-template-columns: 1fr;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
.wp-block-post-template-is-layout-constrained > li > .alignright,
|
|
42
|
+
.wp-block-post-template-is-layout-flow > li > .alignright {
|
|
43
|
+
float: right;
|
|
44
|
+
margin-inline-start: 2em;
|
|
45
|
+
margin-inline-end: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.wp-block-post-template-is-layout-constrained > li > .alignleft,
|
|
49
|
+
.wp-block-post-template-is-layout-flow > li > .alignleft {
|
|
50
|
+
float: left;
|
|
51
|
+
margin-inline-start: 0;
|
|
52
|
+
margin-inline-end: 2em;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.wp-block-post-template-is-layout-constrained > li > .aligncenter,
|
|
56
|
+
.wp-block-post-template-is-layout-flow > li > .aligncenter {
|
|
57
|
+
margin-inline-start: auto;
|
|
58
|
+
margin-inline-end: auto;
|
|
59
|
+
}
|
package/src/query/index.php
CHANGED