@wordpress/block-library 9.29.1-next.e256d081a.0 → 9.30.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/accordion/edit.js +18 -1
  3. package/build/accordion/edit.js.map +1 -1
  4. package/build/accordion/index.js +0 -3
  5. package/build/accordion/index.js.map +1 -1
  6. package/build/accordion-content/index.js +0 -4
  7. package/build/accordion-content/index.js.map +1 -1
  8. package/build/accordion-header/index.js +0 -4
  9. package/build/accordion-header/index.js.map +1 -1
  10. package/build/accordion-panel/edit.js +5 -30
  11. package/build/accordion-panel/edit.js.map +1 -1
  12. package/build/accordion-panel/index.js +0 -4
  13. package/build/accordion-panel/index.js.map +1 -1
  14. package/build/accordion-panel/save.js +3 -29
  15. package/build/accordion-panel/save.js.map +1 -1
  16. package/build/gallery/index.js +2 -1
  17. package/build/gallery/index.js.map +1 -1
  18. package/build/group/variations.js +0 -12
  19. package/build/group/variations.js.map +1 -1
  20. package/build/navigation-link/link-ui.js +5 -1
  21. package/build/navigation-link/link-ui.js.map +1 -1
  22. package/build-module/accordion/edit.js +20 -3
  23. package/build-module/accordion/edit.js.map +1 -1
  24. package/build-module/accordion/index.js +0 -3
  25. package/build-module/accordion/index.js.map +1 -1
  26. package/build-module/accordion-content/index.js +0 -4
  27. package/build-module/accordion-content/index.js.map +1 -1
  28. package/build-module/accordion-header/index.js +0 -4
  29. package/build-module/accordion-header/index.js.map +1 -1
  30. package/build-module/accordion-panel/edit.js +6 -29
  31. package/build-module/accordion-panel/edit.js.map +1 -1
  32. package/build-module/accordion-panel/index.js +0 -4
  33. package/build-module/accordion-panel/index.js.map +1 -1
  34. package/build-module/accordion-panel/save.js +4 -28
  35. package/build-module/accordion-panel/save.js.map +1 -1
  36. package/build-module/gallery/index.js +2 -1
  37. package/build-module/gallery/index.js.map +1 -1
  38. package/build-module/group/variations.js +0 -12
  39. package/build-module/group/variations.js.map +1 -1
  40. package/build-module/navigation-link/link-ui.js +6 -2
  41. package/build-module/navigation-link/link-ui.js.map +1 -1
  42. package/build-style/accordion/style-rtl.css +4 -13
  43. package/build-style/accordion/style.css +4 -13
  44. package/build-style/style-rtl.css +4 -14
  45. package/build-style/style.css +4 -14
  46. package/package.json +35 -35
  47. package/src/accordion/block.json +0 -3
  48. package/src/accordion/edit.js +20 -0
  49. package/src/accordion/style.scss +7 -16
  50. package/src/accordion-content/block.json +0 -3
  51. package/src/accordion-content/index.js +0 -1
  52. package/src/accordion-header/block.json +0 -3
  53. package/src/accordion-header/index.js +0 -1
  54. package/src/accordion-panel/block.json +0 -3
  55. package/src/accordion-panel/edit.js +11 -51
  56. package/src/accordion-panel/index.js +0 -1
  57. package/src/accordion-panel/save.js +4 -45
  58. package/src/gallery/block.json +2 -1
  59. package/src/gallery/index.php +1 -1
  60. package/src/gallery/test/helpers.native.js +3 -3
  61. package/src/group/variations.js +0 -12
  62. package/src/navigation-link/link-ui.js +7 -1
  63. package/src/post-date/index.php +2 -1
@@ -1,51 +1,10 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- InnerBlocks,
6
- useBlockProps,
7
- __experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
8
- __experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
9
- __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
10
- __experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
11
- } from '@wordpress/block-editor';
12
- /**
13
- * External dependencies
14
- */
15
- import clsx from 'clsx';
4
+ import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
16
5
 
17
- export default function save( { attributes } ) {
6
+ export default function save() {
18
7
  const blockProps = useBlockProps.save();
19
- const borderProps = getBorderClassesAndStyles( attributes );
20
- const colorProps = getColorClassesAndStyles( attributes );
21
- const spacingProps = getSpacingClassesAndStyles( attributes );
22
- const shadowProps = getShadowClassesAndStyles( attributes );
23
-
24
- return (
25
- <div
26
- { ...blockProps }
27
- className={ clsx(
28
- blockProps.className,
29
- colorProps.className,
30
- borderProps.className,
31
- {
32
- [ `has-custom-font-size` ]: blockProps?.style?.fontSize,
33
- }
34
- ) }
35
- style={ {
36
- ...borderProps.style,
37
- ...colorProps.style,
38
- ...shadowProps.style,
39
- } }
40
- >
41
- <div
42
- className="accordion-content__wrapper"
43
- style={ {
44
- ...spacingProps.style,
45
- } }
46
- >
47
- <InnerBlocks.Content />
48
- </div>
49
- </div>
50
- );
8
+ const innerBlocksProps = useInnerBlocksProps.save( blockProps );
9
+ return <div { ...innerBlocksProps } />;
51
10
  }
@@ -75,7 +75,8 @@
75
75
  "caption": {
76
76
  "type": "rich-text",
77
77
  "source": "rich-text",
78
- "selector": ".blocks-gallery-caption"
78
+ "selector": ".blocks-gallery-caption",
79
+ "role": "content"
79
80
  },
80
81
  "imageCrop": {
81
82
  "type": "boolean",
@@ -142,7 +142,7 @@ function block_core_gallery_render( $attributes, $content ) {
142
142
 
143
143
  // This pattern matches figure elements with the `wp-block-image` class to
144
144
  // avoid the gallery's wrapping `figure` element and extract images only.
145
- $pattern = '/<figure[^>]*\bwp-block-image\b[^>]*>.*?<\/figure>/';
145
+ $pattern = '/<figure[^>]*\bwp-block-image\b[^>]*>.*?<\/figure>/s';
146
146
 
147
147
  // Find all Image blocks.
148
148
  preg_match_all( $pattern, $updated_content, $matches );
@@ -65,9 +65,9 @@ export const initializeWithGalleryBlock = async ( {
65
65
  /**
66
66
  * Gets a gallery item within a Gallery block.
67
67
  *
68
- * @param {import('react-test-renderer').ReactTestInstance} galleryBlock Gallery block instance.
69
- * @param {number} rowIndex Row position within the Gallery block.
70
- * @return {import('react-test-renderer').ReactTestInstance} Gallery item.
68
+ * @param {ReturnType<import('@testing-library/react-native').RenderAPI['getByTestId']>} galleryBlock Gallery block instance.
69
+ * @param {number} rowIndex Row position within the Gallery block.
70
+ * @return {ReturnType<import('@testing-library/react-native').RenderAPI['getByTestId']>} Gallery item.
71
71
  */
72
72
  export const getGalleryItem = ( galleryBlock, rowIndex ) =>
73
73
  getInnerBlock( galleryBlock, 'Image', { rowIndex } );
@@ -9,48 +9,36 @@ const example = {
9
9
  {
10
10
  name: 'core/paragraph',
11
11
  attributes: {
12
- customTextColor: '#cf2e2e',
13
- fontSize: 'large',
14
12
  content: __( 'One.' ),
15
13
  },
16
14
  },
17
15
  {
18
16
  name: 'core/paragraph',
19
17
  attributes: {
20
- customTextColor: '#ff6900',
21
- fontSize: 'large',
22
18
  content: __( 'Two.' ),
23
19
  },
24
20
  },
25
21
  {
26
22
  name: 'core/paragraph',
27
23
  attributes: {
28
- customTextColor: '#fcb900',
29
- fontSize: 'large',
30
24
  content: __( 'Three.' ),
31
25
  },
32
26
  },
33
27
  {
34
28
  name: 'core/paragraph',
35
29
  attributes: {
36
- customTextColor: '#00d084',
37
- fontSize: 'large',
38
30
  content: __( 'Four.' ),
39
31
  },
40
32
  },
41
33
  {
42
34
  name: 'core/paragraph',
43
35
  attributes: {
44
- customTextColor: '#0693e3',
45
- fontSize: 'large',
46
36
  content: __( 'Five.' ),
47
37
  },
48
38
  },
49
39
  {
50
40
  name: 'core/paragraph',
51
41
  attributes: {
52
- customTextColor: '#9b51e0',
53
- fontSize: 'large',
54
42
  content: __( 'Six.' ),
55
43
  },
56
44
  },
@@ -13,6 +13,7 @@ import {
13
13
  LinkControl,
14
14
  store as blockEditorStore,
15
15
  privateApis as blockEditorPrivateApis,
16
+ useBlockEditingMode,
16
17
  } from '@wordpress/block-editor';
17
18
  import {
18
19
  createInterpolateElement,
@@ -157,6 +158,10 @@ function UnforwardedLinkUI( props, ref ) {
157
158
  name: postType,
158
159
  } );
159
160
 
161
+ // Check if we're in contentOnly mode
162
+ const blockEditingMode = useBlockEditingMode();
163
+ const isDefaultBlockEditingMode = blockEditingMode === 'default';
164
+
160
165
  async function handleCreate( pageTitle ) {
161
166
  const page = await saveEntityRecord( 'postType', postType, {
162
167
  title: pageTitle,
@@ -261,7 +266,8 @@ function UnforwardedLinkUI( props, ref ) {
261
266
  onRemove={ props.onRemove }
262
267
  onCancel={ props.onCancel }
263
268
  renderControlBottom={ () =>
264
- ! link?.url?.length && (
269
+ ! link?.url?.length &&
270
+ isDefaultBlockEditingMode && (
265
271
  <LinkUITools
266
272
  focusAddBlockButton={ focusAddBlockButton }
267
273
  setAddingBlock={ () => {
@@ -76,7 +76,8 @@ function render_block_core_post_date( $attributes, $content, $block ) {
76
76
  $formatted_date = sprintf( __( '%s ago' ), human_time_diff( $post_timestamp ) );
77
77
  }
78
78
  } else {
79
- $formatted_date = gmdate( empty( $attributes['format'] ) ? get_option( 'date_format' ) : $attributes['format'], $post_timestamp );
79
+ $format = empty( $attributes['format'] ) ? get_option( 'date_format' ) : $attributes['format'];
80
+ $formatted_date = wp_date( $format, $post_timestamp );
80
81
  }
81
82
 
82
83
  if ( isset( $attributes['textAlign'] ) ) {