@wordpress/block-library 9.35.1-next.dc3f6d3c1.0 → 9.36.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 (262) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/accordion/view.js +46 -4
  3. package/build/accordion/view.js.map +2 -2
  4. package/build/accordion-heading/block.json +1 -1
  5. package/build/accordion-heading/deprecated.js +1 -1
  6. package/build/accordion-heading/deprecated.js.map +2 -2
  7. package/build/accordion-panel/block.json +1 -1
  8. package/build/audio/index.js +12 -9
  9. package/build/audio/index.js.map +3 -3
  10. package/build/button/index.js +13 -10
  11. package/build/button/index.js.map +3 -3
  12. package/build/code/index.js +9 -6
  13. package/build/code/index.js.map +3 -3
  14. package/build/cover/edit/block-controls.js +37 -3
  15. package/build/cover/edit/block-controls.js.map +3 -3
  16. package/build/cover/edit/cover-placeholder.js +0 -1
  17. package/build/cover/edit/cover-placeholder.js.map +2 -2
  18. package/build/cover/edit/embed-video-url-input.js +83 -0
  19. package/build/cover/edit/embed-video-url-input.js.map +7 -0
  20. package/build/cover/edit/index.js +60 -0
  21. package/build/cover/edit/index.js.map +2 -2
  22. package/build/cover/embed-video-utils.js +151 -0
  23. package/build/cover/embed-video-utils.js.map +7 -0
  24. package/build/cover/index.js +10 -4
  25. package/build/cover/index.js.map +3 -3
  26. package/build/cover/save.js +12 -0
  27. package/build/cover/save.js.map +2 -2
  28. package/build/cover/shared.js +3 -0
  29. package/build/cover/shared.js.map +2 -2
  30. package/build/details/index.js +9 -6
  31. package/build/details/index.js.map +3 -3
  32. package/build/file/index.js +14 -14
  33. package/build/file/index.js.map +3 -3
  34. package/build/freeform/block.json +1 -1
  35. package/build/gallery/edit.js +0 -2
  36. package/build/gallery/edit.js.map +2 -2
  37. package/build/heading/index.js +9 -6
  38. package/build/heading/index.js.map +3 -3
  39. package/build/html/modal.js +127 -118
  40. package/build/html/modal.js.map +3 -3
  41. package/build/image/edit.js +0 -1
  42. package/build/image/edit.js.map +2 -2
  43. package/build/image/image.js +0 -1
  44. package/build/image/image.js.map +2 -2
  45. package/build/image/index.js +18 -18
  46. package/build/image/index.js.map +3 -3
  47. package/build/list-item/index.js +8 -6
  48. package/build/list-item/index.js.map +3 -3
  49. package/build/math/block.json +28 -1
  50. package/build/math/edit.js +4 -1
  51. package/build/math/edit.js.map +2 -2
  52. package/build/media-text/index.js +15 -8
  53. package/build/media-text/index.js.map +3 -3
  54. package/build/media-text/media-container.js +0 -2
  55. package/build/media-text/media-container.js.map +2 -2
  56. package/build/missing/block.json +1 -1
  57. package/build/missing/edit.js +2 -2
  58. package/build/missing/edit.js.map +1 -1
  59. package/build/more/index.js +9 -6
  60. package/build/more/index.js.map +3 -3
  61. package/build/navigation-link/edit.js +36 -11
  62. package/build/navigation-link/edit.js.map +2 -2
  63. package/build/navigation-link/index.js +11 -8
  64. package/build/navigation-link/index.js.map +3 -3
  65. package/build/navigation-submenu/index.js +11 -8
  66. package/build/navigation-submenu/index.js.map +3 -3
  67. package/build/paragraph/deprecated-attributes.js +68 -0
  68. package/build/paragraph/deprecated-attributes.js.map +7 -0
  69. package/build/paragraph/edit.js +2 -0
  70. package/build/paragraph/edit.js.map +3 -3
  71. package/build/paragraph/index.js +9 -6
  72. package/build/paragraph/index.js.map +3 -3
  73. package/build/pattern/block.json +1 -1
  74. package/build/preformatted/index.js +9 -6
  75. package/build/preformatted/index.js.map +3 -3
  76. package/build/pullquote/index.js +11 -11
  77. package/build/pullquote/index.js.map +3 -3
  78. package/build/search/index.js +14 -16
  79. package/build/search/index.js.map +3 -3
  80. package/build/social-link/index.js +11 -8
  81. package/build/social-link/index.js.map +3 -3
  82. package/build/template-part/edit/index.js +37 -7
  83. package/build/template-part/edit/index.js.map +2 -2
  84. package/build/template-part/edit/utils/hooks.js +2 -3
  85. package/build/template-part/edit/utils/hooks.js.map +2 -2
  86. package/build/term-count/index.js +1 -0
  87. package/build/term-count/index.js.map +2 -2
  88. package/build/term-name/index.js +1 -0
  89. package/build/term-name/index.js.map +2 -2
  90. package/build/verse/index.js +9 -6
  91. package/build/verse/index.js.map +3 -3
  92. package/build/video/index.js +12 -9
  93. package/build/video/index.js.map +3 -3
  94. package/build-module/accordion/view.js +46 -4
  95. package/build-module/accordion/view.js.map +2 -2
  96. package/build-module/accordion-heading/block.json +1 -1
  97. package/build-module/accordion-heading/deprecated.js +1 -1
  98. package/build-module/accordion-heading/deprecated.js.map +2 -2
  99. package/build-module/accordion-panel/block.json +1 -1
  100. package/build-module/audio/index.js +12 -9
  101. package/build-module/audio/index.js.map +2 -2
  102. package/build-module/button/index.js +13 -10
  103. package/build-module/button/index.js.map +2 -2
  104. package/build-module/code/index.js +9 -6
  105. package/build-module/code/index.js.map +2 -2
  106. package/build-module/cover/edit/block-controls.js +27 -3
  107. package/build-module/cover/edit/block-controls.js.map +2 -2
  108. package/build-module/cover/edit/cover-placeholder.js +0 -1
  109. package/build-module/cover/edit/cover-placeholder.js.map +2 -2
  110. package/build-module/cover/edit/embed-video-url-input.js +67 -0
  111. package/build-module/cover/edit/embed-video-url-input.js.map +7 -0
  112. package/build-module/cover/edit/index.js +61 -0
  113. package/build-module/cover/edit/index.js.map +2 -2
  114. package/build-module/cover/embed-video-utils.js +122 -0
  115. package/build-module/cover/embed-video-utils.js.map +7 -0
  116. package/build-module/cover/index.js +10 -4
  117. package/build-module/cover/index.js.map +2 -2
  118. package/build-module/cover/save.js +13 -0
  119. package/build-module/cover/save.js.map +2 -2
  120. package/build-module/cover/shared.js +2 -0
  121. package/build-module/cover/shared.js.map +2 -2
  122. package/build-module/details/index.js +9 -6
  123. package/build-module/details/index.js.map +2 -2
  124. package/build-module/file/index.js +14 -14
  125. package/build-module/file/index.js.map +2 -2
  126. package/build-module/freeform/block.json +1 -1
  127. package/build-module/gallery/edit.js +0 -2
  128. package/build-module/gallery/edit.js.map +2 -2
  129. package/build-module/heading/index.js +9 -6
  130. package/build-module/heading/index.js.map +2 -2
  131. package/build-module/html/modal.js +128 -119
  132. package/build-module/html/modal.js.map +2 -2
  133. package/build-module/image/edit.js +0 -1
  134. package/build-module/image/edit.js.map +2 -2
  135. package/build-module/image/image.js +0 -1
  136. package/build-module/image/image.js.map +2 -2
  137. package/build-module/image/index.js +18 -18
  138. package/build-module/image/index.js.map +2 -2
  139. package/build-module/list-item/index.js +8 -6
  140. package/build-module/list-item/index.js.map +2 -2
  141. package/build-module/math/block.json +28 -1
  142. package/build-module/math/edit.js +4 -1
  143. package/build-module/math/edit.js.map +2 -2
  144. package/build-module/media-text/index.js +15 -8
  145. package/build-module/media-text/index.js.map +2 -2
  146. package/build-module/media-text/media-container.js +0 -2
  147. package/build-module/media-text/media-container.js.map +2 -2
  148. package/build-module/missing/block.json +1 -1
  149. package/build-module/missing/edit.js +2 -2
  150. package/build-module/missing/edit.js.map +1 -1
  151. package/build-module/more/index.js +9 -6
  152. package/build-module/more/index.js.map +2 -2
  153. package/build-module/navigation-link/edit.js +37 -12
  154. package/build-module/navigation-link/edit.js.map +2 -2
  155. package/build-module/navigation-link/index.js +11 -8
  156. package/build-module/navigation-link/index.js.map +2 -2
  157. package/build-module/navigation-submenu/index.js +11 -8
  158. package/build-module/navigation-submenu/index.js.map +2 -2
  159. package/build-module/paragraph/deprecated-attributes.js +37 -0
  160. package/build-module/paragraph/deprecated-attributes.js.map +7 -0
  161. package/build-module/paragraph/edit.js +2 -0
  162. package/build-module/paragraph/edit.js.map +2 -2
  163. package/build-module/paragraph/index.js +9 -6
  164. package/build-module/paragraph/index.js.map +2 -2
  165. package/build-module/pattern/block.json +1 -1
  166. package/build-module/preformatted/index.js +9 -6
  167. package/build-module/preformatted/index.js.map +2 -2
  168. package/build-module/pullquote/index.js +11 -11
  169. package/build-module/pullquote/index.js.map +2 -2
  170. package/build-module/search/index.js +14 -16
  171. package/build-module/search/index.js.map +2 -2
  172. package/build-module/social-link/index.js +11 -8
  173. package/build-module/social-link/index.js.map +2 -2
  174. package/build-module/template-part/edit/index.js +37 -7
  175. package/build-module/template-part/edit/index.js.map +2 -2
  176. package/build-module/template-part/edit/utils/hooks.js +2 -3
  177. package/build-module/template-part/edit/utils/hooks.js.map +2 -2
  178. package/build-module/term-count/index.js +1 -0
  179. package/build-module/term-count/index.js.map +2 -2
  180. package/build-module/term-name/index.js +1 -0
  181. package/build-module/term-name/index.js.map +2 -2
  182. package/build-module/verse/index.js +9 -6
  183. package/build-module/verse/index.js.map +2 -2
  184. package/build-module/video/index.js +12 -9
  185. package/build-module/video/index.js.map +2 -2
  186. package/build-style/accordion/style-rtl.css +3 -0
  187. package/build-style/accordion/style.css +3 -0
  188. package/build-style/accordion-heading/style-rtl.css +1 -2
  189. package/build-style/accordion-heading/style.css +1 -2
  190. package/build-style/accordion-item/style-rtl.css +0 -7
  191. package/build-style/accordion-item/style.css +0 -7
  192. package/build-style/accordion-panel/style-rtl.css +1 -4
  193. package/build-style/accordion-panel/style.css +1 -4
  194. package/build-style/cover/style-rtl.css +47 -0
  195. package/build-style/cover/style.css +47 -0
  196. package/build-style/editor-rtl.css +11 -13
  197. package/build-style/editor.css +11 -13
  198. package/build-style/html/editor-rtl.css +11 -13
  199. package/build-style/html/editor.css +11 -13
  200. package/build-style/style-rtl.css +52 -12
  201. package/build-style/style.css +52 -12
  202. package/package.json +37 -37
  203. package/src/accordion/style.scss +4 -0
  204. package/src/accordion/view.js +60 -3
  205. package/src/accordion-heading/block.json +1 -1
  206. package/src/accordion-heading/deprecated.js +1 -1
  207. package/src/accordion-heading/style.scss +1 -9
  208. package/src/accordion-item/index.php +1 -0
  209. package/src/accordion-item/style.scss +2 -9
  210. package/src/accordion-panel/block.json +1 -1
  211. package/src/accordion-panel/style.scss +1 -5
  212. package/src/audio/index.js +13 -9
  213. package/src/breadcrumbs/index.php +71 -82
  214. package/src/button/index.js +14 -10
  215. package/src/code/index.js +10 -6
  216. package/src/cover/edit/block-controls.js +26 -2
  217. package/src/cover/edit/cover-placeholder.js +0 -1
  218. package/src/cover/edit/embed-video-url-input.js +74 -0
  219. package/src/cover/edit/index.js +81 -0
  220. package/src/cover/embed-video-utils.js +196 -0
  221. package/src/cover/index.js +11 -4
  222. package/src/cover/index.php +106 -0
  223. package/src/cover/save.js +14 -0
  224. package/src/cover/shared.js +1 -0
  225. package/src/cover/style.scss +47 -0
  226. package/src/details/index.js +10 -6
  227. package/src/file/index.js +15 -14
  228. package/src/freeform/block.json +1 -1
  229. package/src/gallery/edit.js +0 -2
  230. package/src/heading/index.js +10 -6
  231. package/src/html/editor.scss +10 -15
  232. package/src/html/modal.js +15 -10
  233. package/src/image/edit.js +0 -1
  234. package/src/image/image.js +0 -1
  235. package/src/image/index.js +19 -18
  236. package/src/image/index.php +1 -0
  237. package/src/list-item/index.js +9 -6
  238. package/src/math/block.json +28 -1
  239. package/src/math/edit.js +4 -1
  240. package/src/media-text/index.js +16 -8
  241. package/src/media-text/media-container.js +0 -2
  242. package/src/missing/block.json +1 -1
  243. package/src/missing/edit.js +2 -2
  244. package/src/more/index.js +10 -6
  245. package/src/navigation-link/edit.js +72 -26
  246. package/src/navigation-link/index.js +12 -8
  247. package/src/navigation-submenu/index.js +12 -8
  248. package/src/paragraph/deprecated-attributes.js +45 -0
  249. package/src/paragraph/edit.js +2 -0
  250. package/src/paragraph/index.js +10 -6
  251. package/src/pattern/block.json +1 -1
  252. package/src/preformatted/index.js +10 -6
  253. package/src/pullquote/index.js +12 -11
  254. package/src/search/index.js +14 -15
  255. package/src/social-link/index.js +12 -8
  256. package/src/style.scss +1 -0
  257. package/src/template-part/edit/index.js +44 -6
  258. package/src/template-part/edit/utils/hooks.js +2 -4
  259. package/src/term-count/index.js +1 -0
  260. package/src/term-name/index.js +1 -0
  261. package/src/verse/index.js +10 -6
  262. package/src/video/index.js +13 -9
@@ -596,7 +596,6 @@ export default function GalleryEdit( props ) {
596
596
  instructions: PLACEHOLDER_TEXT,
597
597
  } }
598
598
  onSelect={ updateImages }
599
- accept="image/*"
600
599
  allowedTypes={ ALLOWED_MEDIA_TYPES }
601
600
  multiple
602
601
  onError={ onUploadError }
@@ -910,7 +909,6 @@ export default function GalleryEdit( props ) {
910
909
  <BlockControls group="other">
911
910
  <MediaReplaceFlow
912
911
  allowedTypes={ ALLOWED_MEDIA_TYPES }
913
- accept="image/*"
914
912
  handleUpload={ false }
915
913
  onSelect={ updateImages }
916
914
  name={ __( 'Add' ) }
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { heading as icon } from '@wordpress/icons';
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
+ import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
6
7
 
7
8
  /**
8
9
  * Internal dependencies
@@ -14,6 +15,9 @@ import metadata from './block.json';
14
15
  import save from './save';
15
16
  import transforms from './transforms';
16
17
  import variations from './variations';
18
+ import { unlock } from '../lock-unlock';
19
+
20
+ const { fieldsKey, formKey } = unlock( blocksPrivateApis );
17
21
 
18
22
  const { name } = metadata;
19
23
 
@@ -70,16 +74,16 @@ export const settings = {
70
74
  };
71
75
 
72
76
  if ( window.__experimentalContentOnlyPatternInsertion ) {
73
- settings.fields = [
77
+ settings[ fieldsKey ] = [
74
78
  {
79
+ id: 'content',
75
80
  label: __( 'Content' ),
76
- type: 'RichText',
77
- shownByDefault: true,
78
- mapping: {
79
- value: 'content',
80
- },
81
+ type: 'richtext',
81
82
  },
82
83
  ];
84
+ settings[ formKey ] = {
85
+ fields: [ 'content' ],
86
+ };
83
87
  }
84
88
 
85
89
  export const init = () => initBlock( { name, metadata, settings } );
@@ -14,22 +14,20 @@
14
14
 
15
15
  // Modal styles
16
16
  .block-library-html__modal {
17
- // Make modal content scrollable
18
- .components-modal__content {
19
- display: flex;
20
- flex-direction: column;
21
- padding: 0;
22
- min-height: 70vh;
23
- }
17
+ height: 100%;
24
18
 
25
19
  .components-modal__children-container {
26
20
  height: 100%;
27
- padding: $grid-unit-20;
28
21
  }
29
22
  }
30
23
 
31
24
  .block-library-html__modal-tabs {
32
- height: 100%;
25
+ overflow-y: auto;
26
+ }
27
+
28
+ .block-library-html__modal-content {
29
+ flex: 1;
30
+ min-height: 0;
33
31
  }
34
32
 
35
33
  .block-library-html__modal-tab {
@@ -73,10 +71,7 @@
73
71
  display: flex;
74
72
  align-items: center;
75
73
  justify-content: center;
76
- padding: $grid-unit-60;
77
- }
78
-
79
- .block-library-html__modal-actions {
80
- margin-top: $grid-unit-20;
81
- padding: 0 $grid-unit-40 $grid-unit-40;
74
+ padding: $grid-unit-20;
75
+ flex: 1;
76
+ min-height: 0;
82
77
  }
package/src/html/modal.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  Flex,
11
11
  privateApis as componentsPrivateApis,
12
12
  __experimentalHStack as HStack,
13
- __experimentalVStack as VStack,
13
+ __experimentalGrid as Grid,
14
14
  } from '@wordpress/components';
15
15
  import { PlainText, store as blockEditorStore } from '@wordpress/block-editor';
16
16
  import { fullscreen, square } from '@wordpress/icons';
@@ -117,8 +117,16 @@ export default function HTMLEditModal( {
117
117
  __experimentalHideHeader
118
118
  >
119
119
  <Tabs orientation="horizontal" defaultTabId="html">
120
- <VStack spacing={ 4 } style={ { height: '100%' } }>
121
- <HStack justify="space-between">
120
+ <Grid
121
+ columns={ 1 }
122
+ templateRows="auto 1fr auto"
123
+ gap={ 4 }
124
+ style={ { height: '100%' } }
125
+ >
126
+ <HStack
127
+ justify="space-between"
128
+ className="block-library-html__modal-header"
129
+ >
122
130
  <div>
123
131
  <Tabs.TabList>
124
132
  <Tabs.Tab tabId="html">HTML</Tabs.Tab>
@@ -145,9 +153,8 @@ export default function HTMLEditModal( {
145
153
  justify="flex-start"
146
154
  spacing={ 4 }
147
155
  className="block-library-html__modal-tabs"
148
- style={ { flexGrow: 1 } }
149
156
  >
150
- <div style={ { flexGrow: 1 } }>
157
+ <div className="block-library-html__modal-content">
151
158
  <Tabs.TabPanel
152
159
  tabId="html"
153
160
  focusable={ false }
@@ -192,10 +199,7 @@ export default function HTMLEditModal( {
192
199
  </Tabs.TabPanel>
193
200
  ) }
194
201
  </div>
195
- <div
196
- className="block-library-html__preview"
197
- style={ { width: '50%' } }
198
- >
202
+ <div className="block-library-html__preview">
199
203
  <Preview
200
204
  content={ serializeContent( {
201
205
  html: editedHtml,
@@ -209,6 +213,7 @@ export default function HTMLEditModal( {
209
213
  alignment="center"
210
214
  justify="flex-end"
211
215
  spacing={ 4 }
216
+ className="block-library-html__modal-footer"
212
217
  >
213
218
  <Button
214
219
  __next40pxDefaultSize
@@ -225,7 +230,7 @@ export default function HTMLEditModal( {
225
230
  { __( 'Update' ) }
226
231
  </Button>
227
232
  </HStack>
228
- </VStack>
233
+ </Grid>
229
234
  </Tabs>
230
235
  </Modal>
231
236
 
package/src/image/edit.js CHANGED
@@ -464,7 +464,6 @@ export function ImageEdit( {
464
464
  onSelectURL={ onSelectURL }
465
465
  onError={ onUploadError }
466
466
  placeholder={ placeholder }
467
- accept="image/*"
468
467
  allowedTypes={ ALLOWED_MEDIA_TYPES }
469
468
  handleUpload={ ( files ) => files.length === 1 }
470
469
  value={ { id, src } }
@@ -718,7 +718,6 @@ export default function Image( {
718
718
  mediaId={ id }
719
719
  mediaURL={ url }
720
720
  allowedTypes={ ALLOWED_MEDIA_TYPES }
721
- accept="image/*"
722
721
  onSelect={ onSelectImage }
723
722
  onSelectURL={ onSelectURL }
724
723
  onError={ onUploadError }
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { image as icon } from '@wordpress/icons';
6
+ import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
6
7
 
7
8
  /**
8
9
  * Internal dependencies
@@ -13,6 +14,9 @@ import edit from './edit';
13
14
  import metadata from './block.json';
14
15
  import save from './save';
15
16
  import transforms from './transforms';
17
+ import { unlock } from '../lock-unlock';
18
+
19
+ const { fieldsKey, formKey } = unlock( blocksPrivateApis );
16
20
 
17
21
  const { name } = metadata;
18
22
 
@@ -63,14 +67,14 @@ export const settings = {
63
67
  };
64
68
 
65
69
  if ( window.__experimentalContentOnlyPatternInsertion ) {
66
- settings.fields = [
70
+ settings[ fieldsKey ] = [
67
71
  {
72
+ id: 'image',
68
73
  label: __( 'Image' ),
69
- type: 'Media',
70
- shownByDefault: true,
74
+ type: 'media',
71
75
  mapping: {
72
76
  id: 'id',
73
- src: 'url',
77
+ url: 'url',
74
78
  caption: 'caption',
75
79
  alt: 'alt',
76
80
  },
@@ -80,33 +84,30 @@ if ( window.__experimentalContentOnlyPatternInsertion ) {
80
84
  },
81
85
  },
82
86
  {
87
+ id: 'link',
83
88
  label: __( 'Link' ),
84
- type: 'Link',
85
- shownByDefault: false,
89
+ type: 'link',
86
90
  mapping: {
87
- href: 'href',
91
+ url: 'href',
88
92
  rel: 'rel',
89
- target: 'linkTarget',
93
+ linkTarget: 'linkTarget',
90
94
  destination: 'linkDestination',
91
95
  },
92
96
  },
93
97
  {
98
+ id: 'caption',
94
99
  label: __( 'Caption' ),
95
- type: 'RichText',
96
- shownByDefault: false,
97
- mapping: {
98
- value: 'caption',
99
- },
100
+ type: 'richtext',
100
101
  },
101
102
  {
103
+ id: 'alt',
102
104
  label: __( 'Alt text' ),
103
- type: 'PlainText',
104
- shownByDefault: false,
105
- mapping: {
106
- value: 'alt',
107
- },
105
+ type: 'text',
108
106
  },
109
107
  ];
108
+ settings[ formKey ] = {
109
+ fields: [ 'image' ],
110
+ };
110
111
  }
111
112
 
112
113
  export const init = () => initBlock( { name, metadata, settings } );
@@ -196,6 +196,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
196
196
  $img_styles = $processor->get_attribute( 'style' );
197
197
  $img_width = 'none';
198
198
  $img_height = 'none';
199
+ $img_srcset = false;
199
200
  $aria_label = __( 'Enlarge' );
200
201
  $dialog_aria_label = __( 'Enlarged image' );
201
202
 
@@ -4,6 +4,7 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { listItem as icon } from '@wordpress/icons';
6
6
  import { privateApis } from '@wordpress/block-editor';
7
+ import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
7
8
 
8
9
  /**
9
10
  * Internal dependencies
@@ -15,6 +16,8 @@ import save from './save';
15
16
  import transforms from './transforms';
16
17
  import { unlock } from '../lock-unlock';
17
18
 
19
+ const { fieldsKey, formKey } = unlock( blocksPrivateApis );
20
+
18
21
  const { name } = metadata;
19
22
 
20
23
  export { metadata, name };
@@ -34,16 +37,16 @@ export const settings = {
34
37
  };
35
38
 
36
39
  if ( window.__experimentalContentOnlyPatternInsertion ) {
37
- settings.fields = [
40
+ settings[ fieldsKey ] = [
38
41
  {
42
+ id: 'content',
39
43
  label: __( 'Content' ),
40
- type: 'RichText',
41
- shownByDefault: true,
42
- mapping: {
43
- value: 'content',
44
- },
44
+ type: 'richtext',
45
45
  },
46
46
  ];
47
+ settings[ formKey ] = {
48
+ fields: [ 'content' ],
49
+ };
47
50
  }
48
51
 
49
52
  export const init = () => initBlock( { name, metadata, settings } );
@@ -8,7 +8,34 @@
8
8
  "keywords": [ "equation", "formula", "latex", "mathematics" ],
9
9
  "textdomain": "default",
10
10
  "supports": {
11
- "html": false
11
+ "html": false,
12
+ "__experimentalBorder": {
13
+ "color": true,
14
+ "radius": true,
15
+ "style": true,
16
+ "width": true
17
+ },
18
+ "color": {
19
+ "gradients": true,
20
+ "__experimentalDefaultControls": {
21
+ "background": true,
22
+ "text": true
23
+ }
24
+ },
25
+ "spacing": {
26
+ "margin": true,
27
+ "padding": true,
28
+ "__experimentalDefaultControls": {
29
+ "margin": false,
30
+ "padding": false
31
+ }
32
+ },
33
+ "typography": {
34
+ "fontSize": true,
35
+ "__experimentalDefaultControls": {
36
+ "fontSize": true
37
+ }
38
+ }
12
39
  },
13
40
  "attributes": {
14
41
  "latex": {
package/src/math/edit.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  } from '@wordpress/components';
15
15
  import { useState, useEffect, useRef } from '@wordpress/element';
16
16
  import { useDispatch } from '@wordpress/data';
17
+ import { speak } from '@wordpress/a11y';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -72,7 +73,8 @@ export default function MathEdit( { attributes, setAttributes, isSelected } ) {
72
73
  placement="bottom-start"
73
74
  offset={ 8 }
74
75
  anchor={ blockRef }
75
- focusOnMount="firstContentElement"
76
+ focusOnMount={ false }
77
+ __unstableSlotName="__unstable-block-tools-after"
76
78
  >
77
79
  <div style={ { padding: '4px', minWidth: '300px' } }>
78
80
  <VStack spacing={ 1 }>
@@ -96,6 +98,7 @@ export default function MathEdit( { attributes, setAttributes, isSelected } ) {
96
98
  setError( null );
97
99
  } catch ( err ) {
98
100
  setError( err.message );
101
+ speak( err.message );
99
102
  }
100
103
  setAttributes( {
101
104
  mathML: newMathML,
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { mediaAndText as icon } from '@wordpress/icons';
6
+ import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
6
7
 
7
8
  /**
8
9
  * Internal dependencies
@@ -13,6 +14,9 @@ import edit from './edit';
13
14
  import metadata from './block.json';
14
15
  import save from './save';
15
16
  import transforms from './transforms';
17
+ import { unlock } from '../lock-unlock';
18
+
19
+ const { fieldsKey, formKey } = unlock( blocksPrivateApis );
16
20
 
17
21
  const { name } = metadata;
18
22
 
@@ -51,15 +55,16 @@ export const settings = {
51
55
  };
52
56
 
53
57
  if ( window.__experimentalContentOnlyPatternInsertion ) {
54
- settings.fields = [
58
+ settings[ fieldsKey ] = [
55
59
  {
60
+ id: 'media',
56
61
  label: __( 'Media' ),
57
- type: 'Media',
58
- shownByDefault: true,
62
+ type: 'media',
59
63
  mapping: {
60
64
  id: 'mediaId',
61
65
  type: 'mediaType',
62
- src: 'mediaUrl',
66
+ url: 'mediaUrl',
67
+ link: 'mediaLink',
63
68
  },
64
69
  args: {
65
70
  allowedTypes: [ 'image', 'video' ],
@@ -67,16 +72,19 @@ if ( window.__experimentalContentOnlyPatternInsertion ) {
67
72
  },
68
73
  },
69
74
  {
75
+ id: 'link',
70
76
  label: __( 'Link' ),
71
- type: 'Link',
72
- shownByDefault: false,
77
+ type: 'link',
73
78
  mapping: {
74
- href: 'href',
79
+ url: 'href',
75
80
  rel: 'rel',
76
- target: 'linkTarget',
81
+ linkTarget: 'linkTarget',
77
82
  },
78
83
  },
79
84
  ];
85
+ settings[ formKey ] = {
86
+ fields: [ 'media' ],
87
+ };
80
88
  }
81
89
 
82
90
  export const init = () => initBlock( { name, metadata, settings } );
@@ -61,7 +61,6 @@ function ToolbarEditButton( {
61
61
  mediaId={ mediaId }
62
62
  mediaURL={ mediaUrl }
63
63
  allowedTypes={ ALLOWED_MEDIA_TYPES }
64
- accept="image/*,video/*"
65
64
  onSelect={ onSelectMedia }
66
65
  onToggleFeaturedImage={ toggleUseFeaturedImage }
67
66
  useFeaturedImage={ useFeaturedImage }
@@ -91,7 +90,6 @@ function PlaceholderContainer( {
91
90
  } }
92
91
  className={ className }
93
92
  onSelect={ onSelectMedia }
94
- accept="image/*,video/*"
95
93
  onToggleFeaturedImage={ toggleUseFeaturedImage }
96
94
  allowedTypes={ ALLOWED_MEDIA_TYPES }
97
95
  onError={ onUploadError }
@@ -26,7 +26,7 @@
26
26
  "lock": false,
27
27
  "reusable": false,
28
28
  "renaming": false,
29
- "blockVisibility": false,
29
+ "visibility": false,
30
30
  "interactivity": {
31
31
  "clientNavigation": true
32
32
  }
@@ -66,12 +66,12 @@ export default function MissingEdit( { attributes, clientId } ) {
66
66
  ) {
67
67
  if ( hasHTMLBlock ) {
68
68
  messageHTML = __(
69
- 'It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.'
69
+ 'It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, if you have unsaved changes, you can save them and refresh to use the Classic block.'
70
70
  );
71
71
  actions.push( convertToHtmlButton );
72
72
  } else {
73
73
  messageHTML = __(
74
- 'It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.'
74
+ 'It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, if you have unsaved changes, you can save them and refresh to use the Classic block.'
75
75
  );
76
76
  }
77
77
  } else if ( hasContent && hasHTMLBlock ) {
package/src/more/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { more as icon } from '@wordpress/icons';
5
5
  import { __ } from '@wordpress/i18n';
6
+ import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
6
7
 
7
8
  /**
8
9
  * Internal dependencies
@@ -12,6 +13,9 @@ import edit from './edit';
12
13
  import metadata from './block.json';
13
14
  import save from './save';
14
15
  import transforms from './transforms';
16
+ import { unlock } from '../lock-unlock';
17
+
18
+ const { fieldsKey, formKey } = unlock( blocksPrivateApis );
15
19
 
16
20
  const { name } = metadata;
17
21
 
@@ -37,16 +41,16 @@ export const settings = {
37
41
  };
38
42
 
39
43
  if ( window.__experimentalContentOnlyPatternInsertion ) {
40
- settings.fields = [
44
+ settings[ fieldsKey ] = [
41
45
  {
46
+ id: 'customText',
42
47
  label: __( 'Content' ),
43
- type: 'RichText',
44
- shownByDefault: true,
45
- mapping: {
46
- value: 'customText',
47
- },
48
+ type: 'richtext',
48
49
  },
49
50
  ];
51
+ settings[ formKey ] = {
52
+ fields: [ 'customText' ],
53
+ };
50
54
  }
51
55
 
52
56
  export const init = () => initBlock( { name, metadata, settings } );