@wordpress/block-library 8.19.12 → 8.19.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.19.12",
3
+ "version": "8.19.14",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,36 +31,36 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.42.12",
35
- "@wordpress/api-fetch": "^6.39.12",
36
- "@wordpress/autop": "^3.42.12",
37
- "@wordpress/blob": "^3.42.12",
38
- "@wordpress/block-editor": "^12.10.12",
39
- "@wordpress/blocks": "^12.19.12",
40
- "@wordpress/components": "^25.8.12",
41
- "@wordpress/compose": "^6.19.12",
42
- "@wordpress/core-data": "^6.19.12",
43
- "@wordpress/data": "^9.12.12",
44
- "@wordpress/date": "^4.42.12",
45
- "@wordpress/deprecated": "^3.42.12",
46
- "@wordpress/dom": "^3.42.12",
47
- "@wordpress/element": "^5.19.12",
48
- "@wordpress/escape-html": "^2.42.12",
49
- "@wordpress/hooks": "^3.42.12",
50
- "@wordpress/html-entities": "^3.42.12",
51
- "@wordpress/i18n": "^4.42.12",
52
- "@wordpress/icons": "^9.33.12",
53
- "@wordpress/interactivity": "^2.3.12",
54
- "@wordpress/keycodes": "^3.42.12",
55
- "@wordpress/notices": "^4.10.12",
56
- "@wordpress/primitives": "^3.40.12",
57
- "@wordpress/private-apis": "^0.24.12",
58
- "@wordpress/reusable-blocks": "^4.19.12",
59
- "@wordpress/rich-text": "^6.19.12",
60
- "@wordpress/server-side-render": "^4.19.12",
61
- "@wordpress/url": "^3.43.12",
62
- "@wordpress/viewport": "^5.19.12",
63
- "@wordpress/wordcount": "^3.42.12",
34
+ "@wordpress/a11y": "^3.42.13",
35
+ "@wordpress/api-fetch": "^6.39.13",
36
+ "@wordpress/autop": "^3.42.13",
37
+ "@wordpress/blob": "^3.42.13",
38
+ "@wordpress/block-editor": "^12.10.13",
39
+ "@wordpress/blocks": "^12.19.13",
40
+ "@wordpress/components": "^25.8.13",
41
+ "@wordpress/compose": "^6.19.13",
42
+ "@wordpress/core-data": "^6.19.13",
43
+ "@wordpress/data": "^9.12.13",
44
+ "@wordpress/date": "^4.42.13",
45
+ "@wordpress/deprecated": "^3.42.13",
46
+ "@wordpress/dom": "^3.42.13",
47
+ "@wordpress/element": "^5.19.13",
48
+ "@wordpress/escape-html": "^2.42.13",
49
+ "@wordpress/hooks": "^3.42.13",
50
+ "@wordpress/html-entities": "^3.42.13",
51
+ "@wordpress/i18n": "^4.42.13",
52
+ "@wordpress/icons": "^9.33.13",
53
+ "@wordpress/interactivity": "^2.3.13",
54
+ "@wordpress/keycodes": "^3.42.13",
55
+ "@wordpress/notices": "^4.10.13",
56
+ "@wordpress/primitives": "^3.40.13",
57
+ "@wordpress/private-apis": "^0.24.13",
58
+ "@wordpress/reusable-blocks": "^4.19.13",
59
+ "@wordpress/rich-text": "^6.19.13",
60
+ "@wordpress/server-side-render": "^4.19.13",
61
+ "@wordpress/url": "^3.43.13",
62
+ "@wordpress/viewport": "^5.19.13",
63
+ "@wordpress/wordcount": "^3.42.13",
64
64
  "change-case": "^4.1.2",
65
65
  "classnames": "^2.3.1",
66
66
  "colord": "^2.7.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "8447c60232efe04eb248a1c893bf3a1fc4e47ecc"
81
+ "gitHead": "4009590d0cb3b4de3e783fd1a76bfd0d290d1a80"
82
82
  }
@@ -1047,6 +1047,14 @@ const v8 = {
1047
1047
  },
1048
1048
  },
1049
1049
  migrate( { width, height, ...attributes } ) {
1050
+ // We need to perform a check here because in cases
1051
+ // where attributes are added dynamically to blocks,
1052
+ // block invalidation overrides the isEligible() method
1053
+ // and forces the migration to run, so it's not guaranteed
1054
+ // that `behaviors` or `behaviors.lightbox` will be defined.
1055
+ if ( ! attributes.behaviors?.lightbox ) {
1056
+ return attributes;
1057
+ }
1050
1058
  const {
1051
1059
  behaviors: {
1052
1060
  lightbox: { enabled },
@@ -83,9 +83,29 @@ const scaleOptions = [
83
83
  },
84
84
  ];
85
85
 
86
- const disabledClickProps = {
87
- onClick: ( event ) => event.preventDefault(),
88
- 'aria-disabled': true,
86
+ // If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles.
87
+ const ImageWrapper = ( { href, children } ) => {
88
+ if ( ! href ) {
89
+ return children;
90
+ }
91
+ return (
92
+ <a
93
+ href={ href }
94
+ onClick={ ( event ) => event.preventDefault() }
95
+ aria-disabled={ true }
96
+ style={ {
97
+ // When the Image block is linked,
98
+ // it's wrapped with a disabled <a /> tag.
99
+ // Restore cursor style so it doesn't appear 'clickable'
100
+ // and remove pointer events. Safari needs the display property.
101
+ pointerEvents: 'none',
102
+ cursor: 'default',
103
+ display: 'inline',
104
+ } }
105
+ >
106
+ { children }
107
+ </a>
108
+ );
89
109
  };
90
110
 
91
111
  export default function Image( {
@@ -653,25 +673,31 @@ export default function Image( {
653
673
 
654
674
  if ( canEditImage && isEditingImage ) {
655
675
  img = (
656
- <ImageEditor
657
- id={ id }
658
- url={ url }
659
- width={ numericWidth }
660
- height={ numericHeight }
661
- clientWidth={ fallbackClientWidth }
662
- naturalHeight={ naturalHeight }
663
- naturalWidth={ naturalWidth }
664
- onSaveImage={ ( imageAttributes ) =>
665
- setAttributes( imageAttributes )
666
- }
667
- onFinishEditing={ () => {
668
- setIsEditingImage( false );
669
- } }
670
- borderProps={ isRounded ? undefined : borderProps }
671
- />
676
+ <ImageWrapper href={ href }>
677
+ <ImageEditor
678
+ id={ id }
679
+ url={ url }
680
+ width={ numericWidth }
681
+ height={ numericHeight }
682
+ clientWidth={ fallbackClientWidth }
683
+ naturalHeight={ naturalHeight }
684
+ naturalWidth={ naturalWidth }
685
+ onSaveImage={ ( imageAttributes ) =>
686
+ setAttributes( imageAttributes )
687
+ }
688
+ onFinishEditing={ () => {
689
+ setIsEditingImage( false );
690
+ } }
691
+ borderProps={ isRounded ? undefined : borderProps }
692
+ />
693
+ </ImageWrapper>
672
694
  );
673
695
  } else if ( ! isResizable ) {
674
- img = <div style={ { width, height, aspectRatio } }>{ img }</div>;
696
+ img = (
697
+ <div style={ { width, height, aspectRatio } }>
698
+ <ImageWrapper href={ href }>{ img }</ImageWrapper>
699
+ </div>
700
+ );
675
701
  } else {
676
702
  const numericRatio = aspectRatio && evalAspectRatio( aspectRatio );
677
703
  const customRatio = numericWidth / numericHeight;
@@ -774,7 +800,7 @@ export default function Image( {
774
800
  } }
775
801
  resizeRatio={ align === 'center' ? 2 : 1 }
776
802
  >
777
- { img }
803
+ <ImageWrapper href={ href }>{ img }</ImageWrapper>
778
804
  </ResizableBox>
779
805
  );
780
806
  }
@@ -788,14 +814,7 @@ export default function Image( {
788
814
  { /* Hide controls during upload to avoid component remount,
789
815
  which causes duplicated image upload. */ }
790
816
  { ! temporaryURL && controls }
791
- { /* If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles */ }
792
- { !! href ? (
793
- <a href={ href } { ...disabledClickProps }>
794
- { img }
795
- </a>
796
- ) : (
797
- img
798
- ) }
817
+ { img }
799
818
  { showCaption &&
800
819
  ( ! RichText.isEmpty( caption ) || isSelected ) && (
801
820
  <RichText
@@ -44,11 +44,15 @@ function render_block_core_query( $attributes, $content, $block ) {
44
44
  $block->block_type->supports['interactivity'] = true;
45
45
 
46
46
  // Add a div to announce messages using `aria-live`.
47
- $last_div_position = strripos( $content, '</div>' );
47
+ $html_tag = 'div';
48
+ if ( ! empty( $attributes['tagName'] ) ) {
49
+ $html_tag = esc_attr( $attributes['tagName'] );
50
+ }
51
+ $last_tag_position = strripos( $content, '</' . $html_tag . '>' );
48
52
  $content = substr_replace(
49
53
  $content,
50
54
  '<div
51
- class="wp-block-query__enhanced-pagination-navigation-announce screen-reader-text"
55
+ class="screen-reader-text"
52
56
  aria-live="polite"
53
57
  data-wp-text="context.core.query.message"
54
58
  ></div>
@@ -57,7 +61,7 @@ function render_block_core_query( $attributes, $content, $block ) {
57
61
  data-wp-class--start-animation="selectors.core.query.startAnimation"
58
62
  data-wp-class--finish-animation="selectors.core.query.finishAnimation"
59
63
  ></div>',
60
- $last_div_position,
64
+ $last_tag_position,
61
65
  0
62
66
  );
63
67
  }