@wordpress/block-library 9.37.2-next.ba3aee3a2.0 → 9.38.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 (238) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/build/audio/index.cjs +16 -8
  3. package/build/audio/index.cjs.map +2 -2
  4. package/build/block-keyboard-shortcuts/index.cjs +2 -4
  5. package/build/block-keyboard-shortcuts/index.cjs.map +2 -2
  6. package/build/button/index.cjs +17 -8
  7. package/build/button/index.cjs.map +2 -2
  8. package/build/code/index.cjs +3 -1
  9. package/build/code/index.cjs.map +2 -2
  10. package/build/comments-title/edit.cjs +10 -6
  11. package/build/comments-title/edit.cjs.map +2 -2
  12. package/build/cover/index.cjs +20 -10
  13. package/build/cover/index.cjs.map +2 -2
  14. package/build/details/index.cjs +3 -1
  15. package/build/details/index.cjs.map +2 -2
  16. package/build/file/index.cjs +19 -9
  17. package/build/file/index.cjs.map +2 -2
  18. package/build/heading/block.json +1 -3
  19. package/build/heading/deprecated.cjs +101 -5
  20. package/build/heading/deprecated.cjs.map +3 -3
  21. package/build/heading/edit.cjs +20 -41
  22. package/build/heading/edit.cjs.map +3 -3
  23. package/build/heading/index.cjs +3 -1
  24. package/build/heading/index.cjs.map +2 -2
  25. package/build/heading/save.cjs +2 -16
  26. package/build/heading/save.cjs.map +3 -3
  27. package/build/heading/transforms.cjs +16 -3
  28. package/build/heading/transforms.cjs.map +2 -2
  29. package/build/image/image.cjs +3 -3
  30. package/build/image/image.cjs.map +2 -2
  31. package/build/image/index.cjs +33 -17
  32. package/build/image/index.cjs.map +2 -2
  33. package/build/list-item/index.cjs +3 -1
  34. package/build/list-item/index.cjs.map +2 -2
  35. package/build/media-text/index.cjs +30 -15
  36. package/build/media-text/index.cjs.map +2 -2
  37. package/build/more/block.json +1 -0
  38. package/build/more/index.cjs +3 -1
  39. package/build/more/index.cjs.map +2 -2
  40. package/build/navigation/edit/index.cjs +7 -6
  41. package/build/navigation/edit/index.cjs.map +2 -2
  42. package/build/navigation/edit/responsive-wrapper.cjs +7 -4
  43. package/build/navigation/edit/responsive-wrapper.cjs.map +2 -2
  44. package/build/navigation/edit/use-create-overlay.cjs +2 -0
  45. package/build/navigation/edit/use-create-overlay.cjs.map +2 -2
  46. package/build/navigation-link/edit.cjs +8 -58
  47. package/build/navigation-link/edit.cjs.map +3 -3
  48. package/build/navigation-link/index.cjs +13 -8
  49. package/build/navigation-link/index.cjs.map +2 -2
  50. package/build/navigation-link/shared/index.cjs +11 -2
  51. package/build/navigation-link/shared/index.cjs.map +2 -2
  52. package/build/navigation-link/shared/invalid-draft-display.cjs +82 -0
  53. package/build/navigation-link/shared/invalid-draft-display.cjs.map +7 -0
  54. package/build/navigation-link/shared/use-enable-link-status-validation.cjs +50 -0
  55. package/build/navigation-link/shared/use-enable-link-status-validation.cjs.map +7 -0
  56. package/build/navigation-link/shared/use-is-invalid-link.cjs +64 -0
  57. package/build/navigation-link/shared/use-is-invalid-link.cjs.map +7 -0
  58. package/build/navigation-overlay-close/block.json +1 -4
  59. package/build/navigation-overlay-close/index.cjs +3 -25
  60. package/build/navigation-overlay-close/index.cjs.map +3 -3
  61. package/build/navigation-submenu/edit.cjs +36 -18
  62. package/build/navigation-submenu/edit.cjs.map +2 -2
  63. package/build/navigation-submenu/index.cjs +15 -8
  64. package/build/navigation-submenu/index.cjs.map +2 -2
  65. package/build/nextpage/block.json +1 -0
  66. package/build/paragraph/index.cjs +3 -1
  67. package/build/paragraph/index.cjs.map +2 -2
  68. package/build/paragraph/transforms.cjs +14 -3
  69. package/build/paragraph/transforms.cjs.map +3 -3
  70. package/build/preformatted/index.cjs +3 -1
  71. package/build/preformatted/index.cjs.map +2 -2
  72. package/build/pullquote/index.cjs +7 -3
  73. package/build/pullquote/index.cjs.map +2 -2
  74. package/build/search/index.cjs +10 -5
  75. package/build/search/index.cjs.map +2 -2
  76. package/build/social-link/index.cjs +13 -7
  77. package/build/social-link/index.cjs.map +2 -2
  78. package/build/table-of-contents/hooks.cjs +1 -1
  79. package/build/table-of-contents/hooks.cjs.map +1 -1
  80. package/build/template-part/edit/utils/get-template-part-icon.cjs.map +1 -1
  81. package/build/utils/is-within-overlay.cjs +52 -0
  82. package/build/utils/is-within-overlay.cjs.map +7 -0
  83. package/build/verse/index.cjs +3 -1
  84. package/build/verse/index.cjs.map +2 -2
  85. package/build/video/index.cjs +20 -10
  86. package/build/video/index.cjs.map +2 -2
  87. package/build-module/audio/index.mjs +16 -8
  88. package/build-module/audio/index.mjs.map +2 -2
  89. package/build-module/block-keyboard-shortcuts/index.mjs +2 -4
  90. package/build-module/block-keyboard-shortcuts/index.mjs.map +2 -2
  91. package/build-module/button/index.mjs +17 -8
  92. package/build-module/button/index.mjs.map +2 -2
  93. package/build-module/code/index.mjs +3 -1
  94. package/build-module/code/index.mjs.map +2 -2
  95. package/build-module/comments-title/edit.mjs +10 -6
  96. package/build-module/comments-title/edit.mjs.map +2 -2
  97. package/build-module/cover/index.mjs +20 -10
  98. package/build-module/cover/index.mjs.map +2 -2
  99. package/build-module/details/index.mjs +3 -1
  100. package/build-module/details/index.mjs.map +2 -2
  101. package/build-module/file/index.mjs +19 -9
  102. package/build-module/file/index.mjs.map +2 -2
  103. package/build-module/heading/block.json +1 -3
  104. package/build-module/heading/deprecated.mjs +101 -5
  105. package/build-module/heading/deprecated.mjs.map +2 -2
  106. package/build-module/heading/edit.mjs +22 -46
  107. package/build-module/heading/edit.mjs.map +2 -2
  108. package/build-module/heading/index.mjs +3 -1
  109. package/build-module/heading/index.mjs.map +2 -2
  110. package/build-module/heading/save.mjs +2 -6
  111. package/build-module/heading/save.mjs.map +2 -2
  112. package/build-module/heading/transforms.mjs +16 -3
  113. package/build-module/heading/transforms.mjs.map +2 -2
  114. package/build-module/image/image.mjs +3 -3
  115. package/build-module/image/image.mjs.map +2 -2
  116. package/build-module/image/index.mjs +33 -17
  117. package/build-module/image/index.mjs.map +2 -2
  118. package/build-module/list-item/index.mjs +3 -1
  119. package/build-module/list-item/index.mjs.map +2 -2
  120. package/build-module/media-text/index.mjs +30 -15
  121. package/build-module/media-text/index.mjs.map +2 -2
  122. package/build-module/more/block.json +1 -0
  123. package/build-module/more/index.mjs +3 -1
  124. package/build-module/more/index.mjs.map +2 -2
  125. package/build-module/navigation/edit/index.mjs +7 -6
  126. package/build-module/navigation/edit/index.mjs.map +2 -2
  127. package/build-module/navigation/edit/responsive-wrapper.mjs +7 -4
  128. package/build-module/navigation/edit/responsive-wrapper.mjs.map +2 -2
  129. package/build-module/navigation/edit/use-create-overlay.mjs +2 -0
  130. package/build-module/navigation/edit/use-create-overlay.mjs.map +2 -2
  131. package/build-module/navigation-link/edit.mjs +12 -60
  132. package/build-module/navigation-link/edit.mjs.map +2 -2
  133. package/build-module/navigation-link/index.mjs +13 -8
  134. package/build-module/navigation-link/index.mjs.map +2 -2
  135. package/build-module/navigation-link/shared/index.mjs +7 -1
  136. package/build-module/navigation-link/shared/index.mjs.map +2 -2
  137. package/build-module/navigation-link/shared/invalid-draft-display.mjs +47 -0
  138. package/build-module/navigation-link/shared/invalid-draft-display.mjs.map +7 -0
  139. package/build-module/navigation-link/shared/use-enable-link-status-validation.mjs +25 -0
  140. package/build-module/navigation-link/shared/use-enable-link-status-validation.mjs.map +7 -0
  141. package/build-module/navigation-link/shared/use-is-invalid-link.mjs +39 -0
  142. package/build-module/navigation-link/shared/use-is-invalid-link.mjs.map +7 -0
  143. package/build-module/navigation-overlay-close/block.json +1 -4
  144. package/build-module/navigation-overlay-close/index.mjs +3 -25
  145. package/build-module/navigation-overlay-close/index.mjs.map +2 -2
  146. package/build-module/navigation-submenu/edit.mjs +40 -19
  147. package/build-module/navigation-submenu/edit.mjs.map +2 -2
  148. package/build-module/navigation-submenu/index.mjs +15 -8
  149. package/build-module/navigation-submenu/index.mjs.map +2 -2
  150. package/build-module/nextpage/block.json +1 -0
  151. package/build-module/paragraph/index.mjs +3 -1
  152. package/build-module/paragraph/index.mjs.map +2 -2
  153. package/build-module/paragraph/transforms.mjs +2 -1
  154. package/build-module/paragraph/transforms.mjs.map +2 -2
  155. package/build-module/preformatted/index.mjs +3 -1
  156. package/build-module/preformatted/index.mjs.map +2 -2
  157. package/build-module/pullquote/index.mjs +7 -3
  158. package/build-module/pullquote/index.mjs.map +2 -2
  159. package/build-module/search/index.mjs +10 -5
  160. package/build-module/search/index.mjs.map +2 -2
  161. package/build-module/social-link/index.mjs +13 -7
  162. package/build-module/social-link/index.mjs.map +2 -2
  163. package/build-module/table-of-contents/hooks.mjs +1 -1
  164. package/build-module/table-of-contents/hooks.mjs.map +1 -1
  165. package/build-module/template-part/edit/utils/get-template-part-icon.mjs.map +1 -1
  166. package/build-module/utils/is-within-overlay.mjs +27 -0
  167. package/build-module/utils/is-within-overlay.mjs.map +7 -0
  168. package/build-module/verse/index.mjs +3 -1
  169. package/build-module/verse/index.mjs.map +2 -2
  170. package/build-module/video/index.mjs +20 -10
  171. package/build-module/video/index.mjs.map +2 -2
  172. package/build-style/navigation/style-rtl.css +1 -16
  173. package/build-style/navigation/style.css +1 -16
  174. package/build-style/style-rtl.css +1 -16
  175. package/build-style/style.css +1 -16
  176. package/package.json +37 -38
  177. package/src/audio/index.js +13 -7
  178. package/src/block-keyboard-shortcuts/index.js +4 -7
  179. package/src/breadcrumbs/index.php +6 -3
  180. package/src/button/index.js +15 -8
  181. package/src/code/index.js +2 -1
  182. package/src/comments-title/edit.js +10 -7
  183. package/src/comments-title/index.php +7 -8
  184. package/src/cover/index.js +17 -8
  185. package/src/details/index.js +2 -1
  186. package/src/file/index.js +15 -8
  187. package/src/heading/block.json +1 -3
  188. package/src/heading/deprecated.js +118 -5
  189. package/src/heading/edit.js +6 -32
  190. package/src/heading/edit.native.js +17 -2
  191. package/src/heading/index.js +2 -1
  192. package/src/heading/save.js +2 -11
  193. package/src/heading/transforms.js +16 -3
  194. package/src/image/image.js +38 -40
  195. package/src/image/index.js +29 -16
  196. package/src/list-item/index.js +2 -1
  197. package/src/media-text/index.js +27 -14
  198. package/src/more/block.json +1 -0
  199. package/src/more/index.js +2 -1
  200. package/src/navigation/edit/index.js +9 -4
  201. package/src/navigation/edit/responsive-wrapper.js +15 -8
  202. package/src/navigation/edit/test/use-create-overlay.js +12 -0
  203. package/src/navigation/edit/use-create-overlay.js +2 -0
  204. package/src/navigation/index.php +74 -24
  205. package/src/navigation/style.scss +2 -18
  206. package/src/navigation-link/edit.js +11 -97
  207. package/src/navigation-link/index.js +13 -8
  208. package/src/navigation-link/index.php +17 -29
  209. package/src/navigation-link/shared/helpers.php +46 -0
  210. package/src/navigation-link/shared/index.js +3 -0
  211. package/src/navigation-link/shared/invalid-draft-display.js +63 -0
  212. package/src/navigation-link/shared/test/use-enable-link-status-validation.test.js +127 -0
  213. package/src/navigation-link/shared/use-enable-link-status-validation.js +40 -0
  214. package/src/navigation-link/shared/use-is-invalid-link.js +72 -0
  215. package/src/navigation-overlay-close/block.json +1 -4
  216. package/src/navigation-overlay-close/index.js +2 -37
  217. package/src/navigation-overlay-close/index.php +37 -1
  218. package/src/navigation-submenu/edit.js +49 -24
  219. package/src/navigation-submenu/index.js +13 -8
  220. package/src/navigation-submenu/index.php +25 -18
  221. package/src/nextpage/block.json +1 -0
  222. package/src/paragraph/index.js +2 -1
  223. package/src/paragraph/transforms.js +3 -1
  224. package/src/preformatted/index.js +2 -1
  225. package/src/pullquote/index.js +5 -3
  226. package/src/query-title/index.php +2 -2
  227. package/src/search/index.js +7 -5
  228. package/src/social-link/index.js +12 -7
  229. package/src/table-of-contents/hooks.js +1 -1
  230. package/src/template-part/edit/utils/get-template-part-icon.js +1 -1
  231. package/src/utils/is-within-overlay.js +54 -0
  232. package/src/verse/index.js +2 -1
  233. package/src/video/index.js +17 -9
  234. package/build/navigation-overlay-close/save.cjs +0 -67
  235. package/build/navigation-overlay-close/save.cjs.map +0 -7
  236. package/build-module/navigation-overlay-close/save.mjs +0 -46
  237. package/build-module/navigation-overlay-close/save.mjs.map +0 -7
  238. package/src/navigation-overlay-close/save.js +0 -44
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/table-of-contents/hooks.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetBlocksByName,\n\t\tgetClientIdsOfDescendants,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage, maxLevel } =\n\t\tgetBlockAttributes( clientId ) ?? {};\n\n\t// Get post-content block client ID.\n\tconst [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsOfDescendants( postContentClientId );\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\t// Skip headings that are deeper than maxLevel\n\t\t\t\tif ( maxLevel && headingAttributes.level > maxLevel ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t// Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.\n\t\twindow.queueMicrotask( () => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( clientId, { headings } );\n\t\t} );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetBlocksByName,\n\t\tgetClientIdsOfDescendants,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage, maxLevel } =\n\t\tgetBlockAttributes( clientId ) ?? {};\n\n\t// Get post-content block client ID.\n\tconst [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsOfDescendants( postContentClientId );\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\t// Skip headings that are deeper than maxLevel\n\t\t\t\tif ( maxLevel && headingAttributes.level > maxLevel ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t// Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.\n\t\twindow.queueMicrotask( () => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( clientId, { headings } );\n\t\t} );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],
5
5
  "mappings": ";;;;;;;;;;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blockEditorStore", "stripHTML", "fastDeepEqual"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/template-part/edit/utils/get-template-part-icon.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\ttableColumnAfter as overlayIcon,\n\tsymbolFilled as symbolFilledIcon,\n} from '@wordpress/icons';\n\n/**\n * Helper function to retrieve the corresponding icon by area name or icon name.\n *\n * @param {string} areaOrIconName The area name (e.g., 'header', 'overlay') or icon name (e.g., 'menu').\n *\n * @return {Object} The corresponding icon.\n */\nexport const getTemplatePartIcon = ( areaOrIconName ) => {\n\t// Handle area names first\n\tif ( 'header' === areaOrIconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === areaOrIconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === areaOrIconName ) {\n\t\treturn sidebarIcon;\n\t} else if ( 'overlay' === areaOrIconName ) {\n\t\t// TODO: Replace with a proper overlay icon when available.\n\t\t// Using tableColumnAfter as a placeholder.\n\t\treturn overlayIcon;\n\t}\n\t// Handle icon names for backwards compatibility\n\tif ( 'menu' === areaOrIconName ) {\n\t\t// TODO: Replace with a proper overlay icon when available.\n\t\t// Using tableColumnAfter as a placeholder.\n\t\treturn overlayIcon;\n\t}\n\treturn symbolFilledIcon;\n};\n"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\ttableColumnAfter as overlayIcon,\n\tsymbolFilled as symbolFilledIcon,\n} from '@wordpress/icons';\n\n/**\n * Helper function to retrieve the corresponding icon by area name or icon name.\n *\n * @param {string} areaOrIconName The area name (e.g., 'header', 'navigation-overlay') or icon name (e.g., 'menu').\n *\n * @return {Object} The corresponding icon.\n */\nexport const getTemplatePartIcon = ( areaOrIconName ) => {\n\t// Handle area names first\n\tif ( 'header' === areaOrIconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === areaOrIconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === areaOrIconName ) {\n\t\treturn sidebarIcon;\n\t} else if ( 'overlay' === areaOrIconName ) {\n\t\t// TODO: Replace with a proper overlay icon when available.\n\t\t// Using tableColumnAfter as a placeholder.\n\t\treturn overlayIcon;\n\t}\n\t// Handle icon names for backwards compatibility\n\tif ( 'menu' === areaOrIconName ) {\n\t\t// TODO: Replace with a proper overlay icon when available.\n\t\t// Using tableColumnAfter as a placeholder.\n\t\treturn overlayIcon;\n\t}\n\treturn symbolFilledIcon;\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAMO;AASA,IAAM,sBAAsB,CAAE,mBAAoB;AAExD,MAAK,aAAa,gBAAiB;AAClC,WAAO,aAAAA;AAAA,EACR,WAAY,aAAa,gBAAiB;AACzC,WAAO,aAAAC;AAAA,EACR,WAAY,cAAc,gBAAiB;AAC1C,WAAO,aAAAC;AAAA,EACR,WAAY,cAAc,gBAAiB;AAG1C,WAAO,aAAAC;AAAA,EACR;AAEA,MAAK,WAAW,gBAAiB;AAGhC,WAAO,aAAAA;AAAA,EACR;AACA,SAAO,aAAAC;AACR;",
6
6
  "names": ["headerIcon", "footerIcon", "sidebarIcon", "overlayIcon", "symbolFilledIcon"]
7
7
  }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/block-library/src/utils/is-within-overlay.js
21
+ var is_within_overlay_exports = {};
22
+ __export(is_within_overlay_exports, {
23
+ isWithinNavigationOverlay: () => isWithinNavigationOverlay
24
+ });
25
+ module.exports = __toCommonJS(is_within_overlay_exports);
26
+ var import_data = require("@wordpress/data");
27
+ var import_core_data = require("@wordpress/core-data");
28
+ var import_constants = require("../navigation/constants.cjs");
29
+ function isWithinNavigationOverlay() {
30
+ const editorStore = (0, import_data.select)("core/editor");
31
+ if (!editorStore) {
32
+ return false;
33
+ }
34
+ const { getCurrentPostType, getCurrentPostId } = editorStore;
35
+ const { getEditedEntityRecord } = (0, import_data.select)(import_core_data.store);
36
+ const postType = getCurrentPostType?.();
37
+ const postId = getCurrentPostId?.();
38
+ if (postType === "wp_template_part" && postId) {
39
+ const templatePart = getEditedEntityRecord(
40
+ "postType",
41
+ "wp_template_part",
42
+ postId
43
+ );
44
+ return templatePart?.area === import_constants.NAVIGATION_OVERLAY_TEMPLATE_PART_AREA;
45
+ }
46
+ return false;
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ isWithinNavigationOverlay
51
+ });
52
+ //# sourceMappingURL=is-within-overlay.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/is-within-overlay.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { NAVIGATION_OVERLAY_TEMPLATE_PART_AREA } from '../navigation/constants';\n\n/**\n * Checks if the current editing context is within a navigation overlay template part.\n *\n * This utility exists because @wordpress/block-library cannot depend on @wordpress/editor\n * as a package dependency. Blocks can be loaded into non-post block editors, so we must\n * access the 'core/editor' store by string literal rather than importing it.\n *\n * React components should wrap this in useSelect for reactivity. Non-React contexts\n * (like filter callbacks) can call this directly.\n *\n * @return {boolean} True if editing a navigation overlay template part, false otherwise.\n */\nexport function isWithinNavigationOverlay() {\n\t// @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst editorStore = select( 'core/editor' );\n\n\t// Return false if the editor store is not available.\n\tif ( ! editorStore ) {\n\t\treturn false;\n\t}\n\n\tconst { getCurrentPostType, getCurrentPostId } = editorStore;\n\tconst { getEditedEntityRecord } = select( coreStore );\n\n\tconst postType = getCurrentPostType?.();\n\tconst postId = getCurrentPostId?.();\n\n\tif ( postType === 'wp_template_part' && postId ) {\n\t\tconst templatePart = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\tpostId\n\t\t);\n\n\t\treturn templatePart?.area === NAVIGATION_OVERLAY_TEMPLATE_PART_AREA;\n\t}\n\n\treturn false;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuB;AACvB,uBAAmC;AAKnC,uBAAsD;AAc/C,SAAS,4BAA4B;AAM3C,QAAM,kBAAc,oBAAQ,aAAc;AAG1C,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,oBAAoB,iBAAiB,IAAI;AACjD,QAAM,EAAE,sBAAsB,QAAI,oBAAQ,iBAAAA,KAAU;AAEpD,QAAM,WAAW,qBAAqB;AACtC,QAAM,SAAS,mBAAmB;AAElC,MAAK,aAAa,sBAAsB,QAAS;AAChD,UAAM,eAAe;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAEA,WAAO,cAAc,SAAS;AAAA,EAC/B;AAEA,SAAO;AACR;",
6
+ "names": ["coreStore"]
7
+ }
@@ -75,7 +75,9 @@ if (window.__experimentalContentOnlyInspectorFields) {
75
75
  {
76
76
  id: "content",
77
77
  label: (0, import_i18n.__)("Content"),
78
- type: "richtext"
78
+ type: "text",
79
+ Edit: "rich-text"
80
+ // TODO: replace with custom component
79
81
  }
80
82
  ];
81
83
  settings[formKey] = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/verse/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { verse as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\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 Verse block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'WHAT was he doing, the great god Pan,\\n\tDown in the reeds by the river?\\nSpreading ruin and scattering ban,\\nSplashing and paddling with hoofs of a goat,\\nAnd breaking the golden lilies afloat\\n With the dragon-fly on the river.'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA8B;AAC9B,oBAAiD;AAKjD,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,aAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { verse as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\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 Verse block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'WHAT was he doing, the great god Pan,\\n\tDown in the reeds by the river?\\nSpreading ruin and scattering ban,\\nSplashing and paddling with hoofs of a goat,\\nAnd breaking the golden lilies afloat\\n With the dragon-fly on the river.'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA8B;AAC9B,oBAAiD;AAKjD,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,aAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
6
6
  "names": ["metadata", "blocksPrivateApis", "icon", "transforms", "deprecated", "edit", "save", "initBlock", "metadata"]
7
7
  }
@@ -68,25 +68,35 @@ if (window.__experimentalContentOnlyInspectorFields) {
68
68
  id: "video",
69
69
  label: (0, import_i18n.__)("Video"),
70
70
  type: "media",
71
- mapping: {
72
- id: "id",
73
- url: "src",
74
- caption: "caption",
75
- poster: "poster"
76
- },
77
- args: {
71
+ Edit: {
72
+ control: "media",
73
+ // TODO: replace with custom component
78
74
  allowedTypes: ["video"],
79
75
  multiple: false
80
- }
76
+ },
77
+ getValue: ({ item }) => ({
78
+ id: item.id,
79
+ url: item.src,
80
+ caption: item.caption,
81
+ poster: item.poster
82
+ }),
83
+ setValue: ({ value }) => ({
84
+ id: value.id,
85
+ src: value.url,
86
+ caption: value.caption,
87
+ poster: value.poster
88
+ })
81
89
  },
82
90
  {
83
91
  id: "caption",
84
92
  label: (0, import_i18n.__)("Caption"),
85
- type: "richtext"
93
+ type: "text",
94
+ Edit: "rich-text"
95
+ // TODO: replace with custom component
86
96
  }
87
97
  ];
88
98
  settings[formKey] = {
89
- fields: ["video"]
99
+ fields: ["video", "caption"]
90
100
  };
91
101
  }
92
102
  var init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/video/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { video as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',\n\t\t\t// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.\n\t\t\tcaption: __( 'Wood thrush singing in Central Park, NYC.' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'video',\n\t\t\tlabel: __( 'Video' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'src',\n\t\t\t\tcaption: 'caption',\n\t\t\t\tposter: 'poster',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'caption',\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'video' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA8B;AAC9B,oBAAiD;AAKjD,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,KAAK;AAAA;AAAA,MAEL,aAAS,gBAAI,2CAA4C;AAAA,IAC1D;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,IAAI;AAAA,QACJ,KAAK;AAAA,QACL,SAAS;AAAA,QACT,QAAQ;AAAA,MACT;AAAA,MACA,MAAM;AAAA,QACL,cAAc,CAAE,OAAQ;AAAA,QACxB,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,OAAQ;AAAA,EACnB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { video as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',\n\t\t\t// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.\n\t\t\tcaption: __( 'Wood thrush singing in Central Park, NYC.' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'video',\n\t\t\tlabel: __( 'Video' ),\n\t\t\ttype: 'media',\n\t\t\tEdit: {\n\t\t\t\tcontrol: 'media', // TODO: replace with custom component\n\t\t\t\tallowedTypes: [ 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t\tgetValue: ( { item } ) => ( {\n\t\t\t\tid: item.id,\n\t\t\t\turl: item.src,\n\t\t\t\tcaption: item.caption,\n\t\t\t\tposter: item.poster,\n\t\t\t} ),\n\t\t\tsetValue: ( { value } ) => ( {\n\t\t\t\tid: value.id,\n\t\t\t\tsrc: value.url,\n\t\t\t\tcaption: value.caption,\n\t\t\t\tposter: value.poster,\n\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\tid: 'caption',\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'video', 'caption' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA8B;AAC9B,oBAAiD;AAKjD,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,KAAK;AAAA;AAAA,MAEL,aAAS,gBAAI,2CAA4C;AAAA,IAC1D;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,MAAM;AAAA,QACL,SAAS;AAAA;AAAA,QACT,cAAc,CAAE,OAAQ;AAAA,QACxB,UAAU;AAAA,MACX;AAAA,MACA,UAAU,CAAE,EAAE,KAAK,OAAS;AAAA,QAC3B,IAAI,KAAK;AAAA,QACT,KAAK,KAAK;AAAA,QACV,SAAS,KAAK;AAAA,QACd,QAAQ,KAAK;AAAA,MACd;AAAA,MACA,UAAU,CAAE,EAAE,MAAM,OAAS;AAAA,QAC5B,IAAI,MAAM;AAAA,QACV,KAAK,MAAM;AAAA,QACX,SAAS,MAAM;AAAA,QACf,QAAQ,MAAM;AAAA,MACf;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAS,SAAU;AAAA,EAC9B;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
6
6
  "names": ["metadata", "blocksPrivateApis", "icon", "transforms", "deprecated", "edit", "save", "initBlock", "metadata"]
7
7
  }
@@ -30,23 +30,31 @@ if (window.__experimentalContentOnlyInspectorFields) {
30
30
  id: "audio",
31
31
  label: __("Audio"),
32
32
  type: "media",
33
- mapping: {
34
- id: "id",
35
- url: "src"
36
- },
37
- args: {
33
+ Edit: {
34
+ control: "media",
35
+ // TODO: replace with custom component
38
36
  allowedTypes: ["audio"],
39
37
  multiple: false
40
- }
38
+ },
39
+ getValue: ({ item }) => ({
40
+ id: item.id,
41
+ url: item.src
42
+ }),
43
+ setValue: ({ value }) => ({
44
+ id: value.id,
45
+ src: value.url
46
+ })
41
47
  },
42
48
  {
43
49
  id: "caption",
44
50
  label: __("Caption"),
45
- type: "richtext"
51
+ type: "text",
52
+ Edit: "rich-text"
53
+ // TODO: replace with custom component
46
54
  }
47
55
  ];
48
56
  settings[formKey] = {
49
- fields: ["audio"]
57
+ fields: ["audio", "caption"]
50
58
  };
51
59
  }
52
60
  var init = () => initBlock({ name, metadata, settings });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/audio/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { audio as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t},\n\t\tviewportWidth: 350,\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'audio',\n\t\t\tlabel: __( 'Audio' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'src',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'audio' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'caption',\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'audio' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAC9B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,KAAK;AAAA,IACN;AAAA,IACA,eAAe;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,IAAI;AAAA,QACJ,KAAK;AAAA,MACN;AAAA,MACA,MAAM;AAAA,QACL,cAAc,CAAE,OAAQ;AAAA,QACxB,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,OAAQ;AAAA,EACnB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { audio as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t},\n\t\tviewportWidth: 350,\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'audio',\n\t\t\tlabel: __( 'Audio' ),\n\t\t\ttype: 'media',\n\t\t\tEdit: {\n\t\t\t\tcontrol: 'media', // TODO: replace with custom component\n\t\t\t\tallowedTypes: [ 'audio' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t\tgetValue: ( { item } ) => ( {\n\t\t\t\tid: item.id,\n\t\t\t\turl: item.src,\n\t\t\t} ),\n\t\t\tsetValue: ( { value } ) => ( {\n\t\t\t\tid: value.id,\n\t\t\t\tsrc: value.url,\n\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\tid: 'caption',\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'audio', 'caption' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAC9B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,KAAK;AAAA,IACN;AAAA,IACA,eAAe;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,MAAM;AAAA,QACL,SAAS;AAAA;AAAA,QACT,cAAc,CAAE,OAAQ;AAAA,QACxB,UAAU;AAAA,MACX;AAAA,MACA,UAAU,CAAE,EAAE,KAAK,OAAS;AAAA,QAC3B,IAAI,KAAK;AAAA,QACT,KAAK,KAAK;AAAA,MACX;AAAA,MACA,UAAU,CAAE,EAAE,MAAM,OAAS;AAAA,QAC5B,IAAI,MAAM;AAAA,QACV,KAAK,MAAM;AAAA,MACZ;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAS,SAAU;AAAA,EAC9B;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -35,10 +35,8 @@ function BlockKeyboardShortcuts() {
35
35
  const sourceTextAlign = attributes.textAlign || attributes.style?.typography?.textAlign;
36
36
  if (destinationBlockName === "core/heading") {
37
37
  newAttributes.level = level;
38
- if (sourceTextAlign) {
39
- newAttributes.textAlign = sourceTextAlign;
40
- }
41
- } else if (sourceTextAlign) {
38
+ }
39
+ if (sourceTextAlign) {
42
40
  newAttributes.style = {
43
41
  typography: {
44
42
  textAlign: sourceTextAlign
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/block-keyboard-shortcuts/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockKeyboardShortcuts() {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { getBlockName, getSelectedBlockClientId, getBlockAttributes } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst handleTransformHeadingAndParagraph = ( event, level ) => {\n\t\tevent.preventDefault();\n\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tconst isParagraph = blockName === 'core/paragraph';\n\t\tconst isHeading = blockName === 'core/heading';\n\n\t\tif ( ! isParagraph && ! isHeading ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\n\t\t// Avoid unnecessary block transform when attempting to transform to\n\t\t// the same block type and/or same level.\n\t\tif (\n\t\t\t( isParagraph && level === 0 ) ||\n\t\t\t( isHeading && attributes.level === level )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst newAttributes = {\n\t\t\tcontent: attributes.content,\n\t\t};\n\n\t\t// Read textAlign from source block (could be in old or new format)\n\t\tconst sourceTextAlign =\n\t\t\tattributes.textAlign || attributes.style?.typography?.textAlign;\n\n\t\t// When destination is heading, preserve heading format (textAlign attribute + level)\n\t\t// When destination is paragraph, use block support format (style.typography.textAlign)\n\t\tif ( destinationBlockName === 'core/heading' ) {\n\t\t\tnewAttributes.level = level;\n\t\t\tif ( sourceTextAlign ) {\n\t\t\t\tnewAttributes.textAlign = sourceTextAlign;\n\t\t\t}\n\t\t} else if ( sourceTextAlign ) {\n\t\t\t// Destination is paragraph\n\t\t\tnewAttributes.style = {\n\t\t\t\ttypography: {\n\t\t\t\t\ttextAlign: sourceTextAlign,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, newAttributes )\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/transform-heading-to-paragraph',\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: '0',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: '7',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/block-editor/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\tuseShortcut(\n\t\t'core/block-editor/transform-heading-to-paragraph',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 0 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-1',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 1 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-2',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 2 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-3',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 3 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-4',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 4 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-5',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 5 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-6',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 6 )\n\t);\n\n\treturn null;\n}\n\nexport default BlockKeyboardShortcuts;\n"],
5
- "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,SAAS,wBAAwB;AAE1C,SAAS,yBAAyB;AACjC,QAAM,EAAE,iBAAiB,IAAI,YAAa,sBAAuB;AACjE,QAAM,EAAE,cAAc,IAAI,YAAa,gBAAiB;AACxD,QAAM,EAAE,cAAc,0BAA0B,mBAAmB,IAClE,UAAW,gBAAiB;AAE7B,QAAM,qCAAqC,CAAE,OAAO,UAAW;AAC9D,UAAM,eAAe;AAErB,UAAM,kBAAkB,yBAAyB;AACjD,QAAK,oBAAoB,MAAO;AAC/B;AAAA,IACD;AAEA,UAAM,YAAY,aAAc,eAAgB;AAChD,UAAM,cAAc,cAAc;AAClC,UAAM,YAAY,cAAc;AAEhC,QAAK,CAAE,eAAe,CAAE,WAAY;AACnC;AAAA,IACD;AAEA,UAAM,uBACL,UAAU,IAAI,mBAAmB;AAElC,UAAM,aAAa,mBAAoB,eAAgB;AAIvD,QACG,eAAe,UAAU,KACzB,aAAa,WAAW,UAAU,OACnC;AACD;AAAA,IACD;AACA,UAAM,gBAAgB;AAAA,MACrB,SAAS,WAAW;AAAA,IACrB;AAGA,UAAM,kBACL,WAAW,aAAa,WAAW,OAAO,YAAY;AAIvD,QAAK,yBAAyB,gBAAiB;AAC9C,oBAAc,QAAQ;AACtB,UAAK,iBAAkB;AACtB,sBAAc,YAAY;AAAA,MAC3B;AAAA,IACD,WAAY,iBAAkB;AAE7B,oBAAc,QAAQ;AAAA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SAAO;AACR;AAEA,IAAO,mCAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockKeyboardShortcuts() {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { getBlockName, getSelectedBlockClientId, getBlockAttributes } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst handleTransformHeadingAndParagraph = ( event, level ) => {\n\t\tevent.preventDefault();\n\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tconst isParagraph = blockName === 'core/paragraph';\n\t\tconst isHeading = blockName === 'core/heading';\n\n\t\tif ( ! isParagraph && ! isHeading ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\n\t\t// Avoid unnecessary block transform when attempting to transform to\n\t\t// the same block type and/or same level.\n\t\tif (\n\t\t\t( isParagraph && level === 0 ) ||\n\t\t\t( isHeading && attributes.level === level )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst newAttributes = {\n\t\t\tcontent: attributes.content,\n\t\t};\n\n\t\t// Read textAlign from source block (could be in old or new format)\n\t\tconst sourceTextAlign =\n\t\t\tattributes.textAlign || attributes.style?.typography?.textAlign;\n\n\t\t// When destination is heading, set the level\n\t\tif ( destinationBlockName === 'core/heading' ) {\n\t\t\tnewAttributes.level = level;\n\t\t}\n\n\t\tif ( sourceTextAlign ) {\n\t\t\tnewAttributes.style = {\n\t\t\t\ttypography: {\n\t\t\t\t\ttextAlign: sourceTextAlign,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, newAttributes )\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/transform-heading-to-paragraph',\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: '0',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: '7',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/block-editor/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\tuseShortcut(\n\t\t'core/block-editor/transform-heading-to-paragraph',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 0 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-1',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 1 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-2',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 2 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-3',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 3 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-4',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 4 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-5',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 5 )\n\t);\n\tuseShortcut(\n\t\t'core/block-editor/transform-paragraph-to-heading-6',\n\t\t( event ) => handleTransformHeadingAndParagraph( event, 6 )\n\t);\n\n\treturn null;\n}\n\nexport default BlockKeyboardShortcuts;\n"],
5
+ "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,SAAS,wBAAwB;AAE1C,SAAS,yBAAyB;AACjC,QAAM,EAAE,iBAAiB,IAAI,YAAa,sBAAuB;AACjE,QAAM,EAAE,cAAc,IAAI,YAAa,gBAAiB;AACxD,QAAM,EAAE,cAAc,0BAA0B,mBAAmB,IAClE,UAAW,gBAAiB;AAE7B,QAAM,qCAAqC,CAAE,OAAO,UAAW;AAC9D,UAAM,eAAe;AAErB,UAAM,kBAAkB,yBAAyB;AACjD,QAAK,oBAAoB,MAAO;AAC/B;AAAA,IACD;AAEA,UAAM,YAAY,aAAc,eAAgB;AAChD,UAAM,cAAc,cAAc;AAClC,UAAM,YAAY,cAAc;AAEhC,QAAK,CAAE,eAAe,CAAE,WAAY;AACnC;AAAA,IACD;AAEA,UAAM,uBACL,UAAU,IAAI,mBAAmB;AAElC,UAAM,aAAa,mBAAoB,eAAgB;AAIvD,QACG,eAAe,UAAU,KACzB,aAAa,WAAW,UAAU,OACnC;AACD;AAAA,IACD;AACA,UAAM,gBAAgB;AAAA,MACrB,SAAS,WAAW;AAAA,IACrB;AAGA,UAAM,kBACL,WAAW,aAAa,WAAW,OAAO,YAAY;AAGvD,QAAK,yBAAyB,gBAAiB;AAC9C,oBAAc,QAAQ;AAAA,IACvB;AAEA,QAAK,iBAAk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O,CAAE;AAAA,EAC3D;AAEA,SAAO;AACR;AAEA,IAAO,mCAAQ;",
6
6
  "names": []
7
7
  }
@@ -39,21 +39,30 @@ if (window.__experimentalContentOnlyInspectorFields) {
39
39
  {
40
40
  id: "text",
41
41
  label: __("Content"),
42
- type: "richtext"
42
+ type: "text",
43
+ Edit: "rich-text"
44
+ // TODO: replace with custom component
43
45
  },
44
46
  {
45
47
  id: "link",
46
48
  label: __("Link"),
47
- type: "link",
48
- mapping: {
49
- url: "url",
50
- rel: "rel",
51
- linkTarget: "linkTarget"
52
- }
49
+ type: "url",
50
+ Edit: "link",
51
+ // TODO: replace with custom component
52
+ getValue: ({ item }) => ({
53
+ url: item.url,
54
+ rel: item.rel,
55
+ linkTarget: item.linkTarget
56
+ }),
57
+ setValue: ({ value }) => ({
58
+ url: value.url,
59
+ rel: value.rel,
60
+ linkTarget: value.linkTarget
61
+ })
53
62
  }
54
63
  ];
55
64
  settings[formKey] = {
56
- fields: ["text"]
65
+ fields: ["text", "link"]
57
66
  };
58
67
  }
59
68
  var init = () => initBlock({ name, metadata, settings });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/button/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { button as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tclassName: 'is-style-fill',\n\t\t\ttext: __( 'Call to action' ),\n\t\t},\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n\tmerge: ( a, { text = '' } ) => ( {\n\t\t...a,\n\t\ttext: ( a.text || '' ) + text,\n\t} ),\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { text } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = text?.trim().length > 0;\n\n\t\t// In the list view, use the block's text as the label.\n\t\t// If the text is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || text;\n\t\t}\n\t},\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'text',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'text' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,WAAW;AAAA,MACX,MAAM,GAAI,gBAAiB;AAAA,IAC5B;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,CAAE,GAAG,EAAE,OAAO,GAAG,OAAS;AAAA,IAChC,GAAG;AAAA,IACH,OAAQ,EAAE,QAAQ,MAAO;AAAA,EAC1B;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,KAAK,IAAI;AAEjB,UAAM,aAAa,YAAY,UAAU;AACzC,UAAM,aAAa,MAAM,KAAK,EAAE,SAAS;AAIzC,QAAK,YAAY,gBAAiB,cAAc,aAAe;AAC9D,aAAO,cAAc;AAAA,IACtB;AAAA,EACD;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,KAAK;AAAA,QACL,KAAK;AAAA,QACL,YAAY;AAAA,MACb;AAAA,IACD;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,MAAO;AAAA,EAClB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { button as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tclassName: 'is-style-fill',\n\t\t\ttext: __( 'Call to action' ),\n\t\t},\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n\tmerge: ( a, { text = '' } ) => ( {\n\t\t...a,\n\t\ttext: ( a.text || '' ) + text,\n\t} ),\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { text } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = text?.trim().length > 0;\n\n\t\t// In the list view, use the block's text as the label.\n\t\t// If the text is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || text;\n\t\t}\n\t},\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'text',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'url',\n\t\t\tEdit: 'link', // TODO: replace with custom component\n\t\t\tgetValue: ( { item } ) => ( {\n\t\t\t\turl: item.url,\n\t\t\t\trel: item.rel,\n\t\t\t\tlinkTarget: item.linkTarget,\n\t\t\t} ),\n\t\t\tsetValue: ( { value } ) => ( {\n\t\t\t\turl: value.url,\n\t\t\t\trel: value.rel,\n\t\t\t\tlinkTarget: value.linkTarget,\n\t\t\t} ),\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'text', 'link' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,WAAW;AAAA,MACX,MAAM,GAAI,gBAAiB;AAAA,IAC5B;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,CAAE,GAAG,EAAE,OAAO,GAAG,OAAS;AAAA,IAChC,GAAG;AAAA,IACH,OAAQ,EAAE,QAAQ,MAAO;AAAA,EAC1B;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,KAAK,IAAI;AAEjB,UAAM,aAAa,YAAY,UAAU;AACzC,UAAM,aAAa,MAAM,KAAK,EAAE,SAAS;AAIzC,QAAK,YAAY,gBAAiB,cAAc,aAAe;AAC9D,aAAO,cAAc;AAAA,IACtB;AAAA,EACD;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,MACN,UAAU,CAAE,EAAE,KAAK,OAAS;AAAA,QAC3B,KAAK,KAAK;AAAA,QACV,KAAK,KAAK;AAAA,QACV,YAAY,KAAK;AAAA,MAClB;AAAA,MACA,UAAU,CAAE,EAAE,MAAM,OAAS;AAAA,QAC5B,KAAK,MAAM;AAAA,QACX,KAAK,MAAM;AAAA,QACX,YAAY,MAAM;AAAA,MACnB;AAAA,IACD;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,QAAQ,MAAO;AAAA,EAC1B;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -36,7 +36,9 @@ if (window.__experimentalContentOnlyInspectorFields) {
36
36
  {
37
37
  id: "content",
38
38
  label: __("Code"),
39
- type: "richtext"
39
+ type: "text",
40
+ Edit: "rich-text"
41
+ // TODO: replace with custom component
40
42
  }
41
43
  ];
42
44
  settings[formKey] = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/code/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { code as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\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: Preserve \\n markers for line breaks\n\t\t\tcontent: __(\n\t\t\t\t'// A \u201Cblock\u201D is the abstract term used\\n// to describe units of markup that\\n// when composed together, form the\\n// content or layout of a page.\\nregisterBlockType( name, settings );'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Code' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,QAAQ,YAAY;AAC7B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,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,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,MAAO;AAAA,MAClB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { code as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\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: Preserve \\n markers for line breaks\n\t\t\tcontent: __(\n\t\t\t\t'// A \u201Cblock\u201D is the abstract term used\\n// to describe units of markup that\\n// when composed together, form the\\n// content or layout of a page.\\nregisterBlockType( name, settings );'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Code' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,QAAQ,YAAY;AAC7B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,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,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -143,18 +143,22 @@ function Edit({
143
143
  ]
144
144
  }
145
145
  ) });
146
- const postTitle = isSiteEditor ? __("\u201CPost Title\u201D") : `"${rawTitle}"`;
146
+ const postTitle = isSiteEditor ? __("Post Title") : rawTitle;
147
147
  let placeholder;
148
148
  if (showCommentsCount && commentsCount !== void 0) {
149
149
  if (showPostTitle) {
150
150
  if (commentsCount === 1) {
151
- placeholder = sprintf(__("One response to %s"), postTitle);
151
+ placeholder = sprintf(
152
+ /* translators: %s: Post title. */
153
+ __('One response to "%s"'),
154
+ postTitle
155
+ );
152
156
  } else {
153
157
  placeholder = sprintf(
154
158
  /* translators: 1: Number of comments, 2: Post title. */
155
159
  _n(
156
- "%1$s response to %2$s",
157
- "%1$s responses to %2$s",
160
+ '%1$s response to "%2$s"',
161
+ '%1$s responses to "%2$s"',
158
162
  commentsCount
159
163
  ),
160
164
  commentsCount,
@@ -172,9 +176,9 @@ function Edit({
172
176
  }
173
177
  } else if (showPostTitle) {
174
178
  if (commentsCount === 1) {
175
- placeholder = sprintf(__("Response to %s"), postTitle);
179
+ placeholder = sprintf(__('Response to "%s"'), postTitle);
176
180
  } else {
177
- placeholder = sprintf(__("Responses to %s"), postTitle);
181
+ placeholder = sprintf(__('Responses to "%s"'), postTitle);
178
182
  }
179
183
  } else if (commentsCount === 1) {
180
184
  placeholder = __("Response");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/comments-title/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tHeadingLevelDropdown,\n} from '@wordpress/block-editor';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function Edit( {\n\tattributes: {\n\t\ttextAlign,\n\t\tshowPostTitle,\n\t\tshowCommentsCount,\n\t\tlevel,\n\t\tlevelOptions,\n\t},\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tconst TagName = 'h' + level;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst [ rawTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tconst isSiteEditor = typeof postId === 'undefined';\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst {\n\t\tthreadCommentsDepth,\n\t\tthreadComments,\n\t\tcommentsPerPage,\n\t\tpageComments,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalDiscussionSettings ?? {};\n\t}, [] );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tuseEffect( () => {\n\t\tif ( isSiteEditor ) {\n\t\t\t// Match the number of comments that will be shown in the comment-template/edit.js placeholder\n\n\t\t\tconst nestedCommentsNumber = threadComments\n\t\t\t\t? Math.min( threadCommentsDepth, 3 ) - 1\n\t\t\t\t: 0;\n\t\t\tconst topLevelCommentsNumber = pageComments ? commentsPerPage : 3;\n\n\t\t\tconst commentsNumber =\n\t\t\t\tparseInt( nestedCommentsNumber ) +\n\t\t\t\tparseInt( topLevelCommentsNumber );\n\n\t\t\tsetCommentsCount( Math.min( commentsNumber, 3 ) );\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\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} )\n\t\t\t.then( ( res ) => {\n\t\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\t\tif ( currentPostId === postId ) {\n\t\t\t\t\tsetCommentsCount(\n\t\t\t\t\t\tparseInt( res.headers.get( 'X-WP-Total' ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tsetCommentsCount( 0 );\n\t\t\t} );\n\t}, [ postId ] );\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<HeadingLevelDropdown\n\t\t\t\tvalue={ level }\n\t\t\t\toptions={ levelOptions }\n\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tshowPostTitle: true,\n\t\t\t\t\t\tshowCommentsCount: true,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! showPostTitle }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { showPostTitle: true } )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\t\tchecked={ showPostTitle }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { showPostTitle: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! showCommentsCount }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { showCommentsCount: true } )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\t\tchecked={ showCommentsCount }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { showCommentsCount: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst postTitle = isSiteEditor ? __( '\u201CPost Title\u201D' ) : `\"${ rawTitle }\"`;\n\n\tlet placeholder;\n\tif ( showCommentsCount && commentsCount !== undefined ) {\n\t\tif ( showPostTitle ) {\n\t\t\tif ( commentsCount === 1 ) {\n\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\tplaceholder = sprintf( __( 'One response to %s' ), postTitle );\n\t\t\t} else {\n\t\t\t\tplaceholder = sprintf(\n\t\t\t\t\t/* translators: 1: Number of comments, 2: Post title. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%1$s response to %2$s',\n\t\t\t\t\t\t'%1$s responses to %2$s',\n\t\t\t\t\t\tcommentsCount\n\t\t\t\t\t),\n\t\t\t\t\tcommentsCount,\n\t\t\t\t\tpostTitle\n\t\t\t\t);\n\t\t\t}\n\t\t} else if ( commentsCount === 1 ) {\n\t\t\tplaceholder = __( 'One response' );\n\t\t} else {\n\t\t\tplaceholder = sprintf(\n\t\t\t\t/* translators: %s: Number of comments. */\n\t\t\t\t_n( '%s response', '%s responses', commentsCount ),\n\t\t\t\tcommentsCount\n\t\t\t);\n\t\t}\n\t} else if ( showPostTitle ) {\n\t\tif ( commentsCount === 1 ) {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Response to %s' ), postTitle );\n\t\t} else {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Responses to %s' ), postTitle );\n\t\t}\n\t} else if ( commentsCount === 1 ) {\n\t\tplaceholder = __( 'Response' );\n\t} else {\n\t\tplaceholder = __( 'Responses' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName { ...blockProps }>{ placeholder }</TagName>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,qBAAqB;AAC9B;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,UAAU,iBAAiB;AACpC,SAAS,iBAAiB;AAC1B,OAAO,cAAc;AACrB,SAAS,oBAAoB;AAK7B,SAAS,sCAAsC;AA0E7C,SA6GA,UA5GC,KADD;AAxEa,SAAR,KAAuB;AAAA,EAC7B,YAAY;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAA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YAE9C;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD,GACD;AAGD,QAAM,YAAY,eAAe,GAAI,wBAAe,IAAI,IAAK,QAAS;AAEtE,MAAI;AACJ,MAAK,qBAAqB,kBAAkB,QAAY;AACvD,QAAK,eAAgB;AACpB,UAAK,kBAAkB,GAAI;AAE1B,sBAAc,QAAS,GAAI,oBAAqB,GAAG,SAAU;AAAA,MAC9D,OAAO;AACN,sBAAc;AAAA;AAAA,UAEb;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD,WAAY,kBAAkB,GAAI;AACjC,oBAAc,GAAI,cAAe;AAAA,IAClC,OAAO;AACN,oBAAc;AAAA;AAAA,QAEb,GAAI,eAAe,gBAAgB,aAAc;AAAA,QACjD;AAAA,MACD;AAAA,IACD;AAAA,EACD,WAAY,eAAgB;AAC3B,QAAK,kBAAkB,GAAI;AAE1B,oBAAc,QAAS,GAAI,gBAAiB,GAAG,SAAU;AAAA,IAC1D,OAAO;AAEN,oBAAc,QAAS,GAAI,iBAAkB,GAAG,SAAU;AAAA,IAC3D;AAAA,EACD,WAAY,kBAAkB,GAAI;AACjC,kBAAc,GAAI,UAAW;AAAA,EAC9B,OAAO;AACN,kBAAc,GAAI,WAAY;AAAA,EAC/B;AAEA,SACC,iCACG;AAAA;AAAA,IACA;AAAA,IACF,oBAAC,WAAU,GAAG,YAAe,uBAAa;AAAA,KAC3C;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\tInspectorControls,\n\tstore as blockEditorStore,\n\tHeadingLevelDropdown,\n} from '@wordpress/block-editor';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function Edit( {\n\tattributes: {\n\t\ttextAlign,\n\t\tshowPostTitle,\n\t\tshowCommentsCount,\n\t\tlevel,\n\t\tlevelOptions,\n\t},\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tconst TagName = 'h' + level;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst [ rawTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tconst isSiteEditor = typeof postId === 'undefined';\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst {\n\t\tthreadCommentsDepth,\n\t\tthreadComments,\n\t\tcommentsPerPage,\n\t\tpageComments,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalDiscussionSettings ?? {};\n\t}, [] );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tuseEffect( () => {\n\t\tif ( isSiteEditor ) {\n\t\t\t// Match the number of comments that will be shown in the comment-template/edit.js placeholder\n\n\t\t\tconst nestedCommentsNumber = threadComments\n\t\t\t\t? Math.min( threadCommentsDepth, 3 ) - 1\n\t\t\t\t: 0;\n\t\t\tconst topLevelCommentsNumber = pageComments ? commentsPerPage : 3;\n\n\t\t\tconst commentsNumber =\n\t\t\t\tparseInt( nestedCommentsNumber ) +\n\t\t\t\tparseInt( topLevelCommentsNumber );\n\n\t\t\tsetCommentsCount( Math.min( commentsNumber, 3 ) );\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\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} )\n\t\t\t.then( ( res ) => {\n\t\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\t\tif ( currentPostId === postId ) {\n\t\t\t\t\tsetCommentsCount(\n\t\t\t\t\t\tparseInt( res.headers.get( 'X-WP-Total' ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tsetCommentsCount( 0 );\n\t\t\t} );\n\t}, [ postId ] );\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<HeadingLevelDropdown\n\t\t\t\tvalue={ level }\n\t\t\t\toptions={ levelOptions }\n\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tshowPostTitle: true,\n\t\t\t\t\t\tshowCommentsCount: true,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! showPostTitle }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { showPostTitle: true } )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\t\tchecked={ showPostTitle }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { showPostTitle: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! showCommentsCount }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { showCommentsCount: true } )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\t\tchecked={ showCommentsCount }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { showCommentsCount: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst postTitle = isSiteEditor ? __( 'Post Title' ) : rawTitle;\n\n\tlet placeholder;\n\tif ( showCommentsCount && commentsCount !== undefined ) {\n\t\tif ( showPostTitle ) {\n\t\t\tif ( commentsCount === 1 ) {\n\t\t\t\tplaceholder = sprintf(\n\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\t__( 'One response to \"%s\"' ),\n\t\t\t\t\tpostTitle\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tplaceholder = sprintf(\n\t\t\t\t\t/* translators: 1: Number of comments, 2: Post title. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%1$s response to \"%2$s\"',\n\t\t\t\t\t\t'%1$s responses to \"%2$s\"',\n\t\t\t\t\t\tcommentsCount\n\t\t\t\t\t),\n\t\t\t\t\tcommentsCount,\n\t\t\t\t\tpostTitle\n\t\t\t\t);\n\t\t\t}\n\t\t} else if ( commentsCount === 1 ) {\n\t\t\tplaceholder = __( 'One response' );\n\t\t} else {\n\t\t\tplaceholder = sprintf(\n\t\t\t\t/* translators: %s: Number of comments. */\n\t\t\t\t_n( '%s response', '%s responses', commentsCount ),\n\t\t\t\tcommentsCount\n\t\t\t);\n\t\t}\n\t} else if ( showPostTitle ) {\n\t\tif ( commentsCount === 1 ) {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Response to \"%s\"' ), postTitle );\n\t\t} else {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Responses to \"%s\"' ), postTitle );\n\t\t}\n\t} else if ( commentsCount === 1 ) {\n\t\tplaceholder = __( 'Response' );\n\t} else {\n\t\tplaceholder = __( 'Responses' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName { ...blockProps }>{ placeholder }</TagName>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,qBAAqB;AAC9B;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,UAAU,iBAAiB;AACpC,SAAS,iBAAiB;AAC1B,OAAO,cAAc;AACrB,SAAS,oBAAoB;AAK7B,SAAS,sCAAsC;AA0E7C,SAgHA,UA/GC,KADD;AAxEa,SAAR,KAAuB;AAAA,EAC7B,YAAY;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,EACA,SAAS,EAAE,UAAU,OAAO;AAC7B,GAAI;AACH,QAAM,UAAU,MAAM;AACtB,QA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qBAAqB,kBAAkB,QAAY;AACvD,QAAK,eAAgB;AACpB,UAAK,kBAAkB,GAAI;AAC1B,sBAAc;AAAA;AAAA,UAEb,GAAI,sBAAuB;AAAA,UAC3B;AAAA,QACD;AAAA,MACD,OAAO;AACN,sBAAc;AAAA;AAAA,UAEb;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD,WAAY,kBAAkB,GAAI;AACjC,oBAAc,GAAI,cAAe;AAAA,IAClC,OAAO;AACN,oBAAc;AAAA;AAAA,QAEb,GAAI,eAAe,gBAAgB,aAAc;AAAA,QACjD;AAAA,MACD;AAAA,IACD;AAAA,EACD,WAAY,eAAgB;AAC3B,QAAK,kBAAkB,GAAI;AAE1B,oBAAc,QAAS,GAAI,kBAAmB,GAAG,SAAU;AAAA,IAC5D,OAAO;AAEN,oBAAc,QAAS,GAAI,mBAAoB,GAAG,SAAU;AAAA,IAC7D;AAAA,EACD,WAAY,kBAAkB,GAAI;AACjC,kBAAc,GAAI,UAAW;AAAA,EAC9B,OAAO;AACN,kBAAc,GAAI,WAAY;AAAA,EAC/B;AAEA,SACC,iCACG;AAAA;AAAA,IACA;AAAA,IACF,oBAAC,WAAU,GAAG,YAAe,uBAAa;AAAA,KAC3C;AAEF;",
6
6
  "names": []
7
7
  }
@@ -54,19 +54,29 @@ if (window.__experimentalContentOnlyInspectorFields) {
54
54
  id: "background",
55
55
  label: __("Background"),
56
56
  type: "media",
57
- mapping: {
58
- type: "backgroundType",
59
- id: "id",
60
- url: "url",
61
- alt: "alt",
62
- featuredImage: "useFeaturedImage"
63
- },
64
- args: {
57
+ Edit: {
58
+ control: "media",
59
+ // TODO: replace with custom component
65
60
  // TODO - How to support custom gradient?
66
61
  // Build it into Media, or use a custom control?
67
62
  allowedTypes: ["image", "video"],
68
- multiple: false
69
- }
63
+ multiple: false,
64
+ useFeaturedImage: true
65
+ },
66
+ getValue: ({ item }) => ({
67
+ id: item.id,
68
+ url: item.url,
69
+ alt: item.alt,
70
+ mediaType: item.backgroundType,
71
+ featuredImage: item.useFeaturedImage
72
+ }),
73
+ setValue: ({ value }) => ({
74
+ id: value.id,
75
+ url: value.url,
76
+ alt: value.alt,
77
+ mediaType: value.backgroundType,
78
+ useFeaturedImage: value.featuredImage
79
+ })
70
80
  }
71
81
  ];
72
82
  settings[formKey] = {