@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/paragraph/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { paragraph as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __(\n\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t),\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\tif ( customName ) {\n\t\t\t\treturn customName;\n\t\t\t}\n\n\t\t\tconst { content } = attributes;\n\t\t\treturn ! content || content.length === 0 ? __( 'Empty' ) : content;\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAKlC,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,SAAS;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,aAAa,YAAY,UAAU;AAEzC,QAAK,YAAY,eAAe,YAAa;AAC5C,aAAO;AAAA,IACR;AAEA,QAAK,YAAY,iBAAkB;AAClC,UAAK,YAAa;AACjB,eAAO;AAAA,MACR;AAEA,YAAM,EAAE,QAAQ,IAAI;AACpB,aAAO,CAAE,WAAW,QAAQ,WAAW,IAAI,GAAI,OAAQ,IAAI;AAAA,IAC5D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,UACG,WAAW,WAAW,OACtB,kBAAkB,WAAW;AAAA,IACjC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { paragraph as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __(\n\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t),\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\tif ( customName ) {\n\t\t\t\treturn customName;\n\t\t\t}\n\n\t\t\tconst { content } = attributes;\n\t\t\treturn ! content || content.length === 0 ? __( 'Empty' ) : content;\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings.fields = [\n\t\t{\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: true,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'content',\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAKlC,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,SAAS;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,aAAa,YAAY,UAAU;AAEzC,QAAK,YAAY,eAAe,YAAa;AAC5C,aAAO;AAAA,IACR;AAEA,QAAK,YAAY,iBAAkB;AAClC,UAAK,YAAa;AACjB,eAAO;AAAA,MACR;AAEA,YAAM,EAAE,QAAQ,IAAI;AACpB,aAAO,CAAE,WAAW,QAAQ,WAAW,IAAI,GAAI,OAAQ,IAAI;AAAA,IAC5D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,UACG,WAAW,WAAW,OACtB,kBAAkB,WAAW;AAAA,IACjC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAS,SAAS;AAAA,IACjB;AAAA,MACC,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -3,13 +3,11 @@ import clsx from "clsx";
3
3
  import {
4
4
  AlignmentControl,
5
5
  BlockControls,
6
- Warning,
7
6
  useBlockProps
8
7
  } from "@wordpress/block-editor";
9
8
  import { useState, useEffect } from "@wordpress/element";
10
9
  import apiFetch from "@wordpress/api-fetch";
11
10
  import { addQueryArgs } from "@wordpress/url";
12
- import { __ } from "@wordpress/i18n";
13
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
12
  function PostCommentsCountEdit({
15
13
  attributes,
@@ -55,7 +53,7 @@ function PostCommentsCountEdit({
55
53
  }
56
54
  }
57
55
  ) }),
58
- /* @__PURE__ */ jsx("div", { ...blockProps, style: blockStyles, children: hasPostAndComments ? commentsCount : /* @__PURE__ */ jsx(Warning, { children: __("Post Comments Count block: post not found.") }) })
56
+ /* @__PURE__ */ jsx("div", { ...blockProps, style: blockStyles, children: hasPostAndComments ? commentsCount : "0" })
59
57
  ] });
60
58
  }
61
59
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/post-comments-count/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __ } from '@wordpress/i18n';\n\nexport default function PostCommentsCountEdit( {\n\tattributes,\n\tcontext,\n\tsetAttributes,\n} ) {\n\tconst { textAlign } = attributes;\n\tconst { postId } = context;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( ! postId ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t} ),\n\t\t\tparse: false,\n\t\t} ).then( ( res ) => {\n\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\tif ( currentPostId === postId ) {\n\t\t\t\tsetCommentsCount( res.headers.get( 'X-WP-Total' ) );\n\t\t\t}\n\t\t} );\n\t}, [ postId ] );\n\n\tconst hasPostAndComments = postId && commentsCount !== undefined;\n\tconst blockStyles = {\n\t\t...blockProps.style,\n\t\ttextDecoration: hasPostAndComments\n\t\t\t? blockProps.style?.textDecoration\n\t\t\t: undefined,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps } style={ blockStyles }>\n\t\t\t\t{ hasPostAndComments ? (\n\t\t\t\t\tcommentsCount\n\t\t\t\t) : (\n\t\t\t\t\t<Warning>\n\t\t\t\t\t\t{ __( 'Post Comments Count block: post not found.' ) }\n\t\t\t\t\t</Warning>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU,iBAAiB;AACpC,OAAO,cAAc;AACrB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AA2CjB,mBAEE,KAFF;AAzCa,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,UAAU,IAAI;AACtB,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAS;AACrD,QAAM,aAAa,cAAe;AAAA,IACjC,WAAW,KAAM;AAAA,MAChB,CAAE,kBAAmB,SAAU,EAAG,GAAG;AAAA,IACtC,CAAE;AAAA,EACH,CAAE;AAEF,YAAW,MAAM;AAChB,QAAK,CAAE,QAAS;AACf;AAAA,IACD;AACA,UAAM,gBAAgB;AACtB,aAAU;AAAA,MACT,MAAM,aAAc,mBAAmB;AAAA,QACtC,MAAM;AAAA,MACP,CAAE;AAAA,MACF,OAAO;AAAA,IACR,CAAE,EAAE,KAAM,CAAE,QAAS;AAEpB,UAAK,kBAAkB,QAAS;AAC/B,yBAAkB,IAAI,QAAQ,IAAK,YAAa,CAAE;AAAA,MACnD;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,MAAO,CAAE;AAEd,QAAM,qBAAqB,UAAU,kBAAkB;AACvD,QAAM,cAAc;AAAA,IACnB,GAAG,WAAW;AAAA,IACd,gBAAgB,qBACb,WAAW,OAAO,iBAClB;AAAA,EACJ;AAEA,SACC,iCACC;AAAA,wBAAC,iBAAc,OAAM,SACpB;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR,UAAW,CAAE,cAAe;AAC3B,wBAAe,EAAE,WAAW,UAAU,CAAE;AAAA,QACzC;AAAA;AAAA,IACD,GACD;AAAA,IACA,oBAAC,SAAM,GAAG,YAAa,OAAQ,aAC5B,+BACD,gBAEA,oBAAC,WACE,aAAI,4CAA6C,GACpD,GAEF;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\nexport default function PostCommentsCountEdit( {\n\tattributes,\n\tcontext,\n\tsetAttributes,\n} ) {\n\tconst { textAlign } = attributes;\n\tconst { postId } = context;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( ! postId ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t} ),\n\t\t\tparse: false,\n\t\t} ).then( ( res ) => {\n\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\tif ( currentPostId === postId ) {\n\t\t\t\tsetCommentsCount( res.headers.get( 'X-WP-Total' ) );\n\t\t\t}\n\t\t} );\n\t}, [ postId ] );\n\n\tconst hasPostAndComments = postId && commentsCount !== undefined;\n\tconst blockStyles = {\n\t\t...blockProps.style,\n\t\ttextDecoration: hasPostAndComments\n\t\t\t? blockProps.style?.textDecoration\n\t\t\t: undefined,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps } style={ blockStyles }>\n\t\t\t\t{ hasPostAndComments ? commentsCount : '0' }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU,iBAAiB;AACpC,OAAO,cAAc;AACrB,SAAS,oBAAoB;AA2C3B,mBAEE,KAFF;AAzCa,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,UAAU,IAAI;AACtB,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAS;AACrD,QAAM,aAAa,cAAe;AAAA,IACjC,WAAW,KAAM;AAAA,MAChB,CAAE,kBAAmB,SAAU,EAAG,GAAG;AAAA,IACtC,CAAE;AAAA,EACH,CAAE;AAEF,YAAW,MAAM;AAChB,QAAK,CAAE,QAAS;AACf;AAAA,IACD;AACA,UAAM,gBAAgB;AACtB,aAAU;AAAA,MACT,MAAM,aAAc,mBAAmB;AAAA,QACtC,MAAM;AAAA,MACP,CAAE;AAAA,MACF,OAAO;AAAA,IACR,CAAE,EAAE,KAAM,CAAE,QAAS;AAEpB,UAAK,kBAAkB,QAAS;AAC/B,yBAAkB,IAAI,QAAQ,IAAK,YAAa,CAAE;AAAA,MACnD;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,MAAO,CAAE;AAEd,QAAM,qBAAqB,UAAU,kBAAkB;AACvD,QAAM,cAAc;AAAA,IACnB,GAAG,WAAW;AAAA,IACd,gBAAgB,qBACb,WAAW,OAAO,iBAClB;AAAA,EACJ;AAEA,SACC,iCACC;AAAA,wBAAC,iBAAc,OAAM,SACpB;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR,UAAW,CAAE,cAAe;AAC3B,wBAAe,EAAE,WAAW,UAAU,CAAE;AAAA,QACzC;AAAA;AAAA,IACD,GACD;AAAA,IACA,oBAAC,SAAM,GAAG,YAAa,OAAQ,aAC5B,+BAAqB,gBAAgB,KACxC;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,6 @@ import clsx from "clsx";
3
3
  import {
4
4
  AlignmentControl,
5
5
  BlockControls,
6
- Warning,
7
6
  useBlockProps
8
7
  } from "@wordpress/block-editor";
9
8
  import { useState, useEffect } from "@wordpress/element";
@@ -46,10 +45,6 @@ function PostCommentsLinkEdit({ context, attributes, setAttributes }) {
46
45
  ),
47
46
  [postType, postId]
48
47
  );
49
- if (!post) {
50
- return /* @__PURE__ */ jsx("div", { ...blockProps, children: /* @__PURE__ */ jsx(Warning, { children: __("Post Comments Link block: post not found.") }) });
51
- }
52
- const { link } = post;
53
48
  let commentsText;
54
49
  if (commentsCount !== void 0) {
55
50
  const commentsNumber = parseInt(commentsCount);
@@ -73,14 +68,21 @@ function PostCommentsLinkEdit({ context, attributes, setAttributes }) {
73
68
  }
74
69
  }
75
70
  ) }),
76
- /* @__PURE__ */ jsx("div", { ...blockProps, children: link && commentsText !== void 0 ? /* @__PURE__ */ jsx(
71
+ /* @__PURE__ */ jsx("div", { ...blockProps, children: post?.link && commentsText !== void 0 ? /* @__PURE__ */ jsx(
77
72
  "a",
78
73
  {
79
- href: link + "#comments",
74
+ href: post?.link + "#comments",
80
75
  onClick: (event) => event.preventDefault(),
81
76
  children: commentsText
82
77
  }
83
- ) : /* @__PURE__ */ jsx(Warning, { children: __("Post Comments Link block: post not found.") }) })
78
+ ) : /* @__PURE__ */ jsx(
79
+ "a",
80
+ {
81
+ href: "#post-comments-link-pseudo-link",
82
+ onClick: (event) => event.preventDefault(),
83
+ children: __("No comments")
84
+ }
85
+ ) })
84
86
  ] });
85
87
  }
86
88
  var edit_default = PostCommentsLinkEdit;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/post-comments-link/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nfunction PostCommentsLinkEdit( { context, attributes, setAttributes } ) {\n\tconst { textAlign } = attributes;\n\tconst { postType, postId } = context;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( ! postId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t} ),\n\t\t\tparse: false,\n\t\t} ).then( ( res ) => {\n\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\tif ( currentPostId === postId ) {\n\t\t\t\tsetCommentsCount( res.headers.get( 'X-WP-Total' ) );\n\t\t\t}\n\t\t} );\n\t}, [ postId ] );\n\n\tconst post = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t),\n\t\t[ postType, postId ]\n\t);\n\n\tif ( ! post ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Post Comments Link block: post not found.' ) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst { link } = post;\n\n\tlet commentsText;\n\tif ( commentsCount !== undefined ) {\n\t\tconst commentsNumber = parseInt( commentsCount );\n\n\t\tif ( commentsNumber === 0 ) {\n\t\t\tcommentsText = __( 'No comments' );\n\t\t} else {\n\t\t\tcommentsText = sprintf(\n\t\t\t\t/* translators: %s: Number of comments */\n\t\t\t\t_n( '%s comment', '%s comments', commentsNumber ),\n\t\t\t\tcommentsNumber.toLocaleString()\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ link && commentsText !== undefined ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ link + '#comments' }\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ commentsText }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<Warning>\n\t\t\t\t\t\t{ __( 'Post Comments Link block: post not found.' ) }\n\t\t\t\t\t</Warning>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default PostCommentsLinkEdit;\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,E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C,QAAK,mBAAmB,GAAI;AAC3B,qBAAe,GAAI,aAAc;AAAA,IAClC,OAAO;AACN,qBAAe;AAAA;AAAA,QAEd,GAAI,cAAc,eAAe,cAAe;AAAA,QAChD,eAAe,eAAe;AAAA,MAC/B;AAAA,IACD;AAAA,EACD;AAEA,SACC,iCACC;AAAA,wBAAC,iBAAc,OAAM,SACpB;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR,UAAW,CAAE,cAAe;AAC3B,wBAAe,EAAE,WAAW,UAAU,CAAE;AAAA,QACzC;AAAA;AAAA,IACD,GACD;AAAA,IAEA,oBAAC,SAAM,GAAG,YACP,kBAAQ,iBAAiB,SAC1B;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,OAAO;AAAA,QACd,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,QAE1C;AAAA;AAAA,IACH,IAEA,oBAAC,WACE,aAAI,2CAA4C,GACnD,GAEF;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nfunction PostCommentsLinkEdit( { context, attributes, setAttributes } ) {\n\tconst { textAlign } = attributes;\n\tconst { postType, postId } = context;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( ! postId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t} ),\n\t\t\tparse: false,\n\t\t} ).then( ( res ) => {\n\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\tif ( currentPostId === postId ) {\n\t\t\t\tsetCommentsCount( res.headers.get( 'X-WP-Total' ) );\n\t\t\t}\n\t\t} );\n\t}, [ postId ] );\n\n\tconst post = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t),\n\t\t[ postType, postId ]\n\t);\n\n\tlet commentsText;\n\tif ( commentsCount !== undefined ) {\n\t\tconst commentsNumber = parseInt( commentsCount );\n\n\t\tif ( commentsNumber === 0 ) {\n\t\t\tcommentsText = __( 'No comments' );\n\t\t} else {\n\t\t\tcommentsText = sprintf(\n\t\t\t\t/* translators: %s: Number of comments */\n\t\t\t\t_n( '%s comment', '%s comments', commentsNumber ),\n\t\t\t\tcommentsNumber.toLocaleString()\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ post?.link && commentsText !== undefined ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ post?.link + '#comments' }\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ commentsText }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\"#post-comments-link-pseudo-link\"\n\t\t\t\t\t\tonClick={ ( event ) =>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C,UAAM,iBAAiB,SAAU,aAAc;AAE/C,QAAK,mBAAmB,GAAI;AAC3B,qBAAe,GAAI,aAAc;AAAA,IAClC,OAAO;AACN,qBAAe;AAAA;AAAA,QAEd,GAAI,cAAc,eAAe,cAAe;AAAA,QAChD,eAAe,eAAe;AAAA,MAC/B;AAAA,IACD;AAAA,EACD;AAEA,SACC,iCACC;AAAA,wBAAC,iBAAc,OAAM,SACpB;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR,UAAW,CAAE,cAAe;AAC3B,wBAAe,EAAE,WAAW,UAAU,CAAE;AAAA,QACzC;AAAA;AAAA,IACD,GACD;AAAA,IAEA,oBAAC,SAAM,GAAG,YACP,gBAAM,QAAQ,iBAAiB,SAChC;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,MAAM,OAAO;AAAA,QACpB,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,QAE1C;AAAA;AAAA,IACH,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,QAE1C,aAAI,aAAc;AAAA;AAAA,IACrB,GAEF;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
6
6
  "names": []
7
7
  }
@@ -28,6 +28,18 @@ var settings = {
28
28
  };
29
29
  }
30
30
  };
31
+ if (window.__experimentalContentOnlyPatternInsertion) {
32
+ settings.fields = [
33
+ {
34
+ label: __("Content"),
35
+ type: "RichText",
36
+ shownByDefault: true,
37
+ mapping: {
38
+ value: "content"
39
+ }
40
+ }
41
+ ];
42
+ }
31
43
  var init = () => initBlock({ name, metadata, settings });
32
44
  export {
33
45
  init,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/preformatted/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { preformatted as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\\nWindow, very small in the distance, illuminated.\\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,gBAAgB,YAAY;AAKrC,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,SAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { preformatted as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\\nWindow, very small in the distance, illuminated.\\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings.fields = [\n\t\t{\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: true,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'content',\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,gBAAgB,YAAY;AAKrC,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,SAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAS,SAAS;AAAA,IACjB;AAAA,MACC,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -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
@@ -26,6 +26,26 @@ var settings = {
26
26
  save,
27
27
  deprecated
28
28
  };
29
+ if (window.__experimentalContentOnlyPatternInsertion) {
30
+ settings.fields = [
31
+ {
32
+ label: __("Content"),
33
+ type: "RichText",
34
+ shownByDefault: true,
35
+ mapping: {
36
+ value: "value"
37
+ }
38
+ },
39
+ {
40
+ label: __("Citation"),
41
+ type: "RichText",
42
+ shownByDefault: false,
43
+ mapping: {
44
+ value: "citation"
45
+ }
46
+ }
47
+ ];
48
+ }
29
49
  var init = () => initBlock({ name, metadata, settings });
30
50
  export {
31
51
  init,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pullquote/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalue:\n\t\t\t\t// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.\n\t\t\t\t__(\n\t\t\t\t\t'One of the hardest things to do in technology is disrupt yourself.'\n\t\t\t\t),\n\t\t\tcitation: __( 'Matt Mullenweg' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAKlC,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX;AAAA;AAAA,QAEC;AAAA,UACC;AAAA,QACD;AAAA;AAAA,MACD,UAAU,GAAI,gBAAiB;AAAA,IAChC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalue:\n\t\t\t\t// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.\n\t\t\t\t__(\n\t\t\t\t\t'One of the hardest things to do in technology is disrupt yourself.'\n\t\t\t\t),\n\t\t\tcitation: __( 'Matt Mullenweg' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings.fields = [\n\t\t{\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: true,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'value',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Citation' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: false,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'citation',\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAKlC,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX;AAAA;AAAA,QAEC;AAAA,UACC;AAAA,QACD;AAAA;AAAA,MACD,UAAU,GAAI,gBAAiB;AAAA,IAChC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAS,SAAS;AAAA,IACjB;AAAA,MACC,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,GAAI,UAAW;AAAA,MACtB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -1,37 +1,6 @@
1
1
  // packages/block-library/src/pullquote/transforms.js
2
2
  import { createBlock } from "@wordpress/blocks";
3
- import { create, join, toHTMLString } from "@wordpress/rich-text";
4
3
  var transforms = {
5
- from: [
6
- {
7
- type: "block",
8
- isMultiBlock: true,
9
- blocks: ["core/paragraph"],
10
- transform: (attributes) => {
11
- return createBlock("core/pullquote", {
12
- value: toHTMLString({
13
- value: join(
14
- attributes.map(
15
- ({ content }) => create({ html: content })
16
- ),
17
- "\n"
18
- )
19
- }),
20
- anchor: attributes.anchor
21
- });
22
- }
23
- },
24
- {
25
- type: "block",
26
- blocks: ["core/heading"],
27
- transform: ({ content, anchor }) => {
28
- return createBlock("core/pullquote", {
29
- value: content,
30
- anchor
31
- });
32
- }
33
- }
34
- ],
35
4
  to: [
36
5
  {
37
6
  type: "block",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pullquote/transforms.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { create, join, toHTMLString } from '@wordpress/rich-text';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/pullquote', {\n\t\t\t\t\tvalue: toHTMLString( {\n\t\t\t\t\t\tvalue: join(\n\t\t\t\t\t\t\tattributes.map( ( { content } ) =>\n\t\t\t\t\t\t\t\tcreate( { html: content } )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t'\\n'\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/heading' ],\n\t\t\ttransform: ( { content, anchor } ) => {\n\t\t\t\treturn createBlock( 'core/pullquote', {\n\t\t\t\t\tvalue: content,\n\t\t\t\t\tanchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\tconst paragraphs = [];\n\t\t\t\tif ( value ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( citation ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( paragraphs.length === 0 ) {\n\t\t\t\t\treturn createBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn paragraphs;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/heading' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\t// If there is no pullquote content, use the citation as the\n\t\t\t\t// content of the resulting heading. A nonexistent citation\n\t\t\t\t// will result in an empty heading.\n\t\t\t\tif ( ! value ) {\n\t\t\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tconst headingBlock = createBlock( 'core/heading', {\n\t\t\t\t\tcontent: value,\n\t\t\t\t} );\n\t\t\t\tif ( ! citation ) {\n\t\t\t\t\treturn headingBlock;\n\t\t\t\t}\n\t\t\t\treturn [\n\t\t\t\t\theadingBlock,\n\t\t\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],
5
- "mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,MAAM,oBAAoB;AAE3C,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,IACL;AAAA,MACC,MAAM;AAAA,MACN,cAAc;AAAA,MACd,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,eAAgB;AAC5B,eAAO,YAAa,kBAAkB;AAAA,UACrC,OAAO,aAAc;AAAA,YACpB,OAAO;AAAA,cACN,WAAW;AAAA,gBAAK,CAAE,EAAE,QAAQ,MAC3B,OAAQ,EAAE,MAAM,QAAQ,CAAE;AAAA,cAC3B;AAAA,cACA;AAAA,YACD;AAAA,UACD,CAAE;AAAA,UACF,QAAQ,WAAW;AAAA,QACpB,CAAE;AAAA,MACH;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,cAAe;AAAA,MACzB,WAAW,CAAE,EAAE,SAAS,OAAO,MAAO;AACrC,eAAO,YAAa,kBAAkB;AAAA,UACrC,OAAO;AAAA,UACP;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD;AAAA,EACA,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AACrC,cAAM,aAAa,CAAC;AACpB,YAAK,OAAQ;AACZ,qBAAW;AAAA,YACV,YAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,UAAW;AACf,qBAAW;AAAA,YACV,YAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,WAAW,WAAW,GAAI;AAC9B,iBAAO,YAAa,kBAAkB;AAAA,YACrC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,eAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,cAAe;AAAA,MACzB,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AAIrC,YAAK,CAAE,OAAQ;AACd,iBAAO,YAAa,gBAAgB;AAAA,YACnC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,cAAM,eAAe,YAAa,gBAAgB;AAAA,UACjD,SAAS;AAAA,QACV,CAAE;AACF,YAAK,CAAE,UAAW;AACjB,iBAAO;AAAA,QACR;AACA,eAAO;AAAA,UACN;AAAA,UACA,YAAa,gBAAgB;AAAA,YAC5B,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\tconst paragraphs = [];\n\t\t\t\tif ( value ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( citation ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( paragraphs.length === 0 ) {\n\t\t\t\t\treturn createBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn paragraphs;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/heading' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\t// If there is no pullquote content, use the citation as the\n\t\t\t\t// content of the resulting heading. A nonexistent citation\n\t\t\t\t// will result in an empty heading.\n\t\t\t\tif ( ! value ) {\n\t\t\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tconst headingBlock = createBlock( 'core/heading', {\n\t\t\t\t\tcontent: value,\n\t\t\t\t} );\n\t\t\t\tif ( ! citation ) {\n\t\t\t\t\treturn headingBlock;\n\t\t\t\t}\n\t\t\t\treturn [\n\t\t\t\t\theadingBlock,\n\t\t\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],
5
+ "mappings": ";AAGA,SAAS,mBAAmB;AAE5B,IAAM,aAAa;AAAA,EAClB,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AACrC,cAAM,aAAa,CAAC;AACpB,YAAK,OAAQ;AACZ,qBAAW;AAAA,YACV,YAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,UAAW;AACf,qBAAW;AAAA,YACV,YAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,WAAW,WAAW,GAAI;AAC9B,iBAAO,YAAa,kBAAkB;AAAA,YACrC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,eAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,cAAe;AAAA,MACzB,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AAIrC,YAAK,CAAE,OAAQ;AACd,iBAAO,YAAa,gBAAgB;AAAA,YACnC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,cAAM,eAAe,YAAa,gBAAgB;AAAA,UACjD,SAAS;AAAA,QACV,CAAE;AACF,YAAK,CAAE,UAAW;AACjB,iBAAO;AAAA,QACR;AACA,eAAO;AAAA,UACN;AAAA,UACA,YAAa,gBAAgB;AAAA,YAC5B,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
6
6
  "names": []
7
7
  }
@@ -87,26 +87,6 @@ var transforms = {
87
87
  }
88
88
  ],
89
89
  to: [
90
- {
91
- type: "block",
92
- blocks: ["core/pullquote"],
93
- isMatch: ({}, block) => {
94
- return block.innerBlocks.every(
95
- ({ name }) => name === "core/paragraph"
96
- );
97
- },
98
- transform: ({ align, citation, anchor, fontSize, style }, innerBlocks) => {
99
- const value = innerBlocks.map(({ attributes }) => `${attributes.content}`).join("<br>");
100
- return createBlock("core/pullquote", {
101
- value,
102
- align,
103
- citation,
104
- anchor,
105
- fontSize,
106
- style
107
- });
108
- }
109
- },
110
90
  {
111
91
  type: "block",
112
92
  blocks: ["core/paragraph"],
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/quote/transforms.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\ttransform: ( {\n\t\t\t\tvalue,\n\t\t\t\talign,\n\t\t\t\tcitation,\n\t\t\t\tanchor,\n\t\t\t\tfontSize,\n\t\t\t\tstyle,\n\t\t\t} ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tcitation,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t},\n\t\t\t\t\t[ createBlock( 'core/paragraph', { content: value } ) ]\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'prefix',\n\t\t\tprefix: '>',\n\t\t\ttransform: ( content ) =>\n\t\t\t\tcreateBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] ),\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tschema: () => ( {\n\t\t\t\tblockquote: {\n\t\t\t\t\tchildren: '*',\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tselector: 'blockquote',\n\t\t\ttransform: ( node, handler ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t// Don't try to parse any `cite` out of this content.\n\t\t\t\t\t// * There may be more than one cite.\n\t\t\t\t\t// * There may be more attribution text than just the cite.\n\t\t\t\t\t// * If the cite is nested in the quoted text, it's wrong to\n\t\t\t\t\t// remove it.\n\t\t\t\t\t{},\n\t\t\t\t\thandler( {\n\t\t\t\t\t\tHTML: node.innerHTML,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\tisMatch: ( {}, blocks ) => {\n\t\t\t\t// When a single block is selected make the transformation\n\t\t\t\t// available only to specific blocks that make sense.\n\t\t\t\tif ( blocks.length === 1 ) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t'core/heading',\n\t\t\t\t\t\t'core/list',\n\t\t\t\t\t\t'core/pullquote',\n\t\t\t\t\t].includes( blocks[ 0 ].name );\n\t\t\t\t}\n\t\t\t\treturn ! blocks.some( ( { name } ) => name === 'core/quote' );\n\t\t\t},\n\t\t\t__experimentalConvert: ( blocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{},\n\t\t\t\t\tblocks.map( ( block ) =>\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\tisMatch: ( {}, block ) => {\n\t\t\t\treturn block.innerBlocks.every(\n\t\t\t\t\t( { name } ) => name === 'core/paragraph'\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: (\n\t\t\t\t{ align, citation, anchor, fontSize, style },\n\t\t\t\tinnerBlocks\n\t\t\t) => {\n\t\t\t\tconst value = innerBlocks\n\t\t\t\t\t.map( ( { attributes } ) => `${ attributes.content }` )\n\t\t\t\t\t.join( '<br>' );\n\t\t\t\treturn createBlock( 'core/pullquote', {\n\t\t\t\t\tvalue,\n\t\t\t\t\talign,\n\t\t\t\t\tcitation,\n\t\t\t\t\tanchor,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tstyle,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { citation }, innerBlocks ) =>\n\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t? innerBlocks\n\t\t\t\t\t: [\n\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t ],\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( { citation, anchor }, innerBlocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ anchor },\n\t\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t\t? innerBlocks\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t ]\n\t\t\t\t),\n\t\t},\n\t],\n\tungroup: ( { citation }, innerBlocks ) =>\n\t\tRichText.isEmpty( citation )\n\t\t\t? innerBlocks\n\t\t\t: [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t ],\n};\n\nexport default transforms;\n"],
5
- "mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAE5B,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,IACL;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,MAAO;AACN,eAAO;AAAA,UACN;AAAA,UACA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,UACA,CAAE,YAAa,kBAAkB,EAAE,SAAS,MAAM,CAAE,CAAE;AAAA,QACvD;AAAA,MACD;AAAA,I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E,KAAK,MAAO,SAAS;AAAA,QAC1B;AAAA,MACD;AAAA,MACA,WAAW,CACV,EAAE,OAAO,UAAU,QAAQ,UAAU,MAAM,GAC3C,gBACI;AACJ,cAAM,QAAQ,YACZ,IAAK,CAAE,EAAE,WAAW,MAAO,GAAI,WAAW,OAAQ,EAAG,EACrD,KAAM,MAAO;AACf,eAAO,YAAa,kBAAkB;AAAA,UACrC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,EAAE,SAAS,GAAG,gBAC1B,SAAS,QAAS,QAAS,IACxB,cACA;AAAA,QACA,GAAG;AAAA,QACH,YAAa,kBAAkB;AAAA,UAC9B,SAAS;AAAA,QACV,CAAE;AAAA,MACF;AAAA,IACL;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,YAAa;AAAA,MACvB,WAAW,CAAE,EAAE,UAAU,OAAO,GAAG,gBAClC;AAAA,QACC;AAAA,QACA,EAAE,OAAO;AAAA,QACT,SAAS,QAAS,QAAS,IACxB,cACA;AAAA,UACA,GAAG;AAAA,UACH,YAAa,kBAAkB;AAAA,YAC9B,SAAS;AAAA,UACV,CAAE;AAAA,QACF;AAAA,MACJ;AAAA,IACF;AAAA,EACD;AAAA,EACA,SAAS,CAAE,EAAE,SAAS,GAAG,gBACxB,SAAS,QAAS,QAAS,IACxB,cACA;AAAA,IACA,GAAG;AAAA,IACH,YAAa,kBAAkB;AAAA,MAC9B,SAAS;AAAA,IACV,CAAE;AAAA,EACF;AACL;AAEA,IAAO,qBAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\ttransform: ( {\n\t\t\t\tvalue,\n\t\t\t\talign,\n\t\t\t\tcitation,\n\t\t\t\tanchor,\n\t\t\t\tfontSize,\n\t\t\t\tstyle,\n\t\t\t} ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tcitation,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t},\n\t\t\t\t\t[ createBlock( 'core/paragraph', { content: value } ) ]\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'prefix',\n\t\t\tprefix: '>',\n\t\t\ttransform: ( content ) =>\n\t\t\t\tcreateBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] ),\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tschema: () => ( {\n\t\t\t\tblockquote: {\n\t\t\t\t\tchildren: '*',\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tselector: 'blockquote',\n\t\t\ttransform: ( node, handler ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t// Don't try to parse any `cite` out of this content.\n\t\t\t\t\t// * There may be more than one cite.\n\t\t\t\t\t// * There may be more attribution text than just the cite.\n\t\t\t\t\t// * If the cite is nested in the quoted text, it's wrong to\n\t\t\t\t\t// remove it.\n\t\t\t\t\t{},\n\t\t\t\t\thandler( {\n\t\t\t\t\t\tHTML: node.innerHTML,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\tisMatch: ( {}, blocks ) => {\n\t\t\t\t// When a single block is selected make the transformation\n\t\t\t\t// available only to specific blocks that make sense.\n\t\t\t\tif ( blocks.length === 1 ) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t'core/heading',\n\t\t\t\t\t\t'core/list',\n\t\t\t\t\t\t'core/pullquote',\n\t\t\t\t\t].includes( blocks[ 0 ].name );\n\t\t\t\t}\n\t\t\t\treturn ! blocks.some( ( { name } ) => name === 'core/quote' );\n\t\t\t},\n\t\t\t__experimentalConvert: ( blocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{},\n\t\t\t\t\tblocks.map( ( block ) =>\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { citation }, innerBlocks ) =>\n\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t? innerBlocks\n\t\t\t\t\t: [\n\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t ],\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( { citation, anchor }, innerBlocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ anchor },\n\t\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t\t? innerBlocks\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t ]\n\t\t\t\t),\n\t\t},\n\t],\n\tungroup: ( { citation }, innerBlocks ) =>\n\t\tRichText.isEmpty( citation )\n\t\t\t? innerBlocks\n\t\t\t: [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t ],\n};\n\nexport default transforms;\n"],
5
+ "mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAE5B,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,IACL;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,MAAO;AACN,eAAO;AAAA,UACN;AAAA,UACA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,UACA,CAAE,YAAa,kBAAkB,EAAE,SAAS,MAAM,CAAE,CAAE;AAAA,QACvD;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,WAAW,CAAE,YACZ,YAAa,cAAc,CAAC,GAAG;AAAA,QAC9B,YAAa,kBAAkB,EAAE,QAAQ,CAAE;AAAA,MAC5C,CAAE;AAAA,IACJ;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,OAAQ;AAAA,QACf,YAAY;AAAA,UACX,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,UAAU;AAAA,MACV,WAAW,CAAE,MAAM,YAAa;AAC/B,eAAO;AAAA,UACN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAMA,CAAC;AAAA,UACD,QAAS;AAAA,YACR,MAAM,KAAK;AAAA,YACX,MAAM;AAAA,UACP,CAAE;AAAA,QACH;AAAA,MACD;A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a,kBAAkB;AAAA,MAC9B,SAAS;AAAA,IACV,CAAE;AAAA,EACF;AACL;AAEA,IAAO,qBAAQ;",
6
6
  "names": []
7
7
  }
@@ -15,6 +15,34 @@ var settings = {
15
15
  variations,
16
16
  edit
17
17
  };
18
+ if (window.__experimentalContentOnlyPatternInsertion) {
19
+ settings.fields = [
20
+ {
21
+ label: __("Label"),
22
+ type: "RichText",
23
+ shownByDefault: true,
24
+ mapping: {
25
+ value: "label"
26
+ }
27
+ },
28
+ {
29
+ label: __("Button text"),
30
+ type: "RichText",
31
+ shownByDefault: false,
32
+ mapping: {
33
+ value: "buttonText"
34
+ }
35
+ },
36
+ {
37
+ label: __("Placeholder"),
38
+ type: "RichText",
39
+ shownByDefault: false,
40
+ mapping: {
41
+ value: "placeholder"
42
+ }
43
+ }
44
+ ];
45
+ }
18
46
  var init = () => initBlock({ name, metadata, settings });
19
47
  export {
20
48
  init,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/search/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { search as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY;AAK/B,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY,EAAE,YAAY,GAAI,QAAS,GAAG,OAAO,GAAI,QAAS,EAAE;AAAA,IAChE,eAAe;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { search as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings.fields = [\n\t\t{\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: true,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'label',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button text' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: false,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'buttonText',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Placeholder' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: false,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'placeholder',\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY;AAK/B,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY,EAAE,YAAY,GAAI,QAAS,GAAG,OAAO,GAAI,QAAS,EAAE;AAAA,IAChE,eAAe;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAS,SAAS;AAAA,IACjB;AAAA,MACC,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,GAAI,aAAc;AAAA,MACzB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,GAAI,aAAc;AAAA,MACzB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
1
  // packages/block-library/src/social-link/index.js
2
+ import { __ } from "@wordpress/i18n";
2
3
  import { share as icon } from "@wordpress/icons";
3
4
  import initBlock from "../utils/init-block";
4
5
  import edit from "./edit";
@@ -10,6 +11,27 @@ var settings = {
10
11
  edit,
11
12
  variations
12
13
  };
14
+ if (window.__experimentalContentOnlyPatternInsertion) {
15
+ settings.fields = [
16
+ {
17
+ label: __("Link"),
18
+ type: "Link",
19
+ shownByDefault: true,
20
+ mapping: {
21
+ href: "url",
22
+ rel: "rel"
23
+ }
24
+ },
25
+ {
26
+ label: __("Label"),
27
+ type: "RichText",
28
+ shownByDefault: false,
29
+ mapping: {
30
+ value: "label"
31
+ }
32
+ }
33
+ ];
34
+ }
13
35
  var init = () => initBlock({ name, metadata, settings });
14
36
  export {
15
37
  init,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/social-link/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { share as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,SAAS,YAAY;AAK9B,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { share as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings.fields = [\n\t\t{\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'Link',\n\t\t\tshownByDefault: true,\n\t\t\tmapping: {\n\t\t\t\thref: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: false,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'label',\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAK9B,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAS,SAAS;AAAA,IACjB;AAAA,MACC,OAAO,GAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,MAAM;AAAA,QACN,KAAK;AAAA,MACN;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -151,7 +151,7 @@ function SocialLinksEdit(props) {
151
151
  {
152
152
  __next40pxDefaultSize: true,
153
153
  __nextHasNoMarginBottom: true,
154
- label: __("Icon Size"),
154
+ label: __("Icon size"),
155
155
  onChange: (newSize) => {
156
156
  setAttributes({
157
157
  size: newSize === "" ? void 0 : newSize
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/social-links/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ label: __( 'Default' ), value: '' },\n\t{ label: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ label: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ label: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ label: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\thasSocialIcons: getBlockCount( clientId ) > 0,\n\t\t\t\thasSelectedChild: hasSelectedInnerBlock( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tlet restore;\n\t\t\tsetAttributes( ( prev ) => {\n\t\t\t\trestore = {\n\t\t\t\t\ticonBackgroundColor: prev.iconBackgroundColor,\n\t\t\t\t\ticonBackgroundColorValue: prev.iconBackgroundColorValue,\n\t\t\t\t\tcustomIconBackgroundColor: prev.customIconBackgroundColor,\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn () => setAttributes( { ...restore } );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender:\n\t\t\t! hasSocialIcons || hasAnySelected\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: undefined,\n\t} );\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t\tsize: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! size }\n\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { size: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Icon Size' ) }\n\t\t\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tsize: newSize === '' ? undefined : newSize,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ size ?? '' }\n\t\t\t\t\t\t\toptions={ sizeOptions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ label: __( 'Default' ), value: '' },\n\t{ label: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ label: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ label: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ label: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\thasSocialIcons: getBlockCount( clientId ) > 0,\n\t\t\t\thasSelectedChild: hasSelectedInnerBlock( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tlet restore;\n\t\t\tsetAttributes( ( prev ) => {\n\t\t\t\trestore = {\n\t\t\t\t\ticonBackgroundColor: prev.iconBackgroundColor,\n\t\t\t\t\ticonBackgroundColorValue: prev.iconBackgroundColorValue,\n\t\t\t\t\tcustomIconBackgroundColor: prev.customIconBackgroundColor,\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn () => setAttributes( { ...restore } );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender:\n\t\t\t! hasSocialIcons || hasAnySelected\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: undefined,\n\t} );\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t\tsize: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! size }\n\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { size: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tsize: newSize === '' ? undefined : newSize,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ size ?? '' }\n\t\t\t\t\t\t\toptions={ sizeOptions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],
5
5
  "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,+CAA+C;AAAA,EAC/C,qDAAqD;AAAA,EACrD,SAAS;AAAA,OACH;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAK1B,SAAS,sCAAsC;AAiI7C,mBAqBI,KAnBF,YAFF;AA/HF,IAAM,cAAc;AAAA,EACnB,EAAE,OAAO,GAAI,SAAU,GAAG,OAAO,GAAG;AAAA,EACpC,EAAE,OAAO,GAAI,OAAQ,GAAG,OAAO,sBAAsB;AAAA,EACrD,EAAE,OAAO,GAAI,QAAS,GAAG,OAAO,uBAAuB;AAAA,EACvD,EAAE,OAAO,GAAI,OAAQ,GAAG,OAAO,sBAAsB;AAAA,EACrD,EAAE,OAAO,GAAI,MAAO,GAAG,OAAO,qBAAqB;AACpD;AAEO,SAAS,gBAAiB,OAAQ;AACxC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM,EAAE,gBAAgB,iBAAiB,IAAI;AAAA,IAC5C,CAAE,WAAY;AACb,YAAM,EAAE,eAAe,sBAAsB,IAC5C,OAAQ,gBAAiB;AAC1B,aAAO;AAAA,QACN,gBAAgB,cAAe,QAAS,IAAI;AAAA,QAC5C,kBAAkB,sBAAuB,Q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AAK,GAAG,kBAAmB;AAAA,KAC7B;AAEF;AAEA,IAAM,sBAAsB;AAAA,EAC3B,WAAW;AAAA,EACX,qBAAqB;AACtB;AAEA,IAAO,eAAQ,WAAY,mBAAoB,EAAG,eAAgB;",
6
6
  "names": []
7
7
  }
@@ -6,8 +6,23 @@ import {
6
6
  withSyncEvent
7
7
  } from "@wordpress/interactivity";
8
8
  function createReadOnlyProxy(obj) {
9
+ const arrayMutationMethods = /* @__PURE__ */ new Set([
10
+ "push",
11
+ "pop",
12
+ "shift",
13
+ "unshift",
14
+ "splice",
15
+ "sort",
16
+ "reverse",
17
+ "copyWithin",
18
+ "fill"
19
+ ]);
9
20
  return new Proxy(obj, {
10
21
  get(target, prop) {
22
+ if (Array.isArray(target) && arrayMutationMethods.has(prop)) {
23
+ return () => {
24
+ };
25
+ }
11
26
  const value = target[prop];
12
27
  if (typeof value === "object" && value !== null) {
13
28
  return createReadOnlyProxy(value);
@@ -176,21 +191,19 @@ store("core/tabs", {
176
191
  /**
177
192
  * Gets the index of the active tab element whether it
178
193
  * is a tab label or tab panel.
179
- * Public API for third-party access.
180
194
  *
181
195
  * @type {number|null}
182
196
  */
183
197
  get tabIndex() {
184
- return createReadOnlyProxy(privateState.tabIndex);
198
+ return privateState.tabIndex;
185
199
  },
186
200
  /**
187
201
  * Whether the tab panel or tab label is the active tab.
188
- * Public API for third-party access.
189
202
  *
190
203
  * @type {boolean}
191
204
  */
192
205
  get isActiveTab() {
193
- return createReadOnlyProxy(privateState.isActiveTab);
206
+ return privateState.isActiveTab;
194
207
  }
195
208
  },
196
209
  actions: {