@wordpress/block-library 9.35.1-next.16d95556a.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 (161) 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/index.js +20 -0
  51. package/build/pullquote/index.js.map +2 -2
  52. package/build/search/index.js +28 -0
  53. package/build/search/index.js.map +2 -2
  54. package/build/social-link/index.js +22 -0
  55. package/build/social-link/index.js.map +2 -2
  56. package/build/social-links/edit.js +1 -1
  57. package/build/social-links/edit.js.map +1 -1
  58. package/build/tabs/view.js +17 -4
  59. package/build/tabs/view.js.map +2 -2
  60. package/build/verse/index.js +12 -0
  61. package/build/verse/index.js.map +2 -2
  62. package/build/video/index.js +27 -0
  63. package/build/video/index.js.map +2 -2
  64. package/build-module/audio/index.js +26 -0
  65. package/build-module/audio/index.js.map +2 -2
  66. package/build-module/breadcrumbs/edit.js +1 -1
  67. package/build-module/breadcrumbs/edit.js.map +2 -2
  68. package/build-module/button/index.js +22 -0
  69. package/build-module/button/index.js.map +2 -2
  70. package/build-module/code/index.js +12 -0
  71. package/build-module/code/index.js.map +2 -2
  72. package/build-module/cover/index.js +22 -0
  73. package/build-module/cover/index.js.map +2 -2
  74. package/build-module/details/index.js +12 -0
  75. package/build-module/details/index.js.map +2 -2
  76. package/build-module/file/index.js +34 -1
  77. package/build-module/file/index.js.map +2 -2
  78. package/build-module/heading/index.js +12 -0
  79. package/build-module/heading/index.js.map +2 -2
  80. package/build-module/html/modal.js +127 -145
  81. package/build-module/html/modal.js.map +2 -2
  82. package/build-module/image/index.js +46 -0
  83. package/build-module/image/index.js.map +2 -2
  84. package/build-module/list-item/index.js +13 -0
  85. package/build-module/list-item/index.js.map +2 -2
  86. package/build-module/media-text/index.js +28 -0
  87. package/build-module/media-text/index.js.map +2 -2
  88. package/build-module/more/index.js +13 -0
  89. package/build-module/more/index.js.map +2 -2
  90. package/build-module/navigation/block.json +2 -2
  91. package/build-module/navigation-link/block.json +2 -1
  92. package/build-module/navigation-link/edit.js +20 -4
  93. package/build-module/navigation-link/edit.js.map +2 -2
  94. package/build-module/navigation-link/index.js +23 -1
  95. package/build-module/navigation-link/index.js.map +2 -2
  96. package/build-module/navigation-link/shared/controls.js +12 -18
  97. package/build-module/navigation-link/shared/controls.js.map +2 -2
  98. package/build-module/navigation-link/shared/index.js +3 -1
  99. package/build-module/navigation-link/shared/index.js.map +2 -2
  100. package/build-module/navigation-link/shared/use-entity-binding.js +3 -2
  101. package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
  102. package/build-module/navigation-submenu/block.json +2 -1
  103. package/build-module/navigation-submenu/index.js +23 -1
  104. package/build-module/navigation-submenu/index.js.map +2 -2
  105. package/build-module/paragraph/index.js +12 -0
  106. package/build-module/paragraph/index.js.map +2 -2
  107. package/build-module/post-comments-count/edit.js +1 -3
  108. package/build-module/post-comments-count/edit.js.map +2 -2
  109. package/build-module/post-comments-link/edit.js +10 -8
  110. package/build-module/post-comments-link/edit.js.map +2 -2
  111. package/build-module/preformatted/index.js +12 -0
  112. package/build-module/preformatted/index.js.map +2 -2
  113. package/build-module/pullquote/index.js +20 -0
  114. package/build-module/pullquote/index.js.map +2 -2
  115. package/build-module/search/index.js +28 -0
  116. package/build-module/search/index.js.map +2 -2
  117. package/build-module/social-link/index.js +22 -0
  118. package/build-module/social-link/index.js.map +2 -2
  119. package/build-module/social-links/edit.js +1 -1
  120. package/build-module/social-links/edit.js.map +1 -1
  121. package/build-module/tabs/view.js +17 -4
  122. package/build-module/tabs/view.js.map +2 -2
  123. package/build-module/verse/index.js +12 -0
  124. package/build-module/verse/index.js.map +2 -2
  125. package/build-module/video/index.js +27 -0
  126. package/build-module/video/index.js.map +2 -2
  127. package/package.json +37 -37
  128. package/src/audio/index.js +27 -0
  129. package/src/breadcrumbs/edit.js +4 -2
  130. package/src/breadcrumbs/index.php +112 -30
  131. package/src/button/index.js +23 -0
  132. package/src/code/index.js +13 -0
  133. package/src/cover/index.js +23 -0
  134. package/src/details/index.js +13 -0
  135. package/src/file/index.js +35 -1
  136. package/src/heading/index.js +13 -0
  137. package/src/html/modal.js +8 -28
  138. package/src/image/index.js +47 -0
  139. package/src/list-item/index.js +14 -0
  140. package/src/media-text/index.js +29 -0
  141. package/src/more/index.js +14 -0
  142. package/src/navigation/block.json +2 -2
  143. package/src/navigation-link/block.json +2 -1
  144. package/src/navigation-link/edit.js +27 -4
  145. package/src/navigation-link/index.js +24 -1
  146. package/src/navigation-link/shared/controls.js +13 -17
  147. package/src/navigation-link/shared/index.js +1 -1
  148. package/src/navigation-link/shared/use-entity-binding.js +5 -2
  149. package/src/navigation-submenu/block.json +2 -1
  150. package/src/navigation-submenu/index.js +24 -1
  151. package/src/paragraph/index.js +13 -0
  152. package/src/post-comments-count/edit.js +1 -9
  153. package/src/post-comments-link/edit.js +8 -18
  154. package/src/preformatted/index.js +13 -0
  155. package/src/pullquote/index.js +21 -0
  156. package/src/search/index.js +29 -0
  157. package/src/social-link/index.js +23 -0
  158. package/src/social-links/edit.js +1 -1
  159. package/src/tabs/view.js +19 -4
  160. package/src/verse/index.js +13 -0
  161. package/src/video/index.js +28 -0
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { __ } from '@wordpress/i18n';
4
5
  import { listItem as icon } from '@wordpress/icons';
5
6
  import { privateApis } from '@wordpress/block-editor';
6
7
 
@@ -32,4 +33,17 @@ export const settings = {
32
33
  [ unlock( privateApis ).requiresWrapperOnCopy ]: true,
33
34
  };
34
35
 
36
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
37
+ settings.fields = [
38
+ {
39
+ label: __( 'Content' ),
40
+ type: 'RichText',
41
+ shownByDefault: true,
42
+ mapping: {
43
+ value: 'content',
44
+ },
45
+ },
46
+ ];
47
+ }
48
+
35
49
  export const init = () => initBlock( { name, metadata, settings } );
@@ -50,4 +50,33 @@ export const settings = {
50
50
  deprecated,
51
51
  };
52
52
 
53
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
54
+ settings.fields = [
55
+ {
56
+ label: __( 'Media' ),
57
+ type: 'Media',
58
+ shownByDefault: true,
59
+ mapping: {
60
+ id: 'mediaId',
61
+ type: 'mediaType',
62
+ src: 'mediaUrl',
63
+ },
64
+ args: {
65
+ allowedTypes: [ 'image', 'video' ],
66
+ multiple: false,
67
+ },
68
+ },
69
+ {
70
+ label: __( 'Link' ),
71
+ type: 'Link',
72
+ shownByDefault: false,
73
+ mapping: {
74
+ href: 'href',
75
+ rel: 'rel',
76
+ target: 'linkTarget',
77
+ },
78
+ },
79
+ ];
80
+ }
81
+
53
82
  export const init = () => initBlock( { name, metadata, settings } );
package/src/more/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { more as icon } from '@wordpress/icons';
5
+ import { __ } from '@wordpress/i18n';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -35,4 +36,17 @@ export const settings = {
35
36
  save,
36
37
  };
37
38
 
39
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
40
+ settings.fields = [
41
+ {
42
+ label: __( 'Content' ),
43
+ type: 'RichText',
44
+ shownByDefault: true,
45
+ mapping: {
46
+ value: 'customText',
47
+ },
48
+ },
49
+ ];
50
+ }
51
+
38
52
  export const init = () => initBlock( { name, metadata, settings } );
@@ -105,6 +105,7 @@
105
105
  "supports": {
106
106
  "align": [ "wide", "full" ],
107
107
  "ariaLabel": true,
108
+ "contentRole": true,
108
109
  "html": false,
109
110
  "inserter": true,
110
111
  "typography": {
@@ -138,8 +139,7 @@
138
139
  }
139
140
  },
140
141
  "interactivity": true,
141
- "renaming": false,
142
- "contentRole": true
142
+ "renaming": false
143
143
  },
144
144
  "editorStyle": "wp-block-navigation-editor",
145
145
  "style": "wp-block-navigation"
@@ -34,7 +34,8 @@
34
34
  "default": false
35
35
  },
36
36
  "url": {
37
- "type": "string"
37
+ "type": "string",
38
+ "role": "content"
38
39
  },
39
40
  "title": {
40
41
  "type": "string"
@@ -8,9 +8,13 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { createBlock } from '@wordpress/blocks';
10
10
  import { useSelect, useDispatch } from '@wordpress/data';
11
- import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
11
+ import {
12
+ ToolbarButton,
13
+ ToolbarGroup,
14
+ VisuallyHidden,
15
+ } from '@wordpress/components';
12
16
  import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
13
- import { __ } from '@wordpress/i18n';
17
+ import { __, sprintf } from '@wordpress/i18n';
14
18
  import {
15
19
  BlockControls,
16
20
  InspectorControls,
@@ -26,13 +30,19 @@ import { useState, useEffect, useRef, useCallback } from '@wordpress/element';
26
30
  import { decodeEntities } from '@wordpress/html-entities';
27
31
  import { link as linkIcon, addSubmenu } from '@wordpress/icons';
28
32
  import { store as coreStore } from '@wordpress/core-data';
29
- import { useMergeRefs, usePrevious } from '@wordpress/compose';
33
+ import { useMergeRefs, usePrevious, useInstanceId } from '@wordpress/compose';
30
34
 
31
35
  /**
32
36
  * Internal dependencies
33
37
  */
34
38
  import { getColors } from '../navigation/edit/utils';
35
- import { Controls, LinkUI, updateAttributes, useEntityBinding } from './shared';
39
+ import {
40
+ Controls,
41
+ LinkUI,
42
+ updateAttributes,
43
+ useEntityBinding,
44
+ MissingEntityHelpText,
45
+ } from './shared';
36
46
 
37
47
  const DEFAULT_BLOCK = { name: 'core/navigation-link' };
38
48
  const NESTING_BLOCK_NAMES = [
@@ -394,6 +404,12 @@ export default function NavigationLinkEdit( {
394
404
  }
395
405
  }
396
406
 
407
+ const instanceId = useInstanceId( NavigationLinkEdit );
408
+ const hasMissingEntity = hasUrlBinding && ! isBoundEntityAvailable;
409
+ const missingEntityDescriptionId = hasMissingEntity
410
+ ? sprintf( 'navigation-link-edit-%d-desc', instanceId )
411
+ : undefined;
412
+
397
413
  const blockProps = useBlockProps( {
398
414
  ref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),
399
415
  className: clsx( 'wp-block-navigation-item', {
@@ -407,6 +423,8 @@ export default function NavigationLinkEdit( {
407
423
  [ getColorClassName( 'background-color', backgroundColor ) ]:
408
424
  !! backgroundColor,
409
425
  } ),
426
+ 'aria-describedby': missingEntityDescriptionId,
427
+ 'aria-invalid': hasMissingEntity,
410
428
  style: {
411
429
  color: ! textColor && customTextColor,
412
430
  backgroundColor: ! backgroundColor && customBackgroundColor,
@@ -482,6 +500,11 @@ export default function NavigationLinkEdit( {
482
500
  />
483
501
  </InspectorControls>
484
502
  <div { ...blockProps }>
503
+ { hasMissingEntity && (
504
+ <VisuallyHidden id={ missingEntityDescriptionId }>
505
+ <MissingEntityHelpText type={ type } kind={ kind } />
506
+ </VisuallyHidden>
507
+ ) }
485
508
  { /* eslint-disable jsx-a11y/anchor-is-valid */ }
486
509
  <a className={ classes }>
487
510
  { /* eslint-enable */ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { _x } from '@wordpress/i18n';
4
+ import { _x, __ } from '@wordpress/i18n';
5
5
  import { customLink as linkIcon } from '@wordpress/icons';
6
6
  import { InnerBlocks } from '@wordpress/block-editor';
7
7
  import { addFilter } from '@wordpress/hooks';
@@ -89,6 +89,29 @@ export const settings = {
89
89
  transforms,
90
90
  };
91
91
 
92
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
93
+ settings.fields = [
94
+ {
95
+ label: __( 'Label' ),
96
+ type: 'RichText',
97
+ shownByDefault: true,
98
+ mapping: {
99
+ value: 'label',
100
+ },
101
+ },
102
+ {
103
+ label: __( 'Link' ),
104
+ type: 'Link',
105
+ shownByDefault: false,
106
+ mapping: {
107
+ href: 'url',
108
+ rel: 'rel',
109
+ // TODO - opens in new tab? id?
110
+ },
111
+ },
112
+ ];
113
+ }
114
+
92
115
  export const init = () => {
93
116
  addFilter(
94
117
  'blocks.registerBlockType',
@@ -221,7 +221,7 @@ export function Controls( { attributes, setAttributes, clientId } ) {
221
221
  } }
222
222
  help={
223
223
  hasUrlBinding && ! isBoundEntityAvailable ? (
224
- <MissingEntityHelpText
224
+ <MissingEntityHelp
225
225
  id={ helpTextId }
226
226
  type={ attributes.type }
227
227
  kind={ attributes.kind }
@@ -327,7 +327,7 @@ export function Controls( { attributes, setAttributes, clientId } ) {
327
327
  * @param {string} props.kind - The entity kind
328
328
  * @return {string} Help text for the bound URL
329
329
  */
330
- function BindingHelpText( { type, kind } ) {
330
+ export function BindingHelpText( { type, kind } ) {
331
331
  const entityType = getEntityTypeName( type, kind );
332
332
  return sprintf(
333
333
  /* translators: %s is the entity type (e.g., "page", "post", "category") */
@@ -340,27 +340,23 @@ function BindingHelpText( { type, kind } ) {
340
340
  * Component to display error help text for missing entity bindings.
341
341
  *
342
342
  * @param {Object} props - Component props
343
- * @param {string} props.id - ID for the help text element (for aria-describedby)
344
343
  * @param {string} props.type - The entity type
345
344
  * @param {string} props.kind - The entity kind
346
345
  * @return {JSX.Element} Error help text component
347
346
  */
348
- function MissingEntityHelpText( { id, type, kind } ) {
347
+ export function MissingEntityHelpText( { type, kind } ) {
349
348
  const entityType = getEntityTypeName( type, kind );
349
+ return sprintf(
350
+ /* translators: %s is the entity type (e.g., "page", "post", "category") */
351
+ __( 'Synced %s is missing. Please update or remove this link.' ),
352
+ entityType
353
+ );
354
+ }
355
+
356
+ function MissingEntityHelp( { id, type, kind } ) {
350
357
  return (
351
- <span
352
- id={ id }
353
- className="navigation-link-control__error-text"
354
- role="alert"
355
- aria-live="polite"
356
- >
357
- { sprintf(
358
- /* translators: %s is the entity type (e.g., "page", "post", "category") */
359
- __(
360
- 'Synced %s is missing. Please update or remove this link.'
361
- ),
362
- entityType
363
- ) }
358
+ <span id={ id } className="navigation-link-control__error-text">
359
+ <MissingEntityHelpText type={ type } kind={ kind } />
364
360
  </span>
365
361
  );
366
362
  }
@@ -5,7 +5,7 @@
5
5
  * to reduce code duplication and ensure consistent behavior.
6
6
  */
7
7
 
8
- export { Controls } from './controls';
8
+ export { Controls, BindingHelpText, MissingEntityHelpText } from './controls';
9
9
  export { updateAttributes } from './update-attributes';
10
10
  export {
11
11
  useEntityBinding,
@@ -98,10 +98,13 @@ export function useEntityBinding( { clientId, attributes } ) {
98
98
 
99
99
  // Use the correct entity type based on kind.
100
100
  const entityType = isTaxonomy ? 'taxonomy' : 'postType';
101
- const entityRecord = getEntityRecord( entityType, type, id );
101
+ // Convert 'tag' back to 'post_tag' for the API call
102
+ // (it was converted from 'post_tag' to 'tag' for storage in updateAttributes)
103
+ const typeForAPI = type === 'tag' ? 'post_tag' : type;
104
+ const entityRecord = getEntityRecord( entityType, typeForAPI, id );
102
105
  const hasResolved = hasFinishedResolution( 'getEntityRecord', [
103
106
  entityType,
104
- type,
107
+ typeForAPI,
105
108
  id,
106
109
  ] );
107
110
 
@@ -29,7 +29,8 @@
29
29
  "default": false
30
30
  },
31
31
  "url": {
32
- "type": "string"
32
+ "type": "string",
33
+ "role": "content"
33
34
  },
34
35
  "title": {
35
36
  "type": "string"
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { page, addSubmenu } from '@wordpress/icons';
5
- import { _x } from '@wordpress/i18n';
5
+ import { _x, __ } from '@wordpress/i18n';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -48,4 +48,27 @@ export const settings = {
48
48
  transforms,
49
49
  };
50
50
 
51
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
52
+ settings.fields = [
53
+ {
54
+ label: __( 'Label' ),
55
+ type: 'RichText',
56
+ shownByDefault: true,
57
+ mapping: {
58
+ value: 'label',
59
+ },
60
+ },
61
+ {
62
+ label: __( 'Link' ),
63
+ type: 'Link',
64
+ shownByDefault: false,
65
+ mapping: {
66
+ href: 'url',
67
+ rel: 'rel',
68
+ // TODO - opens in new tab? id?
69
+ },
70
+ },
71
+ ];
72
+ }
73
+
51
74
  export const init = () => initBlock( { name, metadata, settings } );
@@ -58,4 +58,17 @@ export const settings = {
58
58
  variations,
59
59
  };
60
60
 
61
+ if ( window.__experimentalContentOnlyPatternInsertion ) {
62
+ settings.fields = [
63
+ {
64
+ label: __( 'Content' ),
65
+ type: 'RichText',
66
+ shownByDefault: true,
67
+ mapping: {
68
+ value: 'content',
69
+ },
70
+ },
71
+ ];
72
+ }
73
+
61
74
  export const init = () => initBlock( { name, metadata, settings } );
@@ -9,13 +9,11 @@ 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';
16
15
  import apiFetch from '@wordpress/api-fetch';
17
16
  import { addQueryArgs } from '@wordpress/url';
18
- import { __ } from '@wordpress/i18n';
19
17
 
20
18
  export default function PostCommentsCountEdit( {
21
19
  attributes,
@@ -68,13 +66,7 @@ export default function PostCommentsCountEdit( {
68
66
  />
69
67
  </BlockControls>
70
68
  <div { ...blockProps } style={ blockStyles }>
71
- { hasPostAndComments ? (
72
- commentsCount
73
- ) : (
74
- <Warning>
75
- { __( 'Post Comments Count block: post not found.' ) }
76
- </Warning>
77
- ) }
69
+ { hasPostAndComments ? commentsCount : '0' }
78
70
  </div>
79
71
  </>
80
72
  );
@@ -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 } );
@@ -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 } );
@@ -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: {
@@ -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 } );