@wordpress/block-library 8.8.0 → 8.9.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 (185) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/cover/transforms.js +10 -7
  3. package/build/cover/transforms.js.map +1 -1
  4. package/build/group/edit.js +3 -1
  5. package/build/group/edit.js.map +1 -1
  6. package/build/group/index.js +3 -0
  7. package/build/group/index.js.map +1 -1
  8. package/build/image/edit.js +16 -13
  9. package/build/image/edit.js.map +1 -1
  10. package/build/image/index.js +1 -1
  11. package/build/index.native.js +9 -5
  12. package/build/index.native.js.map +1 -1
  13. package/build/media-text/edit.js +4 -2
  14. package/build/media-text/edit.js.map +1 -1
  15. package/build/media-text/index.js +3 -0
  16. package/build/media-text/index.js.map +1 -1
  17. package/build/navigation/edit/index.js +32 -64
  18. package/build/navigation/edit/index.js.map +1 -1
  19. package/build/post-date/edit.js +4 -2
  20. package/build/post-date/edit.js.map +1 -1
  21. package/build/post-excerpt/edit.js +2 -2
  22. package/build/post-excerpt/edit.js.map +1 -1
  23. package/build/post-featured-image/edit.js +8 -5
  24. package/build/post-featured-image/edit.js.map +1 -1
  25. package/build/query/deprecated.js +8 -6
  26. package/build/query/deprecated.js.map +1 -1
  27. package/build/query/edit/inspector-controls/create-new-post-link.js +41 -0
  28. package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
  29. package/build/query/edit/inspector-controls/index.js +14 -6
  30. package/build/query/edit/inspector-controls/index.js.map +1 -1
  31. package/build/query/edit/pattern-selection-modal.js +2 -1
  32. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  33. package/build/query/index.js +5 -12
  34. package/build/query/index.js.map +1 -1
  35. package/build/site-logo/edit.js +114 -16
  36. package/build/site-logo/edit.js.map +1 -1
  37. package/build/site-logo/index.js +1 -1
  38. package/build/social-link/icons/chain.js +1 -1
  39. package/build/social-link/icons/chain.js.map +1 -1
  40. package/build/social-link/icons/mail.js +1 -1
  41. package/build/social-link/icons/mail.js.map +1 -1
  42. package/build/spacer/edit.js +117 -11
  43. package/build/spacer/edit.js.map +1 -1
  44. package/build/template-part/edit/index.js +2 -1
  45. package/build/template-part/edit/index.js.map +1 -1
  46. package/build/template-part/edit/utils/hooks.js +2 -2
  47. package/build/template-part/edit/utils/hooks.js.map +1 -1
  48. package/build/utils/migrate-font-family.js +12 -5
  49. package/build/utils/migrate-font-family.js.map +1 -1
  50. package/build/video/edit.native.js +4 -3
  51. package/build/video/edit.native.js.map +1 -1
  52. package/build-module/cover/transforms.js +5 -1
  53. package/build-module/cover/transforms.js.map +1 -1
  54. package/build-module/group/edit.js +3 -1
  55. package/build-module/group/edit.js.map +1 -1
  56. package/build-module/group/index.js +3 -0
  57. package/build-module/group/index.js.map +1 -1
  58. package/build-module/image/edit.js +16 -13
  59. package/build-module/image/edit.js.map +1 -1
  60. package/build-module/image/index.js +1 -1
  61. package/build-module/index.native.js +9 -5
  62. package/build-module/index.native.js.map +1 -1
  63. package/build-module/media-text/edit.js +4 -2
  64. package/build-module/media-text/edit.js.map +1 -1
  65. package/build-module/media-text/index.js +3 -0
  66. package/build-module/media-text/index.js.map +1 -1
  67. package/build-module/navigation/edit/index.js +31 -63
  68. package/build-module/navigation/edit/index.js.map +1 -1
  69. package/build-module/post-date/edit.js +4 -2
  70. package/build-module/post-date/edit.js.map +1 -1
  71. package/build-module/post-excerpt/edit.js +2 -2
  72. package/build-module/post-excerpt/edit.js.map +1 -1
  73. package/build-module/post-featured-image/edit.js +8 -5
  74. package/build-module/post-featured-image/edit.js.map +1 -1
  75. package/build-module/query/deprecated.js +5 -2
  76. package/build-module/query/deprecated.js.map +1 -1
  77. package/build-module/query/edit/inspector-controls/create-new-post-link.js +33 -0
  78. package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
  79. package/build-module/query/edit/inspector-controls/index.js +12 -7
  80. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  81. package/build-module/query/edit/pattern-selection-modal.js +2 -1
  82. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  83. package/build-module/query/index.js +5 -10
  84. package/build-module/query/index.js.map +1 -1
  85. package/build-module/site-logo/edit.js +115 -18
  86. package/build-module/site-logo/edit.js.map +1 -1
  87. package/build-module/site-logo/index.js +1 -1
  88. package/build-module/social-link/icons/chain.js +1 -1
  89. package/build-module/social-link/icons/chain.js.map +1 -1
  90. package/build-module/social-link/icons/mail.js +1 -1
  91. package/build-module/social-link/icons/mail.js.map +1 -1
  92. package/build-module/spacer/edit.js +118 -12
  93. package/build-module/spacer/edit.js.map +1 -1
  94. package/build-module/template-part/edit/index.js +2 -1
  95. package/build-module/template-part/edit/index.js.map +1 -1
  96. package/build-module/template-part/edit/utils/hooks.js +2 -2
  97. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  98. package/build-module/utils/migrate-font-family.js +9 -1
  99. package/build-module/utils/migrate-font-family.js.map +1 -1
  100. package/build-module/video/edit.native.js +4 -3
  101. package/build-module/video/edit.native.js.map +1 -1
  102. package/build-style/cover/editor-rtl.css +3 -3
  103. package/build-style/cover/editor.css +3 -3
  104. package/build-style/cover/style-rtl.css +1 -2
  105. package/build-style/cover/style.css +1 -2
  106. package/build-style/editor-rtl.css +71 -34
  107. package/build-style/editor.css +71 -34
  108. package/build-style/html/editor-rtl.css +2 -2
  109. package/build-style/html/editor.css +2 -2
  110. package/build-style/image/editor-rtl.css +1 -1
  111. package/build-style/image/editor.css +1 -1
  112. package/build-style/query/editor-rtl.css +8 -12
  113. package/build-style/query/editor.css +8 -12
  114. package/build-style/search/style-rtl.css +2 -0
  115. package/build-style/search/style.css +2 -0
  116. package/build-style/shortcode/editor-rtl.css +3 -4
  117. package/build-style/shortcode/editor.css +3 -4
  118. package/build-style/site-logo/editor-rtl.css +46 -0
  119. package/build-style/site-logo/editor.css +46 -0
  120. package/build-style/style-rtl.css +3 -2
  121. package/build-style/style.css +3 -2
  122. package/build-style/template-part/editor-rtl.css +8 -12
  123. package/build-style/template-part/editor.css +8 -12
  124. package/package.json +31 -31
  125. package/src/buttons/test/__snapshots__/edit.native.js.snap +18 -0
  126. package/src/buttons/test/edit.native.js +123 -2
  127. package/src/cover/editor.scss +1 -1
  128. package/src/cover/style.scss +0 -1
  129. package/src/cover/transforms.js +4 -1
  130. package/src/gallery/test/index.native.js +4 -4
  131. package/src/group/block.json +3 -0
  132. package/src/group/edit.js +8 -2
  133. package/src/heading/test/__snapshots__/index.native.js.snap +12 -0
  134. package/src/heading/test/index.native.js +71 -0
  135. package/src/html/editor.scss +2 -21
  136. package/src/image/block.json +1 -1
  137. package/src/image/edit.js +21 -17
  138. package/src/image/editor.scss +1 -1
  139. package/src/index.native.js +9 -5
  140. package/src/list/test/edit.native.js +7 -7
  141. package/src/media-text/block.json +3 -0
  142. package/src/media-text/edit.js +2 -1
  143. package/src/navigation/edit/index.js +32 -106
  144. package/src/navigation/index.php +15 -8
  145. package/src/paragraph/test/edit.native.js +288 -28
  146. package/src/post-date/edit.js +4 -0
  147. package/src/post-date/index.php +17 -8
  148. package/src/post-excerpt/edit.js +1 -1
  149. package/src/post-featured-image/edit.js +6 -5
  150. package/src/post-featured-image/index.php +1 -1
  151. package/src/preformatted/test/edit.native.js +6 -9
  152. package/src/pullquote/test/edit.native.js +7 -12
  153. package/src/query/deprecated.js +4 -1
  154. package/src/query/edit/inspector-controls/create-new-post-link.js +26 -0
  155. package/src/query/edit/inspector-controls/index.js +13 -6
  156. package/src/query/edit/pattern-selection-modal.js +1 -0
  157. package/src/query/editor.scss +8 -11
  158. package/src/query/index.js +1 -7
  159. package/src/quote/test/edit.native.js +6 -10
  160. package/src/search/style.scss +3 -0
  161. package/src/shortcode/editor.scss +1 -21
  162. package/src/site-logo/block.json +1 -1
  163. package/src/site-logo/edit.js +123 -9
  164. package/src/site-logo/editor.scss +57 -0
  165. package/src/social-link/icons/chain.js +1 -1
  166. package/src/social-link/icons/mail.js +1 -1
  167. package/src/social-link/index.php +2 -2
  168. package/src/spacer/edit.js +157 -18
  169. package/src/template-part/edit/index.js +1 -0
  170. package/src/template-part/edit/utils/hooks.js +2 -2
  171. package/src/template-part/editor.scss +9 -11
  172. package/src/utils/migrate-font-family.js +8 -1
  173. package/src/verse/test/edit.native.js +4 -9
  174. package/src/video/edit.native.js +2 -2
  175. package/tsconfig.json +1 -0
  176. package/build/query/hooks.js +0 -72
  177. package/build/query/hooks.js.map +0 -1
  178. package/build/utils/clean-empty-object.js +0 -37
  179. package/build/utils/clean-empty-object.js.map +0 -1
  180. package/build-module/query/hooks.js +0 -59
  181. package/build-module/query/hooks.js.map +0 -1
  182. package/build-module/utils/clean-empty-object.js +0 -28
  183. package/build-module/utils/clean-empty-object.js.map +0 -1
  184. package/src/query/hooks.js +0 -53
  185. package/src/utils/clean-empty-object.js +0 -28
@@ -609,7 +609,6 @@
609
609
  justify-content: center;
610
610
  align-items: center;
611
611
  padding: 1em;
612
- overflow: hidden;
613
612
  box-sizing: border-box; direction: ltr;
614
613
  /**
615
614
  * Set a default background color for has-background-dim _unless_ it includes another
@@ -825,7 +824,7 @@
825
824
  .wp-block-cover-image .wp-block-cover__inner-container,
826
825
  .wp-block-cover .wp-block-cover__inner-container {
827
826
  width: 100%;
828
- z-index: 32;
827
+ z-index: 1;
829
828
  color: inherit; direction: rtl;
830
829
  }
831
830
  .wp-block-cover-image p:not(.has-text-color),
@@ -2883,6 +2882,8 @@ ul.wp-block-rss.is-grid li {
2883
2882
  min-width: 3rem;
2884
2883
  border: 1px solid #949494;
2885
2884
  text-decoration: unset !important;
2885
+ -webkit-appearance: initial;
2886
+ appearance: initial;
2886
2887
  }
2887
2888
 
2888
2889
  .wp-block-search.wp-block-search__button-only .wp-block-search__button {
@@ -614,7 +614,6 @@
614
614
  justify-content: center;
615
615
  align-items: center;
616
616
  padding: 1em;
617
- overflow: hidden;
618
617
  box-sizing: border-box;
619
618
  /*rtl:raw: direction: ltr; */
620
619
  /**
@@ -831,7 +830,7 @@
831
830
  .wp-block-cover-image .wp-block-cover__inner-container,
832
831
  .wp-block-cover .wp-block-cover__inner-container {
833
832
  width: 100%;
834
- z-index: 32;
833
+ z-index: 1;
835
834
  color: inherit;
836
835
  /*rtl:raw: direction: rtl; */
837
836
  }
@@ -2917,6 +2916,8 @@ ul.wp-block-rss.is-grid li {
2917
2916
  min-width: 3rem;
2918
2917
  border: 1px solid #949494;
2919
2918
  text-decoration: unset !important;
2919
+ -webkit-appearance: initial;
2920
+ appearance: initial;
2920
2921
  }
2921
2922
 
2922
2923
  .wp-block-search.wp-block-search__button-only .wp-block-search__button {
@@ -89,21 +89,17 @@
89
89
  .block-editor-template-part__selection-modal {
90
90
  z-index: 1000001;
91
91
  }
92
- @media (min-width: 600px) {
93
- .block-editor-template-part__selection-modal .components-modal__frame {
94
- width: calc(100% - 32px);
95
- height: calc(100% - 120px);
96
- }
92
+ .block-editor-template-part__selection-modal .block-editor-block-patterns-list {
93
+ column-count: 2;
94
+ column-gap: 24px;
97
95
  }
98
- @media (min-width: 782px) {
99
- .block-editor-template-part__selection-modal .components-modal__frame {
100
- width: 750px;
96
+ @media (min-width: 1280px) {
97
+ .block-editor-template-part__selection-modal .block-editor-block-patterns-list {
98
+ column-count: 3;
101
99
  }
102
100
  }
103
- @media (min-width: 960px) {
104
- .block-editor-template-part__selection-modal .components-modal__frame {
105
- height: 70%;
106
- }
101
+ .block-editor-template-part__selection-modal .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
102
+ break-inside: avoid-column;
107
103
  }
108
104
 
109
105
  .block-library-template-part__selection-search {
@@ -89,21 +89,17 @@
89
89
  .block-editor-template-part__selection-modal {
90
90
  z-index: 1000001;
91
91
  }
92
- @media (min-width: 600px) {
93
- .block-editor-template-part__selection-modal .components-modal__frame {
94
- width: calc(100% - 32px);
95
- height: calc(100% - 120px);
96
- }
92
+ .block-editor-template-part__selection-modal .block-editor-block-patterns-list {
93
+ column-count: 2;
94
+ column-gap: 24px;
97
95
  }
98
- @media (min-width: 782px) {
99
- .block-editor-template-part__selection-modal .components-modal__frame {
100
- width: 750px;
96
+ @media (min-width: 1280px) {
97
+ .block-editor-template-part__selection-modal .block-editor-block-patterns-list {
98
+ column-count: 3;
101
99
  }
102
100
  }
103
- @media (min-width: 960px) {
104
- .block-editor-template-part__selection-modal .components-modal__frame {
105
- height: 70%;
106
- }
101
+ .block-editor-template-part__selection-modal .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
102
+ break-inside: avoid-column;
107
103
  }
108
104
 
109
105
  .block-library-template-part__selection-search {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.8.0",
3
+ "version": "8.9.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,35 +31,35 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.31.0",
35
- "@wordpress/api-fetch": "^6.28.0",
36
- "@wordpress/autop": "^3.31.0",
37
- "@wordpress/blob": "^3.31.0",
38
- "@wordpress/block-editor": "^11.8.0",
39
- "@wordpress/blocks": "^12.8.0",
40
- "@wordpress/components": "^23.8.0",
41
- "@wordpress/compose": "^6.8.0",
42
- "@wordpress/core-data": "^6.8.0",
43
- "@wordpress/data": "^9.1.0",
44
- "@wordpress/date": "^4.31.0",
45
- "@wordpress/deprecated": "^3.31.0",
46
- "@wordpress/dom": "^3.31.0",
47
- "@wordpress/element": "^5.8.0",
48
- "@wordpress/escape-html": "^2.31.0",
49
- "@wordpress/hooks": "^3.31.0",
50
- "@wordpress/html-entities": "^3.31.0",
51
- "@wordpress/i18n": "^4.31.0",
52
- "@wordpress/icons": "^9.22.0",
53
- "@wordpress/keycodes": "^3.31.0",
54
- "@wordpress/notices": "^3.31.0",
55
- "@wordpress/primitives": "^3.29.0",
56
- "@wordpress/private-apis": "^0.13.0",
57
- "@wordpress/reusable-blocks": "^4.8.0",
58
- "@wordpress/rich-text": "^6.8.0",
59
- "@wordpress/server-side-render": "^4.8.0",
60
- "@wordpress/url": "^3.32.0",
61
- "@wordpress/viewport": "^5.8.0",
62
- "@wordpress/wordcount": "^3.31.0",
34
+ "@wordpress/a11y": "^3.32.0",
35
+ "@wordpress/api-fetch": "^6.29.0",
36
+ "@wordpress/autop": "^3.32.0",
37
+ "@wordpress/blob": "^3.32.0",
38
+ "@wordpress/block-editor": "^12.0.0",
39
+ "@wordpress/blocks": "^12.9.0",
40
+ "@wordpress/components": "^23.9.0",
41
+ "@wordpress/compose": "^6.9.0",
42
+ "@wordpress/core-data": "^6.9.0",
43
+ "@wordpress/data": "^9.2.0",
44
+ "@wordpress/date": "^4.32.0",
45
+ "@wordpress/deprecated": "^3.32.0",
46
+ "@wordpress/dom": "^3.32.0",
47
+ "@wordpress/element": "^5.9.0",
48
+ "@wordpress/escape-html": "^2.32.0",
49
+ "@wordpress/hooks": "^3.32.0",
50
+ "@wordpress/html-entities": "^3.32.0",
51
+ "@wordpress/i18n": "^4.32.0",
52
+ "@wordpress/icons": "^9.23.0",
53
+ "@wordpress/keycodes": "^3.32.0",
54
+ "@wordpress/notices": "^4.0.0",
55
+ "@wordpress/primitives": "^3.30.0",
56
+ "@wordpress/private-apis": "^0.14.0",
57
+ "@wordpress/reusable-blocks": "^4.9.0",
58
+ "@wordpress/rich-text": "^6.9.0",
59
+ "@wordpress/server-side-render": "^4.9.0",
60
+ "@wordpress/url": "^3.33.0",
61
+ "@wordpress/viewport": "^5.9.0",
62
+ "@wordpress/wordcount": "^3.32.0",
63
63
  "change-case": "^4.1.2",
64
64
  "classnames": "^2.3.1",
65
65
  "colord": "^2.7.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "d61700b9f1c72ba0b030fc815ef1685b4f4031ec"
81
+ "gitHead": "6df0c62d43b8901414ccd22ffbe56eaa99d012a6"
82
82
  }
@@ -1,5 +1,23 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`Buttons block color customization sets a background color 1`] = `
4
+ "<!-- wp:buttons -->
5
+ <div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"luminous-vivid-amber"} /--></div>
6
+ <!-- /wp:buttons -->"
7
+ `;
8
+
9
+ exports[`Buttons block color customization sets a gradient background color 1`] = `
10
+ "<!-- wp:buttons -->
11
+ <div class="wp-block-buttons"><!-- wp:button {"gradient":"light-green-cyan-to-vivid-green-cyan"} /--></div>
12
+ <!-- /wp:buttons -->"
13
+ `;
14
+
15
+ exports[`Buttons block color customization sets a text color 1`] = `
16
+ "<!-- wp:buttons -->
17
+ <div class="wp-block-buttons"><!-- wp:button {"textColor":"pale-pink"} /--></div>
18
+ <!-- /wp:buttons -->"
19
+ `;
20
+
3
21
  exports[`Buttons block justify content sets Justify items center option 1`] = `
4
22
  "<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
5
23
  <div class="wp-block-buttons"><!-- wp:button /--></div>
@@ -2,12 +2,15 @@
2
2
  * External dependencies
3
3
  */
4
4
  import {
5
+ addBlock,
5
6
  fireEvent,
6
7
  getEditorHtml,
7
8
  within,
8
9
  getBlock,
9
10
  initializeEditor,
10
- changeTextOfRichText,
11
+ triggerBlockListLayout,
12
+ typeInRichText,
13
+ waitFor,
11
14
  } from 'test/helpers';
12
15
 
13
16
  /**
@@ -196,7 +199,7 @@ describe( 'Buttons block', () => {
196
199
  within( secondButtonBlock ).getByLabelText(
197
200
  'Text input. Empty'
198
201
  );
199
- changeTextOfRichText( secondButtonInput, 'Hello!' );
202
+ typeInRichText( secondButtonInput, 'Hello!' );
200
203
 
201
204
  expect( getEditorHtml() ).toMatchSnapshot();
202
205
  } );
@@ -271,4 +274,122 @@ describe( 'Buttons block', () => {
271
274
  } )
272
275
  );
273
276
  } );
277
+
278
+ describe( 'color customization', () => {
279
+ it( 'sets a text color', async () => {
280
+ // Arrange
281
+ const screen = await initializeEditor();
282
+ await addBlock( screen, 'Buttons' );
283
+
284
+ // Act
285
+ const buttonsBlock = getBlock( screen, 'Buttons' );
286
+ fireEvent.press( buttonsBlock );
287
+
288
+ // Trigger onLayout for the list
289
+ await triggerBlockListLayout( buttonsBlock );
290
+
291
+ const buttonBlock = await getBlock( screen, 'Button' );
292
+ fireEvent.press( buttonBlock );
293
+
294
+ // Open Block Settings.
295
+ fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
296
+
297
+ // Wait for Block Settings to be visible.
298
+ const blockSettingsModal = screen.getByTestId(
299
+ 'block-settings-modal'
300
+ );
301
+ await waitFor( () => blockSettingsModal.props.isVisible );
302
+
303
+ // Open Text color settings
304
+ fireEvent.press( screen.getByLabelText( 'Text, Default' ) );
305
+
306
+ // Tap one color
307
+ fireEvent.press( screen.getByLabelText( 'Pale pink' ) );
308
+
309
+ // Dismiss the Block Settings modal.
310
+ fireEvent( blockSettingsModal, 'backdropPress' );
311
+
312
+ // Assert
313
+ expect( getEditorHtml() ).toMatchSnapshot();
314
+ } );
315
+
316
+ it( 'sets a background color', async () => {
317
+ // Arrange
318
+ const screen = await initializeEditor();
319
+ await addBlock( screen, 'Buttons' );
320
+
321
+ // Act
322
+ const buttonsBlock = getBlock( screen, 'Buttons' );
323
+ fireEvent.press( buttonsBlock );
324
+
325
+ // Trigger onLayout for the list
326
+ await triggerBlockListLayout( buttonsBlock );
327
+
328
+ const buttonBlock = await getBlock( screen, 'Button' );
329
+ fireEvent.press( buttonBlock );
330
+
331
+ // Open Block Settings.
332
+ fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
333
+
334
+ // Wait for Block Settings to be visible.
335
+ const blockSettingsModal = screen.getByTestId(
336
+ 'block-settings-modal'
337
+ );
338
+ await waitFor( () => blockSettingsModal.props.isVisible );
339
+
340
+ // Open Text color settings
341
+ fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
342
+
343
+ // Tap one color
344
+ fireEvent.press( screen.getByLabelText( 'Luminous vivid amber' ) );
345
+
346
+ // Dismiss the Block Settings modal.
347
+ fireEvent( blockSettingsModal, 'backdropPress' );
348
+
349
+ // Assert
350
+ expect( getEditorHtml() ).toMatchSnapshot();
351
+ } );
352
+
353
+ it( 'sets a gradient background color', async () => {
354
+ // Arrange
355
+ const screen = await initializeEditor();
356
+ await addBlock( screen, 'Buttons' );
357
+
358
+ // Act
359
+ const buttonsBlock = getBlock( screen, 'Buttons' );
360
+ fireEvent.press( buttonsBlock );
361
+
362
+ // Trigger onLayout for the list
363
+ await triggerBlockListLayout( buttonsBlock );
364
+
365
+ const buttonBlock = await getBlock( screen, 'Button' );
366
+ fireEvent.press( buttonBlock );
367
+
368
+ // Open Block Settings.
369
+ fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
370
+
371
+ // Wait for Block Settings to be visible.
372
+ const blockSettingsModal = screen.getByTestId(
373
+ 'block-settings-modal'
374
+ );
375
+ await waitFor( () => blockSettingsModal.props.isVisible );
376
+
377
+ // Open Text color settings
378
+ fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
379
+
380
+ // Tap on the gradient segment
381
+ fireEvent.press( screen.getByLabelText( 'Gradient' ) );
382
+
383
+ // Tap one gradient color
384
+ fireEvent.press(
385
+ screen.getByLabelText( 'Light green cyan to vivid green cyan' )
386
+ );
387
+
388
+ // Dismiss the Block Settings modal.
389
+ fireEvent( blockSettingsModal, 'backdropPress' );
390
+
391
+ // Assert
392
+ expect( getEditorHtml() ).toMatchSnapshot();
393
+ } );
394
+ } );
274
395
  } );
@@ -10,7 +10,6 @@
10
10
  padding: 0 !important;
11
11
  display: flex;
12
12
  align-items: stretch;
13
- overflow: visible;
14
13
  min-height: 240px;
15
14
 
16
15
  .components-placeholder {
@@ -97,6 +96,7 @@
97
96
  // The inner drag handle will still have `pointer-events: all` allowing
98
97
  // it to continue to be interacted with.
99
98
  pointer-events: none;
99
+ overflow: visible;
100
100
  }
101
101
  }
102
102
 
@@ -7,7 +7,6 @@
7
7
  justify-content: center;
8
8
  align-items: center;
9
9
  padding: 1em;
10
- overflow: hidden;
11
10
  // This block has customizable padding, border-box makes that more predictable.
12
11
  box-sizing: border-box;
13
12
  // Keep the flex layout direction to the physical direction (LTR) in RTL languages.
@@ -2,12 +2,15 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createBlock } from '@wordpress/blocks';
5
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';
10
- import cleanEmptyObject from '../utils/clean-empty-object';
11
+ import { unlock } from '../private-apis';
12
+
13
+ const { cleanEmptyObject } = unlock( blockEditorPrivateApis );
11
14
 
12
15
  const transforms = {
13
16
  from: [
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import {
5
5
  act,
6
- changeTextOfRichText,
6
+ typeInRichText,
7
7
  fireEvent,
8
8
  getBlock,
9
9
  getEditorHtml,
@@ -173,7 +173,7 @@ describe( 'Gallery block', () => {
173
173
  const captionField = within(
174
174
  getByLabelText( /Gallery caption. Empty/ )
175
175
  ).getByPlaceholderText( 'Add caption' );
176
- changeTextOfRichText(
176
+ typeInRichText(
177
177
  captionField,
178
178
  '<strong>Bold</strong> <em>italic</em> <s>strikethrough</s> gallery caption'
179
179
  );
@@ -197,7 +197,7 @@ describe( 'Gallery block', () => {
197
197
  // Set gallery item caption
198
198
  const captionField =
199
199
  within( galleryItem ).getByPlaceholderText( 'Add caption' );
200
- changeTextOfRichText(
200
+ typeInRichText(
201
201
  captionField,
202
202
  '<strong>Bold</strong> <em>italic</em> <s>strikethrough</s> image caption'
203
203
  );
@@ -537,7 +537,7 @@ describe( 'Gallery block', () => {
537
537
  <figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"id":${ media[ 0 ].localId }} -->
538
538
  <figure class="wp-block-image"><img src="${ media[ 0 ].localUrl }" alt="" class="wp-image-${ media[ 0 ].localId }"/></figure>
539
539
  <!-- /wp:image -->
540
-
540
+
541
541
  <!-- wp:image {"id":${ media[ 1 ].localId },"linkDestination":"attachment"} -->
542
542
  <figure class="wp-block-image"><img src="${ media[ 1 ].localUrl }" alt="" class="wp-image-${ media[ 1 ].localId }"/></figure>
543
543
  <!-- /wp:image --></figure>
@@ -15,6 +15,9 @@
15
15
  "templateLock": {
16
16
  "type": [ "string", "boolean" ],
17
17
  "enum": [ "all", "insert", "contentOnly", false ]
18
+ },
19
+ "allowedBlocks": {
20
+ "type": "array"
18
21
  }
19
22
  },
20
23
  "supports": {
package/src/group/edit.js CHANGED
@@ -90,7 +90,12 @@ function GroupEdit( {
90
90
  [ clientId ]
91
91
  );
92
92
 
93
- const { tagName: TagName = 'div', templateLock, layout = {} } = attributes;
93
+ const {
94
+ tagName: TagName = 'div',
95
+ templateLock,
96
+ allowedBlocks,
97
+ layout = {},
98
+ } = attributes;
94
99
 
95
100
  // Layout settings.
96
101
  const defaultLayout = useSetting( 'layout' ) || {};
@@ -131,6 +136,7 @@ function GroupEdit( {
131
136
  : { className: 'wp-block-group__inner-container' },
132
137
  {
133
138
  templateLock,
139
+ allowedBlocks,
134
140
  renderAppender,
135
141
  __unstableDisableLayoutClassNames: ! layoutSupportEnabled,
136
142
  }
@@ -153,7 +159,7 @@ function GroupEdit( {
153
159
  }
154
160
  />
155
161
  { showPlaceholder && (
156
- <View { ...innerBlocksProps }>
162
+ <View>
157
163
  { innerBlocksProps.children }
158
164
  <GroupPlaceHolder
159
165
  clientId={ clientId }
@@ -5,3 +5,15 @@ exports[`Heading block inserts block 1`] = `
5
5
  <h2 class="wp-block-heading"></h2>
6
6
  <!-- /wp:heading -->"
7
7
  `;
8
+
9
+ exports[`Heading block should set a background color 1`] = `
10
+ "<!-- wp:heading {"backgroundColor":"luminous-vivid-orange"} -->
11
+ <h2 class="wp-block-heading has-luminous-vivid-orange-background-color has-background">A quick brown fox jumps over the lazy dog.</h2>
12
+ <!-- /wp:heading -->"
13
+ `;
14
+
15
+ exports[`Heading block should set a text color 1`] = `
16
+ "<!-- wp:heading {"textColor":"pale-pink"} -->
17
+ <h2 class="wp-block-heading has-pale-pink-color has-text-color">A quick brown fox jumps over the lazy dog.</h2>
18
+ <!-- /wp:heading -->"
19
+ `;
@@ -7,6 +7,9 @@ import {
7
7
  initializeEditor,
8
8
  addBlock,
9
9
  getBlock,
10
+ typeInRichText,
11
+ waitFor,
12
+ within,
10
13
  } from 'test/helpers';
11
14
 
12
15
  /**
@@ -41,4 +44,72 @@ describe( 'Heading block', () => {
41
44
 
42
45
  expect( getEditorHtml() ).toMatchSnapshot();
43
46
  } );
47
+
48
+ it( 'should set a text color', async () => {
49
+ // Arrange
50
+ const screen = await initializeEditor();
51
+ await addBlock( screen, 'Heading' );
52
+
53
+ // Act
54
+ const headingBlock = getBlock( screen, 'Heading' );
55
+ fireEvent.press( headingBlock );
56
+ const headingTextInput =
57
+ within( headingBlock ).getByPlaceholderText( 'Heading' );
58
+ typeInRichText(
59
+ headingTextInput,
60
+ 'A quick brown fox jumps over the lazy dog.'
61
+ );
62
+ // Open Block Settings.
63
+ fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
64
+
65
+ // Wait for Block Settings to be visible.
66
+ const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
67
+ await waitFor( () => blockSettingsModal.props.isVisible );
68
+
69
+ // Open Text color settings
70
+ fireEvent.press( screen.getByLabelText( 'Text, Default' ) );
71
+
72
+ // Tap one color
73
+ fireEvent.press( screen.getByLabelText( 'Pale pink' ) );
74
+
75
+ // Dismiss the Block Settings modal.
76
+ fireEvent( blockSettingsModal, 'backdropPress' );
77
+
78
+ // Assert
79
+ expect( getEditorHtml() ).toMatchSnapshot();
80
+ } );
81
+
82
+ it( 'should set a background color', async () => {
83
+ // Arrange
84
+ const screen = await initializeEditor();
85
+ await addBlock( screen, 'Heading' );
86
+
87
+ // Act
88
+ const headingBlock = getBlock( screen, 'Heading' );
89
+ fireEvent.press( headingBlock );
90
+ const headingTextInput =
91
+ within( headingBlock ).getByPlaceholderText( 'Heading' );
92
+ typeInRichText(
93
+ headingTextInput,
94
+ 'A quick brown fox jumps over the lazy dog.'
95
+ );
96
+ // Open Block Settings.
97
+ fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
98
+
99
+ // Wait for Block Settings to be visible.
100
+ const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
101
+ await waitFor( () => blockSettingsModal.props.isVisible );
102
+
103
+ // Open Background color settings
104
+ fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
105
+
106
+ // Tap one color
107
+ fireEvent.press( screen.getByLabelText( 'Luminous vivid orange' ) );
108
+
109
+ // Dismiss the Block Settings modal.
110
+ fireEvent( blockSettingsModal, 'backdropPress' );
111
+
112
+ // Assert
113
+ expect( getEditorHtml() ).toMatchSnapshot();
114
+ } );
44
115
  } );
@@ -10,27 +10,8 @@
10
10
  // The editing view for the HTML block is equivalent to block UI.
11
11
  // Therefore we increase specificity to avoid theme styles bleeding in.
12
12
  .block-editor-plain-text {
13
- font-family: $editor-html-font !important;
14
- color: $gray-900 !important;
15
- background: $white !important;
16
- padding: $grid-unit-15 !important;
17
- border: $border-width solid $gray-900 !important;
18
- box-shadow: none !important;
19
- border-radius: $radius-block-ui !important;
13
+ box-sizing: border-box;
20
14
  max-height: 250px;
21
-
22
- /* Fonts smaller than 16px causes mobile safari to zoom. */
23
- font-size: $mobile-text-min-font-size !important;
24
- @include break-small {
25
- font-size: $default-font-size !important;
26
- }
27
-
28
- &:focus {
29
- border-color: var(--wp-admin-theme-color) !important;
30
- box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;
31
-
32
- // Windows High Contrast mode will show this outline, but not the box-shadow.
33
- outline: 2px solid transparent !important;
34
- }
15
+ @include editor-input-reset();
35
16
  }
36
17
  }
@@ -104,7 +104,7 @@
104
104
  }
105
105
  },
106
106
  "selectors": {
107
- "border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area",
107
+ "border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
108
108
  "filter": {
109
109
  "duotone": ".wp-block-image img, .wp-block-image .components-placeholder"
110
110
  }