@wordpress/block-library 8.12.6 → 8.12.8
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/build/archives/index.js +5 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/index.js +5 -1
- package/build/audio/index.js.map +1 -1
- package/build/categories/index.js +5 -1
- package/build/categories/index.js.map +1 -1
- package/build/code/index.js +5 -1
- package/build/code/index.js.map +1 -1
- package/build/details/index.js +5 -1
- package/build/details/index.js.map +1 -1
- package/build/footnotes/edit.js +20 -1
- package/build/footnotes/edit.js.map +1 -1
- package/build/footnotes/format.js +2 -7
- package/build/footnotes/format.js.map +1 -1
- package/build/footnotes/index.js +0 -1
- package/build/footnotes/index.js.map +1 -1
- package/build/gallery/index.js +3 -1
- package/build/gallery/index.js.map +1 -1
- package/build/heading/index.js +5 -1
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +5 -1
- package/build/heading/transforms.js.map +1 -1
- package/build/image/deprecated.js +453 -175
- package/build/image/deprecated.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/image/save.js +3 -1
- package/build/image/save.js.map +1 -1
- package/build/list/edit.js +4 -4
- package/build/list/edit.js.map +1 -1
- package/build/list/index.js +5 -1
- package/build/list/index.js.map +1 -1
- package/build/list-item/utils.js +5 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/navigation-link/edit.js +10 -5
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +5 -1
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/quote/transforms.js +8 -0
- package/build/quote/transforms.js.map +1 -1
- package/build/site-logo/index.js +5 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/index.js +5 -1
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/index.js +5 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-links/index.js +3 -1
- package/build/social-links/index.js.map +1 -1
- package/build/table/index.js +5 -1
- package/build/table/index.js.map +1 -1
- package/build/verse/index.js +5 -1
- package/build/verse/index.js.map +1 -1
- package/build/video/deprecated.js +5 -1
- package/build/video/deprecated.js.map +1 -1
- package/build/video/index.js +5 -1
- package/build/video/index.js.map +1 -1
- package/build-module/archives/index.js +5 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/index.js +5 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/categories/index.js +5 -1
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/index.js +5 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/details/index.js +5 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/footnotes/edit.js +18 -2
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/footnotes/format.js +2 -7
- package/build-module/footnotes/format.js.map +1 -1
- package/build-module/footnotes/index.js +0 -1
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/gallery/index.js +3 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/heading/index.js +5 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +5 -1
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +454 -176
- package/build-module/image/deprecated.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/save.js +3 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/list/edit.js +4 -4
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list-item/utils.js +5 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/navigation-link/edit.js +10 -5
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +5 -1
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/quote/transforms.js +8 -0
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/site-logo/index.js +5 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/index.js +5 -1
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/index.js +5 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-links/index.js +3 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table/index.js +5 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/verse/index.js +5 -1
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/deprecated.js +5 -1
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/index.js +5 -1
- package/build-module/video/index.js.map +1 -1
- package/build-style/footnotes/style-rtl.css +4 -3
- package/build-style/footnotes/style.css +4 -3
- package/build-style/style-rtl.css +4 -3
- package/build-style/style.css +4 -3
- package/package.json +12 -12
- package/src/archives/block.json +5 -1
- package/src/audio/block.json +5 -1
- package/src/categories/block.json +5 -1
- package/src/code/block.json +5 -1
- package/src/comment-template/index.php +5 -2
- package/src/details/block.json +5 -1
- package/src/footnotes/block.json +0 -1
- package/src/footnotes/edit.js +21 -2
- package/src/footnotes/format.js +2 -6
- package/src/footnotes/style.scss +6 -3
- package/src/gallery/block.json +3 -1
- package/src/heading/block.json +5 -1
- package/src/image/deprecated.js +597 -320
- package/src/image/image.js +2 -1
- package/src/image/save.js +2 -0
- package/src/list/block.json +5 -1
- package/src/list/edit.js +6 -4
- package/src/navigation-link/edit.js +59 -45
- package/src/post-template/index.php +4 -2
- package/src/post-time-to-read/block.json +5 -1
- package/src/post-title/index.php +6 -3
- package/src/quote/test/__snapshots__/transforms.native.js.snap +10 -0
- package/src/quote/test/transforms.native.js +5 -1
- package/src/quote/transforms.js +13 -0
- package/src/site-logo/block.json +5 -1
- package/src/site-tagline/block.json +5 -1
- package/src/site-title/block.json +5 -1
- package/src/social-links/block.json +3 -1
- package/src/table/block.json +5 -1
- package/src/verse/block.json +5 -1
- package/src/video/block.json +5 -1
package/src/image/image.js
CHANGED
|
@@ -607,7 +607,8 @@ export default function Image( {
|
|
|
607
607
|
const ratio =
|
|
608
608
|
( aspectRatio && evalAspectRatio( aspectRatio ) ) ||
|
|
609
609
|
( width && height && width / height ) ||
|
|
610
|
-
naturalWidth / naturalHeight
|
|
610
|
+
naturalWidth / naturalHeight ||
|
|
611
|
+
1;
|
|
611
612
|
|
|
612
613
|
const currentWidth = ! width && height ? height * ratio : width;
|
|
613
614
|
const currentHeight = ! height && width ? width / ratio : height;
|
package/src/image/save.js
CHANGED
package/src/list/block.json
CHANGED
package/src/list/edit.js
CHANGED
|
@@ -177,10 +177,12 @@ export default function Edit( { attributes, setAttributes, clientId, style } ) {
|
|
|
177
177
|
{ controls }
|
|
178
178
|
{ ordered && (
|
|
179
179
|
<OrderedListSettings
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
{ ...{
|
|
181
|
+
setAttributes,
|
|
182
|
+
reversed,
|
|
183
|
+
start,
|
|
184
|
+
type,
|
|
185
|
+
} }
|
|
184
186
|
/>
|
|
185
187
|
) }
|
|
186
188
|
</>
|
|
@@ -181,6 +181,10 @@ export default function NavigationLinkEdit( {
|
|
|
181
181
|
const itemLabelPlaceholder = __( 'Add label…' );
|
|
182
182
|
const ref = useRef();
|
|
183
183
|
|
|
184
|
+
// Change the label using inspector causes rich text to change focus on firefox.
|
|
185
|
+
// This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text.
|
|
186
|
+
const [ isLabelFieldFocused, setIsLabelFieldFocused ] = useState( false );
|
|
187
|
+
|
|
184
188
|
const {
|
|
185
189
|
innerBlocks,
|
|
186
190
|
isAtMaxNesting,
|
|
@@ -424,6 +428,8 @@ export default function NavigationLinkEdit( {
|
|
|
424
428
|
} }
|
|
425
429
|
label={ __( 'Label' ) }
|
|
426
430
|
autoComplete="off"
|
|
431
|
+
onFocus={ () => setIsLabelFieldFocused( true ) }
|
|
432
|
+
onBlur={ () => setIsLabelFieldFocused( false ) }
|
|
427
433
|
/>
|
|
428
434
|
<TextControl
|
|
429
435
|
__nextHasNoMarginBottom
|
|
@@ -492,52 +498,56 @@ export default function NavigationLinkEdit( {
|
|
|
492
498
|
</div>
|
|
493
499
|
) : (
|
|
494
500
|
<>
|
|
495
|
-
{ ! isInvalid &&
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
501
|
+
{ ! isInvalid &&
|
|
502
|
+
! isDraft &&
|
|
503
|
+
! isLabelFieldFocused && (
|
|
504
|
+
<>
|
|
505
|
+
<RichText
|
|
506
|
+
ref={ ref }
|
|
507
|
+
identifier="label"
|
|
508
|
+
className="wp-block-navigation-item__label"
|
|
509
|
+
value={ label }
|
|
510
|
+
onChange={ ( labelValue ) =>
|
|
511
|
+
setAttributes( {
|
|
512
|
+
label: labelValue,
|
|
513
|
+
} )
|
|
514
|
+
}
|
|
515
|
+
onMerge={ mergeBlocks }
|
|
516
|
+
onReplace={ onReplace }
|
|
517
|
+
__unstableOnSplitAtEnd={ () =>
|
|
518
|
+
insertBlocksAfter(
|
|
519
|
+
createBlock(
|
|
520
|
+
'core/navigation-link'
|
|
521
|
+
)
|
|
513
522
|
)
|
|
514
|
-
)
|
|
515
|
-
}
|
|
516
|
-
aria-label={ __(
|
|
517
|
-
'Navigation link text'
|
|
518
|
-
) }
|
|
519
|
-
placeholder={ itemLabelPlaceholder }
|
|
520
|
-
withoutInteractiveFormatting
|
|
521
|
-
allowedFormats={ [
|
|
522
|
-
'core/bold',
|
|
523
|
-
'core/italic',
|
|
524
|
-
'core/image',
|
|
525
|
-
'core/strikethrough',
|
|
526
|
-
] }
|
|
527
|
-
onClick={ () => {
|
|
528
|
-
if ( ! url ) {
|
|
529
|
-
setIsLinkOpen( true );
|
|
530
523
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
524
|
+
aria-label={ __(
|
|
525
|
+
'Navigation link text'
|
|
526
|
+
) }
|
|
527
|
+
placeholder={ itemLabelPlaceholder }
|
|
528
|
+
withoutInteractiveFormatting
|
|
529
|
+
allowedFormats={ [
|
|
530
|
+
'core/bold',
|
|
531
|
+
'core/italic',
|
|
532
|
+
'core/image',
|
|
533
|
+
'core/strikethrough',
|
|
534
|
+
] }
|
|
535
|
+
onClick={ () => {
|
|
536
|
+
if ( ! url ) {
|
|
537
|
+
setIsLinkOpen( true );
|
|
538
|
+
}
|
|
539
|
+
} }
|
|
540
|
+
/>
|
|
541
|
+
{ description && (
|
|
542
|
+
<span className="wp-block-navigation-item__description">
|
|
543
|
+
{ description }
|
|
544
|
+
</span>
|
|
545
|
+
) }
|
|
546
|
+
</>
|
|
547
|
+
) }
|
|
548
|
+
{ ( isInvalid ||
|
|
549
|
+
isDraft ||
|
|
550
|
+
isLabelFieldFocused ) && (
|
|
541
551
|
<div className="wp-block-navigation-link__placeholder-text wp-block-navigation-link__label">
|
|
542
552
|
<Tooltip
|
|
543
553
|
position="top center"
|
|
@@ -557,7 +567,11 @@ export default function NavigationLinkEdit( {
|
|
|
557
567
|
// See `updateAttributes` for more details.
|
|
558
568
|
`${ decodeEntities(
|
|
559
569
|
label
|
|
560
|
-
) } ${
|
|
570
|
+
) } ${
|
|
571
|
+
isInvalid || isDraft
|
|
572
|
+
? placeholderText
|
|
573
|
+
: ''
|
|
574
|
+
}`.trim()
|
|
561
575
|
}
|
|
562
576
|
</span>
|
|
563
577
|
<span className="wp-block-navigation-link__missing_text-tooltip">
|
|
@@ -97,11 +97,13 @@ function render_block_core_post_template( $attributes, $content, $block ) {
|
|
|
97
97
|
$context['postId'] = $post_id;
|
|
98
98
|
return $context;
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
|
|
101
|
+
// Use an early priority to so that other 'render_block_context' filters have access to the values.
|
|
102
|
+
add_filter( 'render_block_context', $filter_block_context, 1 );
|
|
101
103
|
// Render the inner blocks of the Post Template block with `dynamic` set to `false` to prevent calling
|
|
102
104
|
// `render_callback` and ensure that no wrapper markup is included.
|
|
103
105
|
$block_content = ( new WP_Block( $block_instance ) )->render( array( 'dynamic' => false ) );
|
|
104
|
-
remove_filter( 'render_block_context', $filter_block_context );
|
|
106
|
+
remove_filter( 'render_block_context', $filter_block_context, 1 );
|
|
105
107
|
|
|
106
108
|
// Wrap the render inner blocks in a `li` element with the appropriate post classes.
|
|
107
109
|
$post_classes = implode( ' ', get_post_class( 'wp-block-post' ) );
|
package/src/post-title/index.php
CHANGED
|
@@ -19,8 +19,11 @@ function render_block_core_post_title( $attributes, $content, $block ) {
|
|
|
19
19
|
return '';
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The `$post` argument is intentionally omitted so that changes are reflected when previewing a post.
|
|
24
|
+
* See: https://github.com/WordPress/gutenberg/pull/37622#issuecomment-1000932816.
|
|
25
|
+
*/
|
|
26
|
+
$title = get_the_title();
|
|
24
27
|
|
|
25
28
|
if ( ! $title ) {
|
|
26
29
|
return '';
|
|
@@ -33,7 +36,7 @@ function render_block_core_post_title( $attributes, $content, $block ) {
|
|
|
33
36
|
|
|
34
37
|
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
|
|
35
38
|
$rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
|
|
36
|
-
$title = sprintf( '<a href="%1$s" target="%2$s" %3$s>%4$s</a>', get_the_permalink( $
|
|
39
|
+
$title = sprintf( '<a href="%1$s" target="%2$s" %3$s>%4$s</a>', get_the_permalink( $block->context['postId'] ), esc_attr( $attributes['linkTarget'] ), $rel, $title );
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
$classes = array();
|
|
@@ -22,6 +22,16 @@ exports[`Quote block transforms to Group block 1`] = `
|
|
|
22
22
|
<!-- /wp:group -->"
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
+
exports[`Quote block transforms to Paragraph block 1`] = `
|
|
26
|
+
"<!-- wp:paragraph -->
|
|
27
|
+
<p>"This will make running your own blog a viable alternative again."</p>
|
|
28
|
+
<!-- /wp:paragraph -->
|
|
29
|
+
|
|
30
|
+
<!-- wp:paragraph -->
|
|
31
|
+
<p>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></p>
|
|
32
|
+
<!-- /wp:paragraph -->"
|
|
33
|
+
`;
|
|
34
|
+
|
|
25
35
|
exports[`Quote block transforms to Pullquote block 1`] = `
|
|
26
36
|
"<!-- wp:pullquote -->
|
|
27
37
|
<figure class="wp-block-pullquote"><blockquote><p>"This will make running your own blog a viable alternative again."</p><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote></figure>
|
|
@@ -21,7 +21,11 @@ const initialHtml = `
|
|
|
21
21
|
<!-- /wp:quote -->`;
|
|
22
22
|
|
|
23
23
|
const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
|
|
24
|
-
const blockTransforms = [
|
|
24
|
+
const blockTransforms = [
|
|
25
|
+
'Pullquote',
|
|
26
|
+
'Paragraph',
|
|
27
|
+
...transformsWithInnerBlocks,
|
|
28
|
+
];
|
|
25
29
|
|
|
26
30
|
setupCoreBlocks();
|
|
27
31
|
|
package/src/quote/transforms.js
CHANGED
|
@@ -109,6 +109,19 @@ const transforms = {
|
|
|
109
109
|
} );
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
|
+
{
|
|
113
|
+
type: 'block',
|
|
114
|
+
blocks: [ 'core/paragraph' ],
|
|
115
|
+
transform: ( { citation }, innerBlocks ) =>
|
|
116
|
+
citation
|
|
117
|
+
? [
|
|
118
|
+
...innerBlocks,
|
|
119
|
+
createBlock( 'core/paragraph', {
|
|
120
|
+
content: citation,
|
|
121
|
+
} ),
|
|
122
|
+
]
|
|
123
|
+
: innerBlocks,
|
|
124
|
+
},
|
|
112
125
|
{
|
|
113
126
|
type: 'block',
|
|
114
127
|
blocks: [ 'core/group' ],
|
package/src/site-logo/block.json
CHANGED
package/src/table/block.json
CHANGED
package/src/verse/block.json
CHANGED
package/src/video/block.json
CHANGED