@wordpress/block-library 9.35.0 → 9.35.1-next.dc3f6d3c1.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 (184) hide show
  1. package/build/audio/index.js +26 -0
  2. package/build/audio/index.js.map +2 -2
  3. package/build/breadcrumbs/edit.js +1 -1
  4. package/build/breadcrumbs/edit.js.map +2 -2
  5. package/build/button/index.js +22 -0
  6. package/build/button/index.js.map +2 -2
  7. package/build/code/index.js +12 -0
  8. package/build/code/index.js.map +2 -2
  9. package/build/cover/index.js +22 -0
  10. package/build/cover/index.js.map +2 -2
  11. package/build/details/index.js +12 -0
  12. package/build/details/index.js.map +2 -2
  13. package/build/file/index.js +33 -0
  14. package/build/file/index.js.map +2 -2
  15. package/build/heading/index.js +12 -0
  16. package/build/heading/index.js.map +2 -2
  17. package/build/html/modal.js +126 -144
  18. package/build/html/modal.js.map +2 -2
  19. package/build/image/index.js +46 -0
  20. package/build/image/index.js.map +2 -2
  21. package/build/list-item/index.js +13 -0
  22. package/build/list-item/index.js.map +2 -2
  23. package/build/media-text/index.js +28 -0
  24. package/build/media-text/index.js.map +2 -2
  25. package/build/more/index.js +13 -0
  26. package/build/more/index.js.map +2 -2
  27. package/build/navigation/block.json +2 -2
  28. package/build/navigation-link/block.json +2 -1
  29. package/build/navigation-link/edit.js +6 -0
  30. package/build/navigation-link/edit.js.map +2 -2
  31. package/build/navigation-link/index.js +22 -0
  32. package/build/navigation-link/index.js.map +2 -2
  33. package/build/navigation-link/shared/controls.js +15 -19
  34. package/build/navigation-link/shared/controls.js.map +2 -2
  35. package/build/navigation-link/shared/index.js +4 -0
  36. package/build/navigation-link/shared/index.js.map +2 -2
  37. package/build/navigation-link/shared/use-entity-binding.js +3 -2
  38. package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
  39. package/build/navigation-submenu/block.json +2 -1
  40. package/build/navigation-submenu/index.js +22 -0
  41. package/build/navigation-submenu/index.js.map +2 -2
  42. package/build/paragraph/index.js +12 -0
  43. package/build/paragraph/index.js.map +2 -2
  44. package/build/post-comments-count/edit.js +1 -2
  45. package/build/post-comments-count/edit.js.map +2 -2
  46. package/build/post-comments-link/edit.js +10 -7
  47. package/build/post-comments-link/edit.js.map +2 -2
  48. package/build/preformatted/index.js +12 -0
  49. package/build/preformatted/index.js.map +2 -2
  50. package/build/pullquote/block.json +3 -2
  51. package/build/pullquote/index.js +20 -0
  52. package/build/pullquote/index.js.map +2 -2
  53. package/build/pullquote/transforms.js +0 -31
  54. package/build/pullquote/transforms.js.map +2 -2
  55. package/build/quote/transforms.js +0 -20
  56. package/build/quote/transforms.js.map +2 -2
  57. package/build/search/index.js +28 -0
  58. package/build/search/index.js.map +2 -2
  59. package/build/social-link/index.js +22 -0
  60. package/build/social-link/index.js.map +2 -2
  61. package/build/social-links/edit.js +1 -1
  62. package/build/social-links/edit.js.map +1 -1
  63. package/build/tabs/view.js +17 -4
  64. package/build/tabs/view.js.map +2 -2
  65. package/build/verse/index.js +12 -0
  66. package/build/verse/index.js.map +2 -2
  67. package/build/video/index.js +27 -0
  68. package/build/video/index.js.map +2 -2
  69. package/build-module/audio/index.js +26 -0
  70. package/build-module/audio/index.js.map +2 -2
  71. package/build-module/breadcrumbs/edit.js +1 -1
  72. package/build-module/breadcrumbs/edit.js.map +2 -2
  73. package/build-module/button/index.js +22 -0
  74. package/build-module/button/index.js.map +2 -2
  75. package/build-module/code/index.js +12 -0
  76. package/build-module/code/index.js.map +2 -2
  77. package/build-module/cover/index.js +22 -0
  78. package/build-module/cover/index.js.map +2 -2
  79. package/build-module/details/index.js +12 -0
  80. package/build-module/details/index.js.map +2 -2
  81. package/build-module/file/index.js +34 -1
  82. package/build-module/file/index.js.map +2 -2
  83. package/build-module/heading/index.js +12 -0
  84. package/build-module/heading/index.js.map +2 -2
  85. package/build-module/html/modal.js +127 -145
  86. package/build-module/html/modal.js.map +2 -2
  87. package/build-module/image/index.js +46 -0
  88. package/build-module/image/index.js.map +2 -2
  89. package/build-module/list-item/index.js +13 -0
  90. package/build-module/list-item/index.js.map +2 -2
  91. package/build-module/media-text/index.js +28 -0
  92. package/build-module/media-text/index.js.map +2 -2
  93. package/build-module/more/index.js +13 -0
  94. package/build-module/more/index.js.map +2 -2
  95. package/build-module/navigation/block.json +2 -2
  96. package/build-module/navigation-link/block.json +2 -1
  97. package/build-module/navigation-link/edit.js +20 -4
  98. package/build-module/navigation-link/edit.js.map +2 -2
  99. package/build-module/navigation-link/index.js +23 -1
  100. package/build-module/navigation-link/index.js.map +2 -2
  101. package/build-module/navigation-link/shared/controls.js +12 -18
  102. package/build-module/navigation-link/shared/controls.js.map +2 -2
  103. package/build-module/navigation-link/shared/index.js +3 -1
  104. package/build-module/navigation-link/shared/index.js.map +2 -2
  105. package/build-module/navigation-link/shared/use-entity-binding.js +3 -2
  106. package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
  107. package/build-module/navigation-submenu/block.json +2 -1
  108. package/build-module/navigation-submenu/index.js +23 -1
  109. package/build-module/navigation-submenu/index.js.map +2 -2
  110. package/build-module/paragraph/index.js +12 -0
  111. package/build-module/paragraph/index.js.map +2 -2
  112. package/build-module/post-comments-count/edit.js +1 -3
  113. package/build-module/post-comments-count/edit.js.map +2 -2
  114. package/build-module/post-comments-link/edit.js +10 -8
  115. package/build-module/post-comments-link/edit.js.map +2 -2
  116. package/build-module/preformatted/index.js +12 -0
  117. package/build-module/preformatted/index.js.map +2 -2
  118. package/build-module/pullquote/block.json +3 -2
  119. package/build-module/pullquote/index.js +20 -0
  120. package/build-module/pullquote/index.js.map +2 -2
  121. package/build-module/pullquote/transforms.js +0 -31
  122. package/build-module/pullquote/transforms.js.map +2 -2
  123. package/build-module/quote/transforms.js +0 -20
  124. package/build-module/quote/transforms.js.map +2 -2
  125. package/build-module/search/index.js +28 -0
  126. package/build-module/search/index.js.map +2 -2
  127. package/build-module/social-link/index.js +22 -0
  128. package/build-module/social-link/index.js.map +2 -2
  129. package/build-module/social-links/edit.js +1 -1
  130. package/build-module/social-links/edit.js.map +1 -1
  131. package/build-module/tabs/view.js +17 -4
  132. package/build-module/tabs/view.js.map +2 -2
  133. package/build-module/verse/index.js +12 -0
  134. package/build-module/verse/index.js.map +2 -2
  135. package/build-module/video/index.js +27 -0
  136. package/build-module/video/index.js.map +2 -2
  137. package/package.json +37 -37
  138. package/src/audio/index.js +27 -0
  139. package/src/breadcrumbs/edit.js +4 -2
  140. package/src/breadcrumbs/index.php +112 -30
  141. package/src/button/index.js +23 -0
  142. package/src/code/index.js +13 -0
  143. package/src/cover/index.js +23 -0
  144. package/src/details/index.js +13 -0
  145. package/src/file/index.js +35 -1
  146. package/src/heading/index.js +13 -0
  147. package/src/heading/test/__snapshots__/transforms.native.js.snap +0 -6
  148. package/src/heading/test/transforms.native.js +1 -5
  149. package/src/html/modal.js +8 -28
  150. package/src/image/index.js +47 -0
  151. package/src/list-item/index.js +14 -0
  152. package/src/media-text/index.js +29 -0
  153. package/src/more/index.js +14 -0
  154. package/src/navigation/block.json +2 -2
  155. package/src/navigation-link/block.json +2 -1
  156. package/src/navigation-link/edit.js +27 -4
  157. package/src/navigation-link/index.js +24 -1
  158. package/src/navigation-link/shared/controls.js +13 -17
  159. package/src/navigation-link/shared/index.js +1 -1
  160. package/src/navigation-link/shared/use-entity-binding.js +5 -2
  161. package/src/navigation-submenu/block.json +2 -1
  162. package/src/navigation-submenu/index.js +24 -1
  163. package/src/paragraph/index.js +13 -0
  164. package/src/paragraph/test/__snapshots__/transforms.native.js.snap +0 -6
  165. package/src/paragraph/test/transforms.native.js +0 -1
  166. package/src/post-comments-count/edit.js +1 -9
  167. package/src/post-comments-link/edit.js +8 -18
  168. package/src/preformatted/index.js +13 -0
  169. package/src/pullquote/block.json +3 -2
  170. package/src/pullquote/index.js +21 -0
  171. package/src/pullquote/test/__snapshots__/transforms.native.js.snap +5 -5
  172. package/src/pullquote/test/transforms.native.js +1 -1
  173. package/src/pullquote/transforms.js +0 -31
  174. package/src/quote/test/__snapshots__/transforms.native.js.snap +0 -6
  175. package/src/quote/test/transforms.native.js +1 -5
  176. package/src/quote/transforms.js +0 -25
  177. package/src/search/index.js +29 -0
  178. package/src/social-link/index.js +23 -0
  179. package/src/social-links/edit.js +1 -1
  180. package/src/tabs/view.js +19 -4
  181. package/src/utils/transformation-categories.native.js +0 -1
  182. package/src/verse/index.js +13 -0
  183. package/src/video/index.js +28 -0
  184. package/src/pullquote/test/edit.native.js +0 -73
@@ -9,7 +9,6 @@ import clsx from 'clsx';
9
9
  import {
10
10
  AlignmentControl,
11
11
  BlockControls,
12
- Warning,
13
12
  useBlockProps,
14
13
  } from '@wordpress/block-editor';
15
14
  import { useState, useEffect } from '@wordpress/element';
@@ -59,18 +58,6 @@ function PostCommentsLinkEdit( { context, attributes, setAttributes } ) {
59
58
  [ postType, postId ]
60
59
  );
61
60
 
62
- if ( ! post ) {
63
- return (
64
- <div { ...blockProps }>
65
- <Warning>
66
- { __( 'Post Comments Link block: post not found.' ) }
67
- </Warning>
68
- </div>
69
- );
70
- }
71
-
72
- const { link } = post;
73
-
74
61
  let commentsText;
75
62
  if ( commentsCount !== undefined ) {
76
63
  const commentsNumber = parseInt( commentsCount );
@@ -98,17 +85,20 @@ function PostCommentsLinkEdit( { context, attributes, setAttributes } ) {
98
85
  </BlockControls>
99
86
 
100
87
  <div { ...blockProps }>
101
- { link && commentsText !== undefined ? (
88
+ { post?.link && commentsText !== undefined ? (
102
89
  <a
103
- href={ link + '#comments' }
90
+ href={ post?.link + '#comments' }
104
91
  onClick={ ( event ) => event.preventDefault() }
105
92
  >
106
93
  { commentsText }
107
94
  </a>
108
95
  ) : (
109
- <Warning>
110
- { __( 'Post Comments Link block: post not found.' ) }
111
- </Warning>
96
+ <a
97
+ href="#post-comments-link-pseudo-link"
98
+ onClick={ ( event ) => event.preventDefault() }
99
+ >
100
+ { __( 'No comments' ) }
101
+ </a>
112
102
  ) }
113
103
  </div>
114
104
  </>
@@ -39,4 +39,17 @@ export const settings = {
39
39
  },
40
40
  };
41
41
 
42
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
43
+ settings.fields = [
44
+ {
45
+ label: __( 'Content' ),
46
+ type: 'RichText',
47
+ shownByDefault: true,
48
+ mapping: {
49
+ value: 'content',
50
+ },
51
+ },
52
+ ];
53
+ }
54
+
42
55
  export const init = () => initBlock( { name, metadata, settings } );
@@ -2,9 +2,9 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 3,
4
4
  "name": "core/pullquote",
5
- "title": "Pullquote",
5
+ "title": "Pullquote (deprecated)",
6
6
  "category": "text",
7
- "description": "Give special visual emphasis to a quote from your text.",
7
+ "description": "This block is deprecated. Please use the Quote block instead.",
8
8
  "textdomain": "default",
9
9
  "attributes": {
10
10
  "value": {
@@ -48,6 +48,7 @@
48
48
  "minHeight": false
49
49
  }
50
50
  },
51
+ "inserter": false,
51
52
  "spacing": {
52
53
  "margin": true,
53
54
  "padding": true
@@ -36,4 +36,25 @@ export const settings = {
36
36
  deprecated,
37
37
  };
38
38
 
39
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
40
+ settings.fields = [
41
+ {
42
+ label: __( 'Content' ),
43
+ type: 'RichText',
44
+ shownByDefault: true,
45
+ mapping: {
46
+ value: 'value',
47
+ },
48
+ },
49
+ {
50
+ label: __( 'Citation' ),
51
+ type: 'RichText',
52
+ shownByDefault: false,
53
+ mapping: {
54
+ value: 'citation',
55
+ },
56
+ },
57
+ ];
58
+ }
59
+
39
60
  export const init = () => initBlock( { name, metadata, settings } );
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Pullquote block transforms to Columns block 1`] = `
3
+ exports[`Pullquote \\(deprecated\\) block transforms to Columns block 1`] = `
4
4
  "<!-- wp:columns -->
5
5
  <div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
6
6
  <div class="wp-block-column" style="flex-basis:100%"><!-- wp:pullquote -->
@@ -10,7 +10,7 @@ exports[`Pullquote block transforms to Columns block 1`] = `
10
10
  <!-- /wp:columns -->"
11
11
  `;
12
12
 
13
- exports[`Pullquote block transforms to Group block 1`] = `
13
+ exports[`Pullquote \\(deprecated\\) block transforms to Group block 1`] = `
14
14
  "<!-- wp:group {"layout":{"type":"constrained"}} -->
15
15
  <div class="wp-block-group"><!-- wp:pullquote -->
16
16
  <figure class="wp-block-pullquote"><blockquote><p>One of the hardest things to do in technology is disrupt yourself.</p><cite>Matt Mullenweg</cite></blockquote></figure>
@@ -18,7 +18,7 @@ exports[`Pullquote block transforms to Group block 1`] = `
18
18
  <!-- /wp:group -->"
19
19
  `;
20
20
 
21
- exports[`Pullquote block transforms to Heading block 1`] = `
21
+ exports[`Pullquote \\(deprecated\\) block transforms to Heading block 1`] = `
22
22
  "<!-- wp:heading -->
23
23
  <h2 class="wp-block-heading">One of the hardest things to do in technology is disrupt yourself.</h2>
24
24
  <!-- /wp:heading -->
@@ -28,7 +28,7 @@ exports[`Pullquote block transforms to Heading block 1`] = `
28
28
  <!-- /wp:heading -->"
29
29
  `;
30
30
 
31
- exports[`Pullquote block transforms to Paragraph block 1`] = `
31
+ exports[`Pullquote \\(deprecated\\) block transforms to Paragraph block 1`] = `
32
32
  "<!-- wp:paragraph -->
33
33
  <p>One of the hardest things to do in technology is disrupt yourself.</p>
34
34
  <!-- /wp:paragraph -->
@@ -38,7 +38,7 @@ exports[`Pullquote block transforms to Paragraph block 1`] = `
38
38
  <!-- /wp:paragraph -->"
39
39
  `;
40
40
 
41
- exports[`Pullquote block transforms to Quote block 1`] = `
41
+ exports[`Pullquote \\(deprecated\\) block transforms to Quote block 1`] = `
42
42
  "<!-- wp:quote -->
43
43
  <blockquote class="wp-block-quote"><!-- wp:paragraph -->
44
44
  <p>One of the hardest things to do in technology is disrupt yourself.</p>
@@ -9,7 +9,7 @@ import {
9
9
  getBlockTransformOptions,
10
10
  } from 'test/helpers';
11
11
 
12
- const block = 'Pullquote';
12
+ const block = 'Pullquote \\(deprecated\\)';
13
13
  const initialHtml = `
14
14
  <!-- wp:pullquote -->
15
15
  <figure class="wp-block-pullquote"><blockquote><p>One of the hardest things to do in technology is disrupt yourself.</p><cite>Matt Mullenweg</cite></blockquote></figure>
@@ -2,39 +2,8 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createBlock } from '@wordpress/blocks';
5
- import { create, join, toHTMLString } from '@wordpress/rich-text';
6
5
 
7
6
  const transforms = {
8
- from: [
9
- {
10
- type: 'block',
11
- isMultiBlock: true,
12
- blocks: [ 'core/paragraph' ],
13
- transform: ( attributes ) => {
14
- return createBlock( 'core/pullquote', {
15
- value: toHTMLString( {
16
- value: join(
17
- attributes.map( ( { content } ) =>
18
- create( { html: content } )
19
- ),
20
- '\n'
21
- ),
22
- } ),
23
- anchor: attributes.anchor,
24
- } );
25
- },
26
- },
27
- {
28
- type: 'block',
29
- blocks: [ 'core/heading' ],
30
- transform: ( { content, anchor } ) => {
31
- return createBlock( 'core/pullquote', {
32
- value: content,
33
- anchor,
34
- } );
35
- },
36
- },
37
- ],
38
7
  to: [
39
8
  {
40
9
  type: 'block',
@@ -32,12 +32,6 @@ exports[`Quote block transforms to Paragraph block 1`] = `
32
32
  <!-- /wp:paragraph -->"
33
33
  `;
34
34
 
35
- exports[`Quote block transforms to Pullquote block 1`] = `
36
- "<!-- wp:pullquote -->
37
- <figure class="wp-block-pullquote"><blockquote><p>"This will make running your own blog a viable alternative again."</p><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote></figure>
38
- <!-- /wp:pullquote -->"
39
- `;
40
-
41
35
  exports[`Quote block transforms ungroups block 1`] = `
42
36
  "<!-- wp:paragraph -->
43
37
  <p>"This will make running your own blog a viable alternative again."</p>
@@ -21,11 +21,7 @@ const initialHtml = `
21
21
  <!-- /wp:quote -->`;
22
22
 
23
23
  const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
24
- const blockTransforms = [
25
- 'Pullquote',
26
- 'Paragraph',
27
- ...transformsWithInnerBlocks,
28
- ];
24
+ const blockTransforms = [ 'Paragraph', ...transformsWithInnerBlocks ];
29
25
 
30
26
  setupCoreBlocks();
31
27
 
@@ -94,31 +94,6 @@ const transforms = {
94
94
  },
95
95
  ],
96
96
  to: [
97
- {
98
- type: 'block',
99
- blocks: [ 'core/pullquote' ],
100
- isMatch: ( {}, block ) => {
101
- return block.innerBlocks.every(
102
- ( { name } ) => name === 'core/paragraph'
103
- );
104
- },
105
- transform: (
106
- { align, citation, anchor, fontSize, style },
107
- innerBlocks
108
- ) => {
109
- const value = innerBlocks
110
- .map( ( { attributes } ) => `${ attributes.content }` )
111
- .join( '<br>' );
112
- return createBlock( 'core/pullquote', {
113
- value,
114
- align,
115
- citation,
116
- anchor,
117
- fontSize,
118
- style,
119
- } );
120
- },
121
- },
122
97
  {
123
98
  type: 'block',
124
99
  blocks: [ 'core/paragraph' ],
@@ -26,4 +26,33 @@ export const settings = {
26
26
  edit,
27
27
  };
28
28
 
29
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
30
+ settings.fields = [
31
+ {
32
+ label: __( 'Label' ),
33
+ type: 'RichText',
34
+ shownByDefault: true,
35
+ mapping: {
36
+ value: 'label',
37
+ },
38
+ },
39
+ {
40
+ label: __( 'Button text' ),
41
+ type: 'RichText',
42
+ shownByDefault: false,
43
+ mapping: {
44
+ value: 'buttonText',
45
+ },
46
+ },
47
+ {
48
+ label: __( 'Placeholder' ),
49
+ type: 'RichText',
50
+ shownByDefault: false,
51
+ mapping: {
52
+ value: 'placeholder',
53
+ },
54
+ },
55
+ ];
56
+ }
57
+
29
58
  export const init = () => initBlock( { name, metadata, settings } );
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { __ } from '@wordpress/i18n';
4
5
  import { share as icon } from '@wordpress/icons';
5
6
 
6
7
  /**
@@ -21,4 +22,26 @@ export const settings = {
21
22
  variations,
22
23
  };
23
24
 
25
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
26
+ settings.fields = [
27
+ {
28
+ label: __( 'Link' ),
29
+ type: 'Link',
30
+ shownByDefault: true,
31
+ mapping: {
32
+ href: 'url',
33
+ rel: 'rel',
34
+ },
35
+ },
36
+ {
37
+ label: __( 'Label' ),
38
+ type: 'RichText',
39
+ shownByDefault: false,
40
+ mapping: {
41
+ value: 'label',
42
+ },
43
+ },
44
+ ];
45
+ }
46
+
24
47
  export const init = () => initBlock( { name, metadata, settings } );
@@ -183,7 +183,7 @@ export function SocialLinksEdit( props ) {
183
183
  <SelectControl
184
184
  __next40pxDefaultSize
185
185
  __nextHasNoMarginBottom
186
- label={ __( 'Icon Size' ) }
186
+ label={ __( 'Icon size' ) }
187
187
  onChange={ ( newSize ) => {
188
188
  setAttributes( {
189
189
  size: newSize === '' ? undefined : newSize,
package/src/tabs/view.js CHANGED
@@ -9,8 +9,25 @@ import {
9
9
  } from '@wordpress/interactivity';
10
10
 
11
11
  function createReadOnlyProxy( obj ) {
12
+ const arrayMutationMethods = new Set( [
13
+ 'push',
14
+ 'pop',
15
+ 'shift',
16
+ 'unshift',
17
+ 'splice',
18
+ 'sort',
19
+ 'reverse',
20
+ 'copyWithin',
21
+ 'fill',
22
+ ] );
23
+
12
24
  return new Proxy( obj, {
13
25
  get( target, prop ) {
26
+ // If accessing an array mutation method, return a no-op function.
27
+ if ( Array.isArray( target ) && arrayMutationMethods.has( prop ) ) {
28
+ return () => {};
29
+ }
30
+
14
31
  const value = target[ prop ];
15
32
  if ( typeof value === 'object' && value !== null ) {
16
33
  return createReadOnlyProxy( value );
@@ -186,21 +203,19 @@ store( 'core/tabs', {
186
203
  /**
187
204
  * Gets the index of the active tab element whether it
188
205
  * is a tab label or tab panel.
189
- * Public API for third-party access.
190
206
  *
191
207
  * @type {number|null}
192
208
  */
193
209
  get tabIndex() {
194
- return createReadOnlyProxy( privateState.tabIndex );
210
+ return privateState.tabIndex;
195
211
  },
196
212
  /**
197
213
  * Whether the tab panel or tab label is the active tab.
198
- * Public API for third-party access.
199
214
  *
200
215
  * @type {boolean}
201
216
  */
202
217
  get isActiveTab() {
203
- return createReadOnlyProxy( privateState.isActiveTab );
218
+ return privateState.isActiveTab;
204
219
  },
205
220
  },
206
221
  actions: {
@@ -5,7 +5,6 @@ const transformationCategories = {
5
5
  'core/list',
6
6
  'core/list-item',
7
7
  'core/quote',
8
- 'core/pullquote',
9
8
  'core/preformatted',
10
9
  'core/verse',
11
10
  'core/shortcode',
@@ -41,4 +41,17 @@ export const settings = {
41
41
  save,
42
42
  };
43
43
 
44
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
45
+ settings.fields = [
46
+ {
47
+ label: __( 'Content' ),
48
+ type: 'RichText',
49
+ shownByDefault: true,
50
+ mapping: {
51
+ value: 'content',
52
+ },
53
+ },
54
+ ];
55
+ }
56
+
44
57
  export const init = () => initBlock( { name, metadata, settings } );
@@ -33,4 +33,32 @@ export const settings = {
33
33
  save,
34
34
  };
35
35
 
36
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
37
+ settings.fields = [
38
+ {
39
+ label: __( 'Video' ),
40
+ type: 'Media',
41
+ shownByDefault: true,
42
+ mapping: {
43
+ id: 'id',
44
+ src: 'src',
45
+ caption: 'caption',
46
+ poster: 'poster',
47
+ },
48
+ args: {
49
+ allowedTypes: [ 'video' ],
50
+ multiple: false,
51
+ },
52
+ },
53
+ {
54
+ label: __( 'Caption' ),
55
+ type: 'RichText',
56
+ shownByDefault: false,
57
+ mapping: {
58
+ value: 'caption',
59
+ },
60
+ },
61
+ ];
62
+ }
63
+
36
64
  export const init = () => initBlock( { name, metadata, settings } );
@@ -1,73 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import {
5
- addBlock,
6
- getBlock,
7
- initializeEditor,
8
- selectRangeInRichText,
9
- setupCoreBlocks,
10
- getEditorHtml,
11
- fireEvent,
12
- within,
13
- waitFor,
14
- typeInRichText,
15
- } from 'test/helpers';
16
-
17
- /**
18
- * WordPress dependencies
19
- */
20
- import { ENTER } from '@wordpress/keycodes';
21
-
22
- setupCoreBlocks();
23
-
24
- describe( 'Pullquote', () => {
25
- it( 'should produce expected markup for multiline text', async () => {
26
- // Arrange
27
- const screen = await initializeEditor();
28
- await addBlock( screen, 'Pullquote' );
29
- // Await inner blocks to be rendered
30
- const citationBlock = await waitFor( () =>
31
- screen.getByPlaceholderText( 'Add citation' )
32
- );
33
-
34
- // Act
35
- const pullquoteBlock = getBlock( screen, 'Pullquote' );
36
- fireEvent.press( pullquoteBlock );
37
- const pullquoteTextInput =
38
- within( pullquoteBlock ).getByPlaceholderText( 'Add quote' );
39
- typeInRichText( pullquoteTextInput, 'A great statement.' );
40
- fireEvent( pullquoteTextInput, 'onKeyDown', {
41
- nativeEvent: {},
42
- preventDefault() {},
43
- keyCode: ENTER,
44
- } );
45
- typeInRichText( pullquoteTextInput, 'Again' );
46
-
47
- const citationTextInput =
48
- within( citationBlock ).getByPlaceholderText( 'Add citation' );
49
- typeInRichText( citationTextInput, 'A person' );
50
- fireEvent( citationTextInput, 'onKeyDown', {
51
- nativeEvent: {},
52
- preventDefault() {},
53
- keyCode: ENTER,
54
- } );
55
- selectRangeInRichText( citationTextInput, 2 );
56
- fireEvent( citationTextInput, 'onKeyDown', {
57
- nativeEvent: {},
58
- preventDefault() {},
59
- keyCode: ENTER,
60
- } );
61
-
62
- // Assert
63
- expect( getEditorHtml() ).toMatchInlineSnapshot( `
64
- "<!-- wp:pullquote -->
65
- <figure class="wp-block-pullquote"><blockquote><p>A great statement.<br>Again</p><cite>A <br>person</cite></blockquote></figure>
66
- <!-- /wp:pullquote -->
67
-
68
- <!-- wp:paragraph -->
69
- <p></p>
70
- <!-- /wp:paragraph -->"
71
- ` );
72
- } );
73
- } );