@wordpress/block-library 9.40.2-next.v.202602271551.0 → 9.40.2

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 (250) hide show
  1. package/build/accordion/view.cjs +34 -0
  2. package/build/accordion/view.cjs.map +2 -2
  3. package/build/comment-reply-link/edit.cjs +2 -1
  4. package/build/comment-reply-link/edit.cjs.map +2 -2
  5. package/build/comments/edit/placeholder.cjs +2 -1
  6. package/build/comments/edit/placeholder.cjs.map +2 -2
  7. package/build/cover/edit/index.cjs +39 -26
  8. package/build/cover/edit/index.cjs.map +2 -2
  9. package/build/cover/embed-video-utils.cjs +8 -6
  10. package/build/cover/embed-video-utils.cjs.map +2 -2
  11. package/build/embed/embed-preview.cjs +2 -1
  12. package/build/embed/embed-preview.cjs.map +2 -2
  13. package/build/html/block.json +2 -1
  14. package/build/html/modal.cjs +147 -230
  15. package/build/html/modal.cjs.map +3 -3
  16. package/build/icon/block.json +3 -12
  17. package/build/image/image.cjs +1 -1
  18. package/build/image/image.cjs.map +2 -2
  19. package/build/latest-comments/deprecated.cjs +33 -0
  20. package/build/latest-comments/deprecated.cjs.map +2 -2
  21. package/build/navigation/edit/index.cjs +125 -123
  22. package/build/navigation/edit/index.cjs.map +3 -3
  23. package/build/navigation/edit/leaf-more-menu.cjs +6 -68
  24. package/build/navigation/edit/leaf-more-menu.cjs.map +3 -3
  25. package/build/navigation/edit/menu-inspector-controls.cjs +91 -20
  26. package/build/navigation/edit/menu-inspector-controls.cjs.map +3 -3
  27. package/build/navigation/edit/navigation-menu-selector.cjs +4 -5
  28. package/build/navigation/edit/navigation-menu-selector.cjs.map +3 -3
  29. package/build/navigation/edit/placeholder/index.cjs +2 -2
  30. package/build/navigation/edit/placeholder/index.cjs.map +3 -3
  31. package/build/navigation/use-navigation-entities.cjs +67 -0
  32. package/build/navigation/use-navigation-entities.cjs.map +7 -0
  33. package/build/navigation/view.cjs +9 -2
  34. package/build/navigation/view.cjs.map +2 -2
  35. package/build/navigation-link/edit.cjs +2 -1
  36. package/build/navigation-link/edit.cjs.map +2 -2
  37. package/build/navigation-link/shared/use-handle-link-change.cjs +19 -3
  38. package/build/navigation-link/shared/use-handle-link-change.cjs.map +3 -3
  39. package/build/navigation-link/shared/use-link-preview.cjs +2 -2
  40. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  41. package/build/navigation-submenu/edit.cjs +8 -22
  42. package/build/navigation-submenu/edit.cjs.map +2 -2
  43. package/build/nextpage/block.json +0 -1
  44. package/build/paragraph/edit.cjs +1 -1
  45. package/build/paragraph/edit.cjs.map +1 -1
  46. package/build/post-navigation-link/block.json +3 -1
  47. package/build/post-navigation-link/edit.cjs +36 -2
  48. package/build/post-navigation-link/edit.cjs.map +3 -3
  49. package/build/post-navigation-link/index.cjs +0 -2
  50. package/build/post-navigation-link/index.cjs.map +3 -3
  51. package/build/post-title/block.json +3 -1
  52. package/build/post-title/deprecated.cjs +1 -82
  53. package/build/post-title/deprecated.cjs.map +3 -3
  54. package/build/post-title/edit.cjs +36 -10
  55. package/build/post-title/edit.cjs.map +3 -3
  56. package/build/query-title/block.json +3 -1
  57. package/build/query-title/deprecated.cjs +1 -70
  58. package/build/query-title/deprecated.cjs.map +3 -3
  59. package/build/query-title/edit.cjs +35 -17
  60. package/build/query-title/edit.cjs.map +3 -3
  61. package/build/shortcode/block.json +2 -1
  62. package/build/site-tagline/block.json +4 -6
  63. package/build/site-tagline/deprecated.cjs +1 -66
  64. package/build/site-tagline/deprecated.cjs.map +3 -3
  65. package/build/site-tagline/edit.cjs +28 -14
  66. package/build/site-tagline/edit.cjs.map +3 -3
  67. package/build/site-title/block.json +3 -1
  68. package/build/site-title/deprecated.cjs +1 -79
  69. package/build/site-title/deprecated.cjs.map +3 -3
  70. package/build/site-title/edit.cjs +30 -14
  71. package/build/site-title/edit.cjs.map +3 -3
  72. package/build/tabs-menu-item/block.json +26 -1
  73. package/build/tabs-menu-item/controls.cjs +100 -2
  74. package/build/tabs-menu-item/controls.cjs.map +3 -3
  75. package/build/tabs-menu-item/edit.cjs +65 -6
  76. package/build/tabs-menu-item/edit.cjs.map +2 -2
  77. package/build/tabs-menu-item/save.cjs +15 -1
  78. package/build/tabs-menu-item/save.cjs.map +2 -2
  79. package/build-module/accordion/view.mjs +35 -1
  80. package/build-module/accordion/view.mjs.map +2 -2
  81. package/build-module/comment-reply-link/edit.mjs +3 -2
  82. package/build-module/comment-reply-link/edit.mjs.map +2 -2
  83. package/build-module/comments/edit/placeholder.mjs +3 -2
  84. package/build-module/comments/edit/placeholder.mjs.map +2 -2
  85. package/build-module/cover/edit/index.mjs +47 -29
  86. package/build-module/cover/edit/index.mjs.map +2 -2
  87. package/build-module/cover/embed-video-utils.mjs +7 -5
  88. package/build-module/cover/embed-video-utils.mjs.map +2 -2
  89. package/build-module/embed/embed-preview.mjs +2 -1
  90. package/build-module/embed/embed-preview.mjs.map +2 -2
  91. package/build-module/html/block.json +2 -1
  92. package/build-module/html/modal.mjs +149 -232
  93. package/build-module/html/modal.mjs.map +2 -2
  94. package/build-module/icon/block.json +3 -12
  95. package/build-module/image/image.mjs +1 -1
  96. package/build-module/image/image.mjs.map +2 -2
  97. package/build-module/latest-comments/deprecated.mjs +33 -0
  98. package/build-module/latest-comments/deprecated.mjs.map +2 -2
  99. package/build-module/navigation/edit/index.mjs +125 -123
  100. package/build-module/navigation/edit/index.mjs.map +2 -2
  101. package/build-module/navigation/edit/leaf-more-menu.mjs +7 -73
  102. package/build-module/navigation/edit/leaf-more-menu.mjs.map +2 -2
  103. package/build-module/navigation/edit/menu-inspector-controls.mjs +101 -21
  104. package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
  105. package/build-module/navigation/edit/navigation-menu-selector.mjs +5 -6
  106. package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
  107. package/build-module/navigation/edit/placeholder/index.mjs +2 -2
  108. package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
  109. package/build-module/navigation/use-navigation-entities.mjs +46 -0
  110. package/build-module/navigation/use-navigation-entities.mjs.map +7 -0
  111. package/build-module/navigation/view.mjs +9 -2
  112. package/build-module/navigation/view.mjs.map +2 -2
  113. package/build-module/navigation-link/edit.mjs +2 -1
  114. package/build-module/navigation-link/edit.mjs.map +2 -2
  115. package/build-module/navigation-link/shared/use-handle-link-change.mjs +19 -3
  116. package/build-module/navigation-link/shared/use-handle-link-change.mjs.map +2 -2
  117. package/build-module/navigation-link/shared/use-link-preview.mjs +2 -2
  118. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  119. package/build-module/navigation-submenu/edit.mjs +9 -23
  120. package/build-module/navigation-submenu/edit.mjs.map +2 -2
  121. package/build-module/nextpage/block.json +0 -1
  122. package/build-module/paragraph/edit.mjs +2 -2
  123. package/build-module/paragraph/edit.mjs.map +1 -1
  124. package/build-module/post-navigation-link/block.json +3 -1
  125. package/build-module/post-navigation-link/edit.mjs +30 -3
  126. package/build-module/post-navigation-link/edit.mjs.map +2 -2
  127. package/build-module/post-navigation-link/index.mjs +0 -2
  128. package/build-module/post-navigation-link/index.mjs.map +2 -2
  129. package/build-module/post-title/block.json +3 -1
  130. package/build-module/post-title/deprecated.mjs +1 -82
  131. package/build-module/post-title/deprecated.mjs.map +2 -2
  132. package/build-module/post-title/edit.mjs +27 -10
  133. package/build-module/post-title/edit.mjs.map +2 -2
  134. package/build-module/query-title/block.json +3 -1
  135. package/build-module/query-title/deprecated.mjs +1 -70
  136. package/build-module/query-title/deprecated.mjs.map +2 -2
  137. package/build-module/query-title/edit.mjs +36 -17
  138. package/build-module/query-title/edit.mjs.map +2 -2
  139. package/build-module/shortcode/block.json +2 -1
  140. package/build-module/site-tagline/block.json +4 -6
  141. package/build-module/site-tagline/deprecated.mjs +1 -66
  142. package/build-module/site-tagline/deprecated.mjs.map +2 -2
  143. package/build-module/site-tagline/edit.mjs +29 -14
  144. package/build-module/site-tagline/edit.mjs.map +2 -2
  145. package/build-module/site-title/block.json +3 -1
  146. package/build-module/site-title/deprecated.mjs +1 -79
  147. package/build-module/site-title/deprecated.mjs.map +2 -2
  148. package/build-module/site-title/edit.mjs +31 -14
  149. package/build-module/site-title/edit.mjs.map +2 -2
  150. package/build-module/tabs-menu-item/block.json +26 -1
  151. package/build-module/tabs-menu-item/controls.mjs +104 -3
  152. package/build-module/tabs-menu-item/controls.mjs.map +2 -2
  153. package/build-module/tabs-menu-item/edit.mjs +66 -6
  154. package/build-module/tabs-menu-item/edit.mjs.map +2 -2
  155. package/build-module/tabs-menu-item/save.mjs +15 -1
  156. package/build-module/tabs-menu-item/save.mjs.map +2 -2
  157. package/build-style/editor-rtl.css +20 -6
  158. package/build-style/editor.css +20 -6
  159. package/build-style/html/editor-rtl.css +10 -6
  160. package/build-style/html/editor.css +10 -6
  161. package/build-style/icon/editor-rtl.css +5 -0
  162. package/build-style/icon/editor.css +5 -0
  163. package/build-style/navigation/style-rtl.css +15 -1
  164. package/build-style/navigation/style.css +15 -1
  165. package/build-style/navigation-overlay-close/style-rtl.css +3 -3
  166. package/build-style/navigation-overlay-close/style.css +3 -3
  167. package/build-style/style-rtl.css +30 -7
  168. package/build-style/style.css +30 -7
  169. package/build-style/tabs-menu-item/editor-rtl.css +5 -0
  170. package/build-style/tabs-menu-item/editor.css +5 -0
  171. package/build-style/tabs-menu-item/style-rtl.css +12 -3
  172. package/build-style/tabs-menu-item/style.css +12 -3
  173. package/package.json +38 -38
  174. package/src/accordion/view.js +44 -1
  175. package/src/accordion-item/index.php +18 -5
  176. package/src/comment-reply-link/edit.js +5 -2
  177. package/src/comments/edit/placeholder.js +5 -2
  178. package/src/cover/edit/index.js +72 -35
  179. package/src/cover/embed-video-utils.js +9 -7
  180. package/src/cover/index.php +12 -4
  181. package/src/details/index.php +47 -0
  182. package/src/embed/embed-preview.js +6 -5
  183. package/src/html/block.json +2 -1
  184. package/src/html/editor.scss +15 -5
  185. package/src/html/modal.js +32 -99
  186. package/src/icon/block.json +3 -12
  187. package/src/icon/editor.scss +5 -0
  188. package/src/icon/index.php +3 -1
  189. package/src/image/image.js +14 -15
  190. package/src/image/index.php +7 -5
  191. package/src/latest-comments/deprecated.js +33 -0
  192. package/src/navigation/edit/index.js +136 -134
  193. package/src/navigation/edit/leaf-more-menu.js +11 -86
  194. package/src/navigation/edit/menu-inspector-controls.js +142 -23
  195. package/src/navigation/edit/navigation-menu-selector.js +5 -6
  196. package/src/navigation/edit/placeholder/index.js +2 -3
  197. package/src/navigation/edit/test/navigation-menu-selector.js +20 -23
  198. package/src/navigation/index.php +62 -9
  199. package/src/navigation/style.scss +17 -1
  200. package/src/navigation/use-navigation-entities.js +72 -0
  201. package/src/navigation/view.js +14 -2
  202. package/src/navigation-link/edit.js +1 -0
  203. package/src/navigation-link/shared/test/use-handle-link-change.test.js +212 -0
  204. package/src/navigation-link/shared/test/use-link-preview.test.js +9 -0
  205. package/src/navigation-link/shared/use-handle-link-change.js +36 -9
  206. package/src/navigation-link/shared/use-link-preview.js +6 -9
  207. package/src/navigation-overlay-close/style.scss +3 -3
  208. package/src/navigation-submenu/edit.js +11 -28
  209. package/src/nextpage/block.json +0 -1
  210. package/src/page-list/index.php +1 -1
  211. package/src/paragraph/edit.js +2 -2
  212. package/src/post-featured-image/index.php +4 -2
  213. package/src/post-navigation-link/block.json +3 -1
  214. package/src/post-navigation-link/edit.js +35 -2
  215. package/src/post-navigation-link/index.js +0 -2
  216. package/src/post-title/block.json +3 -1
  217. package/src/post-title/deprecated.js +1 -86
  218. package/src/post-title/edit.js +18 -2
  219. package/src/query-title/block.json +3 -1
  220. package/src/query-title/deprecated.js +1 -74
  221. package/src/query-title/edit.js +27 -11
  222. package/src/query-title/index.php +1 -1
  223. package/src/shortcode/block.json +2 -1
  224. package/src/site-tagline/block.json +4 -6
  225. package/src/site-tagline/deprecated.js +1 -70
  226. package/src/site-tagline/edit.js +22 -9
  227. package/src/site-title/block.json +3 -1
  228. package/src/site-title/deprecated.js +1 -83
  229. package/src/site-title/edit.js +22 -9
  230. package/src/tabs-menu-item/block.json +26 -1
  231. package/src/tabs-menu-item/controls.js +108 -0
  232. package/src/tabs-menu-item/edit.js +79 -6
  233. package/src/tabs-menu-item/editor.scss +6 -0
  234. package/src/tabs-menu-item/save.js +26 -1
  235. package/src/tabs-menu-item/style.scss +14 -3
  236. package/build/navigation/edit/navigation-link-ui.cjs +0 -97
  237. package/build/navigation/edit/navigation-link-ui.cjs.map +0 -7
  238. package/build/navigation/edit/navigation-list-view-header.cjs +0 -86
  239. package/build/navigation/edit/navigation-list-view-header.cjs.map +0 -7
  240. package/build/post-navigation-link/deprecated.cjs +0 -100
  241. package/build/post-navigation-link/deprecated.cjs.map +0 -7
  242. package/build-module/navigation/edit/navigation-link-ui.mjs +0 -76
  243. package/build-module/navigation/edit/navigation-link-ui.mjs.map +0 -7
  244. package/build-module/navigation/edit/navigation-list-view-header.mjs +0 -58
  245. package/build-module/navigation/edit/navigation-list-view-header.mjs.map +0 -7
  246. package/build-module/post-navigation-link/deprecated.mjs +0 -69
  247. package/build-module/post-navigation-link/deprecated.mjs.map +0 -7
  248. package/src/navigation/edit/navigation-link-ui.js +0 -115
  249. package/src/navigation/edit/navigation-list-view-header.js +0 -62
  250. package/src/post-navigation-link/deprecated.js +0 -72
@@ -2,91 +2,6 @@
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
- };
90
5
 
91
6
  const v1 = {
92
7
  attributes: {
@@ -147,4 +62,4 @@ const v1 = {
147
62
  *
148
63
  * See block-deprecation.md
149
64
  */
150
- export default [ v2, v1 ];
65
+ export default [ v1 ];
@@ -1,7 +1,13 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
4
9
  import {
10
+ AlignmentControl,
5
11
  BlockControls,
6
12
  InspectorControls,
7
13
  useBlockProps,
@@ -28,7 +34,7 @@ import { createInterpolateElement } from '@wordpress/element';
28
34
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
29
35
 
30
36
  export default function PostTitleEdit( {
31
- attributes: { level, levelOptions, isLink, rel, linkTarget },
37
+ attributes: { level, levelOptions, textAlign, isLink, rel, linkTarget },
32
38
  setAttributes,
33
39
  context: { postType, postId, queryId },
34
40
  insertBlocksAfter,
@@ -66,7 +72,11 @@ export default function PostTitleEdit( {
66
72
  const onSplitAtEnd = () => {
67
73
  insertBlocksAfter( createBlock( getDefaultBlockName() ) );
68
74
  };
69
- const blockProps = useBlockProps();
75
+ const blockProps = useBlockProps( {
76
+ className: clsx( {
77
+ [ `has-text-align-${ textAlign }` ]: textAlign,
78
+ } ),
79
+ } );
70
80
  const blockEditingMode = useBlockEditingMode();
71
81
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
72
82
 
@@ -137,6 +147,12 @@ export default function PostTitleEdit( {
137
147
  setAttributes( { level: newLevel } )
138
148
  }
139
149
  />
150
+ <AlignmentControl
151
+ value={ textAlign }
152
+ onChange={ ( nextAlign ) => {
153
+ setAttributes( { textAlign: nextAlign } );
154
+ } }
155
+ />
140
156
  </BlockControls>
141
157
  <InspectorControls>
142
158
  <ToolsPanel
@@ -10,6 +10,9 @@
10
10
  "type": {
11
11
  "type": "string"
12
12
  },
13
+ "textAlign": {
14
+ "type": "string"
15
+ },
13
16
  "level": {
14
17
  "type": "number",
15
18
  "default": 1
@@ -50,7 +53,6 @@
50
53
  "typography": {
51
54
  "fontSize": true,
52
55
  "lineHeight": true,
53
- "textAlign": true,
54
56
  "__experimentalFontFamily": true,
55
57
  "__experimentalFontStyle": true,
56
58
  "__experimentalFontWeight": true,
@@ -2,79 +2,6 @@
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
- type: {
10
- type: 'string',
11
- },
12
- textAlign: {
13
- type: 'string',
14
- },
15
- level: {
16
- type: 'number',
17
- default: 1,
18
- },
19
- levelOptions: {
20
- type: 'array',
21
- },
22
- },
23
- supports: {
24
- anchor: true,
25
- align: [ 'wide', 'full' ],
26
- html: false,
27
- color: {
28
- gradients: true,
29
- __experimentalDefaultControls: {
30
- background: true,
31
- text: true,
32
- },
33
- },
34
- spacing: {
35
- padding: true,
36
- margin: true,
37
- },
38
- typography: {
39
- fontSize: true,
40
- lineHeight: true,
41
- __experimentalFontFamily: true,
42
- __experimentalTextTransform: true,
43
- __experimentalTextDecoration: true,
44
- __experimentalFontStyle: true,
45
- __experimentalFontWeight: true,
46
- __experimentalLetterSpacing: true,
47
- __experimentalDefaultControls: {
48
- fontSize: true,
49
- },
50
- },
51
- interactivity: {
52
- clientNavigation: true,
53
- },
54
- __experimentalBorder: {
55
- radius: true,
56
- color: true,
57
- width: true,
58
- style: true,
59
- __experimentalDefaultControls: {
60
- radius: true,
61
- color: true,
62
- width: true,
63
- style: true,
64
- },
65
- },
66
- },
67
- migrate: migrateTextAlign,
68
- isEligible( attributes ) {
69
- return (
70
- !! attributes.textAlign ||
71
- !! attributes.className?.match(
72
- /\bhas-text-align-(left|center|right)\b/
73
- )
74
- );
75
- },
76
- save: () => null,
77
- };
78
5
 
79
6
  const v1 = {
80
7
  attributes: {
@@ -121,4 +48,4 @@ const v1 = {
121
48
  *
122
49
  * See block-deprecation.md
123
50
  */
124
- export default [ v2, v1 ];
51
+ export default [ v1 ];
@@ -1,7 +1,13 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
4
9
  import {
10
+ AlignmentControl,
5
11
  BlockControls,
6
12
  InspectorControls,
7
13
  useBlockProps,
@@ -21,19 +27,21 @@ import { __, _x, sprintf } from '@wordpress/i18n';
21
27
  import { useArchiveLabel } from './use-archive-label';
22
28
  import { usePostTypeLabel } from './use-post-type-label';
23
29
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
24
- import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
25
30
 
26
31
  const SUPPORTED_TYPES = [ 'archive', 'search', 'post-type' ];
27
32
 
28
- export default function QueryTitleEdit( props ) {
29
- useDeprecatedTextAlign( props );
30
-
31
- const {
32
- attributes: { type, level, levelOptions, showPrefix, showSearchTerm },
33
- setAttributes,
34
- context: { query },
35
- } = props;
36
-
33
+ export default function QueryTitleEdit( {
34
+ attributes: {
35
+ type,
36
+ level,
37
+ levelOptions,
38
+ textAlign,
39
+ showPrefix,
40
+ showSearchTerm,
41
+ },
42
+ setAttributes,
43
+ context: { query },
44
+ } ) {
37
45
  const { archiveTypeLabel, archiveNameLabel } = useArchiveLabel();
38
46
  const { postTypeLabel } = usePostTypeLabel( query?.postType );
39
47
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
@@ -41,7 +49,9 @@ export default function QueryTitleEdit( props ) {
41
49
  const TagName = level === 0 ? 'p' : `h${ level }`;
42
50
 
43
51
  const blockProps = useBlockProps( {
44
- className: 'wp-block-query-title__placeholder',
52
+ className: clsx( 'wp-block-query-title__placeholder', {
53
+ [ `has-text-align-${ textAlign }` ]: textAlign,
54
+ } ),
45
55
  } );
46
56
 
47
57
  if ( ! SUPPORTED_TYPES.includes( type ) ) {
@@ -229,6 +239,12 @@ export default function QueryTitleEdit( props ) {
229
239
  setAttributes( { level: newLevel } )
230
240
  }
231
241
  />
242
+ <AlignmentControl
243
+ value={ textAlign }
244
+ onChange={ ( nextAlign ) => {
245
+ setAttributes( { textAlign: nextAlign } );
246
+ } }
247
+ />
232
248
  </BlockControls>
233
249
  { titleElement }
234
250
  </>
@@ -13,7 +13,7 @@
13
13
  * @since 5.8.0
14
14
  *
15
15
  * @param array $attributes Block attributes.
16
- * @param array $content Block content.
16
+ * @param array $_content Block content.
17
17
  * @param object $block Block instance.
18
18
  *
19
19
  * @return string Returns the query title based on the queried object.
@@ -17,7 +17,8 @@
17
17
  "className": false,
18
18
  "customClassName": false,
19
19
  "html": false,
20
- "customCSS": false
20
+ "customCSS": false,
21
+ "visibility": false
21
22
  },
22
23
  "editorStyle": "wp-block-shortcode-editor"
23
24
  }
@@ -8,6 +8,9 @@
8
8
  "keywords": [ "description" ],
9
9
  "textdomain": "default",
10
10
  "attributes": {
11
+ "textAlign": {
12
+ "type": "string"
13
+ },
11
14
  "level": {
12
15
  "type": "number",
13
16
  "default": 0
@@ -20,11 +23,7 @@
20
23
  "example": {
21
24
  "viewportWidth": 350,
22
25
  "attributes": {
23
- "style": {
24
- "typography": {
25
- "textAlign": "center"
26
- }
27
- }
26
+ "textAlign": "center"
28
27
  }
29
28
  },
30
29
  "supports": {
@@ -50,7 +49,6 @@
50
49
  "typography": {
51
50
  "fontSize": true,
52
51
  "lineHeight": true,
53
- "textAlign": true,
54
52
  "__experimentalFontFamily": true,
55
53
  "__experimentalTextTransform": true,
56
54
  "__experimentalTextDecoration": true,
@@ -2,75 +2,6 @@
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
- },
15
- levelOptions: {
16
- type: 'array',
17
- default: [ 0, 1, 2, 3, 4, 5, 6 ],
18
- },
19
- },
20
- supports: {
21
- anchor: true,
22
- reusable: false,
23
- html: false,
24
- color: {
25
- gradients: true,
26
- __experimentalDefaultControls: {
27
- background: true,
28
- text: true,
29
- },
30
- },
31
- spacing: {
32
- margin: true,
33
- padding: true,
34
- __experimentalDefaultControls: {
35
- margin: false,
36
- padding: false,
37
- },
38
- },
39
- typography: {
40
- fontSize: true,
41
- lineHeight: true,
42
- __experimentalFontFamily: true,
43
- __experimentalTextTransform: true,
44
- __experimentalTextDecoration: true,
45
- __experimentalFontStyle: true,
46
- __experimentalFontWeight: true,
47
- __experimentalLetterSpacing: true,
48
- __experimentalWritingMode: true,
49
- __experimentalDefaultControls: {
50
- fontSize: true,
51
- },
52
- },
53
- interactivity: {
54
- clientNavigation: true,
55
- },
56
- __experimentalBorder: {
57
- radius: true,
58
- color: true,
59
- width: true,
60
- style: true,
61
- },
62
- },
63
- migrate: migrateTextAlign,
64
- isEligible( attributes ) {
65
- return (
66
- !! attributes.textAlign ||
67
- !! attributes.className?.match(
68
- /\bhas-text-align-(left|center|right)\b/
69
- )
70
- );
71
- },
72
- save: () => null,
73
- };
74
5
 
75
6
  const v1 = {
76
7
  attributes: {
@@ -115,4 +46,4 @@ const v1 = {
115
46
  *
116
47
  * See block-deprecation.md
117
48
  */
118
- export default [ v2, v1 ];
49
+ export default [ v1 ];
@@ -1,9 +1,15 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
4
9
  import { useDispatch, useSelect } from '@wordpress/data';
5
10
  import { store as coreStore } from '@wordpress/core-data';
6
11
  import {
12
+ AlignmentControl,
7
13
  useBlockProps,
8
14
  BlockControls,
9
15
  HeadingLevelDropdown,
@@ -11,13 +17,13 @@ import {
11
17
  } from '@wordpress/block-editor';
12
18
  import { __ } from '@wordpress/i18n';
13
19
  import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
14
- import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
15
-
16
- export default function SiteTaglineEdit( props ) {
17
- useDeprecatedTextAlign( props );
18
20
 
19
- const { attributes, setAttributes, insertBlocksAfter } = props;
20
- const { level, levelOptions } = attributes;
21
+ export default function SiteTaglineEdit( {
22
+ attributes,
23
+ setAttributes,
24
+ insertBlocksAfter,
25
+ } ) {
26
+ const { textAlign, level, levelOptions } = attributes;
21
27
  const { canUserEdit, tagline } = useSelect( ( select ) => {
22
28
  const { canUser, getEntityRecord, getEditedEntityRecord } =
23
29
  select( coreStore );
@@ -46,10 +52,11 @@ export default function SiteTaglineEdit( props ) {
46
52
  }
47
53
 
48
54
  const blockProps = useBlockProps( {
49
- className:
50
- ! canUserEdit && ! tagline && 'wp-block-site-tagline__placeholder',
55
+ className: clsx( {
56
+ [ `has-text-align-${ textAlign }` ]: textAlign,
57
+ 'wp-block-site-tagline__placeholder': ! canUserEdit && ! tagline,
58
+ } ),
51
59
  } );
52
-
53
60
  const siteTaglineContent = canUserEdit ? (
54
61
  <RichText
55
62
  allowedFormats={ [] }
@@ -79,6 +86,12 @@ export default function SiteTaglineEdit( props ) {
79
86
  setAttributes( { level: newLevel } )
80
87
  }
81
88
  />
89
+ <AlignmentControl
90
+ onChange={ ( newAlign ) =>
91
+ setAttributes( { textAlign: newAlign } )
92
+ }
93
+ value={ textAlign }
94
+ />
82
95
  </BlockControls>
83
96
  { siteTaglineContent }
84
97
  </>
@@ -15,6 +15,9 @@
15
15
  "type": "array",
16
16
  "default": [ 0, 1, 2, 3, 4, 5, 6 ]
17
17
  },
18
+ "textAlign": {
19
+ "type": "string"
20
+ },
18
21
  "isLink": {
19
22
  "type": "boolean",
20
23
  "default": true,
@@ -53,7 +56,6 @@
53
56
  "typography": {
54
57
  "fontSize": true,
55
58
  "lineHeight": true,
56
- "textAlign": true,
57
59
  "__experimentalFontFamily": true,
58
60
  "__experimentalTextTransform": true,
59
61
  "__experimentalTextDecoration": true,
@@ -2,88 +2,6 @@
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: 1,
15
- },
16
- levelOptions: {
17
- type: 'array',
18
- default: [ 0, 1, 2, 3, 4, 5, 6 ],
19
- },
20
- isLink: {
21
- type: 'boolean',
22
- default: true,
23
- role: 'content',
24
- },
25
- linkTarget: {
26
- type: 'string',
27
- default: '_self',
28
- role: 'content',
29
- },
30
- },
31
- supports: {
32
- anchor: true,
33
- align: [ 'wide', 'full' ],
34
- html: false,
35
- color: {
36
- gradients: true,
37
- link: true,
38
- __experimentalDefaultControls: {
39
- background: true,
40
- text: true,
41
- link: true,
42
- },
43
- },
44
- spacing: {
45
- padding: true,
46
- margin: true,
47
- __experimentalDefaultControls: {
48
- margin: false,
49
- padding: false,
50
- },
51
- },
52
- typography: {
53
- fontSize: true,
54
- lineHeight: true,
55
- __experimentalFontFamily: true,
56
- __experimentalTextTransform: true,
57
- __experimentalTextDecoration: true,
58
- __experimentalFontStyle: true,
59
- __experimentalFontWeight: true,
60
- __experimentalLetterSpacing: true,
61
- __experimentalWritingMode: true,
62
- __experimentalDefaultControls: {
63
- fontSize: true,
64
- },
65
- },
66
- interactivity: {
67
- clientNavigation: true,
68
- },
69
- __experimentalBorder: {
70
- radius: true,
71
- color: true,
72
- width: true,
73
- style: true,
74
- },
75
- },
76
- migrate: migrateTextAlign,
77
- isEligible( attributes ) {
78
- return (
79
- !! attributes.textAlign ||
80
- !! attributes.className?.match(
81
- /\bhas-text-align-(left|center|right)\b/
82
- )
83
- );
84
- },
85
- save: () => null,
86
- };
87
5
 
88
6
  const v1 = {
89
7
  attributes: {
@@ -141,4 +59,4 @@ const v1 = {
141
59
  *
142
60
  * See block-deprecation.md
143
61
  */
144
- export default [ v2, v1 ];
62
+ export default [ v1 ];
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -6,6 +11,7 @@ import { store as coreStore } from '@wordpress/core-data';
6
11
  import { __ } from '@wordpress/i18n';
7
12
  import {
8
13
  RichText,
14
+ AlignmentControl,
9
15
  InspectorControls,
10
16
  BlockControls,
11
17
  useBlockProps,
@@ -24,14 +30,13 @@ import { decodeEntities } from '@wordpress/html-entities';
24
30
  * Internal dependencies
25
31
  */
26
32
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
27
- import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
28
33
 
29
- export default function SiteTitleEdit( props ) {
30
- useDeprecatedTextAlign( props );
31
-
32
- const { attributes, setAttributes, insertBlocksAfter } = props;
33
-
34
- const { level, levelOptions, isLink, linkTarget } = attributes;
34
+ export default function SiteTitleEdit( {
35
+ attributes,
36
+ setAttributes,
37
+ insertBlocksAfter,
38
+ } ) {
39
+ const { level, levelOptions, textAlign, isLink, linkTarget } = attributes;
35
40
  const { canUserEdit, title } = useSelect( ( select ) => {
36
41
  const { canUser, getEntityRecord, getEditedEntityRecord } =
37
42
  select( coreStore );
@@ -59,8 +64,10 @@ export default function SiteTitleEdit( props ) {
59
64
 
60
65
  const TagName = level === 0 ? 'p' : `h${ level }`;
61
66
  const blockProps = useBlockProps( {
62
- className:
63
- ! canUserEdit && ! title && 'wp-block-site-title__placeholder',
67
+ className: clsx( {
68
+ [ `has-text-align-${ textAlign }` ]: textAlign,
69
+ 'wp-block-site-title__placeholder': ! canUserEdit && ! title,
70
+ } ),
64
71
  } );
65
72
  const siteTitleContent = canUserEdit ? (
66
73
  <TagName { ...blockProps }>
@@ -107,6 +114,12 @@ export default function SiteTitleEdit( props ) {
107
114
  setAttributes( { level: newLevel } )
108
115
  }
109
116
  />
117
+ <AlignmentControl
118
+ value={ textAlign }
119
+ onChange={ ( nextAlign ) => {
120
+ setAttributes( { textAlign: nextAlign } );
121
+ } }
122
+ />
110
123
  </BlockControls>
111
124
  ) }
112
125
  <InspectorControls>