@wordpress/block-library 9.40.1 → 9.40.2-next.v.202602241322.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 (138) hide show
  1. package/build/icon/block.json +9 -1
  2. package/build/icon/components/custom-inserter/icon-grid.cjs +1 -1
  3. package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
  4. package/build/icon/components/custom-inserter/index.cjs +1 -1
  5. package/build/icon/components/custom-inserter/index.cjs.map +2 -2
  6. package/build/icon/edit.cjs +15 -7
  7. package/build/icon/edit.cjs.map +2 -2
  8. package/build/image/edit.cjs +1 -1
  9. package/build/image/edit.cjs.map +2 -2
  10. package/build/navigation-overlay-close/edit.cjs +2 -3
  11. package/build/navigation-overlay-close/edit.cjs.map +2 -2
  12. package/build/post-navigation-link/block.json +1 -3
  13. package/build/post-navigation-link/deprecated.cjs +100 -0
  14. package/build/post-navigation-link/deprecated.cjs.map +7 -0
  15. package/build/post-navigation-link/edit.cjs +2 -36
  16. package/build/post-navigation-link/edit.cjs.map +3 -3
  17. package/build/post-navigation-link/index.cjs +2 -0
  18. package/build/post-navigation-link/index.cjs.map +3 -3
  19. package/build/post-title/block.json +1 -3
  20. package/build/post-title/deprecated.cjs +82 -1
  21. package/build/post-title/deprecated.cjs.map +3 -3
  22. package/build/post-title/edit.cjs +10 -36
  23. package/build/post-title/edit.cjs.map +3 -3
  24. package/build/pullquote/deprecated.cjs +6 -6
  25. package/build/pullquote/deprecated.cjs.map +2 -2
  26. package/build/query/block.json +1 -2
  27. package/build/query-title/block.json +1 -3
  28. package/build/query-title/deprecated.cjs +70 -1
  29. package/build/query-title/deprecated.cjs.map +3 -3
  30. package/build/query-title/edit.cjs +17 -35
  31. package/build/query-title/edit.cjs.map +3 -3
  32. package/build/site-tagline/block.json +6 -4
  33. package/build/site-tagline/deprecated.cjs +66 -1
  34. package/build/site-tagline/deprecated.cjs.map +3 -3
  35. package/build/site-tagline/edit.cjs +14 -28
  36. package/build/site-tagline/edit.cjs.map +3 -3
  37. package/build/site-title/block.json +1 -3
  38. package/build/site-title/deprecated.cjs +79 -1
  39. package/build/site-title/deprecated.cjs.map +3 -3
  40. package/build/site-title/edit.cjs +14 -30
  41. package/build/site-title/edit.cjs.map +3 -3
  42. package/build/tabs-menu-item/block.json +1 -26
  43. package/build/tabs-menu-item/controls.cjs +2 -100
  44. package/build/tabs-menu-item/controls.cjs.map +3 -3
  45. package/build/tabs-menu-item/edit.cjs +6 -65
  46. package/build/tabs-menu-item/edit.cjs.map +2 -2
  47. package/build/tabs-menu-item/save.cjs +1 -15
  48. package/build/tabs-menu-item/save.cjs.map +2 -2
  49. package/build-module/icon/block.json +9 -1
  50. package/build-module/icon/components/custom-inserter/icon-grid.mjs +1 -1
  51. package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
  52. package/build-module/icon/components/custom-inserter/index.mjs +1 -1
  53. package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
  54. package/build-module/icon/edit.mjs +15 -7
  55. package/build-module/icon/edit.mjs.map +2 -2
  56. package/build-module/image/edit.mjs +1 -1
  57. package/build-module/image/edit.mjs.map +2 -2
  58. package/build-module/navigation-overlay-close/edit.mjs +2 -3
  59. package/build-module/navigation-overlay-close/edit.mjs.map +2 -2
  60. package/build-module/post-navigation-link/block.json +1 -3
  61. package/build-module/post-navigation-link/deprecated.mjs +69 -0
  62. package/build-module/post-navigation-link/deprecated.mjs.map +7 -0
  63. package/build-module/post-navigation-link/edit.mjs +3 -30
  64. package/build-module/post-navigation-link/edit.mjs.map +2 -2
  65. package/build-module/post-navigation-link/index.mjs +2 -0
  66. package/build-module/post-navigation-link/index.mjs.map +2 -2
  67. package/build-module/post-title/block.json +1 -3
  68. package/build-module/post-title/deprecated.mjs +82 -1
  69. package/build-module/post-title/deprecated.mjs.map +2 -2
  70. package/build-module/post-title/edit.mjs +10 -27
  71. package/build-module/post-title/edit.mjs.map +2 -2
  72. package/build-module/pullquote/deprecated.mjs +6 -6
  73. package/build-module/pullquote/deprecated.mjs.map +2 -2
  74. package/build-module/query/block.json +1 -2
  75. package/build-module/query-title/block.json +1 -3
  76. package/build-module/query-title/deprecated.mjs +70 -1
  77. package/build-module/query-title/deprecated.mjs.map +2 -2
  78. package/build-module/query-title/edit.mjs +17 -36
  79. package/build-module/query-title/edit.mjs.map +2 -2
  80. package/build-module/site-tagline/block.json +6 -4
  81. package/build-module/site-tagline/deprecated.mjs +66 -1
  82. package/build-module/site-tagline/deprecated.mjs.map +2 -2
  83. package/build-module/site-tagline/edit.mjs +14 -29
  84. package/build-module/site-tagline/edit.mjs.map +2 -2
  85. package/build-module/site-title/block.json +1 -3
  86. package/build-module/site-title/deprecated.mjs +79 -1
  87. package/build-module/site-title/deprecated.mjs.map +2 -2
  88. package/build-module/site-title/edit.mjs +14 -31
  89. package/build-module/site-title/edit.mjs.map +2 -2
  90. package/build-module/tabs-menu-item/block.json +1 -26
  91. package/build-module/tabs-menu-item/controls.mjs +3 -104
  92. package/build-module/tabs-menu-item/controls.mjs.map +2 -2
  93. package/build-module/tabs-menu-item/edit.mjs +6 -66
  94. package/build-module/tabs-menu-item/edit.mjs.map +2 -2
  95. package/build-module/tabs-menu-item/save.mjs +1 -15
  96. package/build-module/tabs-menu-item/save.mjs.map +2 -2
  97. package/build-style/editor-rtl.css +0 -5
  98. package/build-style/editor.css +0 -5
  99. package/build-style/style-rtl.css +3 -12
  100. package/build-style/style.css +3 -12
  101. package/build-style/tabs-menu-item/editor-rtl.css +0 -5
  102. package/build-style/tabs-menu-item/editor.css +0 -5
  103. package/build-style/tabs-menu-item/style-rtl.css +3 -12
  104. package/build-style/tabs-menu-item/style.css +3 -12
  105. package/package.json +38 -38
  106. package/src/icon/block.json +9 -1
  107. package/src/icon/components/custom-inserter/icon-grid.js +1 -1
  108. package/src/icon/components/custom-inserter/index.js +1 -1
  109. package/src/icon/edit.js +20 -10
  110. package/src/icon/index.php +1 -3
  111. package/src/image/edit.js +1 -1
  112. package/src/image/index.php +1 -4
  113. package/src/navigation-overlay-close/edit.js +4 -3
  114. package/src/post-featured-image/index.php +2 -4
  115. package/src/post-navigation-link/block.json +1 -3
  116. package/src/post-navigation-link/deprecated.js +72 -0
  117. package/src/post-navigation-link/edit.js +2 -35
  118. package/src/post-navigation-link/index.js +2 -0
  119. package/src/post-title/block.json +1 -3
  120. package/src/post-title/deprecated.js +86 -1
  121. package/src/post-title/edit.js +2 -18
  122. package/src/pullquote/deprecated.js +3 -3
  123. package/src/query/block.json +1 -2
  124. package/src/query-title/block.json +1 -3
  125. package/src/query-title/deprecated.js +74 -1
  126. package/src/query-title/edit.js +11 -27
  127. package/src/site-tagline/block.json +6 -4
  128. package/src/site-tagline/deprecated.js +70 -1
  129. package/src/site-tagline/edit.js +9 -22
  130. package/src/site-title/block.json +1 -3
  131. package/src/site-title/deprecated.js +83 -1
  132. package/src/site-title/edit.js +9 -22
  133. package/src/tabs-menu-item/block.json +1 -26
  134. package/src/tabs-menu-item/controls.js +0 -108
  135. package/src/tabs-menu-item/edit.js +6 -79
  136. package/src/tabs-menu-item/editor.scss +0 -6
  137. package/src/tabs-menu-item/save.js +1 -26
  138. package/src/tabs-menu-item/style.scss +3 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.40.1",
3
+ "version": "9.40.2-next.v.202602241322.0+bce7cff88",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -94,42 +94,42 @@
94
94
  "build-module/*/init.mjs"
95
95
  ],
96
96
  "dependencies": {
97
- "@wordpress/a11y": "^4.40.0",
98
- "@wordpress/api-fetch": "^7.40.0",
99
- "@wordpress/autop": "^4.40.0",
100
- "@wordpress/base-styles": "^6.16.0",
101
- "@wordpress/blob": "^4.40.0",
102
- "@wordpress/block-editor": "^15.13.1",
103
- "@wordpress/blocks": "^15.13.0",
104
- "@wordpress/components": "^32.2.0",
105
- "@wordpress/compose": "^7.40.0",
106
- "@wordpress/core-data": "^7.40.1",
107
- "@wordpress/data": "^10.40.0",
108
- "@wordpress/date": "^5.40.0",
109
- "@wordpress/deprecated": "^4.40.0",
110
- "@wordpress/dom": "^4.40.0",
111
- "@wordpress/element": "^6.40.0",
112
- "@wordpress/escape-html": "^3.40.0",
113
- "@wordpress/hooks": "^4.40.0",
114
- "@wordpress/html-entities": "^4.40.0",
115
- "@wordpress/i18n": "^6.13.0",
116
- "@wordpress/icons": "^11.7.0",
117
- "@wordpress/interactivity": "^6.40.0",
118
- "@wordpress/interactivity-router": "^2.40.0",
119
- "@wordpress/keyboard-shortcuts": "^5.40.0",
120
- "@wordpress/keycodes": "^4.40.0",
121
- "@wordpress/latex-to-mathml": "^1.8.0",
122
- "@wordpress/notices": "^5.40.0",
123
- "@wordpress/patterns": "^2.40.1",
124
- "@wordpress/primitives": "^4.40.0",
125
- "@wordpress/private-apis": "^1.40.0",
126
- "@wordpress/reusable-blocks": "^5.40.1",
127
- "@wordpress/rich-text": "^7.40.0",
128
- "@wordpress/server-side-render": "^6.16.0",
129
- "@wordpress/upload-media": "^0.25.1",
130
- "@wordpress/url": "^4.40.0",
131
- "@wordpress/viewport": "^6.40.0",
132
- "@wordpress/wordcount": "^4.40.0",
97
+ "@wordpress/a11y": "^4.40.1-next.v.202602241322.0+bce7cff88",
98
+ "@wordpress/api-fetch": "^7.40.1-next.v.202602241322.0+bce7cff88",
99
+ "@wordpress/autop": "^4.40.1-next.v.202602241322.0+bce7cff88",
100
+ "@wordpress/base-styles": "^6.16.1-next.v.202602241322.0+bce7cff88",
101
+ "@wordpress/blob": "^4.40.1-next.v.202602241322.0+bce7cff88",
102
+ "@wordpress/block-editor": "^15.13.2-next.v.202602241322.0+bce7cff88",
103
+ "@wordpress/blocks": "^15.13.1-next.v.202602241322.0+bce7cff88",
104
+ "@wordpress/components": "^32.3.1-next.v.202602241322.0+bce7cff88",
105
+ "@wordpress/compose": "^7.40.1-next.v.202602241322.0+bce7cff88",
106
+ "@wordpress/core-data": "^7.40.2-next.v.202602241322.0+bce7cff88",
107
+ "@wordpress/data": "^10.40.1-next.v.202602241322.0+bce7cff88",
108
+ "@wordpress/date": "^5.40.1-next.v.202602241322.0+bce7cff88",
109
+ "@wordpress/deprecated": "^4.40.1-next.v.202602241322.0+bce7cff88",
110
+ "@wordpress/dom": "^4.40.1-next.v.202602241322.0+bce7cff88",
111
+ "@wordpress/element": "^6.40.1-next.v.202602241322.0+bce7cff88",
112
+ "@wordpress/escape-html": "^3.40.1-next.v.202602241322.0+bce7cff88",
113
+ "@wordpress/hooks": "^4.40.1-next.v.202602241322.0+bce7cff88",
114
+ "@wordpress/html-entities": "^4.40.1-next.v.202602241322.0+bce7cff88",
115
+ "@wordpress/i18n": "^6.13.1-next.v.202602241322.0+bce7cff88",
116
+ "@wordpress/icons": "^11.7.1-next.v.202602241322.0+bce7cff88",
117
+ "@wordpress/interactivity": "^6.40.1-next.v.202602241322.0+bce7cff88",
118
+ "@wordpress/interactivity-router": "^2.40.1-next.v.202602241322.0+bce7cff88",
119
+ "@wordpress/keyboard-shortcuts": "^5.40.1-next.v.202602241322.0+bce7cff88",
120
+ "@wordpress/keycodes": "^4.40.1-next.v.202602241322.0+bce7cff88",
121
+ "@wordpress/latex-to-mathml": "^1.8.1-next.v.202602241322.0+bce7cff88",
122
+ "@wordpress/notices": "^5.40.1-next.v.202602241322.0+bce7cff88",
123
+ "@wordpress/patterns": "^2.40.2-next.v.202602241322.0+bce7cff88",
124
+ "@wordpress/primitives": "^4.40.1-next.v.202602241322.0+bce7cff88",
125
+ "@wordpress/private-apis": "^1.40.1-next.v.202602241322.0+bce7cff88",
126
+ "@wordpress/reusable-blocks": "^5.40.2-next.v.202602241322.0+bce7cff88",
127
+ "@wordpress/rich-text": "^7.40.1-next.v.202602241322.0+bce7cff88",
128
+ "@wordpress/server-side-render": "^6.16.1-next.v.202602241322.0+bce7cff88",
129
+ "@wordpress/upload-media": "^0.25.2-next.v.202602241322.0+bce7cff88",
130
+ "@wordpress/url": "^4.40.1-next.v.202602241322.0+bce7cff88",
131
+ "@wordpress/viewport": "^6.40.1-next.v.202602241322.0+bce7cff88",
132
+ "@wordpress/wordcount": "^4.40.1-next.v.202602241322.0+bce7cff88",
133
133
  "change-case": "^4.1.2",
134
134
  "clsx": "^2.1.1",
135
135
  "colord": "^2.7.0",
@@ -150,5 +150,5 @@
150
150
  "publishConfig": {
151
151
  "access": "public"
152
152
  },
153
- "gitHead": "398c509dbbdcdb525d17e968edd83da33a0a7bde"
153
+ "gitHead": "943dde7f0b600ce238726c36284bc9f70ce0ffa4"
154
154
  }
@@ -3,7 +3,6 @@
3
3
  "$schema": "https://schemas.wp.org/trunk/block.json",
4
4
  "name": "core/icon",
5
5
  "title": "Icon",
6
- "__experimental": true,
7
6
  "category": "media",
8
7
  "description": "Insert an SVG icon.",
9
8
  "keywords": [ "icon", "svg" ],
@@ -61,6 +60,15 @@
61
60
  },
62
61
  "selectors": {
63
62
  "root": ".wp-block-icon",
63
+ "color": {
64
+ "root": ".wp-block-icon svg"
65
+ },
66
+ "border": {
67
+ "root": ".wp-block-icon svg"
68
+ },
69
+ "spacing": {
70
+ "padding": ".wp-block-icon svg"
71
+ },
64
72
  "dimensions": {
65
73
  "root": ".wp-block-icon svg",
66
74
  "width": ".wp-block-icon svg"
@@ -12,7 +12,7 @@ import HtmlRenderer from '../../../utils/html-renderer';
12
12
  export default function IconGrid( { icons, onChange, attributes } ) {
13
13
  return (
14
14
  <div className="wp-block-icon__inserter-grid">
15
- { icons.length === 0 ? (
15
+ { ! icons?.length ? (
16
16
  <div className="wp-block-icon__inserter-grid-no-results">
17
17
  <p>{ __( 'No results found.' ) }</p>
18
18
  </div>
@@ -13,7 +13,7 @@ import IconGrid from './icon-grid';
13
13
  import { normalizeSearchInput } from '../../../utils/search-patterns';
14
14
 
15
15
  export default function CustomInserterModal( {
16
- icons,
16
+ icons = [],
17
17
  setInserterOpen,
18
18
  attributes,
19
19
  setAttributes,
package/src/icon/edit.js CHANGED
@@ -25,10 +25,10 @@ import {
25
25
  __experimentalGetSpacingClassesAndStyles as useSpacingProps,
26
26
  getDimensionsClassesAndStyles as useDimensionsProps,
27
27
  } from '@wordpress/block-editor';
28
- import { useSelect } from '@wordpress/data';
29
- import { store as coreDataStore } from '@wordpress/core-data';
30
28
  import { useState } from '@wordpress/element';
31
29
  import { SVG, Rect, Path } from '@wordpress/primitives';
30
+ import { useSelect } from '@wordpress/data';
31
+ import { store as coreDataStore } from '@wordpress/core-data';
32
32
 
33
33
  /**
34
34
  * Internal dependencies
@@ -36,7 +36,6 @@ import { SVG, Rect, Path } from '@wordpress/primitives';
36
36
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
37
37
  import HtmlRenderer from '../utils/html-renderer';
38
38
  import { CustomInserterModal } from './components';
39
- import { unlock } from '../lock-unlock';
40
39
 
41
40
  const IconPlaceholder = ( { className, style } ) => (
42
41
  <SVG
@@ -70,14 +69,25 @@ export function Edit( { attributes, setAttributes } ) {
70
69
  const borderProps = useBorderProps( attributes );
71
70
  const dimensionsProps = useDimensionsProps( attributes );
72
71
 
73
- const allIcons = useSelect( ( select ) => {
74
- return unlock( select( coreDataStore ) ).getIcons();
75
- }, [] );
72
+ const { selectedIcon, allIcons = [] } = useSelect(
73
+ ( select ) => {
74
+ const { getEntityRecord, getEntityRecords } =
75
+ select( coreDataStore );
76
+ return {
77
+ selectedIcon: icon
78
+ ? getEntityRecord( 'root', 'icon', icon )
79
+ : null,
80
+ allIcons: isInserterOpen
81
+ ? getEntityRecords( 'root', 'icon', {
82
+ per_page: -1,
83
+ } )
84
+ : undefined,
85
+ };
86
+ },
87
+ [ isInserterOpen, icon ]
88
+ );
76
89
 
77
- const iconToDisplay =
78
- allIcons?.length > 0
79
- ? allIcons?.find( ( { name } ) => name === icon )?.content
80
- : '';
90
+ const iconToDisplay = selectedIcon?.content || '';
81
91
 
82
92
  const blockControls = (
83
93
  <>
@@ -10,9 +10,7 @@
10
10
  *
11
11
  * @since 7.0.0
12
12
  *
13
- * @param array $attributes The block attributes.
14
- * @param string $content The block content.
15
- * @param WP_Block $block The block instance.
13
+ * @param array $attributes The block attributes.
16
14
  *
17
15
  * @return string Returns the Icon.
18
16
  */
package/src/image/edit.js CHANGED
@@ -348,7 +348,7 @@ export function ImageEdit( {
348
348
 
349
349
  const isSideloading = useSelect(
350
350
  ( select ) => {
351
- if ( ! window.__experimentalMediaProcessing || ! id ) {
351
+ if ( ! window.__clientSideMediaProcessing || ! id ) {
352
352
  return false;
353
353
  }
354
354
  return select( uploadStore ).isUploadingById( id );
@@ -310,10 +310,7 @@ function block_core_image_render_lightbox( $block_content, $block, $block_instan
310
310
 
311
311
  $body_content = preg_replace( '/<img[^>]+>/', $button, $body_content );
312
312
 
313
- $overlay_callback = function () {
314
- block_core_image_print_lightbox_overlay();
315
- };
316
- add_action( 'wp_footer', $overlay_callback );
313
+ add_action( 'wp_footer', 'block_core_image_print_lightbox_overlay' );
317
314
 
318
315
  return $body_content;
319
316
  }
@@ -28,6 +28,9 @@ export default function NavigationOverlayCloseEdit( {
28
28
  const showIcon = displayMode === 'icon' || displayMode === 'both';
29
29
  const showText = displayMode === 'text' || displayMode === 'both';
30
30
 
31
+ // Use translated default if text is empty
32
+ const displayText = text || __( 'Close' );
33
+
31
34
  const blockProps = useBlockProps( {
32
35
  className: 'wp-block-navigation-overlay-close',
33
36
  } );
@@ -84,12 +87,10 @@ export default function NavigationOverlayCloseEdit( {
84
87
  { showText && (
85
88
  <RichText
86
89
  identifier="text"
87
- value={ text }
90
+ value={ displayText }
88
91
  onChange={ ( value ) =>
89
92
  setAttributes( { text: value } )
90
93
  }
91
- placeholder={ __( 'Close' ) }
92
- withoutInteractiveFormatting
93
94
  tagName="span"
94
95
  className="wp-block-navigation-overlay-close__text"
95
96
  allowedFormats={ [ 'core/bold', 'core/italic' ] }
@@ -166,10 +166,8 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
166
166
  }
167
167
 
168
168
  // Apply overlay and gradient classes.
169
- if ( $has_dim_background ) {
170
- $class_names[] = 'has-background-dim';
171
- $class_names[] = "has-background-dim-{$attributes['dimRatio']}";
172
- }
169
+ $class_names[] = 'has-background-dim';
170
+ $class_names[] = "has-background-dim-{$attributes['dimRatio']}";
173
171
 
174
172
  if ( $has_solid_overlay ) {
175
173
  $class_names[] = "has-{$attributes['overlayColor']}-background-color";
@@ -7,9 +7,6 @@
7
7
  "description": "Displays the next or previous post link that is adjacent to the current post.",
8
8
  "textdomain": "default",
9
9
  "attributes": {
10
- "textAlign": {
11
- "type": "string"
12
- },
13
10
  "type": {
14
11
  "type": "string",
15
12
  "default": "next"
@@ -46,6 +43,7 @@
46
43
  "typography": {
47
44
  "fontSize": true,
48
45
  "lineHeight": true,
46
+ "textAlign": true,
49
47
  "__experimentalFontFamily": true,
50
48
  "__experimentalFontWeight": true,
51
49
  "__experimentalFontStyle": true,
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import migrateTextAlign from '../utils/migrate-text-align';
5
+
6
+ const v1 = {
7
+ attributes: {
8
+ textAlign: {
9
+ type: 'string',
10
+ },
11
+ type: {
12
+ type: 'string',
13
+ default: 'next',
14
+ },
15
+ label: {
16
+ type: 'string',
17
+ role: 'content',
18
+ },
19
+ showTitle: {
20
+ type: 'boolean',
21
+ default: false,
22
+ },
23
+ linkLabel: {
24
+ type: 'boolean',
25
+ default: false,
26
+ },
27
+ arrow: {
28
+ type: 'string',
29
+ default: 'none',
30
+ },
31
+ taxonomy: {
32
+ type: 'string',
33
+ default: '',
34
+ },
35
+ },
36
+ supports: {
37
+ anchor: true,
38
+ reusable: false,
39
+ html: false,
40
+ color: {
41
+ link: true,
42
+ },
43
+ typography: {
44
+ fontSize: true,
45
+ lineHeight: true,
46
+ __experimentalFontFamily: true,
47
+ __experimentalFontWeight: true,
48
+ __experimentalFontStyle: true,
49
+ __experimentalTextTransform: true,
50
+ __experimentalTextDecoration: true,
51
+ __experimentalLetterSpacing: true,
52
+ __experimentalDefaultControls: {
53
+ fontSize: true,
54
+ },
55
+ },
56
+ interactivity: {
57
+ clientNavigation: true,
58
+ },
59
+ },
60
+ migrate: migrateTextAlign,
61
+ isEligible( attributes ) {
62
+ return (
63
+ !! attributes.textAlign ||
64
+ !! attributes.className?.match(
65
+ /\bhas-text-align-(left|center|right)\b/
66
+ )
67
+ );
68
+ },
69
+ save: () => null,
70
+ };
71
+
72
+ export default [ v1 ];
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -17,10 +12,7 @@ import {
17
12
  import {
18
13
  InspectorControls,
19
14
  RichText,
20
- BlockControls,
21
- AlignmentToolbar,
22
15
  useBlockProps,
23
- useBlockEditingMode,
24
16
  } from '@wordpress/block-editor';
25
17
  import { __, _x } from '@wordpress/i18n';
26
18
  import { useSelect } from '@wordpress/data';
@@ -33,19 +25,9 @@ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
33
25
 
34
26
  export default function PostNavigationLinkEdit( {
35
27
  context: { postType },
36
- attributes: {
37
- type,
38
- label,
39
- showTitle,
40
- textAlign,
41
- linkLabel,
42
- arrow,
43
- taxonomy,
44
- },
28
+ attributes: { type, label, showTitle, linkLabel, arrow, taxonomy },
45
29
  setAttributes,
46
30
  } ) {
47
- const blockEditingMode = useBlockEditingMode();
48
- const showControls = blockEditingMode === 'default';
49
31
  const isNext = type === 'next';
50
32
  let placeholder = isNext ? __( 'Next' ) : __( 'Previous' );
51
33
 
@@ -66,12 +48,7 @@ export default function PostNavigationLinkEdit( {
66
48
  }
67
49
 
68
50
  const ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' );
69
- const blockProps = useBlockProps( {
70
- className: clsx( {
71
- [ `has-text-align-${ textAlign }` ]: textAlign,
72
- } ),
73
- } );
74
-
51
+ const blockProps = useBlockProps();
75
52
  const taxonomies = useSelect(
76
53
  ( select ) => {
77
54
  const { getTaxonomies } = select( coreStore );
@@ -220,16 +197,6 @@ export default function PostNavigationLinkEdit( {
220
197
  ) }
221
198
  />
222
199
  </InspectorControls>
223
- { showControls && (
224
- <BlockControls>
225
- <AlignmentToolbar
226
- value={ textAlign }
227
- onChange={ ( nextAlign ) => {
228
- setAttributes( { textAlign: nextAlign } );
229
- } }
230
- />
231
- </BlockControls>
232
- ) }
233
200
  <div { ...blockProps }>
234
201
  { ! isNext && displayArrow && (
235
202
  <span
@@ -10,6 +10,7 @@ import initBlock from '../utils/init-block';
10
10
  import metadata from './block.json';
11
11
  import edit from './edit';
12
12
  import variations from './variations';
13
+ import deprecated from './deprecated';
13
14
 
14
15
  const { name } = metadata;
15
16
  export { metadata, name };
@@ -17,6 +18,7 @@ export { metadata, name };
17
18
  export const settings = {
18
19
  edit,
19
20
  variations,
21
+ deprecated,
20
22
  example: {
21
23
  attributes: {
22
24
  label: __( 'Next post' ),
@@ -8,9 +8,6 @@
8
8
  "textdomain": "default",
9
9
  "usesContext": [ "postId", "postType", "queryId" ],
10
10
  "attributes": {
11
- "textAlign": {
12
- "type": "string"
13
- },
14
11
  "level": {
15
12
  "type": "number",
16
13
  "default": 2
@@ -58,6 +55,7 @@
58
55
  "typography": {
59
56
  "fontSize": true,
60
57
  "lineHeight": true,
58
+ "textAlign": true,
61
59
  "__experimentalFontFamily": true,
62
60
  "__experimentalFontWeight": true,
63
61
  "__experimentalFontStyle": true,
@@ -2,6 +2,91 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import migrateFontFamily from '../utils/migrate-font-family';
5
+ import migrateTextAlign from '../utils/migrate-text-align';
6
+
7
+ const v2 = {
8
+ attributes: {
9
+ textAlign: {
10
+ type: 'string',
11
+ },
12
+ level: {
13
+ type: 'number',
14
+ default: 2,
15
+ },
16
+ levelOptions: {
17
+ type: 'array',
18
+ },
19
+ isLink: {
20
+ type: 'boolean',
21
+ default: false,
22
+ },
23
+ rel: {
24
+ type: 'string',
25
+ attribute: 'rel',
26
+ default: '',
27
+ },
28
+ linkTarget: {
29
+ type: 'string',
30
+ default: '_self',
31
+ },
32
+ },
33
+ supports: {
34
+ anchor: true,
35
+ align: [ 'wide', 'full' ],
36
+ html: false,
37
+ color: {
38
+ gradients: true,
39
+ link: true,
40
+ __experimentalDefaultControls: {
41
+ background: true,
42
+ text: true,
43
+ link: true,
44
+ },
45
+ },
46
+ spacing: {
47
+ padding: true,
48
+ margin: true,
49
+ },
50
+ typography: {
51
+ fontSize: true,
52
+ lineHeight: true,
53
+ __experimentalFontFamily: true,
54
+ __experimentalTextTransform: true,
55
+ __experimentalTextDecoration: true,
56
+ __experimentalFontStyle: true,
57
+ __experimentalFontWeight: true,
58
+ __experimentalLetterSpacing: true,
59
+ __experimentalDefaultControls: {
60
+ fontSize: true,
61
+ },
62
+ },
63
+ interactivity: {
64
+ clientNavigation: true,
65
+ },
66
+ __experimentalBorder: {
67
+ radius: true,
68
+ color: true,
69
+ width: true,
70
+ style: true,
71
+ __experimentalDefaultControls: {
72
+ radius: true,
73
+ color: true,
74
+ width: true,
75
+ style: true,
76
+ },
77
+ },
78
+ },
79
+ migrate: migrateTextAlign,
80
+ isEligible( attributes ) {
81
+ return (
82
+ !! attributes.textAlign ||
83
+ !! attributes.className?.match(
84
+ /\bhas-text-align-(left|center|right)\b/
85
+ )
86
+ );
87
+ },
88
+ save: () => null,
89
+ };
5
90
 
6
91
  const v1 = {
7
92
  attributes: {
@@ -62,4 +147,4 @@ const v1 = {
62
147
  *
63
148
  * See block-deprecation.md
64
149
  */
65
- export default [ v1 ];
150
+ export default [ v2, v1 ];
@@ -1,13 +1,7 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
4
  import {
10
- AlignmentControl,
11
5
  BlockControls,
12
6
  InspectorControls,
13
7
  useBlockProps,
@@ -34,7 +28,7 @@ import { createInterpolateElement } from '@wordpress/element';
34
28
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
35
29
 
36
30
  export default function PostTitleEdit( {
37
- attributes: { level, levelOptions, textAlign, isLink, rel, linkTarget },
31
+ attributes: { level, levelOptions, isLink, rel, linkTarget },
38
32
  setAttributes,
39
33
  context: { postType, postId, queryId },
40
34
  insertBlocksAfter,
@@ -72,11 +66,7 @@ export default function PostTitleEdit( {
72
66
  const onSplitAtEnd = () => {
73
67
  insertBlocksAfter( createBlock( getDefaultBlockName() ) );
74
68
  };
75
- const blockProps = useBlockProps( {
76
- className: clsx( {
77
- [ `has-text-align-${ textAlign }` ]: textAlign,
78
- } ),
79
- } );
69
+ const blockProps = useBlockProps();
80
70
  const blockEditingMode = useBlockEditingMode();
81
71
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
82
72
 
@@ -147,12 +137,6 @@ export default function PostTitleEdit( {
147
137
  setAttributes( { level: newLevel } )
148
138
  }
149
139
  />
150
- <AlignmentControl
151
- value={ textAlign }
152
- onChange={ ( nextAlign ) => {
153
- setAttributes( { textAlign: nextAlign } );
154
- } }
155
- />
156
140
  </BlockControls>
157
141
  <InspectorControls>
158
142
  <ToolsPanel
@@ -297,8 +297,8 @@ const v4 = {
297
297
  backgroundColor: isSolidColorStyle ? mainColor : undefined,
298
298
  borderColor: isSolidColorStyle ? undefined : mainColor,
299
299
  textAlign: isSolidColorStyle ? 'left' : undefined,
300
- style,
301
300
  ...attributes,
301
+ style,
302
302
  };
303
303
  },
304
304
  };
@@ -454,8 +454,8 @@ const v3 = {
454
454
  backgroundColor: isSolidColorStyle ? mainColor : undefined,
455
455
  borderColor: isSolidColorStyle ? undefined : mainColor,
456
456
  textAlign: isSolidColorStyle ? 'left' : undefined,
457
- style,
458
457
  ...attributes,
458
+ style,
459
459
  };
460
460
  },
461
461
  };
@@ -572,8 +572,8 @@ const v2 = {
572
572
  backgroundColor: isSolidColorStyle ? mainColor : undefined,
573
573
  borderColor: isSolidColorStyle ? undefined : mainColor,
574
574
  textAlign: isSolidColorStyle ? 'left' : undefined,
575
- style,
576
575
  ...attributes,
576
+ style,
577
577
  };
578
578
  },
579
579
  };
@@ -54,8 +54,7 @@
54
54
  "align": [ "wide", "full" ],
55
55
  "html": false,
56
56
  "layout": true,
57
- "interactivity": true,
58
- "contentRole": true
57
+ "interactivity": true
59
58
  },
60
59
  "editorStyle": "wp-block-query-editor"
61
60
  }
@@ -10,9 +10,6 @@
10
10
  "type": {
11
11
  "type": "string"
12
12
  },
13
- "textAlign": {
14
- "type": "string"
15
- },
16
13
  "level": {
17
14
  "type": "number",
18
15
  "default": 1
@@ -53,6 +50,7 @@
53
50
  "typography": {
54
51
  "fontSize": true,
55
52
  "lineHeight": true,
53
+ "textAlign": true,
56
54
  "__experimentalFontFamily": true,
57
55
  "__experimentalFontStyle": true,
58
56
  "__experimentalFontWeight": true,