@wordpress/block-library 8.7.0 → 8.8.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 (270) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/column/index.js +2 -1
  3. package/build/column/index.js.map +1 -1
  4. package/build/columns/edit.js +24 -6
  5. package/build/columns/edit.js.map +1 -1
  6. package/build/columns/index.js +2 -1
  7. package/build/columns/index.js.map +1 -1
  8. package/build/columns/utils.js +4 -9
  9. package/build/columns/utils.js.map +1 -1
  10. package/build/cover/edit/index.js +46 -50
  11. package/build/cover/edit/index.js.map +1 -1
  12. package/build/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +32 -6
  13. package/build/cover/edit/resizable-cover-popover.js.map +1 -0
  14. package/build/cover/index.js +12 -0
  15. package/build/cover/index.js.map +1 -1
  16. package/build/details/edit.js +67 -0
  17. package/build/details/edit.js.map +1 -0
  18. package/build/details/index.js +110 -0
  19. package/build/details/index.js.map +1 -0
  20. package/build/details/save.js +33 -0
  21. package/build/details/save.js.map +1 -0
  22. package/build/details-content/edit.js +34 -0
  23. package/build/details-content/edit.js.map +1 -0
  24. package/build/details-content/index.js +94 -0
  25. package/build/details-content/index.js.map +1 -0
  26. package/build/details-content/save.js +20 -0
  27. package/build/details-content/save.js.map +1 -0
  28. package/build/details-summary/edit.js +42 -0
  29. package/build/details-summary/edit.js.map +1 -0
  30. package/build/details-summary/index.js +97 -0
  31. package/build/details-summary/index.js.map +1 -0
  32. package/build/details-summary/save.js +24 -0
  33. package/build/details-summary/save.js.map +1 -0
  34. package/build/embed/deprecated.js +4 -1
  35. package/build/embed/deprecated.js.map +1 -1
  36. package/build/embed/embed-link-settings.native.js +1 -1
  37. package/build/embed/embed-link-settings.native.js.map +1 -1
  38. package/build/embed/embed-placeholder.js +1 -1
  39. package/build/embed/embed-placeholder.js.map +1 -1
  40. package/build/embed/index.js +4 -1
  41. package/build/embed/index.js.map +1 -1
  42. package/build/embed/transforms.js +4 -1
  43. package/build/embed/transforms.js.map +1 -1
  44. package/build/embed/util.js +4 -1
  45. package/build/embed/util.js.map +1 -1
  46. package/build/file/edit.native.js +0 -2
  47. package/build/file/edit.native.js.map +1 -1
  48. package/build/gallery/use-get-media.native.js +2 -1
  49. package/build/gallery/use-get-media.native.js.map +1 -1
  50. package/build/image/index.js +4 -2
  51. package/build/image/index.js.map +1 -1
  52. package/build/index.js +24 -6
  53. package/build/index.js.map +1 -1
  54. package/build/media-text/media-container.js +2 -6
  55. package/build/media-text/media-container.js.map +1 -1
  56. package/build/media-text/media-container.native.js +3 -3
  57. package/build/media-text/media-container.native.js.map +1 -1
  58. package/build/navigation/deprecated.js +8 -11
  59. package/build/navigation/deprecated.js.map +1 -1
  60. package/build/navigation/edit/unsaved-inner-blocks.js +1 -14
  61. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  62. package/build/post-author/index.js +0 -1
  63. package/build/post-author/index.js.map +1 -1
  64. package/build/post-featured-image/dimension-controls.js +2 -1
  65. package/build/post-featured-image/dimension-controls.js.map +1 -1
  66. package/build/post-featured-image/edit.js +8 -22
  67. package/build/post-featured-image/edit.js.map +1 -1
  68. package/build/post-time-to-read/edit.js +1 -1
  69. package/build/post-time-to-read/edit.js.map +1 -1
  70. package/build/post-time-to-read/index.js +7 -0
  71. package/build/post-time-to-read/index.js.map +1 -1
  72. package/build/spacer/controls.js +25 -6
  73. package/build/spacer/controls.js.map +1 -1
  74. package/build/spacer/edit.js +14 -4
  75. package/build/spacer/edit.js.map +1 -1
  76. package/build/spacer/save.js +2 -2
  77. package/build/spacer/save.js.map +1 -1
  78. package/build/table/state.js +35 -35
  79. package/build/table/state.js.map +1 -1
  80. package/build/term-description/index.js +1 -2
  81. package/build/term-description/index.js.map +1 -1
  82. package/build/utils/clean-empty-object.js +5 -2
  83. package/build/utils/clean-empty-object.js.map +1 -1
  84. package/build-module/column/index.js +2 -1
  85. package/build-module/column/index.js.map +1 -1
  86. package/build-module/columns/edit.js +24 -6
  87. package/build-module/columns/edit.js.map +1 -1
  88. package/build-module/columns/index.js +2 -1
  89. package/build-module/columns/index.js.map +1 -1
  90. package/build-module/columns/utils.js +4 -8
  91. package/build-module/columns/utils.js.map +1 -1
  92. package/build-module/cover/edit/index.js +48 -52
  93. package/build-module/cover/edit/index.js.map +1 -1
  94. package/build-module/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +31 -6
  95. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -0
  96. package/build-module/cover/index.js +12 -0
  97. package/build-module/cover/index.js.map +1 -1
  98. package/build-module/details/edit.js +52 -0
  99. package/build-module/details/edit.js.map +1 -0
  100. package/build-module/details/index.js +91 -0
  101. package/build-module/details/index.js.map +1 -0
  102. package/build-module/details/save.js +20 -0
  103. package/build-module/details/save.js.map +1 -0
  104. package/build-module/details-content/edit.js +23 -0
  105. package/build-module/details-content/edit.js.map +1 -0
  106. package/build-module/details-content/index.js +76 -0
  107. package/build-module/details-content/index.js.map +1 -0
  108. package/build-module/details-content/save.js +11 -0
  109. package/build-module/details-content/save.js.map +1 -0
  110. package/build-module/details-summary/edit.js +30 -0
  111. package/build-module/details-summary/edit.js.map +1 -0
  112. package/build-module/details-summary/index.js +79 -0
  113. package/build-module/details-summary/index.js.map +1 -0
  114. package/build-module/details-summary/save.js +16 -0
  115. package/build-module/details-summary/save.js.map +1 -0
  116. package/build-module/embed/deprecated.js +4 -1
  117. package/build-module/embed/deprecated.js.map +1 -1
  118. package/build-module/embed/embed-link-settings.native.js +1 -1
  119. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  120. package/build-module/embed/embed-placeholder.js +1 -1
  121. package/build-module/embed/embed-placeholder.js.map +1 -1
  122. package/build-module/embed/index.js +4 -1
  123. package/build-module/embed/index.js.map +1 -1
  124. package/build-module/embed/transforms.js +4 -1
  125. package/build-module/embed/transforms.js.map +1 -1
  126. package/build-module/embed/util.js +4 -1
  127. package/build-module/embed/util.js.map +1 -1
  128. package/build-module/file/edit.native.js +0 -2
  129. package/build-module/file/edit.native.js.map +1 -1
  130. package/build-module/gallery/use-get-media.native.js +2 -1
  131. package/build-module/gallery/use-get-media.native.js.map +1 -1
  132. package/build-module/image/index.js +4 -2
  133. package/build-module/image/index.js.map +1 -1
  134. package/build-module/index.js +21 -6
  135. package/build-module/index.js.map +1 -1
  136. package/build-module/media-text/media-container.js +1 -5
  137. package/build-module/media-text/media-container.js.map +1 -1
  138. package/build-module/media-text/media-container.native.js +1 -1
  139. package/build-module/media-text/media-container.native.js.map +1 -1
  140. package/build-module/navigation/deprecated.js +8 -10
  141. package/build-module/navigation/deprecated.js.map +1 -1
  142. package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -14
  143. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  144. package/build-module/post-author/index.js +0 -1
  145. package/build-module/post-author/index.js.map +1 -1
  146. package/build-module/post-featured-image/dimension-controls.js +2 -1
  147. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  148. package/build-module/post-featured-image/edit.js +8 -22
  149. package/build-module/post-featured-image/edit.js.map +1 -1
  150. package/build-module/post-time-to-read/edit.js +1 -1
  151. package/build-module/post-time-to-read/edit.js.map +1 -1
  152. package/build-module/post-time-to-read/index.js +7 -0
  153. package/build-module/post-time-to-read/index.js.map +1 -1
  154. package/build-module/spacer/controls.js +27 -9
  155. package/build-module/spacer/controls.js.map +1 -1
  156. package/build-module/spacer/edit.js +14 -5
  157. package/build-module/spacer/edit.js.map +1 -1
  158. package/build-module/spacer/save.js +3 -3
  159. package/build-module/spacer/save.js.map +1 -1
  160. package/build-module/table/state.js +35 -33
  161. package/build-module/table/state.js.map +1 -1
  162. package/build-module/term-description/index.js +1 -2
  163. package/build-module/term-description/index.js.map +1 -1
  164. package/build-module/utils/clean-empty-object.js +6 -3
  165. package/build-module/utils/clean-empty-object.js.map +1 -1
  166. package/build-style/columns/style-rtl.css +4 -1
  167. package/build-style/columns/style.css +4 -1
  168. package/build-style/common-rtl.css +1 -1
  169. package/build-style/common.css +1 -1
  170. package/build-style/cover/editor-rtl.css +11 -12
  171. package/build-style/cover/editor.css +11 -12
  172. package/build-style/cover/style-rtl.css +3 -2
  173. package/build-style/cover/style.css +3 -2
  174. package/build-style/details/style-rtl.css +91 -0
  175. package/build-style/details/style.css +91 -0
  176. package/build-style/details-summary/editor-rtl.css +91 -0
  177. package/build-style/details-summary/editor.css +91 -0
  178. package/build-style/details-summary/style-rtl.css +91 -0
  179. package/build-style/details-summary/style.css +91 -0
  180. package/build-style/editor-rtl.css +34 -48
  181. package/build-style/editor.css +34 -48
  182. package/build-style/file/style-rtl.css +4 -3
  183. package/build-style/file/style.css +4 -3
  184. package/build-style/post-excerpt/style-rtl.css +1 -1
  185. package/build-style/post-excerpt/style.css +1 -1
  186. package/build-style/pullquote/style-rtl.css +4 -1
  187. package/build-style/pullquote/style.css +4 -1
  188. package/build-style/shortcode/editor-rtl.css +15 -34
  189. package/build-style/shortcode/editor.css +15 -34
  190. package/build-style/spacer/editor-rtl.css +4 -2
  191. package/build-style/spacer/editor.css +4 -2
  192. package/build-style/style-rtl.css +25 -9
  193. package/build-style/style.css +25 -9
  194. package/package.json +31 -31
  195. package/src/column/block.json +2 -1
  196. package/src/columns/block.json +2 -1
  197. package/src/columns/edit.js +33 -9
  198. package/src/columns/style.scss +5 -1
  199. package/src/columns/utils.js +8 -9
  200. package/src/common.scss +1 -1
  201. package/src/cover/block.json +12 -0
  202. package/src/cover/edit/index.js +44 -37
  203. package/src/cover/edit/resizable-cover-popover.js +82 -0
  204. package/src/cover/editor.scss +20 -13
  205. package/src/cover/index.php +9 -10
  206. package/src/cover/style.scss +2 -1
  207. package/src/cover/test/edit.js +1 -1
  208. package/src/details/block.json +54 -0
  209. package/src/details/edit.js +59 -0
  210. package/src/details/index.js +35 -0
  211. package/src/details/save.js +15 -0
  212. package/src/details/style.scss +3 -0
  213. package/src/details-content/block.json +50 -0
  214. package/src/details-content/edit.js +29 -0
  215. package/src/details-content/index.js +23 -0
  216. package/src/details-content/save.js +12 -0
  217. package/src/details-summary/block.json +53 -0
  218. package/src/details-summary/edit.js +27 -0
  219. package/src/details-summary/editor.scss +3 -0
  220. package/src/details-summary/index.js +23 -0
  221. package/src/details-summary/save.js +13 -0
  222. package/src/details-summary/style.scss +3 -0
  223. package/src/editor.scss +1 -0
  224. package/src/embed/block.json +4 -1
  225. package/src/embed/embed-link-settings.native.js +1 -1
  226. package/src/embed/embed-placeholder.js +1 -1
  227. package/src/file/edit.native.js +0 -2
  228. package/src/file/style.scss +5 -2
  229. package/src/gallery/test/use-get-media.native.js +24 -0
  230. package/src/gallery/use-get-media.native.js +1 -1
  231. package/src/image/block.json +4 -2
  232. package/src/index.js +13 -3
  233. package/src/media-text/media-container.js +1 -5
  234. package/src/media-text/media-container.native.js +1 -1
  235. package/src/navigation/deprecated.js +15 -19
  236. package/src/navigation/edit/unsaved-inner-blocks.js +34 -46
  237. package/src/navigation/index.php +0 -4
  238. package/src/paragraph/test/edit.native.js +356 -1
  239. package/src/post-author/block.json +0 -1
  240. package/src/post-excerpt/index.php +3 -3
  241. package/src/post-excerpt/style.scss +2 -1
  242. package/src/post-featured-image/dimension-controls.js +5 -1
  243. package/src/post-featured-image/edit.js +8 -29
  244. package/src/post-time-to-read/block.json +7 -0
  245. package/src/post-time-to-read/edit.js +1 -1
  246. package/src/post-time-to-read/index.php +3 -3
  247. package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -2
  248. package/src/preformatted/test/edit.native.js +45 -2
  249. package/src/pullquote/style.scss +5 -1
  250. package/src/pullquote/test/edit.native.js +70 -0
  251. package/src/quote/test/edit.native.js +92 -0
  252. package/src/search/index.php +1 -1
  253. package/src/shortcode/editor.scss +26 -5
  254. package/src/spacer/controls.js +42 -17
  255. package/src/spacer/edit.js +23 -4
  256. package/src/spacer/editor.scss +2 -1
  257. package/src/spacer/save.js +3 -3
  258. package/src/style.scss +2 -0
  259. package/src/table/state.js +83 -66
  260. package/src/term-description/block.json +1 -2
  261. package/src/utils/clean-empty-object.js +4 -4
  262. package/src/verse/test/edit.native.js +33 -0
  263. package/build/cover/edit/resizable-cover.js.map +0 -1
  264. package/build/media-text/media-container-icon.js +0 -27
  265. package/build/media-text/media-container-icon.js.map +0 -1
  266. package/build-module/cover/edit/resizable-cover.js.map +0 -1
  267. package/build-module/media-text/media-container-icon.js +0 -17
  268. package/build-module/media-text/media-container-icon.js.map +0 -1
  269. package/src/cover/edit/resizable-cover.js +0 -61
  270. package/src/media-text/media-container-icon.js +0 -12
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`core/more/edit/native should match snapshot when content is empty 1`] = `
3
+ exports[`Preformatted should match snapshot when content is empty 1`] = `
4
4
  <View
5
5
  style={
6
6
  [
@@ -46,7 +46,7 @@ exports[`core/more/edit/native should match snapshot when content is empty 1`] =
46
46
  </View>
47
47
  `;
48
48
 
49
- exports[`core/more/edit/native should match snapshot when content is not empty 1`] = `
49
+ exports[`Preformatted should match snapshot when content is not empty 1`] = `
50
50
  <View
51
51
  style={
52
52
  [
@@ -1,14 +1,29 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render } from 'test/helpers';
4
+ import {
5
+ addBlock,
6
+ changeAndSelectTextOfRichText,
7
+ fireEvent,
8
+ getEditorHtml,
9
+ initializeEditor,
10
+ render,
11
+ setupCoreBlocks,
12
+ } from 'test/helpers';
13
+
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+ import { ENTER } from '@wordpress/keycodes';
5
18
 
6
19
  /**
7
20
  * Internal dependencies
8
21
  */
9
22
  import PreformattedEdit from '../edit';
10
23
 
11
- describe( 'core/more/edit/native', () => {
24
+ setupCoreBlocks();
25
+
26
+ describe( 'Preformatted', () => {
12
27
  it( 'renders without crashing', () => {
13
28
  const screen = render(
14
29
  <PreformattedEdit
@@ -42,4 +57,32 @@ describe( 'core/more/edit/native', () => {
42
57
  );
43
58
  expect( screen.toJSON() ).toMatchSnapshot();
44
59
  } );
60
+
61
+ it( 'should produce expected markup for multiline text', async () => {
62
+ // Arrange
63
+ const screen = await initializeEditor();
64
+
65
+ // Act
66
+ await addBlock( screen, 'Preformatted' );
67
+ const verseTextInput = await screen.findByPlaceholderText(
68
+ 'Write preformatted text…'
69
+ );
70
+ const string = 'A great statement.';
71
+ changeAndSelectTextOfRichText( verseTextInput, string, {
72
+ selectionStart: string.length,
73
+ selectionEnd: string.length,
74
+ } );
75
+ fireEvent( verseTextInput, 'onKeyDown', {
76
+ nativeEvent: {},
77
+ preventDefault() {},
78
+ keyCode: ENTER,
79
+ } );
80
+
81
+ // Assert
82
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
83
+ "<!-- wp:preformatted -->
84
+ <pre class="wp-block-preformatted">A great statement.<br></pre>
85
+ <!-- /wp:preformatted -->"
86
+ ` );
87
+ } );
45
88
  } );
@@ -1,5 +1,4 @@
1
1
  .wp-block-pullquote {
2
- margin: 0 0 1em 0;
3
2
  padding: 3em 0;
4
3
  text-align: center; // Default text-alignment where the `textAlign` attribute value isn't specified.
5
4
  overflow-wrap: break-word; // Break long strings of text without spaces so they don't overflow the block.
@@ -25,6 +24,11 @@
25
24
  }
26
25
  }
27
26
 
27
+ // Lowest specificity to avoid overriding layout styles.
28
+ :where(.wp-block-pullquote) {
29
+ margin: 0 0 1em 0;
30
+ }
31
+
28
32
  // Ensure that we are reasonably specific to override theme defaults.
29
33
  .wp-block-pullquote.has-text-align-left blockquote {
30
34
  text-align: left;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ addBlock,
6
+ getBlock,
7
+ initializeEditor,
8
+ setupCoreBlocks,
9
+ getEditorHtml,
10
+ fireEvent,
11
+ within,
12
+ waitFor,
13
+ changeAndSelectTextOfRichText,
14
+ } from 'test/helpers';
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+ import { ENTER } from '@wordpress/keycodes';
20
+
21
+ setupCoreBlocks();
22
+
23
+ describe( 'Pullquote', () => {
24
+ it( 'should produce expected markup for multiline text', async () => {
25
+ // Arrange
26
+ const screen = await initializeEditor();
27
+ await addBlock( screen, 'Pullquote' );
28
+ // Await inner blocks to be rendered
29
+ const citationBlock = await waitFor( () =>
30
+ screen.getByPlaceholderText( 'Add citation' )
31
+ );
32
+
33
+ // Act
34
+ const pullquoteBlock = getBlock( screen, 'Pullquote' );
35
+ fireEvent.press( pullquoteBlock );
36
+ const pullquoteTextInput =
37
+ within( pullquoteBlock ).getByPlaceholderText( 'Add quote' );
38
+ const string = 'A great statement.';
39
+ changeAndSelectTextOfRichText( pullquoteTextInput, string, {
40
+ selectionStart: string.length,
41
+ selectionEnd: string.length,
42
+ } );
43
+ fireEvent( pullquoteTextInput, 'onKeyDown', {
44
+ nativeEvent: {},
45
+ preventDefault() {},
46
+ keyCode: ENTER,
47
+ } );
48
+
49
+ // TODO: Determine a way to type after pressing ENTER within the block.
50
+
51
+ const citationTextInput =
52
+ within( citationBlock ).getByPlaceholderText( 'Add citation' );
53
+ changeAndSelectTextOfRichText( citationTextInput, 'A person', {
54
+ selectionStart: 2,
55
+ selectionEnd: 2,
56
+ } );
57
+ fireEvent( citationTextInput, 'onKeyDown', {
58
+ nativeEvent: {},
59
+ preventDefault() {},
60
+ keyCode: ENTER,
61
+ } );
62
+
63
+ // Assert
64
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
65
+ "<!-- wp:pullquote -->
66
+ <figure class="wp-block-pullquote"><blockquote><p>A great statement.<br></p><cite>A <br>person</cite></blockquote></figure>
67
+ <!-- /wp:pullquote -->"
68
+ ` );
69
+ } );
70
+ } );
@@ -0,0 +1,92 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ addBlock,
6
+ getBlock,
7
+ initializeEditor,
8
+ setupCoreBlocks,
9
+ getEditorHtml,
10
+ fireEvent,
11
+ within,
12
+ waitFor,
13
+ changeAndSelectTextOfRichText,
14
+ } from 'test/helpers';
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+ import { ENTER } from '@wordpress/keycodes';
20
+
21
+ setupCoreBlocks();
22
+
23
+ describe( 'Quote', () => {
24
+ it( 'should produce expected markup for multiline text', async () => {
25
+ // Arrange
26
+ const screen = await initializeEditor();
27
+ await addBlock( screen, 'Quote' );
28
+ const quoteBlock = getBlock( screen, 'Quote' );
29
+ // A layout event must be explicitly dispatched in BlockList component,
30
+ // otherwise the inner blocks are not rendered.
31
+ fireEvent(
32
+ within( quoteBlock ).getByTestId( 'block-list-wrapper' ),
33
+ 'layout',
34
+ {
35
+ nativeEvent: {
36
+ layout: {
37
+ width: 320,
38
+ },
39
+ },
40
+ }
41
+ );
42
+ // Await inner blocks to be rendered
43
+ const citationBlock = await waitFor( () =>
44
+ screen.getByPlaceholderText( 'Add citation' )
45
+ );
46
+
47
+ // Act
48
+ fireEvent.press( quoteBlock );
49
+ // screen.debug();
50
+ let quoteTextInput =
51
+ within( quoteBlock ).getByPlaceholderText( 'Start writing…' );
52
+ const string = 'A great statement.';
53
+ changeAndSelectTextOfRichText( quoteTextInput, string, {
54
+ selectionStart: string.length,
55
+ selectionEnd: string.length,
56
+ } );
57
+ fireEvent( quoteTextInput, 'onKeyDown', {
58
+ nativeEvent: {},
59
+ preventDefault() {},
60
+ keyCode: ENTER,
61
+ } );
62
+ quoteTextInput =
63
+ within( quoteBlock ).getAllByPlaceholderText(
64
+ 'Start writing…'
65
+ )[ 1 ];
66
+ changeAndSelectTextOfRichText( quoteTextInput, 'Again.' );
67
+ const citationTextInput =
68
+ within( citationBlock ).getByPlaceholderText( 'Add citation' );
69
+ changeAndSelectTextOfRichText( citationTextInput, 'A person', {
70
+ selectionStart: 2,
71
+ selectionEnd: 2,
72
+ } );
73
+ fireEvent( citationTextInput, 'onKeyDown', {
74
+ nativeEvent: {},
75
+ preventDefault() {},
76
+ keyCode: ENTER,
77
+ } );
78
+
79
+ // Assert
80
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
81
+ "<!-- wp:quote -->
82
+ <blockquote class="wp-block-quote"><!-- wp:paragraph -->
83
+ <p>A great statement.</p>
84
+ <!-- /wp:paragraph -->
85
+
86
+ <!-- wp:paragraph -->
87
+ <p>Again.</p>
88
+ <!-- /wp:paragraph --><cite>A <br>person</cite></blockquote>
89
+ <!-- /wp:quote -->"
90
+ ` );
91
+ } );
92
+ } );
@@ -116,7 +116,7 @@ function render_block_core_search( $attributes ) {
116
116
 
117
117
  $button_internal_markup =
118
118
  '<svg class="search-icon" viewBox="0 0 24 24" width="24" height="24">
119
- <path d="M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"></path>
119
+ <path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"></path>
120
120
  </svg>';
121
121
  }
122
122
 
@@ -1,13 +1,34 @@
1
1
  [data-type="core/shortcode"] {
2
- .block-editor-plain-text {
3
- max-height: 250px;
4
- }
5
-
6
2
  &.components-placeholder {
7
3
  min-height: 0;
8
4
  }
9
5
  }
10
6
 
7
+ // The editing view for the Shortcode block is equivalent to block UI.
8
+ // Therefore we increase specificity to avoid theme styles bleeding in.
11
9
  .blocks-shortcode__textarea {
12
- @include input-control;
10
+ font-family: $editor-html-font !important;
11
+ color: $gray-900 !important;
12
+ background: $white !important;
13
+ padding: $grid-unit-15 !important;
14
+ border: $border-width solid $gray-900 !important;
15
+ box-shadow: none !important;
16
+ border-radius: $radius-block-ui !important;
17
+ box-sizing: border-box;
18
+ max-height: 250px;
19
+ resize: none;
20
+
21
+ /* Fonts smaller than 16px causes mobile safari to zoom. */
22
+ font-size: $mobile-text-min-font-size !important;
23
+ @include break-small {
24
+ font-size: $default-font-size !important;
25
+ }
26
+
27
+ &:focus {
28
+ border-color: var(--wp-admin-theme-color) !important;
29
+ box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;
30
+
31
+ // Windows High Contrast mode will show this outline, but not the box-shadow.
32
+ outline: 2px solid transparent !important;
33
+ }
13
34
  }
@@ -2,14 +2,21 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { InspectorControls, useSetting } from '@wordpress/block-editor';
6
5
  import {
6
+ InspectorControls,
7
+ useSetting,
8
+ __experimentalSpacingSizesControl as SpacingSizesControl,
9
+ isValueSpacingPreset,
10
+ } from '@wordpress/block-editor';
11
+ import {
12
+ BaseControl,
7
13
  PanelBody,
8
14
  __experimentalUseCustomUnits as useCustomUnits,
9
15
  __experimentalUnitControl as UnitControl,
10
16
  __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
11
17
  } from '@wordpress/components';
12
18
  import { useInstanceId } from '@wordpress/compose';
19
+ import { View } from '@wordpress/primitives';
13
20
 
14
21
  /**
15
22
  * Internal dependencies
@@ -18,7 +25,7 @@ import { MIN_SPACER_SIZE } from './constants';
18
25
 
19
26
  function DimensionInput( { label, onChange, isResizing, value = '' } ) {
20
27
  const inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );
21
-
28
+ const spacingSizes = useSetting( 'spacing.spacingSizes' );
22
29
  // In most contexts the spacer size cannot meaningfully be set to a
23
30
  // percentage, since this is relative to the parent container. This
24
31
  // unit is disabled from the UI.
@@ -38,28 +45,46 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
38
45
  } );
39
46
 
40
47
  const handleOnChange = ( unprocessedValue ) => {
41
- onChange( unprocessedValue );
48
+ onChange( unprocessedValue.all );
42
49
  };
43
50
 
44
51
  // Force the unit to update to `px` when the Spacer is being resized.
45
52
  const [ parsedQuantity, parsedUnit ] =
46
53
  parseQuantityAndUnitFromRawValue( value );
47
- const computedValue = [
48
- parsedQuantity,
49
- isResizing ? 'px' : parsedUnit,
50
- ].join( '' );
54
+ const computedValue = isValueSpacingPreset( value )
55
+ ? value
56
+ : [ parsedQuantity, isResizing ? 'px' : parsedUnit ].join( '' );
51
57
 
52
58
  return (
53
- <UnitControl
54
- label={ label }
55
- id={ inputId }
56
- isResetValueOnUnitChange
57
- min={ MIN_SPACER_SIZE }
58
- onChange={ handleOnChange }
59
- __unstableInputWidth={ '80px' }
60
- value={ computedValue }
61
- units={ units }
62
- />
59
+ <>
60
+ { ( ! spacingSizes || spacingSizes?.length === 0 ) && (
61
+ <BaseControl label={ label } id={ inputId }>
62
+ <UnitControl
63
+ id={ inputId }
64
+ isResetValueOnUnitChange
65
+ min={ MIN_SPACER_SIZE }
66
+ onChange={ handleOnChange }
67
+ style={ { maxWidth: 80 } }
68
+ value={ computedValue }
69
+ units={ units }
70
+ />
71
+ </BaseControl>
72
+ ) }
73
+
74
+ { spacingSizes?.length > 0 && (
75
+ <View className="tools-panel-item-spacing">
76
+ <SpacingSizesControl
77
+ values={ { all: computedValue } }
78
+ onChange={ handleOnChange }
79
+ label={ label }
80
+ sides={ [ 'all' ] }
81
+ units={ units }
82
+ allowReset={ false }
83
+ splitOnAxis={ false }
84
+ />
85
+ </View>
86
+ ) }
87
+ </>
63
88
  );
64
89
  }
65
90
 
@@ -6,10 +6,15 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useBlockProps } from '@wordpress/block-editor';
9
+ import {
10
+ useBlockProps,
11
+ getSpacingPresetCssVar,
12
+ store as blockEditorStore,
13
+ } from '@wordpress/block-editor';
10
14
  import { ResizableBox } from '@wordpress/components';
11
15
  import { useState, useEffect } from '@wordpress/element';
12
16
  import { View } from '@wordpress/primitives';
17
+ import { useSelect } from '@wordpress/data';
13
18
 
14
19
  /**
15
20
  * Internal dependencies
@@ -79,7 +84,12 @@ const SpacerEdit = ( {
79
84
  toggleSelection,
80
85
  context,
81
86
  __unstableParentLayout: parentLayout,
87
+ className,
82
88
  } ) => {
89
+ const disableCustomSpacingSizes = useSelect( ( select ) => {
90
+ const editorSettings = select( blockEditorStore ).getSettings();
91
+ return editorSettings?.disableCustomSpacingSizes;
92
+ } );
83
93
  const { orientation } = context;
84
94
  const { orientation: parentOrientation, type } = parentLayout || {};
85
95
  // If the spacer is inside a flex container, it should either inherit the orientation
@@ -114,10 +124,12 @@ const SpacerEdit = ( {
114
124
  height:
115
125
  inheritedOrientation === 'horizontal'
116
126
  ? 24
117
- : temporaryHeight || height || undefined,
127
+ : temporaryHeight ||
128
+ getSpacingPresetCssVar( height ) ||
129
+ undefined,
118
130
  width:
119
131
  inheritedOrientation === 'horizontal'
120
- ? temporaryWidth || width || undefined
132
+ ? temporaryWidth || getSpacingPresetCssVar( width ) || undefined
121
133
  : undefined,
122
134
  // In vertical flex containers, the spacer shrinks to nothing without a minimum width.
123
135
  minWidth:
@@ -189,7 +201,14 @@ const SpacerEdit = ( {
189
201
 
190
202
  return (
191
203
  <>
192
- <View { ...useBlockProps( { style } ) }>
204
+ <View
205
+ { ...useBlockProps( {
206
+ style,
207
+ className: classnames( className, {
208
+ 'custom-sizes-disabled': disableCustomSpacingSizes,
209
+ } ),
210
+ } ) }
211
+ >
193
212
  { resizableBoxWithOrientation( inheritedOrientation ) }
194
213
  </View>
195
214
  <SpacerControls
@@ -17,7 +17,8 @@
17
17
  }
18
18
 
19
19
  .wp-block-spacer.is-hovered .block-library-spacer__resize-container,
20
- .block-library-spacer__resize-container.has-show-handle {
20
+ .block-library-spacer__resize-container.has-show-handle,
21
+ .wp-block-spacer.is-selected.custom-sizes-disabled {
21
22
  background: rgba($black, 0.1);
22
23
 
23
24
  .is-dark-theme & {
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useBlockProps } from '@wordpress/block-editor';
4
+ import { useBlockProps, getSpacingPresetCssVar } from '@wordpress/block-editor';
5
5
 
6
6
  export default function save( { attributes: { height, width } } ) {
7
7
  return (
8
8
  <div
9
9
  { ...useBlockProps.save( {
10
10
  style: {
11
- height,
12
- width,
11
+ height: getSpacingPresetCssVar( height ),
12
+ width: getSpacingPresetCssVar( width ),
13
13
  },
14
14
  'aria-hidden': true,
15
15
  } ) }
package/src/style.scss CHANGED
@@ -11,6 +11,8 @@
11
11
  @import "./comments-pagination/style.scss";
12
12
  @import "./comment-template/style.scss";
13
13
  @import "./cover/style.scss";
14
+ @import "./details/style.scss";
15
+ @import "./details-summary/style.scss";
14
16
  @import "./embed/style.scss";
15
17
  @import "./file/style.scss";
16
18
  @import "./gallery/style.scss";