@wordpress/block-library 9.21.0 → 9.23.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 (201) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/calendar/index.js +1 -0
  3. package/build/calendar/index.js.map +1 -1
  4. package/build/comments/edit/comments-inspector-controls.js +13 -13
  5. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  6. package/build/comments/edit/index.js +4 -2
  7. package/build/comments/edit/index.js.map +1 -1
  8. package/build/cover/edit/inspector-controls.js +9 -12
  9. package/build/cover/edit/inspector-controls.js.map +1 -1
  10. package/build/cover/index.js +1 -1
  11. package/build/cover/index.js.map +1 -1
  12. package/build/details/edit.js +1 -5
  13. package/build/details/edit.js.map +1 -1
  14. package/build/details/index.js +1 -1
  15. package/build/details/index.js.map +1 -1
  16. package/build/group/edit.js +17 -13
  17. package/build/group/edit.js.map +1 -1
  18. package/build/image/edit.js +0 -6
  19. package/build/image/edit.js.map +1 -1
  20. package/build/latest-posts/edit.js +100 -54
  21. package/build/latest-posts/edit.js.map +1 -1
  22. package/build/navigation/view.js +2 -1
  23. package/build/navigation/view.js.map +1 -1
  24. package/build/navigation-link/edit.js +0 -21
  25. package/build/navigation-link/edit.js.map +1 -1
  26. package/build/navigation-link/index.js +0 -3
  27. package/build/navigation-link/index.js.map +1 -1
  28. package/build/navigation-link/transforms.js +0 -2
  29. package/build/navigation-link/transforms.js.map +1 -1
  30. package/build/navigation-link/update-attributes.js +0 -1
  31. package/build/navigation-link/update-attributes.js.map +1 -1
  32. package/build/navigation-submenu/edit.js +1 -24
  33. package/build/navigation-submenu/edit.js.map +1 -1
  34. package/build/navigation-submenu/index.js +0 -3
  35. package/build/navigation-submenu/index.js.map +1 -1
  36. package/build/post-comments-count/index.js +0 -1
  37. package/build/post-comments-count/index.js.map +1 -1
  38. package/build/post-comments-link/index.js +0 -1
  39. package/build/post-comments-link/index.js.map +1 -1
  40. package/build/post-featured-image/edit.js +15 -5
  41. package/build/post-featured-image/edit.js.map +1 -1
  42. package/build/query/edit/inspector-controls/index.js +47 -59
  43. package/build/query/edit/inspector-controls/index.js.map +1 -1
  44. package/build/query/edit/inspector-controls/parent-control.js +2 -2
  45. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  46. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  47. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  48. package/build/query/edit/query-content.js +15 -29
  49. package/build/query/edit/query-content.js.map +1 -1
  50. package/build/quote/index.js +1 -1
  51. package/build/quote/index.js.map +1 -1
  52. package/build/separator/edit.js +13 -12
  53. package/build/separator/edit.js.map +1 -1
  54. package/build/social-links/edit.js +29 -31
  55. package/build/social-links/edit.js.map +1 -1
  56. package/build/table/index.js +3 -3
  57. package/build/table/index.js.map +1 -1
  58. package/build/table/transforms.js +11 -3
  59. package/build/table/transforms.js.map +1 -1
  60. package/build/table-of-contents/edit.js +1 -1
  61. package/build/table-of-contents/edit.js.map +1 -1
  62. package/build/table-of-contents/hooks.js +6 -3
  63. package/build/table-of-contents/hooks.js.map +1 -1
  64. package/build/template-part/edit/advanced-controls.js +14 -12
  65. package/build/template-part/edit/advanced-controls.js.map +1 -1
  66. package/build/template-part/edit/index.js +2 -1
  67. package/build/template-part/edit/index.js.map +1 -1
  68. package/build-module/calendar/index.js +1 -0
  69. package/build-module/calendar/index.js.map +1 -1
  70. package/build-module/comments/edit/comments-inspector-controls.js +14 -14
  71. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  72. package/build-module/comments/edit/index.js +4 -2
  73. package/build-module/comments/edit/index.js.map +1 -1
  74. package/build-module/cover/edit/inspector-controls.js +10 -13
  75. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  76. package/build-module/cover/index.js +1 -1
  77. package/build-module/cover/index.js.map +1 -1
  78. package/build-module/details/edit.js +1 -5
  79. package/build-module/details/edit.js.map +1 -1
  80. package/build-module/details/index.js +1 -1
  81. package/build-module/details/index.js.map +1 -1
  82. package/build-module/group/edit.js +16 -14
  83. package/build-module/group/edit.js.map +1 -1
  84. package/build-module/image/edit.js +0 -6
  85. package/build-module/image/edit.js.map +1 -1
  86. package/build-module/latest-posts/edit.js +100 -54
  87. package/build-module/latest-posts/edit.js.map +1 -1
  88. package/build-module/navigation/view.js +2 -1
  89. package/build-module/navigation/view.js.map +1 -1
  90. package/build-module/navigation-link/edit.js +0 -21
  91. package/build-module/navigation-link/edit.js.map +1 -1
  92. package/build-module/navigation-link/index.js +0 -3
  93. package/build-module/navigation-link/index.js.map +1 -1
  94. package/build-module/navigation-link/transforms.js +0 -2
  95. package/build-module/navigation-link/transforms.js.map +1 -1
  96. package/build-module/navigation-link/update-attributes.js +0 -1
  97. package/build-module/navigation-link/update-attributes.js.map +1 -1
  98. package/build-module/navigation-submenu/edit.js +1 -24
  99. package/build-module/navigation-submenu/edit.js.map +1 -1
  100. package/build-module/navigation-submenu/index.js +0 -3
  101. package/build-module/navigation-submenu/index.js.map +1 -1
  102. package/build-module/post-comments-count/index.js +0 -1
  103. package/build-module/post-comments-count/index.js.map +1 -1
  104. package/build-module/post-comments-link/index.js +0 -1
  105. package/build-module/post-comments-link/index.js.map +1 -1
  106. package/build-module/post-featured-image/edit.js +15 -5
  107. package/build-module/post-featured-image/edit.js.map +1 -1
  108. package/build-module/query/edit/inspector-controls/index.js +49 -61
  109. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  110. package/build-module/query/edit/inspector-controls/parent-control.js +2 -2
  111. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  112. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  113. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  114. package/build-module/query/edit/query-content.js +16 -30
  115. package/build-module/query/edit/query-content.js.map +1 -1
  116. package/build-module/quote/index.js +1 -1
  117. package/build-module/quote/index.js.map +1 -1
  118. package/build-module/separator/edit.js +15 -14
  119. package/build-module/separator/edit.js.map +1 -1
  120. package/build-module/social-links/edit.js +30 -32
  121. package/build-module/social-links/edit.js.map +1 -1
  122. package/build-module/table/index.js +3 -3
  123. package/build-module/table/index.js.map +1 -1
  124. package/build-module/table/transforms.js +11 -3
  125. package/build-module/table/transforms.js.map +1 -1
  126. package/build-module/table-of-contents/edit.js +1 -1
  127. package/build-module/table-of-contents/edit.js.map +1 -1
  128. package/build-module/table-of-contents/hooks.js +6 -3
  129. package/build-module/table-of-contents/hooks.js.map +1 -1
  130. package/build-module/template-part/edit/advanced-controls.js +14 -12
  131. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  132. package/build-module/template-part/edit/index.js +2 -1
  133. package/build-module/template-part/edit/index.js.map +1 -1
  134. package/build-style/editor-rtl.css +1 -50
  135. package/build-style/editor.css +1 -50
  136. package/build-style/media-text/style-rtl.css +0 -2
  137. package/build-style/media-text/style.css +0 -2
  138. package/build-style/search/style-rtl.css +1 -0
  139. package/build-style/search/style.css +1 -0
  140. package/build-style/social-links/editor-rtl.css +1 -50
  141. package/build-style/social-links/editor.css +1 -50
  142. package/build-style/style-rtl.css +1 -6
  143. package/build-style/style.css +1 -6
  144. package/build-style/tag-cloud/style-rtl.css +0 -4
  145. package/build-style/tag-cloud/style.css +0 -4
  146. package/package.json +35 -35
  147. package/src/button/index.php +2 -3
  148. package/src/calendar/block.json +1 -0
  149. package/src/comments/edit/comments-inspector-controls.js +14 -12
  150. package/src/comments/edit/index.js +2 -1
  151. package/src/cover/edit/inspector-controls.js +9 -12
  152. package/src/cover/index.js +1 -1
  153. package/src/details/edit.js +6 -8
  154. package/src/details/index.js +1 -1
  155. package/src/file/index.php +2 -3
  156. package/src/group/edit.js +11 -10
  157. package/src/image/edit.js +0 -4
  158. package/src/latest-comments/index.php +1 -1
  159. package/src/latest-posts/edit.js +113 -81
  160. package/src/latest-posts/index.php +3 -0
  161. package/src/loginout/index.php +5 -1
  162. package/src/media-text/style.scss +0 -2
  163. package/src/navigation/index.php +1 -2
  164. package/src/navigation/view.js +2 -1
  165. package/src/navigation-link/block.json +0 -3
  166. package/src/navigation-link/edit.js +1 -22
  167. package/src/navigation-link/index.php +2 -6
  168. package/src/navigation-link/transforms.js +1 -2
  169. package/src/navigation-link/update-attributes.js +0 -1
  170. package/src/navigation-submenu/block.json +0 -3
  171. package/src/navigation-submenu/edit.js +1 -24
  172. package/src/navigation-submenu/index.php +1 -5
  173. package/src/post-author/index.php +1 -1
  174. package/src/post-author-name/index.php +1 -1
  175. package/src/post-comments-count/block.json +0 -1
  176. package/src/post-comments-count/index.php +4 -0
  177. package/src/post-comments-link/block.json +0 -1
  178. package/src/post-comments-link/index.php +4 -0
  179. package/src/post-featured-image/edit.js +94 -77
  180. package/src/query/edit/inspector-controls/index.js +66 -91
  181. package/src/query/edit/inspector-controls/parent-control.js +2 -2
  182. package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  183. package/src/query/edit/query-content.js +17 -27
  184. package/src/quote/index.js +1 -1
  185. package/src/search/index.php +12 -9
  186. package/src/search/style.scss +1 -0
  187. package/src/separator/edit.js +16 -12
  188. package/src/social-links/edit.js +29 -30
  189. package/src/social-links/editor.scss +1 -59
  190. package/src/table/index.js +3 -3
  191. package/src/table/transforms.js +14 -2
  192. package/src/table-of-contents/edit.js +1 -1
  193. package/src/table-of-contents/hooks.js +5 -2
  194. package/src/tag-cloud/style.scss +0 -5
  195. package/src/template-part/edit/advanced-controls.js +9 -8
  196. package/src/template-part/edit/index.js +1 -0
  197. package/build/utils/messages.js +0 -22
  198. package/build/utils/messages.js.map +0 -1
  199. package/build-module/utils/messages.js +0 -15
  200. package/build-module/utils/messages.js.map +0 -1
  201. package/src/utils/messages.js +0 -31
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","hasFixedLayout","type","caption","source","selector","head","query","cells","content","tag","scope","attribute","align","colspan","rowspan","body","foot","supports","anchor","color","__experimentalSkipSerialization","gradients","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalTextDecoration","__experimentalBorder","style","width","interactivity","clientNavigation","selectors","root","styles","label","isDefault","editorStyle","settings","icon","example","__","viewportWidth","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/table/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Jaco Pastorius',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Betty Carter',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Bebo Valdés',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tviewportWidth: 450,\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IA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AE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,aAAa;UACtBC,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,kBAAmB,CAAC;UACjC1C,GAAG,EAAE;QACN,CAAC;MAEH,CAAC;IAEH,CAAC;IACD2C,aAAa,EAAE;EAChB,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEhE,IAAI;EAAEJ,QAAQ;EAAE0D;AAAS,CAAE,CAAC;AAACzD,OAAA,CAAAkE,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","hasFixedLayout","type","caption","source","selector","head","query","cells","content","tag","scope","attribute","align","colspan","rowspan","body","foot","supports","anchor","color","__experimentalSkipSerialization","gradients","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalTextDecoration","__experimentalBorder","style","width","interactivity","clientNavigation","selectors","root","styles","label","isDefault","editorStyle","settings","icon","example","__","viewportWidth","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/table/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jaco Pastorius' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Betty Carter' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Bebo Valdés' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tviewportWidth: 450,\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAQ,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,cAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,OAAA;MAAAD,IAAA;MAAAE,MAAA;MAAAC,QAAA;IAAA;IAAAC,IAAA;MAAAJ,IAAA;MAAA;MAAAE,MAAA;MAAAC,QAAA;MAAAE,KAAA;QAAAC,KAAA;UAAAN,IAAA;UAAA;UAAAE,MAAA;UAAAC,QAAA;UAAAE,KAAA;YAAAE,OAAA;cAAAP,IAAA;cAAAE,MAAA;YAAA;YAAAM,GAAA;cAAAR,IAAA;cAAA;cAAAE,MAAA;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AA,IAAA","ignoreList":[]}
@@ -23,12 +23,12 @@ const tableContentPasteSchema = ({
23
23
  th: {
24
24
  allowEmpty: true,
25
25
  children: phrasingContentSchema,
26
- attributes: ['scope', 'colspan', 'rowspan']
26
+ attributes: ['scope', 'colspan', 'rowspan', 'style']
27
27
  },
28
28
  td: {
29
29
  allowEmpty: true,
30
30
  children: phrasingContentSchema,
31
- attributes: ['colspan', 'rowspan']
31
+ attributes: ['colspan', 'rowspan', 'style']
32
32
  }
33
33
  }
34
34
  }
@@ -69,11 +69,19 @@ const transforms = {
69
69
  const rowAttributes = Array.from(row.children).reduce((colAcc, col) => {
70
70
  const rowspan = (0, _utils.normalizeRowColSpan)(col.getAttribute('rowspan'));
71
71
  const colspan = (0, _utils.normalizeRowColSpan)(col.getAttribute('colspan'));
72
+ const {
73
+ textAlign
74
+ } = col.style || {};
75
+ let align;
76
+ if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') {
77
+ align = textAlign;
78
+ }
72
79
  colAcc.push({
73
80
  tag: col.nodeName.toLowerCase(),
74
81
  content: col.innerHTML,
75
82
  rowspan,
76
- colspan
83
+ colspan,
84
+ align
77
85
  });
78
86
  return colAcc;
79
87
  }, []);
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_utils","tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","normalizeRowColSpan","getAttribute","colspan","push","tag","content","innerHTML","cells","createBlock","_default","exports","default"],"sources":["@wordpress/block-library/src/table/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { normalizeRowColSpan } from './utils';\n\nconst tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst attributes = Array.from( node.children ).reduce(\n\t\t\t\t\t( sectionAcc, section ) => {\n\t\t\t\t\t\tif ( ! section.children.length ) {\n\t\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sectionName = section.nodeName\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.slice( 1 );\n\n\t\t\t\t\t\tconst sectionAttributes = Array.from(\n\t\t\t\t\t\t\tsection.children\n\t\t\t\t\t\t).reduce( ( rowAcc, row ) => {\n\t\t\t\t\t\t\tif ( ! row.children.length ) {\n\t\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rowAttributes = Array.from(\n\t\t\t\t\t\t\t\trow.children\n\t\t\t\t\t\t\t).reduce( ( colAcc, col ) => {\n\t\t\t\t\t\t\t\tconst rowspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'rowspan' )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst colspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'colspan' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tcolAcc.push( {\n\t\t\t\t\t\t\t\t\ttag: col.nodeName.toLowerCase(),\n\t\t\t\t\t\t\t\t\tcontent: col.innerHTML,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn colAcc;\n\t\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\t\trowAcc.push( {\n\t\t\t\t\t\t\t\tcells: rowAttributes,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\tsectionAcc[ sectionName ] = sectionAttributes;\n\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/table', attributes );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAME,uBAAuB,GAAGA,CAAE;EAAEC;AAAsB,CAAC,MAAQ;EAClEC,EAAE,EAAE;IACHC,UAAU,EAAE,IAAI;IAChBC,QAAQ,EAAE;MACTC,EAAE,EAAE;QACHF,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAEH,qBAAqB;QAC/BK,UAAU,EAAE,CAAE,OAAO,EAAE,SAAS,EAAE,SAAS;MAC5C,CAAC;MACDC,EAAE,EAAE;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a,GAAGZ,KAAK,CAACN,IAAI,CAC/BiB,GAAG,CAAC5B,QACL,CAAC,CAACkB,MAAM,CAAE,CAAEY,MAAM,EAAEC,GAAG,KAAM;YAC5B,MAAMC,OAAO,GAAG,IAAAC,0BAAmB,EAClCF,GAAG,CAACG,YAAY,CAAE,SAAU,CAC7B,CAAC;YACD,MAAMC,OAAO,GAAG,IAAAF,0BAAmB,EAClCF,GAAG,CAACG,YAAY,CAAE,SAAU,CAC7B,CAAC;YAEDJ,MAAM,CAACM,IAAI,CAAE;cACZC,GAAG,EAAEN,GAAG,CAACR,QAAQ,CAACC,WAAW,CAAC,CAAC;cAC/Bc,OAAO,EAAEP,GAAG,CAACQ,SAAS;cACtBP,OAAO;cACPG;YACD,CAAE,CAAC;YAEH,OAAOL,MAAM;UACd,CAAC,EAAE,EAAG,CAAC;UAEPH,MAAM,CAACS,IAAI,CAAE;YACZI,KAAK,EAAEX;UACR,CAAE,CAAC;UAEH,OAAOF,MAAM;QACd,CAAC,EAAE,EAAG,CAAC;QAEPR,UAAU,CAAEG,WAAW,CAAE,GAAGI,iBAAiB;QAC7C,OAAOP,UAAU;MAClB,CAAC,EACD,CAAC,CACF,CAAC;MAED,OAAO,IAAAsB,mBAAW,EAAE,YAAY,EAAEvC,UAAW,CAAC;IAC/C;EACD,CAAC;AAEH,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalC,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_utils","tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","normalizeRowColSpan","getAttribute","colspan","textAlign","style","align","push","tag","content","innerHTML","cells","createBlock","_default","exports","default"],"sources":["@wordpress/block-library/src/table/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { normalizeRowColSpan } from './utils';\n\nconst tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan', 'rowspan', 'style' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan', 'rowspan', 'style' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst attributes = Array.from( node.children ).reduce(\n\t\t\t\t\t( sectionAcc, section ) => {\n\t\t\t\t\t\tif ( ! section.children.length ) {\n\t\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sectionName = section.nodeName\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.slice( 1 );\n\n\t\t\t\t\t\tconst sectionAttributes = Array.from(\n\t\t\t\t\t\t\tsection.children\n\t\t\t\t\t\t).reduce( ( rowAcc, row ) => {\n\t\t\t\t\t\t\tif ( ! row.children.length ) {\n\t\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rowAttributes = Array.from(\n\t\t\t\t\t\t\t\trow.children\n\t\t\t\t\t\t\t).reduce( ( colAcc, col ) => {\n\t\t\t\t\t\t\t\tconst rowspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'rowspan' )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst colspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'colspan' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst { textAlign } = col.style || {};\n\n\t\t\t\t\t\t\t\tlet align;\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\ttextAlign === 'left' ||\n\t\t\t\t\t\t\t\t\ttextAlign === 'center' ||\n\t\t\t\t\t\t\t\t\ttextAlign === 'right'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\talign = textAlign;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcolAcc.push( {\n\t\t\t\t\t\t\t\t\ttag: col.nodeName.toLowerCase(),\n\t\t\t\t\t\t\t\t\tcontent: col.innerHTML,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn colAcc;\n\t\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\t\trowAcc.push( {\n\t\t\t\t\t\t\t\tcells: rowAttributes,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\tsectionAcc[ sectionName ] = sectionAttributes;\n\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n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CAAC;UAEPH,MAAM,CAACY,IAAI,CAAE;YACZI,KAAK,EAAEd;UACR,CAAE,CAAC;UAEH,OAAOF,MAAM;QACd,CAAC,EAAE,EAAG,CAAC;QAEPR,UAAU,CAAEG,WAAW,CAAE,GAAGI,iBAAiB;QAC7C,OAAOP,UAAU;MAClB,CAAC,EACD,CAAC,CACF,CAAC;MAED,OAAO,IAAAyB,mBAAW,EAAE,YAAY,EAAE1C,UAAW,CAAC;IAC/C;EACD,CAAC;AAEH,CAAC;AAAC,IAAA2C,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEarC,UAAU","ignoreList":[]}
@@ -154,7 +154,7 @@ var _jsxRuntime = require("react/jsx-runtime");
154
154
  onChange: value => setAttributes({
155
155
  maxLevel: value ? parseInt(value) : undefined
156
156
  }),
157
- help: maxLevel ? (0, _i18n.__)('Including all heading levels in the table of contents.') : (0, _i18n.__)('Only include headings up to and including this level.')
157
+ help: !maxLevel ? (0, _i18n.__)('Including all heading levels in the table of contents.') : (0, _i18n.__)('Only include headings up to and including this level.')
158
158
  })
159
159
  })]
160
160
  })
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_hooks2","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","maxLevel","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","dropdownMenuProps","useToolsPanelDropdownMenuProps","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","jsxs","__experimentalToolsPanel","label","resetAll","undefined","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","onChange","value","help","SelectControl","__next40pxDefaultSize","options","parseInt","length","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPlaceholder,\n\tToggleControl,\n\tSelectControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.\n * @param {string} props.clientId The client id.\n * @param {(attributes: Object) => void} props.setAttributes The set attributes function.\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage, maxLevel },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\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\tonlyIncludeCurrentPage: false,\n\t\t\t\t\t\tmaxLevel: undefined,\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\thasValue={ () => !! onlyIncludeCurrentPage }\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t'Include headings from all pages (if the post is paginated).'\n\t\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</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! maxLevel }\n\t\t\t\t\tlabel={ __( 'Limit heading levels' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { maxLevel: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Include headings down to level' ) }\n\t\t\t\t\t\tvalue={ maxLevel || '' }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ value: '', label: __( 'All levels' ) },\n\t\t\t\t\t\t\t{ value: '1', label: __( 'Heading 1' ) },\n\t\t\t\t\t\t\t{ value: '2', label: __( 'Heading 2' ) },\n\t\t\t\t\t\t\t{ value: '3', label: __( 'Heading 3' ) },\n\t\t\t\t\t\t\t{ value: '4', label: __( 'Heading 4' ) },\n\t\t\t\t\t\t\t{ value: '5', label: __( 'Heading 5' ) },\n\t\t\t\t\t\t\t{ value: '6', label: __( 'Heading 6' ) },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tmaxLevel: value ? parseInt( value ) : undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tmaxLevel\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Including all heading levels in the table of contents.'\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t'Only include headings up to and including this level.'\n\t\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</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAAgE,IAAAc,WAAA,GAAAd,OAAA;AAjChE;AACA;AACA;;AAyBA;AACA;AACA;;AAMA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASe,mBAAmBA,CAAE;EAC5CC,UAAU,EAAE;IAAEC,QAAQ,GAAG,EAAE;IAAEC,sBAAsB;IAAEC;EAAS,CAAC;EAC/DC,QAAQ;EACRC;AACD,CAAC,EAA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lC,OAAO,EAAGxB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJkB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_hooks2","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","maxLevel","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","dropdownMenuProps","useToolsPanelDropdownMenuProps","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","jsxs","__experimentalToolsPanel","label","resetAll","undefined","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","onChange","value","help","SelectControl","__next40pxDefaultSize","options","parseInt","length","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPlaceholder,\n\tToggleControl,\n\tSelectControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.\n * @param {string} props.clientId The client id.\n * @param {(attributes: Object) => void} props.setAttributes The set attributes function.\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage, maxLevel },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\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\tonlyIncludeCurrentPage: false,\n\t\t\t\t\t\tmaxLevel: undefined,\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\thasValue={ () => !! onlyIncludeCurrentPage }\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t'Include headings from all pages (if the post is paginated).'\n\t\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</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! maxLevel }\n\t\t\t\t\tlabel={ __( 'Limit heading levels' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { maxLevel: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Include headings down to level' ) }\n\t\t\t\t\t\tvalue={ maxLevel || '' }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ value: '', label: __( 'All levels' ) },\n\t\t\t\t\t\t\t{ value: '1', label: __( 'Heading 1' ) },\n\t\t\t\t\t\t\t{ value: '2', label: __( 'Heading 2' ) },\n\t\t\t\t\t\t\t{ value: '3', label: __( 'Heading 3' ) },\n\t\t\t\t\t\t\t{ value: '4', label: __( 'Heading 4' ) },\n\t\t\t\t\t\t\t{ value: '5', label: __( 'Heading 5' ) },\n\t\t\t\t\t\t\t{ value: '6', label: __( 'Heading 6' ) },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tmaxLevel: value ? parseInt( value ) : undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t! maxLevel\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Including all heading levels in the table of contents.'\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t'Only include headings up to and including this level.'\n\t\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</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OA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QAAA4B,QAAA,eACnB,IAAArC,WAAA,CAAAmC,GAAA,EAAC/C,WAAA,CAAAkF,WAAW;UACXC,IAAI,eAAG,IAAAvE,WAAA,CAAAmC,GAAA,EAAClD,YAAA,CAAAuF,SAAS;YAACD,IAAI,EAAGA;UAAM,CAAE,CAAG;UACpCpB,KAAK,EAAG,IAAAhC,QAAE,EAAE,mBAAoB,CAAG;UACnCsD,YAAY,EAAG,IAAAtD,QAAE,EAChB,4GACD;QAAG,CACH;MAAC,CACE,CAAC,EACJ4B,iBAAiB;IAAA,CAClB,CAAC;EAEL;EAEA,oBACC,IAAA/C,WAAA,CAAAiD,IAAA,EAAAjD,WAAA,CAAAqE,QAAA;IAAAhC,QAAA,gBACC,IAAArC,WAAA,CAAAmC,GAAA;MAAA,GAAU1B,UAAU;MAAA4B,QAAA,eACnB,IAAArC,WAAA,CAAAmC,GAAA;QAAAE,QAAA,eACC,IAAArC,WAAA,CAAAmC,GAAA,EAACxC,KAAA,CAAAkD,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjC0C,qBAAqB;UACrBlC,OAAO,EAAGxB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJkB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
@@ -137,9 +137,12 @@ function observeCallback(select, dispatch, clientId) {
137
137
  }
138
138
  const headings = getLatestHeadings(select, clientId);
139
139
  if (!(0, _es.default)(headings, attributes.headings)) {
140
- __unstableMarkNextChangeAsNotPersistent();
141
- updateBlockAttributes(clientId, {
142
- headings
140
+ // Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.
141
+ window.queueMicrotask(() => {
142
+ __unstableMarkNextChangeAsNotPersistent();
143
+ updateBlockAttributes(clientId, {
144
+ headings
145
+ });
143
146
  });
144
147
  }
145
148
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","maxLevel","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","level","canBeLinked","anchor","push","content","stripHTML","replace","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","useObserveHeadings","registry","useRegistry","useEffect","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"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\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\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__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\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"],"mappings":";;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASM,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EAC9C,MAAM;IACLC,kBAAkB;IAClBC,YAAY;IACZC,eAAe;IACfC;EACD,CAAC,GAAGP,MAAM,CAAEQ,kBAAiB,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,SAAS,IAAAP,oBAAA,GAAGF,MAAM,CAAE,aAAc,CAAC,CAACU,YAAY,CAAC,CAAC,cAAAR,oBAAA,cAAAA,oBAAA,GAAI,IAAI;EAEhE,MAAMS,WAAW,GAAGL,eAAe,CAAE,eAAgB,CAAC,CAACM,MAAM,KAAK,CAAC;EACnE,MAAM;IAAEC,sBAAsB;IAAEC;EAAS,CAAC,IAAAX,mBAAA,GACzCC,kBAAkB,CAAEH,QAAS,CAAC,cAAAE,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAC;;EAErC;EACA,MAAM,CAAEY,mBAAmB,GAAG,EAAE,CAAE,GAAGT,eAAe,CAAE,mBAAoB,CAAC;;EAE3E;EACA,MAAMU,iBAAi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AAExC,QAAQ,EAAE;MAAE2C;IAAS,CAAE,CAAC;EAChD;AACD;AAEO,SAASE,kBAAkBA,CAAE7C,QAAQ,EAAG;EAC9C,MAAM8C,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA;IACA,OAAOF,QAAQ,CAACG,SAAS,CAAE,MAC1BX,eAAe,CAAEQ,QAAQ,CAAC/C,MAAM,EAAE+C,QAAQ,CAACP,QAAQ,EAAEvC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAE8C,QAAQ,EAAE9C,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
1
+ {"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","maxLevel","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","level","canBeLinked","anchor","push","content","stripHTML","replace","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","window","queueMicrotask","useObserveHeadings","registry","useRegistry","useEffect","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"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\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\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"],"mappings":";;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASM,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EA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J;IACD;EACD;EAEA,OAAOV,cAAc;AACtB;AAEA,SAASgB,eAAeA,CAAEvC,MAAM,EAAEwC,QAAQ,EAAEvC,QAAQ,EAAG;EACtD,MAAM;IAAEG;EAAmB,CAAC,GAAGJ,MAAM,CAAEQ,kBAAiB,CAAC;EACzD,MAAM;IAAEiC,qBAAqB;IAAEC;EAAwC,CAAC,GACvEF,QAAQ,CAAEhC,kBAAiB,CAAC;;EAE7B;AACD;AACA;AACA;AACA;EACC,MAAMmC,UAAU,GAAGvC,kBAAkB,CAAEH,QAAS,CAAC;EACjD,IAAK0C,UAAU,KAAK,IAAI,EAAG;IAC1B;EACD;EAEA,MAAMC,QAAQ,GAAG7C,iBAAiB,CAAEC,MAAM,EAAEC,QAAS,CAAC;EACtD,IAAK,CAAE,IAAA4C,WAAa,EAAED,QAAQ,EAAED,UAAU,CAACC,QAAS,CAAC,EAAG;IACvD;IACAE,MAAM,CAACC,cAAc,CAAE,MAAM;MAC5BL,uCAAuC,CAAC,CAAC;MACzCD,qBAAqB,CAAExC,QAAQ,EAAE;QAAE2C;MAAS,CAAE,CAAC;IAChD,CAAE,CAAC;EACJ;AACD;AAEO,SAASI,kBAAkBA,CAAE/C,QAAQ,EAAG;EAC9C,MAAMgD,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA;IACA,OAAOF,QAAQ,CAACG,SAAS,CAAE,MAC1Bb,eAAe,CAAEU,QAAQ,CAACjD,MAAM,EAAEiD,QAAQ,CAACT,QAAQ,EAAEvC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAEgD,QAAQ,EAAEhD,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
@@ -8,8 +8,9 @@ var _coreData = require("@wordpress/core-data");
8
8
  var _components = require("@wordpress/components");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _data = require("@wordpress/data");
11
+ var _blockEditor = require("@wordpress/block-editor");
11
12
  var _importControls = require("./import-controls");
12
- var _messages = require("../../utils/messages");
13
+ var _lockUnlock = require("../../lock-unlock");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  /**
15
16
  * WordPress dependencies
@@ -19,13 +20,17 @@ var _jsxRuntime = require("react/jsx-runtime");
19
20
  * Internal dependencies
20
21
  */
21
22
 
23
+ const {
24
+ HTMLElementControl
25
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
22
26
  function TemplatePartAdvancedControls({
23
27
  tagName,
24
28
  setAttributes,
25
29
  isEntityAvailable,
26
30
  templatePartId,
27
31
  defaultWrapper,
28
- hasInnerBlocks
32
+ hasInnerBlocks,
33
+ clientId
29
34
  }) {
30
35
  const [area, setArea] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'area', templatePartId);
31
36
  const [title, setTitle] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'title', templatePartId);
@@ -57,10 +62,12 @@ function TemplatePartAdvancedControls({
57
62
  value: area,
58
63
  onChange: setArea
59
64
  })]
60
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
61
- __nextHasNoMarginBottom: true,
62
- __next40pxDefaultSize: true,
63
- label: (0, _i18n.__)('HTML element'),
65
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(HTMLElementControl, {
66
+ tagName: tagName || '',
67
+ onChange: value => setAttributes({
68
+ tagName: value
69
+ }),
70
+ clientId: clientId,
64
71
  options: [{
65
72
  label: (0, _i18n.sprintf)(/* translators: %s: HTML tag based on area. */
66
73
  (0, _i18n.__)('Default based on area (%s)'), `<${defaultWrapper}>`),
@@ -86,12 +93,7 @@ function TemplatePartAdvancedControls({
86
93
  }, {
87
94
  label: '<div>',
88
95
  value: 'div'
89
- }],
90
- value: tagName || '',
91
- onChange: value => setAttributes({
92
- tagName: value
93
- }),
94
- help: _messages.htmlElementMessages[tagName]
96
+ }]
95
97
  }), !hasInnerBlocks && /*#__PURE__*/(0, _jsxRuntime.jsx)(_importControls.TemplatePartImportControls, {
96
98
  area: area,
97
99
  setAttributes: setAttributes
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_messages","_jsxRuntime","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getCurrentTheme","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","__","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","htmlElementMessages","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\nimport { htmlElementMessages } from '../../utils/messages';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAZ3D;AACA;AACA;;AAMA;AACA;AACA;;AAIO,SAASO,4BAA4BA,CAAE;EAC7CC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,cAAc;EACdC,cAAc;EACdC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,IAAI,EAAEC,OAAO,CAAE,GAAG,IAAAC,uBAAa,EACtC,UAAU,EACV,kBAAkB,EAClB,MAAM,EACNL,cACD,CAAC;EAED,MAAM,CAAEM,KAAK,EAAEC,QAAQ,CAAE,GAAG,IAAAF,uBAAa,EACxC,UAAU,EACV,kBAAkB,EAClB,OAAO,EACPL,cACD,CAAC;EAED,MAAMQ,wBAAwB,GAAG,IAAAC,eAAS,EACvCC,MAAM,IACPA,MAAM,CAAEC,eAAU,CAAC,CAACC,eAAe,CAAC,CAAC,EAClCC,2BAA2B,IAAI,EAAE,EACrC,EACD,CAAC;EAED,MAAMC,WAAW,GAAGN,wBAAwB,CAACO,GAAG,CAC/C,CAAE;IAAEC,KAAK;IAAEb,IAAI,EAAEc;EAAM,CAAC,MAAQ;IAC/BD,KAAK;IACLE,KAAK,EAAED;EACR,CAAC,CACF,CAAC;EAED,oBACC,IAAAtB,WAAA,CAAAwB,IAAA,EAAAxB,WAAA,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EACxC;QAAEF,KAAK,EAAE,WAAW;QAAEE,KAAK,EAAE;MAAU,CAAC,EACxC;QAAEF,KAAK,EAAE,SAAS;QAAEE,KAAK,EAAE;MAAQ,CAAC,EACpC;QAAEF,KAAK,EAAE,UAAU;QAAEE,KAAK,EAAE;MAAS,CAAC,EACtC;QAAEF,KAAK,EAAE,OAAO;QAAEE,KAAK,EAAE;MAAM,CAAC,CAC9B;MACHA,KAAK,EAAGrB,OAAO,IAAI,EAAI;MACvB8B,QAAQ,EAAKT,KAAK,IAAMpB,aAAa,CAAE;QAAED,OAAO,EAAEqB;MAAM,CAAE,CAAG;MAC7DiB,IAAI,EAAGC,6BAAmB,CAAEvC,OAAO;IAAI,CACvC,CAAC,EACA,CAAEK,cAAc,iBACjB,IAAAP,WAAA,CAAA2B,GAAA,EAAC7B,eAAA,CAAA4C,0BAA0B;MAC1BlC,IAAI,EAAGA,IAAM;MACbL,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_components","_i18n","_data","_blockEditor","_importControls","_lockUnlock","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","clientId","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getCurrentTheme","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","__","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\nimport { unlock } from '../../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n\tclientId,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<HTMLElementControl\n\t\t\t\ttagName={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\tclientId={ clientId }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAb3C;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAM;EAAEQ;AAAmB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAExD,SAASC,4BAA4BA,CAA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
@@ -189,7 +189,8 @@ function TemplatePartEdit({
189
189
  isEntityAvailable: isEntityAvailable,
190
190
  templatePartId: templatePartId,
191
191
  defaultWrapper: areaObject.tagName,
192
- hasInnerBlocks: hasInnerBlocks
192
+ hasInnerBlocks: hasInnerBlocks,
193
+ clientId: clientId
193
194
  })
194
195
  }), isPlaceholder && /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
195
196
  ...blockProps,
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_blockEditor","_components","_i18n","_coreData","_element","_notices","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","_jsxRuntime","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","useAlternativeTemplateParts","hasReplacements","length","canReplace","jsx","MenuItem","onClick","children","__","TemplatesList","clientId","onSelect","blockPatterns","useAlternativeBlockPatterns","PanelBody","title","__experimentalBlockPatternsList","label","onClickPattern","showTitlesAsTooltip","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","useDispatch","noticesStore","editEntityRecord","coreStore","currentTheme","useSelect","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","createTemplatePartId","hasAlreadyRendered","useHasRecursion","useState","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","serialize","sprintf","type","Warning","jsxs","Fragment","RecursionProvider","uniqueId","BlockControls","group","ToolbarButton","postId","postType","InspectorControls","TemplatePartAdvancedControls","defaultWrapper","default","onOpenSelectionModal","BlockSettingsMenuControls","selectedClientIds","Spinner","Modal","overlayClassName","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitlesAsTooltip\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\t! hasInnerBlocks &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,YAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,eAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,qBAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAIuB,IAAAe,WAAA,GAAAf,OAAA;AAxCvB;AACA;AACA;;AA0BA;AACA;AACA;;AAYA,SAASgB,aAAaA,CAAE;EACvBC,iBAAiB;EACjBC,IAAI;EACJC,cAAc;EACdC,2BAA2B;EAC3BC;AACD,CAAC,EAAG;EACH;EACA;EACA,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,kCAA2B,EACpDL,IAAI,EACJC,cACD,CAAC;EACD,MAAMK,eAAe,GAAG,CAAC,CAAEF,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AAA,eAEZ,IAAAf,WAAA,CAAAY,GAAA,EAACjB,eAAA,CAAAqG,OAA0B;QAC1B5F,cAAc,EAAGA,cAAgB;QACjCc,QAAQ,EAAGA,QAAU;QACrBf,IAAI,EAAGA,IAAM;QACb2B,aAAa,EAAGA,aAAe;QAC/B4E,OAAO,EAAGA,CAAA,KACTpG,8BAA8B,CAAE,KAAM;MACtC,CACD;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_data","_blockEditor","_components","_i18n","_coreData","_element","_notices","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","_jsxRuntime","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","useAlternativeTemplateParts","hasReplacements","length","canReplace","jsx","MenuItem","onClick","children","__","TemplatesList","clientId","onSelect","blockPatterns","useAlternativeBlockPatterns","PanelBody","title","__experimentalBlockPatternsList","label","onClickPattern","showTitlesAsTooltip","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","useDispatch","noticesStore","editEntityRecord","coreStore","currentTheme","useSelect","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","createTemplatePartId","hasAlreadyRendered","useHasRecursion","useState","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","serialize","sprintf","type","Warning","jsxs","Fragment","RecursionProvider","uniqueId","BlockControls","group","ToolbarButton","postId","postType","InspectorControls","TemplatePartAdvancedControls","defaultWrapper","default","onOpenSelectionModal","BlockSettingsMenuControls","selectedClientIds","Spinner","Modal","overlayClassName","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitlesAsTooltip\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\t! hasInnerBlocks &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,YAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,eAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,qBAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAIuB,IAAAe,WAAA,GAAAf,OAAA;AAxCvB;AACA;AACA;;AA0BA;AACA;AACA;;AAYA,SAASgB,aAAaA,CAAE;EACvBC,iBAAiB;EACjBC,IAAI;EACJC,cAAc;EACdC,2BAA2B;EAC3BC;AACD,CAAC,EAAG;EACH;EACA;EACA,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,kCAA2B,EACpDL,IAAI,EACJC,cAC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c,EAAGA,CAAA,KAChBlG,8BAA8B,CAAE,KAAM,CACtC;MACDmG,YAAY;MAAA1F,QAAA,eAEZ,IAAAf,WAAA,CAAAY,GAAA,EAACjB,eAAA,CAAAqG,OAA0B;QAC1B5F,cAAc,EAAGA,cAAgB;QACjCc,QAAQ,EAAGA,QAAU;QACrBf,IAAI,EAAGA,IAAM;QACb2B,aAAa,EAAGA,aAAe;QAC/B4E,OAAO,EAAGA,CAAA,KACTpG,8BAA8B,CAAE,KAAM;MACtC,CACD;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -26,6 +26,7 @@ const metadata = {
26
26
  },
27
27
  supports: {
28
28
  align: true,
29
+ html: false,
29
30
  color: {
30
31
  link: true,
31
32
  __experimentalSkipSerialization: ["text", "background"],
@@ -1 +1 @@
1
- {"version":3,"names":["calendar","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","month","type","year","supports","align","color","link","__experimentalSkipSerialization","__experimentalDefaultControls","background","text","__experimentalSelector","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalLetterSpacing","interactivity","clientNavigation","style","edit","transforms","settings","example","init"],"sources":["@wordpress/block-library/src/calendar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { calendar as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,IAAI,QAAQ,kBAAkB;;AAEnD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,IAAA;MAAAD,IAAA;IAAA;EAAA;EAAAE,QAAA;IAAAC,KAAA;IAAAC,KAAA;MAAAC,IAAA;MAAAC,+BAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;MAAA;MAAAC,sBAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,2BAAA;MAAAX,6BAAA;QAAAK,QAAA;MAAA;IAAA;IAAAO,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,KAAA;AAAA;AAE5C,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAE/B;AAAK,CAAC,GAAGH,QAAQ;AAEzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAMgC,QAAQ,GAAG;EACvBrC,IAAI;EACJsC,OAAO,EAAE,CAAC,CAAC;EACXH,IAAI;EACJC;AACD,CAAC;AAED,OAAO,MAAMG,IAAI,GAAGA,CAAA,KAAMtC,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAEmC;AAAS,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["calendar","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","month","type","year","supports","align","html","color","link","__experimentalSkipSerialization","__experimentalDefaultControls","background","text","__experimentalSelector","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalLetterSpacing","interactivity","clientNavigation","style","edit","transforms","settings","example","init"],"sources":["@wordpress/block-library/src/calendar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { calendar as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,IAAI,QAAQ,kBAAkB;;AAEnD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,IAAA;MAAAD,IAAA;IAAA;EAAA;EAAAE,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,KAAA;MAAAC,IAAA;MAAAC,+BAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;MAAA;MAAAC,sBAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,2BAAA;MAAAX,6BAAA;QAAAK,QAAA;MAAA;IAAA;IAAAO,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,KAAA;AAAA;AAE5C,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAEhC;AAAK,CAAC,GAAGH,QAAQ;AAEzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAMiC,QAAQ,GAAG;EACvBtC,IAAI;EACJuC,OAAO,EAAE,CAAC,CAAC;EACXH,IAAI;EACJC;AACD,CAAC;AAED,OAAO,MAAMG,IAAI,GAAGA,CAAA,KAAMvC,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAEoC;AAAS,CAAE,CAAC","ignoreList":[]}
@@ -1,28 +1,33 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { SelectControl } from '@wordpress/components';
5
4
  import { __ } from '@wordpress/i18n';
6
- import { InspectorControls } from '@wordpress/block-editor';
5
+ import { InspectorControls, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
10
9
  */
11
- import { htmlElementMessages } from '../../utils/messages';
10
+ import { unlock } from '../../lock-unlock';
12
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ const {
13
+ HTMLElementControl
14
+ } = unlock(blockEditorPrivateApis);
13
15
  export default function CommentsInspectorControls({
14
16
  attributes: {
15
17
  tagName
16
18
  },
17
- setAttributes
19
+ setAttributes,
20
+ clientId
18
21
  }) {
19
22
  return /*#__PURE__*/_jsx(InspectorControls, {
20
23
  children: /*#__PURE__*/_jsx(InspectorControls, {
21
24
  group: "advanced",
22
- children: /*#__PURE__*/_jsx(SelectControl, {
23
- __nextHasNoMarginBottom: true,
24
- __next40pxDefaultSize: true,
25
- label: __('HTML element'),
25
+ children: /*#__PURE__*/_jsx(HTMLElementControl, {
26
+ tagName: tagName,
27
+ onChange: value => setAttributes({
28
+ tagName: value
29
+ }),
30
+ clientId: clientId,
26
31
  options: [{
27
32
  label: __('Default (<div>)'),
28
33
  value: 'div'
@@ -32,12 +37,7 @@ export default function CommentsInspectorControls({
32
37
  }, {
33
38
  label: '<aside>',
34
39
  value: 'aside'
35
- }],
36
- value: tagName,
37
- onChange: value => setAttributes({
38
- tagName: value
39
- }),
40
- help: htmlElementMessages[tagName]
40
+ }]
41
41
  })
42
42
  })
43
43
  });
@@ -1 +1 @@
1
- {"version":3,"names":["SelectControl","__","InspectorControls","htmlElementMessages","jsx","_jsx","CommentsInspectorControls","attributes","tagName","setAttributes","children","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/comments/edit/comments-inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { htmlElementMessages } from '../../utils/messages';\n\nexport default function CommentsInspectorControls( {\n\tattributes: { tagName },\n\tsetAttributes,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,iBAAiB,QAAQ,yBAAyB;;AAE3D;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3D,eAAe,SAASC,yBAAyBA,CAAE;EAClDC,UAAU,EAAE;IAAEC;EAAQ,CAAC;EACvBC;AACD,CAAC,EAAG;EACH,oBACCJ,IAAA,CAACH,iBAAiB;IAAAQ,QAAA,eACjBL,IAAA,CAACH,iBAAiB;MAACS,KAAK,EAAC,UAAU;MAAAD,QAAA,eAClCL,IAAA,CAACL,aAAa;QACbY,uBAAuB;QACvBC,qBAAqB;QACrBC,KAAK,EAAGb,EAAE,CAAE,cAAe,CAAG;QAC9Bc,OAAO,EAAG,CACT;UAAED,KAAK,EAAEb,EAAE,CAAE,iBAAkB,CAAC;UAAEe,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGR,OAAS;QACjBS,QAAQ,EAAKD,KAAK,IACjBP,aAAa,CAAE;UAAED,OAAO,EAAEQ;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGf,mBAAmB,CAAEK,OAAO;MAAI,CACvC;IAAC,CACgB;EAAC,CACF,CAAC;AAEtB","ignoreList":[]}
1
+ {"version":3,"names":["__","InspectorControls","privateApis","blockEditorPrivateApis","unlock","jsx","_jsx","HTMLElementControl","CommentsInspectorControls","attributes","tagName","setAttributes","clientId","children","group","onChange","value","options","label"],"sources":["@wordpress/block-library/src/comments/edit/comments-inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport default function CommentsInspectorControls( {\n\tattributes: { tagName },\n\tsetAttributes,\n\tclientId,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAM;EAAEC;AAAmB,CAAC,GAAGH,MAAM,CAAED,sBAAuB,CAAC;AAE/D,eAAe,SAASK,yBAAyBA,CAAE;EAClDC,UAAU,EAAE;IAAEC;EAAQ,CAAC;EACvBC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACCN,IAAA,CAACL,iBAAiB;IAAAY,QAAA,eACjBP,IAAA,CAACL,iBAAiB;MAACa,KAAK,EAAC,UAAU;MAAAD,QAAA,eAClCP,IAAA,CAACC,kBAAkB;QAClBG,OAAO,EAAGA,OAAS;QACnBK,QAAQ,EAAKC,KAAK,IACjBL,aAAa,CAAE;UAAED,OAAO,EAAEM;QAAM,CAAE,CAClC;QACDJ,QAAQ,EAAGA,QAAU;QACrBK,OAAO,EAAG,CACT;UAAEC,KAAK,EAAElB,EAAE,CAAE,iBAAkB,CAAC;UAAEgB,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEE,KAAK,EAAE,WAAW;UAAEF,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEE,KAAK,EAAE,SAAS;UAAEF,KAAK,EAAE;QAAQ,CAAC;MAClC,CACH;IAAC,CACgB;EAAC,CACF,CAAC;AAEtB","ignoreList":[]}