@wordpress/block-library 7.5.0 → 7.6.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 (527) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +3 -2
  3. package/babel-plugin.js +154 -0
  4. package/build/audio/edit.js +1 -1
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/block/edit.js +10 -9
  7. package/build/block/edit.js.map +1 -1
  8. package/build/button/index.js +1 -0
  9. package/build/button/index.js.map +1 -1
  10. package/build/categories/edit.js +1 -1
  11. package/build/categories/edit.js.map +1 -1
  12. package/build/categories/index.js +1 -1
  13. package/build/comment-author-avatar/index.js +1 -0
  14. package/build/comment-author-avatar/index.js.map +1 -1
  15. package/build/comments-title/deprecated.js +110 -0
  16. package/build/comments-title/deprecated.js.map +1 -0
  17. package/build/comments-title/edit.js +35 -37
  18. package/build/comments-title/edit.js.map +1 -1
  19. package/build/comments-title/index.js +5 -8
  20. package/build/comments-title/index.js.map +1 -1
  21. package/build/cover/controls.native.js +2 -3
  22. package/build/cover/controls.native.js.map +1 -1
  23. package/build/cover/edit/block-controls.js +115 -0
  24. package/build/cover/edit/block-controls.js.map +1 -0
  25. package/build/cover/edit/cover-placeholder.js +49 -0
  26. package/build/cover/edit/cover-placeholder.js.map +1 -0
  27. package/build/cover/edit/index.js +333 -0
  28. package/build/cover/edit/index.js.map +1 -0
  29. package/build/cover/edit/inspector-controls.js +224 -0
  30. package/build/cover/edit/inspector-controls.js.map +1 -0
  31. package/build/cover/edit/resizable-cover.js +67 -0
  32. package/build/cover/edit/resizable-cover.js.map +1 -0
  33. package/build/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
  34. package/build/cover/edit/use-cover-is-dark.js.map +1 -0
  35. package/build/cover/edit.native.js +0 -1
  36. package/build/cover/edit.native.js.map +1 -1
  37. package/build/cover/focal-point-settings-button.native.js.map +1 -1
  38. package/build/cover/shared.js +9 -0
  39. package/build/cover/shared.js.map +1 -1
  40. package/build/embed/embed-preview.js +1 -1
  41. package/build/embed/embed-preview.js.map +1 -1
  42. package/build/file/edit.native.js +0 -1
  43. package/build/file/edit.native.js.map +1 -1
  44. package/build/gallery/edit.js +2 -1
  45. package/build/gallery/edit.js.map +1 -1
  46. package/build/gallery/gallery.js +1 -1
  47. package/build/gallery/gallery.js.map +1 -1
  48. package/build/gallery/shared.js +2 -2
  49. package/build/gallery/shared.js.map +1 -1
  50. package/build/gallery/use-get-media.js +2 -1
  51. package/build/gallery/use-get-media.js.map +1 -1
  52. package/build/gallery/use-short-code-transform.js +19 -18
  53. package/build/gallery/use-short-code-transform.js.map +1 -1
  54. package/build/gallery/v1/gallery.js +1 -1
  55. package/build/gallery/v1/gallery.js.map +1 -1
  56. package/build/heading/edit.js +6 -2
  57. package/build/heading/edit.js.map +1 -1
  58. package/build/heading/index.js +1 -0
  59. package/build/heading/index.js.map +1 -1
  60. package/build/heading/transforms.js +1 -0
  61. package/build/heading/transforms.js.map +1 -1
  62. package/build/image/edit.js +5 -2
  63. package/build/image/edit.js.map +1 -1
  64. package/build/image/edit.native.js +0 -1
  65. package/build/image/edit.native.js.map +1 -1
  66. package/build/image/image.js +1 -1
  67. package/build/image/image.js.map +1 -1
  68. package/build/index.js +46 -10
  69. package/build/index.js.map +1 -1
  70. package/build/is-block-metadata-experimental.js +18 -0
  71. package/build/is-block-metadata-experimental.js.map +1 -0
  72. package/build/latest-posts/edit.js +30 -4
  73. package/build/latest-posts/edit.js.map +1 -1
  74. package/build/list/transforms.js +6 -0
  75. package/build/list/transforms.js.map +1 -1
  76. package/build/list/v2/edit.js +2 -1
  77. package/build/list/v2/edit.js.map +1 -1
  78. package/build/list/v2/migrate.js +1 -0
  79. package/build/list/v2/migrate.js.map +1 -1
  80. package/build/list/v2/transforms.js +46 -9
  81. package/build/list/v2/transforms.js.map +1 -1
  82. package/build/list-item/edit.js +7 -9
  83. package/build/list-item/edit.js.map +1 -1
  84. package/build/list-item/hooks/index.js +24 -0
  85. package/build/list-item/hooks/index.js.map +1 -1
  86. package/build/list-item/hooks/use-backspace.js +59 -0
  87. package/build/list-item/hooks/use-backspace.js.map +1 -0
  88. package/build/list-item/hooks/use-enter.js +6 -9
  89. package/build/list-item/hooks/use-enter.js.map +1 -1
  90. package/build/list-item/hooks/use-indent-list-item.js +33 -39
  91. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  92. package/build/list-item/hooks/use-space.js +54 -0
  93. package/build/list-item/hooks/use-space.js.map +1 -0
  94. package/build/list-item/hooks/use-split.js +30 -0
  95. package/build/list-item/hooks/use-split.js.map +1 -0
  96. package/build/list-item/index.js +1 -0
  97. package/build/list-item/index.js.map +1 -1
  98. package/build/list-item/utils.js +1 -1
  99. package/build/list-item/utils.js.map +1 -1
  100. package/build/media-text/edit.native.js +2 -1
  101. package/build/media-text/edit.native.js.map +1 -1
  102. package/build/media-text/media-container.native.js +2 -4
  103. package/build/media-text/media-container.native.js.map +1 -1
  104. package/build/media-text/transforms.js +137 -8
  105. package/build/media-text/transforms.js.map +1 -1
  106. package/build/navigation/edit/index.js +86 -81
  107. package/build/navigation/edit/index.js.map +1 -1
  108. package/build/navigation/edit/inner-blocks.js +1 -5
  109. package/build/navigation/edit/inner-blocks.js.map +1 -1
  110. package/build/navigation/use-navigation-entities.js +3 -3
  111. package/build/navigation/use-navigation-entities.js.map +1 -1
  112. package/build/navigation-link/fallback-variations.js +1 -1
  113. package/build/navigation-link/fallback-variations.js.map +1 -1
  114. package/build/navigation-link/hooks.js +1 -1
  115. package/build/navigation-link/hooks.js.map +1 -1
  116. package/build/page-list/convert-to-links-modal.js +1 -1
  117. package/build/page-list/convert-to-links-modal.js.map +1 -1
  118. package/build/page-list/edit.js +1 -1
  119. package/build/page-list/edit.js.map +1 -1
  120. package/build/post-author/edit.js +1 -1
  121. package/build/post-author/edit.js.map +1 -1
  122. package/build/post-author-name/index.js +1 -0
  123. package/build/post-author-name/index.js.map +1 -1
  124. package/build/post-comment/index.js +1 -0
  125. package/build/post-comment/index.js.map +1 -1
  126. package/build/post-comments/edit.js +34 -16
  127. package/build/post-comments/edit.js.map +1 -1
  128. package/build/post-comments-count/index.js +1 -0
  129. package/build/post-comments-count/index.js.map +1 -1
  130. package/build/post-comments-form/form.js +1 -1
  131. package/build/post-comments-form/form.js.map +1 -1
  132. package/build/post-comments-link/index.js +1 -0
  133. package/build/post-comments-link/index.js.map +1 -1
  134. package/build/post-featured-image/edit.js +1 -1
  135. package/build/post-featured-image/edit.js.map +1 -1
  136. package/build/post-template/edit.js +7 -2
  137. package/build/post-template/edit.js.map +1 -1
  138. package/build/post-terms/edit.js +11 -2
  139. package/build/post-terms/edit.js.map +1 -1
  140. package/build/post-terms/hooks.js +33 -0
  141. package/build/post-terms/hooks.js.map +1 -0
  142. package/build/post-terms/index.js +12 -5
  143. package/build/post-terms/index.js.map +1 -1
  144. package/build/post-title/index.js +1 -1
  145. package/build/post-title/index.js.map +1 -1
  146. package/build/pullquote/edit.js +1 -1
  147. package/build/pullquote/edit.js.map +1 -1
  148. package/build/pullquote/edit.native.js +1 -1
  149. package/build/pullquote/edit.native.js.map +1 -1
  150. package/build/query/edit/inspector-controls/index.js +26 -17
  151. package/build/query/edit/inspector-controls/index.js.map +1 -1
  152. package/build/query/edit/inspector-controls/parent-control.js +148 -0
  153. package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
  154. package/build/query/edit/inspector-controls/sticky-control.js +41 -0
  155. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
  156. package/build/query/index.js +2 -1
  157. package/build/query/index.js.map +1 -1
  158. package/build/query/utils.js +28 -2
  159. package/build/query/utils.js.map +1 -1
  160. package/build/query-title/index.js +1 -1
  161. package/build/query-title/index.js.map +1 -1
  162. package/build/query-title/variations.js +1 -1
  163. package/build/query-title/variations.js.map +1 -1
  164. package/build/quote/edit.js +3 -2
  165. package/build/quote/edit.js.map +1 -1
  166. package/build/quote/v2/edit.js +1 -1
  167. package/build/quote/v2/edit.js.map +1 -1
  168. package/build/search/edit.js +1 -0
  169. package/build/search/edit.js.map +1 -1
  170. package/build/site-logo/edit.js +1 -1
  171. package/build/site-logo/edit.js.map +1 -1
  172. package/build/table/edit.js +15 -2
  173. package/build/table/edit.js.map +1 -1
  174. package/build/table-of-contents/edit.js +138 -66
  175. package/build/table-of-contents/edit.js.map +1 -1
  176. package/build/table-of-contents/index.js +13 -3
  177. package/build/table-of-contents/index.js.map +1 -1
  178. package/build/table-of-contents/list.js +16 -9
  179. package/build/table-of-contents/list.js.map +1 -1
  180. package/build/table-of-contents/save.js +40 -0
  181. package/build/table-of-contents/save.js.map +1 -0
  182. package/build/table-of-contents/utils.js +11 -77
  183. package/build/table-of-contents/utils.js.map +1 -1
  184. package/build/template-part/edit/index.js +7 -3
  185. package/build/template-part/edit/index.js.map +1 -1
  186. package/build/template-part/edit/inner-blocks.js +3 -8
  187. package/build/template-part/edit/inner-blocks.js.map +1 -1
  188. package/build/video/edit.js +1 -1
  189. package/build/video/edit.js.map +1 -1
  190. package/build-module/audio/edit.js +2 -2
  191. package/build-module/audio/edit.js.map +1 -1
  192. package/build-module/block/edit.js +11 -10
  193. package/build-module/block/edit.js.map +1 -1
  194. package/build-module/button/index.js +1 -0
  195. package/build-module/button/index.js.map +1 -1
  196. package/build-module/categories/edit.js +1 -1
  197. package/build-module/categories/edit.js.map +1 -1
  198. package/build-module/categories/index.js +1 -1
  199. package/build-module/comment-author-avatar/index.js +1 -0
  200. package/build-module/comment-author-avatar/index.js.map +1 -1
  201. package/build-module/comments-title/deprecated.js +102 -0
  202. package/build-module/comments-title/deprecated.js.map +1 -0
  203. package/build-module/comments-title/edit.js +38 -40
  204. package/build-module/comments-title/edit.js.map +1 -1
  205. package/build-module/comments-title/index.js +4 -8
  206. package/build-module/comments-title/index.js.map +1 -1
  207. package/build-module/cover/controls.native.js +2 -3
  208. package/build-module/cover/controls.native.js.map +1 -1
  209. package/build-module/cover/edit/block-controls.js +104 -0
  210. package/build-module/cover/edit/block-controls.js.map +1 -0
  211. package/build-module/cover/edit/cover-placeholder.js +38 -0
  212. package/build-module/cover/edit/cover-placeholder.js.map +1 -0
  213. package/build-module/cover/edit/index.js +307 -0
  214. package/build-module/cover/edit/index.js.map +1 -0
  215. package/build-module/cover/edit/inspector-controls.js +215 -0
  216. package/build-module/cover/edit/inspector-controls.js.map +1 -0
  217. package/build-module/cover/edit/resizable-cover.js +55 -0
  218. package/build-module/cover/edit/resizable-cover.js.map +1 -0
  219. package/build-module/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
  220. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
  221. package/build-module/cover/edit.native.js +0 -1
  222. package/build-module/cover/edit.native.js.map +1 -1
  223. package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
  224. package/build-module/cover/shared.js +7 -0
  225. package/build-module/cover/shared.js.map +1 -1
  226. package/build-module/embed/embed-preview.js +2 -2
  227. package/build-module/embed/embed-preview.js.map +1 -1
  228. package/build-module/file/edit.native.js +0 -1
  229. package/build-module/file/edit.native.js.map +1 -1
  230. package/build-module/gallery/edit.js +2 -1
  231. package/build-module/gallery/edit.js.map +1 -1
  232. package/build-module/gallery/gallery.js +2 -2
  233. package/build-module/gallery/gallery.js.map +1 -1
  234. package/build-module/gallery/shared.js +2 -2
  235. package/build-module/gallery/shared.js.map +1 -1
  236. package/build-module/gallery/use-get-media.js +2 -1
  237. package/build-module/gallery/use-get-media.js.map +1 -1
  238. package/build-module/gallery/use-short-code-transform.js +19 -18
  239. package/build-module/gallery/use-short-code-transform.js.map +1 -1
  240. package/build-module/gallery/v1/gallery.js +2 -2
  241. package/build-module/gallery/v1/gallery.js.map +1 -1
  242. package/build-module/heading/edit.js +6 -2
  243. package/build-module/heading/edit.js.map +1 -1
  244. package/build-module/heading/index.js +1 -0
  245. package/build-module/heading/index.js.map +1 -1
  246. package/build-module/heading/transforms.js +1 -0
  247. package/build-module/heading/transforms.js.map +1 -1
  248. package/build-module/image/edit.js +6 -3
  249. package/build-module/image/edit.js.map +1 -1
  250. package/build-module/image/edit.native.js +0 -1
  251. package/build-module/image/edit.native.js.map +1 -1
  252. package/build-module/image/image.js +2 -2
  253. package/build-module/image/image.js.map +1 -1
  254. package/build-module/index.js +42 -10
  255. package/build-module/index.js.map +1 -1
  256. package/build-module/is-block-metadata-experimental.js +16 -0
  257. package/build-module/is-block-metadata-experimental.js.map +1 -0
  258. package/build-module/latest-posts/edit.js +29 -5
  259. package/build-module/latest-posts/edit.js.map +1 -1
  260. package/build-module/list/transforms.js +6 -0
  261. package/build-module/list/transforms.js.map +1 -1
  262. package/build-module/list/v2/edit.js +2 -1
  263. package/build-module/list/v2/edit.js.map +1 -1
  264. package/build-module/list/v2/migrate.js +1 -3
  265. package/build-module/list/v2/migrate.js.map +1 -1
  266. package/build-module/list/v2/transforms.js +46 -9
  267. package/build-module/list/v2/transforms.js.map +1 -1
  268. package/build-module/list-item/edit.js +8 -9
  269. package/build-module/list-item/edit.js.map +1 -1
  270. package/build-module/list-item/hooks/index.js +3 -0
  271. package/build-module/list-item/hooks/index.js.map +1 -1
  272. package/build-module/list-item/hooks/use-backspace.js +44 -0
  273. package/build-module/list-item/hooks/use-backspace.js.map +1 -0
  274. package/build-module/list-item/hooks/use-enter.js +6 -9
  275. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  276. package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
  277. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  278. package/build-module/list-item/hooks/use-space.js +40 -0
  279. package/build-module/list-item/hooks/use-space.js.map +1 -0
  280. package/build-module/list-item/hooks/use-split.js +19 -0
  281. package/build-module/list-item/hooks/use-split.js.map +1 -0
  282. package/build-module/list-item/index.js +1 -0
  283. package/build-module/list-item/index.js.map +1 -1
  284. package/build-module/list-item/utils.js +1 -1
  285. package/build-module/list-item/utils.js.map +1 -1
  286. package/build-module/media-text/edit.native.js +2 -1
  287. package/build-module/media-text/edit.native.js.map +1 -1
  288. package/build-module/media-text/media-container.native.js +2 -4
  289. package/build-module/media-text/media-container.native.js.map +1 -1
  290. package/build-module/media-text/transforms.js +137 -8
  291. package/build-module/media-text/transforms.js.map +1 -1
  292. package/build-module/navigation/edit/index.js +87 -82
  293. package/build-module/navigation/edit/index.js.map +1 -1
  294. package/build-module/navigation/edit/inner-blocks.js +2 -6
  295. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  296. package/build-module/navigation/use-navigation-entities.js +1 -1
  297. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  298. package/build-module/navigation-link/fallback-variations.js +1 -1
  299. package/build-module/navigation-link/fallback-variations.js.map +1 -1
  300. package/build-module/navigation-link/hooks.js +2 -2
  301. package/build-module/navigation-link/hooks.js.map +1 -1
  302. package/build-module/page-list/convert-to-links-modal.js +1 -1
  303. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  304. package/build-module/page-list/edit.js +1 -1
  305. package/build-module/page-list/edit.js.map +1 -1
  306. package/build-module/post-author/edit.js +1 -1
  307. package/build-module/post-author/edit.js.map +1 -1
  308. package/build-module/post-author-name/index.js +1 -0
  309. package/build-module/post-author-name/index.js.map +1 -1
  310. package/build-module/post-comment/index.js +1 -0
  311. package/build-module/post-comment/index.js.map +1 -1
  312. package/build-module/post-comments/edit.js +35 -16
  313. package/build-module/post-comments/edit.js.map +1 -1
  314. package/build-module/post-comments-count/index.js +1 -0
  315. package/build-module/post-comments-count/index.js.map +1 -1
  316. package/build-module/post-comments-form/form.js +1 -1
  317. package/build-module/post-comments-form/form.js.map +1 -1
  318. package/build-module/post-comments-link/index.js +1 -0
  319. package/build-module/post-comments-link/index.js.map +1 -1
  320. package/build-module/post-featured-image/edit.js +1 -1
  321. package/build-module/post-featured-image/edit.js.map +1 -1
  322. package/build-module/post-template/edit.js +7 -2
  323. package/build-module/post-template/edit.js.map +1 -1
  324. package/build-module/post-terms/edit.js +10 -3
  325. package/build-module/post-terms/edit.js.map +1 -1
  326. package/build-module/post-terms/hooks.js +25 -0
  327. package/build-module/post-terms/hooks.js.map +1 -0
  328. package/build-module/post-terms/index.js +10 -8
  329. package/build-module/post-terms/index.js.map +1 -1
  330. package/build-module/post-title/index.js +1 -1
  331. package/build-module/post-title/index.js.map +1 -1
  332. package/build-module/pullquote/edit.js +2 -2
  333. package/build-module/pullquote/edit.js.map +1 -1
  334. package/build-module/pullquote/edit.native.js +2 -2
  335. package/build-module/pullquote/edit.native.js.map +1 -1
  336. package/build-module/query/edit/inspector-controls/index.js +24 -17
  337. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  338. package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
  339. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
  340. package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
  341. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
  342. package/build-module/query/index.js +2 -1
  343. package/build-module/query/index.js.map +1 -1
  344. package/build-module/query/utils.js +21 -0
  345. package/build-module/query/utils.js.map +1 -1
  346. package/build-module/query-title/index.js +1 -1
  347. package/build-module/query-title/index.js.map +1 -1
  348. package/build-module/query-title/variations.js +2 -2
  349. package/build-module/query-title/variations.js.map +1 -1
  350. package/build-module/quote/edit.js +4 -3
  351. package/build-module/quote/edit.js.map +1 -1
  352. package/build-module/quote/v2/edit.js +2 -2
  353. package/build-module/quote/v2/edit.js.map +1 -1
  354. package/build-module/search/edit.js +1 -0
  355. package/build-module/search/edit.js.map +1 -1
  356. package/build-module/site-logo/edit.js +1 -1
  357. package/build-module/site-logo/edit.js.map +1 -1
  358. package/build-module/table/edit.js +17 -4
  359. package/build-module/table/edit.js.map +1 -1
  360. package/build-module/table-of-contents/edit.js +136 -68
  361. package/build-module/table-of-contents/edit.js.map +1 -1
  362. package/build-module/table-of-contents/index.js +12 -3
  363. package/build-module/table-of-contents/index.js.map +1 -1
  364. package/build-module/table-of-contents/list.js +18 -10
  365. package/build-module/table-of-contents/list.js.map +1 -1
  366. package/build-module/table-of-contents/save.js +28 -0
  367. package/build-module/table-of-contents/save.js.map +1 -0
  368. package/build-module/table-of-contents/utils.js +11 -73
  369. package/build-module/table-of-contents/utils.js.map +1 -1
  370. package/build-module/template-part/edit/index.js +8 -4
  371. package/build-module/template-part/edit/index.js.map +1 -1
  372. package/build-module/template-part/edit/inner-blocks.js +4 -9
  373. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  374. package/build-module/video/edit.js +2 -2
  375. package/build-module/video/edit.js.map +1 -1
  376. package/build-style/editor-rtl.css +4 -6
  377. package/build-style/editor.css +4 -6
  378. package/build-style/image/editor-rtl.css +1 -1
  379. package/build-style/image/editor.css +1 -1
  380. package/build-style/post-comments/style-rtl.css +22 -0
  381. package/build-style/post-comments/style.css +22 -0
  382. package/build-style/post-comments-form/style-rtl.css +1 -3
  383. package/build-style/post-comments-form/style.css +1 -3
  384. package/build-style/separator/editor-rtl.css +1 -0
  385. package/build-style/separator/editor.css +1 -0
  386. package/build-style/style-rtl.css +23 -3
  387. package/build-style/style.css +23 -3
  388. package/build-style/video/editor-rtl.css +2 -5
  389. package/build-style/video/editor.css +2 -5
  390. package/build-types/table-of-contents/list.d.ts +12 -0
  391. package/build-types/table-of-contents/list.d.ts.map +1 -0
  392. package/build-types/table-of-contents/utils.d.ts +24 -0
  393. package/build-types/table-of-contents/utils.d.ts.map +1 -0
  394. package/package.json +30 -29
  395. package/src/audio/edit.js +4 -2
  396. package/src/avatar/block.json +0 -1
  397. package/src/avatar/index.php +2 -2
  398. package/src/block/edit.js +39 -42
  399. package/src/block/test/edit.native.js +1 -1
  400. package/src/button/block.json +1 -0
  401. package/src/categories/block.json +1 -1
  402. package/src/categories/edit.js +1 -1
  403. package/src/comment-author-avatar/block.json +1 -0
  404. package/src/comments-title/block.json +0 -6
  405. package/src/comments-title/deprecated.js +34 -0
  406. package/src/comments-title/edit.js +44 -100
  407. package/src/comments-title/index.js +3 -1
  408. package/src/comments-title/index.php +41 -23
  409. package/src/cover/controls.native.js +1 -2
  410. package/src/cover/edit/block-controls.js +119 -0
  411. package/src/cover/edit/cover-placeholder.js +39 -0
  412. package/src/cover/edit/index.js +381 -0
  413. package/src/cover/edit/inspector-controls.js +286 -0
  414. package/src/cover/edit/resizable-cover.js +55 -0
  415. package/src/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
  416. package/src/cover/edit.native.js +0 -1
  417. package/src/cover/editor.scss +1 -1
  418. package/src/cover/focal-point-settings-button.native.js +1 -1
  419. package/src/cover/index.php +20 -37
  420. package/src/cover/shared.js +4 -0
  421. package/src/cover/test/block-controls.js +62 -0
  422. package/src/embed/embed-preview.js +4 -2
  423. package/src/file/edit.native.js +0 -1
  424. package/src/gallery/edit.js +2 -1
  425. package/src/gallery/gallery.js +2 -2
  426. package/src/gallery/shared.js +3 -2
  427. package/src/gallery/use-get-media.js +2 -1
  428. package/src/gallery/use-short-code-transform.js +19 -16
  429. package/src/gallery/v1/gallery.js +2 -2
  430. package/src/heading/block.json +1 -0
  431. package/src/heading/edit.js +5 -2
  432. package/src/image/edit.js +9 -1
  433. package/src/image/edit.native.js +0 -1
  434. package/src/image/editor.scss +1 -1
  435. package/src/image/image.js +8 -2
  436. package/src/image/test/edit.native.js +7 -7
  437. package/src/index.js +50 -27
  438. package/src/is-block-metadata-experimental.js +19 -0
  439. package/src/latest-posts/edit.js +27 -2
  440. package/src/latest-posts/index.php +12 -6
  441. package/src/list/transforms.js +7 -0
  442. package/src/list/v2/edit.js +1 -0
  443. package/src/list/v2/migrate.js +1 -1
  444. package/src/list/v2/transforms.js +35 -0
  445. package/src/list-item/block.json +2 -1
  446. package/src/list-item/edit.js +17 -10
  447. package/src/list-item/hooks/index.js +3 -0
  448. package/src/list-item/hooks/use-backspace.js +52 -0
  449. package/src/list-item/hooks/use-enter.js +9 -16
  450. package/src/list-item/hooks/use-indent-list-item.js +50 -63
  451. package/src/list-item/hooks/use-space.js +48 -0
  452. package/src/list-item/hooks/use-split.js +24 -0
  453. package/src/list-item/utils.js +1 -1
  454. package/src/media-text/edit.native.js +3 -1
  455. package/src/media-text/media-container.native.js +2 -4
  456. package/src/media-text/transforms.js +154 -0
  457. package/src/navigation/edit/index.js +175 -169
  458. package/src/navigation/edit/inner-blocks.js +1 -8
  459. package/src/navigation/index.php +40 -0
  460. package/src/navigation/use-navigation-entities.js +1 -1
  461. package/src/navigation-link/fallback-variations.js +1 -1
  462. package/src/navigation-link/hooks.js +2 -2
  463. package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
  464. package/src/page-list/convert-to-links-modal.js +1 -1
  465. package/src/page-list/edit.js +1 -4
  466. package/src/post-author/edit.js +24 -22
  467. package/src/post-author-name/block.json +1 -0
  468. package/src/post-comment/block.json +1 -0
  469. package/src/post-comments/edit.js +54 -22
  470. package/src/post-comments/style.scss +26 -0
  471. package/src/post-comments-count/block.json +1 -0
  472. package/src/post-comments-form/form.js +1 -4
  473. package/src/post-comments-form/style.scss +1 -4
  474. package/src/post-comments-link/block.json +1 -0
  475. package/src/post-featured-image/edit.js +1 -1
  476. package/src/post-template/edit.js +5 -0
  477. package/src/post-template/index.php +30 -0
  478. package/src/post-terms/edit.js +19 -0
  479. package/src/post-terms/hooks.js +27 -0
  480. package/src/post-terms/index.js +14 -7
  481. package/src/post-terms/index.php +40 -2
  482. package/src/post-title/index.js +1 -1
  483. package/src/pullquote/edit.js +2 -2
  484. package/src/pullquote/edit.native.js +2 -2
  485. package/src/query/block.json +2 -1
  486. package/src/query/edit/inspector-controls/index.js +25 -11
  487. package/src/query/edit/inspector-controls/parent-control.js +133 -0
  488. package/src/query/edit/inspector-controls/sticky-control.js +25 -0
  489. package/src/query/utils.js +22 -0
  490. package/src/query-title/index.js +1 -1
  491. package/src/query-title/variations.js +2 -2
  492. package/src/quote/edit.js +5 -2
  493. package/src/quote/v2/edit.js +4 -2
  494. package/src/search/edit.js +1 -0
  495. package/src/search/index.php +1 -1
  496. package/src/separator/editor.scss +1 -0
  497. package/src/site-logo/edit.js +1 -1
  498. package/src/table/edit.js +19 -4
  499. package/src/table-of-contents/block.json +9 -2
  500. package/src/table-of-contents/edit.js +155 -75
  501. package/src/table-of-contents/index.js +2 -0
  502. package/src/table-of-contents/list.tsx +46 -0
  503. package/src/table-of-contents/save.js +25 -0
  504. package/src/table-of-contents/utils.ts +71 -0
  505. package/src/tag-cloud/block.json +1 -1
  506. package/src/template-part/edit/index.js +25 -15
  507. package/src/template-part/edit/inner-blocks.js +2 -10
  508. package/src/video/edit.js +4 -2
  509. package/src/video/editor.scss +3 -6
  510. package/test/babel-plugin.js +67 -0
  511. package/tsconfig.json +11 -0
  512. package/tsconfig.tsbuildinfo +1 -0
  513. package/build/cover/edit.js +0 -598
  514. package/build/cover/edit.js.map +0 -1
  515. package/build/cover/use-cover-is-dark.js.map +0 -1
  516. package/build/post-terms/variations.js +0 -37
  517. package/build/post-terms/variations.js.map +0 -1
  518. package/build-module/cover/edit.js +0 -575
  519. package/build-module/cover/edit.js.map +0 -1
  520. package/build-module/cover/use-cover-is-dark.js.map +0 -1
  521. package/build-module/post-terms/variations.js +0 -27
  522. package/build-module/post-terms/variations.js.map +0 -1
  523. package/src/cover/edit.js +0 -757
  524. package/src/post-terms/variations.js +0 -28
  525. package/src/table-of-contents/index.php +0 -346
  526. package/src/table-of-contents/list.js +0 -28
  527. package/src/table-of-contents/utils.js +0 -126
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/utils.js"],"names":["getHeadingsFromHeadingElements","headingElements","map","heading","level","parseInt","tagName","anchor","hasAttribute","id","content","textContent","getHeadingsFromContent","tempPostContentDOM","document","createElement","innerHTML","template","querySelectorAll","remove","linearToNestedHeadingList","headingList","index","nestedHeadingList","forEach","key","undefined","endOfSlice","length","i","push","children","slice"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,8BAAT,CAAyCC,eAAzC,EAA2D;AACjE,SAAO,CAAE,GAAGA,e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BiB,WAAW,CAAE,CAAF,CAAX,CAAiBjB,KAAxC,EAAgD;AAC/C;AACA;AACA;AACA,UACCiB,WAAW,CAAEI,GAAG,GAAG,CAAR,CAAX,KAA2BC,SAA3B,IACAL,WAAW,CAAEI,GAAG,GAAG,CAAR,CAAX,CAAuBrB,KAAvB,GAA+BD,OAAO,CAACC,KAFxC,EAGE;AACD;AACA;AACA;AACA,YAAIuB,UAAU,GAAGN,WAAW,CAACO,MAA7B;;AACA,aAAM,IAAIC,CAAC,GAAGJ,GAAG,GAAG,CAApB,EAAuBI,CAAC,GAAGR,WAAW,CAACO,MAAvC,EAA+CC,CAAC,EAAhD,EAAqD;AACpD,cAAKR,WAAW,CAAEQ,CAAF,CAAX,CAAiBzB,KAAjB,KAA2BD,OAAO,CAACC,KAAxC,EAAgD;AAC/CuB,YAAAA,UAAU,GAAGE,CAAb;AACA;AACA;AACD,SAVA,CAYD;;;AACAN,QAAAA,iBAAiB,CAACO,IAAlB,CAAwB;AACvB3B,UAAAA,OADuB;AAEvBmB,UAAAA,KAAK,EAAEA,KAAK,GAAGG,GAFQ;AAGvBM,UAAAA,QAAQ,EAAEX,yBAAyB,CAClCC,WAAW,CAACW,KAAZ,CAAmBP,GAAG,GAAG,CAAzB,EAA4BE,UAA5B,CADkC,EAElCL,KAAK,GAAGG,GAAR,GAAc,CAFoB;AAHZ,SAAxB;AAQA,OAxBD,MAwBO;AACN;AACAF,QAAAA,iBAAiB,CAACO,IAAlB,CAAwB;AACvB3B,UAAAA,OADuB;AAEvBmB,UAAAA,KAAK,EAAEA,KAAK,GAAGG,GAFQ;AAGvBM,UAAAA,QAAQ,EAAE;AAHa,SAAxB;AAKA;AACD;AACD,GA3CD;AA6CA,SAAOR,iBAAP;AACA","sourcesContent":["/**\n * @typedef WPHeadingData\n *\n * @property {string} anchor The anchor link to the heading, or '' if none.\n * @property {string} content The plain text content of the heading.\n * @property {number} level The heading level.\n */\n\n/**\n * Extracts text, anchor, and level from a list of heading elements.\n *\n * @param {NodeList} headingElements The list of heading elements.\n *\n * @return {WPHeadingData[]} The list of heading parameters.\n */\nexport function getHeadingsFromHeadingElements( headingElements ) {\n\treturn [ ...headingElements ].map( ( heading ) => ( {\n\t\t// A little hacky, but since we know at this point that the tag will\n\t\t// be an H1-H6, we can just grab the 2nd character of the tag name and\n\t\t// convert it to an integer. Should be faster than conditionals.\n\t\tlevel: parseInt( heading.tagName[ 1 ], 10 ),\n\t\tanchor: heading.hasAttribute( 'id' ) ? `#${ heading.id }` : '',\n\t\tcontent: heading.textContent,\n\t} ) );\n}\n\n/**\n * Extracts heading data from the provided content.\n *\n * @param {string} content The content to extract heading data from.\n *\n * @return {WPHeadingData[]} The list of heading parameters.\n */\nexport function getHeadingsFromContent( content ) {\n\t// Create a temporary container to put the post content into, so we can\n\t// use the DOM to find all the headings.\n\tconst tempPostContentDOM = document.createElement( 'div' );\n\ttempPostContentDOM.innerHTML = content;\n\n\t// Remove template elements so that headings inside them aren't counted.\n\t// This is only needed for IE11, which doesn't recognize the element and\n\t// treats it like a div.\n\tfor ( const template of tempPostContentDOM.querySelectorAll(\n\t\t'template'\n\t) ) {\n\t\ttemplate.remove();\n\t}\n\n\tconst headingElements = tempPostContentDOM.querySelectorAll(\n\t\t'h1:not(:empty), h2:not(:empty), h3:not(:empty), h4:not(:empty), h5:not(:empty), h6:not(:empty)'\n\t);\n\n\treturn getHeadingsFromHeadingElements( headingElements );\n}\n\n/**\n * @typedef WPNestedHeadingData\n *\n * @property {WPHeadingData} heading The heading content, anchor,\n * and level.\n * @property {number} index The index of this heading\n * node in the entire nested\n * list of heading data.\n * @property {WPNestedHeadingData[]|null} children The sub-headings of this\n * heading, if any.\n */\n\n/**\n * Takes a flat list of heading parameters and nests them based on each header's\n * immediate parent's level.\n *\n * @param {WPHeadingData[]} headingList The flat list of headings to nest.\n * @param {number} index The current list index.\n *\n * @return {WPNestedHeadingData[]} The nested list of headings.\n */\nexport function linearToNestedHeadingList( headingList, index = 0 ) {\n\tconst nestedHeadingList = [];\n\n\theadingList.forEach( ( heading, key ) => {\n\t\tif ( heading.content === '' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure we are only working with the same level as the first iteration in our set.\n\t\tif ( heading.level === headingList[ 0 ].level ) {\n\t\t\t// Check that the next iteration will return a value.\n\t\t\t// If it does and the next level is greater than the current level,\n\t\t\t// the next iteration becomes a child of the current iteration.\n\t\t\tif (\n\t\t\t\theadingList[ key + 1 ] !== undefined &&\n\t\t\t\theadingList[ key + 1 ].level > heading.level\n\t\t\t) {\n\t\t\t\t// We need to calculate the last index before the next iteration that has the same level (siblings).\n\t\t\t\t// We then use this last index to slice the array for use in recursion.\n\t\t\t\t// This prevents duplicate nodes.\n\t\t\t\tlet endOfSlice = headingList.length;\n\t\t\t\tfor ( let i = key + 1; i < headingList.length; i++ ) {\n\t\t\t\t\tif ( headingList[ i ].level === heading.level ) {\n\t\t\t\t\t\tendOfSlice = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We found a child node: Push a new node onto the return array with children.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tindex: index + key,\n\t\t\t\t\tchildren: linearToNestedHeadingList(\n\t\t\t\t\t\theadingList.slice( key + 1, endOfSlice ),\n\t\t\t\t\t\tindex + key + 1\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\t// No child node: Push a new node onto the return array.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tindex: index + key,\n\t\t\t\t\tchildren: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn nestedHeadingList;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/utils.ts"],"names":["linearToNestedHeadingList","headingList","nestedHeadingList","forEach","heading","key","content","level","endOfSlice","length","i","push","children","slice"],"mappings":"AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,yBAAT,CACNC,WADM,EAEgB;AACtB,QAAMC,iBAAsC,GAAG,EAA/C;AAEAD,EAAAA,WAAW,CAACE,OAAZ,CAAqB,CAAEC,OAAF,EAAWC,GAAX,KAAoB;AACxC,QAAKD,OAAO,CAACE,OAAR,KAAoB,EAAzB,EAA8B;AAC7B;AACA,KAHuC,CAKxC;;;AACA,QAAKF,OAAO,CAACG,KAAR,KAAkBN,WAAW,CAAE,CAAF,CAAX,CAAiBM,KAAxC,EAAgD;AAAA;;AAC/C;AACA;AACA;AACA,UAAK,iBAAAN,WAAW,CAAEI,GAAG,GAAG,CAAR,CAAX,8DAAwBE,KAAxB,IAAgCH,OAAO,CAACG,KAA7C,EAAqD;AACpD;AACA;AACA;AACA,YAAIC,UAAU,GAAGP,WAAW,CAACQ,MAA7B;;AACA,aAAM,IAAIC,CAAC,GAAGL,GAAG,GAAG,CAApB,EAAuBK,CAAC,GAAGT,WAAW,CAACQ,MAAvC,EAA+CC,CAAC,EAAhD,EAAqD;AACpD,cAAKT,WAAW,CAAES,CAAF,CAAX,CAAiBH,KAAjB,KAA2BH,OAAO,CAACG,KAAxC,EAAgD;AAC/CC,YAAAA,UAAU,GAAGE,CAAb;AACA;AACA;AACD,SAVmD,CAYpD;AACA;;;AACAR,QAAAA,iBAAiB,CAACS,IAAlB,CAAwB;AACvBP,UAAAA,OADuB;AAEvBQ,UAAAA,QAAQ,EAAEZ,yBAAyB,CAClCC,WAAW,CAACY,KAAZ,CAAmBR,GAAG,GAAG,CAAzB,EAA4BG,UAA5B,CADkC;AAFZ,SAAxB;AAMA,OApBD,MAoBO;AACN;AACAN,QAAAA,iBAAiB,CAACS,IAAlB,CAAwB;AACvBP,UAAAA,OADuB;AAEvBQ,UAAAA,QAAQ,EAAE;AAFa,SAAxB;AAIA;AACD;AACD,GAtCD;AAwCA,SAAOV,iBAAP;AACA","sourcesContent":["export interface HeadingData {\n\t/** The plain text content of the heading. */\n\tcontent: string;\n\t/** The heading level. */\n\tlevel: number;\n\t/** Link to the heading. */\n\tlink: string;\n}\n\nexport interface NestedHeadingData {\n\t/** The heading content, level, and link. */\n\theading: HeadingData;\n\t/** The sub-headings of this heading, if any. */\n\tchildren: NestedHeadingData[] | null;\n}\n\n/**\n * Takes a flat list of heading parameters and nests them based on each header's\n * immediate parent's level.\n *\n * @param headingList The flat list of headings to nest.\n *\n * @return The nested list of headings.\n */\nexport function linearToNestedHeadingList(\n\theadingList: HeadingData[]\n): NestedHeadingData[] {\n\tconst nestedHeadingList: NestedHeadingData[] = [];\n\n\theadingList.forEach( ( heading, key ) => {\n\t\tif ( heading.content === '' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure we are only working with the same level as the first iteration in our set.\n\t\tif ( heading.level === headingList[ 0 ].level ) {\n\t\t\t// Check that the next iteration will return a value.\n\t\t\t// If it does and the next level is greater than the current level,\n\t\t\t// the next iteration becomes a child of the current iteration.\n\t\t\tif ( headingList[ key + 1 ]?.level > heading.level ) {\n\t\t\t\t// We must calculate the last index before the next iteration that\n\t\t\t\t// has the same level (siblings). We then use this index to slice\n\t\t\t\t// the array for use in recursion. This prevents duplicate nodes.\n\t\t\t\tlet endOfSlice = headingList.length;\n\t\t\t\tfor ( let i = key + 1; i < headingList.length; i++ ) {\n\t\t\t\t\tif ( headingList[ i ].level === heading.level ) {\n\t\t\t\t\t\tendOfSlice = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We found a child node: Push a new node onto the return array\n\t\t\t\t// with children.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: linearToNestedHeadingList(\n\t\t\t\t\t\theadingList.slice( key + 1, endOfSlice )\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\t// No child node: Push a new node onto the return array.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn nestedHeadingList;\n}\n"]}
@@ -9,7 +9,7 @@ import { isEmpty } from 'lodash';
9
9
  */
10
10
 
11
11
  import { useSelect } from '@wordpress/data';
12
- import { BlockControls, useBlockProps, __experimentalUseNoRecursiveRenders as useNoRecursiveRenders, Warning, store as blockEditorStore } from '@wordpress/block-editor';
12
+ import { BlockControls, useBlockProps, __experimentalUseNoRecursiveRenders as useNoRecursiveRenders, Warning, store as blockEditorStore, __experimentalUseBlockOverlayActive as useBlockOverlayActive } from '@wordpress/block-editor';
13
13
  import { ToolbarGroup, ToolbarButton, Spinner, Modal } from '@wordpress/components';
14
14
  import { __, sprintf } from '@wordpress/i18n';
15
15
  import { store as coreStore } from '@wordpress/core-data';
@@ -74,7 +74,12 @@ export default function TemplatePartEdit(_ref) {
74
74
  const blockPatterns = useAlternativeBlockPatterns(area, clientId);
75
75
  const hasReplacements = !!templateParts.length || !!blockPatterns.length;
76
76
  const areaObject = useTemplatePartArea(area);
77
- const blockProps = useBlockProps();
77
+ const hasBlockOverlay = useBlockOverlayActive(clientId);
78
+ const blockProps = useBlockProps({
79
+ className: hasBlockOverlay ? 'block-editor-block-content-overlay' : undefined
80
+ }, {
81
+ __unstableIsDisabled: hasBlockOverlay
82
+ });
78
83
  const isPlaceholder = !slug;
79
84
  const isEntityAvailable = !isPlaceholder && !isMissing && isResolved;
80
85
  const TagName = tagName || areaObject.tagName; // We don't want to render a missing state if we have any inner blocks.
@@ -102,12 +107,11 @@ export default function TemplatePartEdit(_ref) {
102
107
  clientId: clientId,
103
108
  setAttributes: setAttributes,
104
109
  onOpenSelectionModal: () => setIsTemplatePartSelectionOpen(true)
105
- })), isEntityAvailable && hasReplacements && createElement(BlockControls, null, createElement(ToolbarGroup, {
110
+ })), isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer') && createElement(BlockControls, null, createElement(ToolbarGroup, {
106
111
  className: "wp-block-template-part__block-control-group"
107
112
  }, createElement(ToolbarButton, {
108
113
  onClick: () => setIsTemplatePartSelectionOpen(true)
109
114
  }, __('Replace')))), isEntityAvailable && createElement(TemplatePartInnerBlocks, {
110
- clientId: clientId,
111
115
  tagName: TagName,
112
116
  blockProps: blockProps,
113
117
  postId: templatePartId,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"names":["isEmpty","useSelect","BlockControls","useBlockProps","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","Warning","store","blockEditorStore","ToolbarGroup","ToolbarButton","Spinner","Modal","__","sprintf","coreStore","useState","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","RecursionProvider","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","templateParts","blockPatterns","hasReplacements","length","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","label","toLowerCase"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,OAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SACCC,YADD,EAECC,aAFD,EAGCC,OAHD,EAICC,KAJD,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,eAApC;AACA,OAAOC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AD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,KAAK,EAAGtB,OAAO,EACd;AACAD,IAAAA,EAAE,CAAE,aAAF,CAFY,EAGdyC,UAAU,CAACK,KAAX,CAAiBC,WAAjB,EAHc,CAFhB;AAOC,IAAA,UAAU,EAAG/C,EAAE,CAAE,QAAF,CAPhB;AAQC,IAAA,cAAc,EAAG,MAChBwB,8BAA8B,CAAE,KAAF;AAThC,KAYC,cAAC,0BAAD;AACC,IAAA,cAAc,EAAGJ,cADlB;AAEC,IAAA,QAAQ,EAAGL,QAFZ;AAGC,IAAA,IAAI,EAAGa,IAHR;AAIC,IAAA,aAAa,EAAGd,aAJjB;AAKC,IAAA,OAAO,EAAG,MACTU,8BAA8B,CAAE,KAAF;AANhC,IAZD,CAlDF,CADD;AA4EA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n\tWarning,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tSpinner,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\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\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst [ hasAlreadyRendered, RecursionProvider ] = useNoRecursiveRenders(\n\t\ttemplatePartId\n\t);\n\tconst [\n\t\tisTemplatePartSelectionOpen,\n\t\tsetIsTemplatePartSelectionOpen,\n\t] = useState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst { getBlocks } = 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\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing: hasResolvedEntity && isEmpty( entityRecord ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\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\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\tinnerBlocks.length === 0 &&\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<RecursionProvider>\n\t\t\t<TemplatePartAdvancedControls\n\t\t\t\ttagName={ tagName }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t/>\n\t\t\t{ isPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isEntityAvailable && hasReplacements && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ () =>\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\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tclassName=\"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\tcloseLabel={ __( 'Cancel' ) }\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>\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</RecursionProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"names":["isEmpty","useSelect","BlockControls","useBlockProps","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","Warning","store","blockEditorStore","__experimentalUseBlockOverlayActive","useBlockOverlayActive","ToolbarGroup","ToolbarButton","Spinner","Modal","__","sprintf","coreStore","useState","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","RecursionProvider","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","templateParts","blockPatterns","hasReplacements","length","areaObject","hasBlockOverlay","blockProps","className","undefined","__unstableIsDisabled","isPlaceholder","isEntityAvailable","TagName","label","toLowerCase"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,OAJD,EAKCC,KAAK,IAAIC,gBALV,EAMCC,mCAAmC,IAAIC,qBANxC,QAOO,yBAPP;AAQA,SACCC,YADD,EAECC,aAFD,EAGCC,OAHD,EAICC,KAJD,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAAST,KAAK,IAAIU,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AAC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C,IAAA,MAAM,EAAGvB,cAHV;AAIC,IAAA,cAAc,EAAGM,WAAW,CAACc,MAAZ,GAAqB,CAJvC;AAKC,IAAA,MAAM,EAAGrB;AALV,IArCF,EA6CG,CAAE4B,aAAF,IAAmB,CAAEtB,UAArB,IACD,cAAC,OAAD,EAAckB,UAAd,EACC,cAAC,OAAD,OADD,CA9CF,EAkDGpB,2BAA2B,IAC5B,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,KAAK,EAAGtB,OAAO,EACd;AACAD,IAAAA,EAAE,CAAE,aAAF,CAFY,EAGdyC,UAAU,CAACS,KAAX,CAAiBC,WAAjB,EAHc,CAFhB;AAOC,IAAA,UAAU,EAAGnD,EAAE,CAAE,QAAF,CAPhB;AAQC,IAAA,cAAc,EAAG,MAChBwB,8BAA8B,CAAE,KAAF;AAThC,KAYC,cAAC,0BAAD;AACC,IAAA,cAAc,EAAGJ,cADlB;AAEC,IAAA,QAAQ,EAAGL,QAFZ;AAGC,IAAA,IAAI,EAAGa,IAHR;AAIC,IAAA,aAAa,EAAGd,aAJjB;AAKC,IAAA,OAAO,EAAG,MACTU,8BAA8B,CAAE,KAAF;AANhC,IAZD,CAnDF,CADD;AA6EA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalUseBlockOverlayActive as useBlockOverlayActive,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tSpinner,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\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\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst [ hasAlreadyRendered, RecursionProvider ] = useNoRecursiveRenders(\n\t\ttemplatePartId\n\t);\n\tconst [\n\t\tisTemplatePartSelectionOpen,\n\t\tsetIsTemplatePartSelectionOpen,\n\t] = useState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst { getBlocks } = 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\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing: hasResolvedEntity && isEmpty( entityRecord ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\n\tconst areaObject = useTemplatePartArea( area );\n\tconst hasBlockOverlay = useBlockOverlayActive( clientId );\n\tconst blockProps = useBlockProps(\n\t\t{\n\t\t\tclassName: hasBlockOverlay\n\t\t\t\t? 'block-editor-block-content-overlay'\n\t\t\t\t: undefined,\n\t\t},\n\t\t{ __unstableIsDisabled: hasBlockOverlay }\n\t);\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\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\tinnerBlocks.length === 0 &&\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<RecursionProvider>\n\t\t\t<TemplatePartAdvancedControls\n\t\t\t\ttagName={ tagName }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t/>\n\t\t\t{ isPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isEntityAvailable &&\n\t\t\t\thasReplacements &&\n\t\t\t\t( area === 'header' || area === 'footer' ) && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\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\tsetIsTemplatePartSelectionOpen( true )\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{ __( 'Replace' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tclassName=\"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\tcloseLabel={ __( 'Cancel' ) }\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>\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</RecursionProvider>\n\t);\n}\n"]}
@@ -4,16 +4,15 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { useEntityBlockEditor } from '@wordpress/core-data';
7
- import { InnerBlocks, useInnerBlocksProps, __experimentalBlockContentOverlay as BlockContentOverlay, useSetting, store as blockEditorStore } from '@wordpress/block-editor';
7
+ import { InnerBlocks, useInnerBlocksProps, useSetting, store as blockEditorStore } from '@wordpress/block-editor';
8
8
  import { useSelect } from '@wordpress/data';
9
9
  export default function TemplatePartInnerBlocks(_ref) {
10
10
  let {
11
11
  postId: id,
12
12
  hasInnerBlocks,
13
13
  layout,
14
- tagName,
15
- blockProps,
16
- clientId
14
+ tagName: TagName,
15
+ blockProps
17
16
  } = _ref;
18
17
  const themeSupportsLayout = useSelect(select => {
19
18
  var _getSettings;
@@ -35,10 +34,6 @@ export default function TemplatePartInnerBlocks(_ref) {
35
34
  renderAppender: hasInnerBlocks ? undefined : InnerBlocks.ButtonBlockAppender,
36
35
  __experimentalLayout: themeSupportsLayout ? usedLayout : undefined
37
36
  });
38
- return createElement(BlockContentOverlay, {
39
- clientId: clientId,
40
- tagName: tagName,
41
- wrapperProps: innerBlocksProps
42
- });
37
+ return createElement(TagName, innerBlocksProps);
43
38
  }
44
39
  //# sourceMappingURL=inner-blocks.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/inner-blocks.js"],"names":["useEntityBlockEditor","InnerBlocks","useInnerBlocksProps","__experimentalBlockContentOverlay","BlockContentOverlay","useSetting","store","blockEditorStore","useSelect","TemplatePartInnerBlocks","postId","id","hasInnerBlocks","layout","tagName","blockProps","clientId","themeSupportsLayout","select","getSettings","supportsLayout","defaultLayout","usedLayout","inherit","blocks","onInput","onChange","innerBlocksProps","value","renderAppender","undefined","ButtonBlockAppender","__experimentalLayout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,oBAAT,QAAqC,sBAArC;AACA,SACCC,WADD,EAECC,mBAFD,EAGCC,iCAAiC,IAAIC,mBAHtC,EAICC,UAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,eAAe,SAASC,uBAAT,OAOX;AAAA,MAP6C;AAChDC,IAAAA,MAAM,EAAEC,EADwC;AAEhDC,IAAAA,cAFgD;AAGhDC,IAAAA,MAHgD;AAIhDC,IAAAA,OAJgD;AAKhDC,IAAAA,UALgD;AAMhDC,IAAAA;AANgD,GAO7C;AACH,QAAMC,mBAAmB,GAAGT,SAAS,CAAIU,MAAF,IAAc;AAAA;;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEX,gBAAF,CAA9B;AACA,2BAAOY,WAAW,EAAlB,iDAAO,aAAeC,cAAtB;AACA,GAHoC,EAGlC,EAHkC,CAArC;AAIA,QAAMC,aAAa,GAAGhB,UAAU,CAAE,QAAF,CAAV,IAA0B,EAAhD;AACA,QAAMiB,UAAU,GAAG,CAAC,CAAET,MAAH,IAAaA,MAAM,CAACU,OAApB,GAA8BF,aAA9B,GAA8CR,MAAjE;AAEA,QAAM,CAAEW,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC1B,oBAAoB,CACzD,UADyD,EAEzD,kBAFyD,EAGzD;AAAEW,IAAAA;AAAF,GAHyD,CAA1D;AAMA,QAAMgB,gBAAgB,GAAGzB,mBAAmB,CAAEa,UAAF,EAAc;AACzDa,IAAAA,KAAK,EAAEJ,MADkD;AAEzDC,IAAAA,OAFyD;AAGzDC,IAAAA,QAHyD;AAIzDG,IAAAA,cAAc,EAAEjB,cAAc,GAC3BkB,SAD2B,GAE3B7B,WAAW,CAAC8B,mBAN0C;AAOzDC,IAAAA,oBAAoB,EAAEf,mBAAmB,GAAGK,UAAH,GAAgBQ;AAPA,GAAd,CAA5C;AAUA,SACC,cAAC,mBAAD;AACC,IAAA,QAAQ,EAAGd,QADZ;AAEC,IAAA,OAAO,EAAGF,OAFX;AAGC,IAAA,YAAY,EAAGa;AAHhB,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\t__experimentalBlockContentOverlay as BlockContentOverlay,\n\tuseSetting,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function TemplatePartInnerBlocks( {\n\tpostId: id,\n\thasInnerBlocks,\n\tlayout,\n\ttagName,\n\tblockProps,\n\tclientId,\n} ) {\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings()?.supportsLayout;\n\t}, [] );\n\tconst defaultLayout = useSetting( 'layout' ) || {};\n\tconst usedLayout = !! layout && layout.inherit ? defaultLayout : layout;\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{ id }\n\t);\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tvalue: blocks,\n\t\tonInput,\n\t\tonChange,\n\t\trenderAppender: hasInnerBlocks\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t\t__experimentalLayout: themeSupportsLayout ? usedLayout : undefined,\n\t} );\n\n\treturn (\n\t\t<BlockContentOverlay\n\t\t\tclientId={ clientId }\n\t\t\ttagName={ tagName }\n\t\t\twrapperProps={ innerBlocksProps }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/inner-blocks.js"],"names":["useEntityBlockEditor","InnerBlocks","useInnerBlocksProps","useSetting","store","blockEditorStore","useSelect","TemplatePartInnerBlocks","postId","id","hasInnerBlocks","layout","tagName","TagName","blockProps","themeSupportsLayout","select","getSettings","supportsLayout","defaultLayout","usedLayout","inherit","blocks","onInput","onChange","innerBlocksProps","value","renderAppender","undefined","ButtonBlockAppender","__experimentalLayout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,oBAAT,QAAqC,sBAArC;AACA,SACCC,WADD,EAECC,mBAFD,EAGCC,UAHD,EAICC,KAAK,IAAIC,gBAJV,QAKO,yBALP;AAMA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,eAAe,SAASC,uBAAT,OAMX;AAAA,MAN6C;AAChDC,IAAAA,MAAM,EAAEC,EADwC;AAEhDC,IAAAA,cAFgD;AAGhDC,IAAAA,MAHgD;AAIhDC,IAAAA,OAAO,EAAEC,OAJuC;AAKhDC,IAAAA;AALgD,GAM7C;AACH,QAAMC,mBAAmB,GAAGT,SAAS,CAAIU,MAAF,IAAc;AAAA;;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEX,gBAAF,CAA9B;AACA,2BAAOY,WAAW,EAAlB,iDAAO,aAAeC,cAAtB;AACA,GAHoC,EAGlC,EAHkC,CAArC;AAIA,QAAMC,aAAa,GAAGhB,UAAU,CAAE,QAAF,CAAV,IAA0B,EAAhD;AACA,QAAMiB,UAAU,GAAG,CAAC,CAAET,MAAH,IAAaA,MAAM,CAACU,OAApB,GAA8BF,aAA9B,GAA8CR,MAAjE;AAEA,QAAM,CAAEW,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgCxB,oBAAoB,CACzD,UADyD,EAEzD,kBAFyD,EAGzD;AAAES,IAAAA;AAAF,GAHyD,CAA1D;AAMA,QAAMgB,gBAAgB,GAAGvB,mBAAmB,CAAEY,UAAF,EAAc;AACzDY,IAAAA,KAAK,EAAEJ,MADkD;AAEzDC,IAAAA,OAFyD;AAGzDC,IAAAA,QAHyD;AAIzDG,IAAAA,cAAc,EAAEjB,cAAc,GAC3BkB,SAD2B,GAE3B3B,WAAW,CAAC4B,mBAN0C;AAOzDC,IAAAA,oBAAoB,EAAEf,mBAAmB,GAAGK,UAAH,GAAgBQ;AAPA,GAAd,CAA5C;AAUA,SAAO,cAAC,OAAD,EAAcH,gBAAd,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tuseSetting,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function TemplatePartInnerBlocks( {\n\tpostId: id,\n\thasInnerBlocks,\n\tlayout,\n\ttagName: TagName,\n\tblockProps,\n} ) {\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings()?.supportsLayout;\n\t}, [] );\n\tconst defaultLayout = useSetting( 'layout' ) || {};\n\tconst usedLayout = !! layout && layout.inherit ? defaultLayout : layout;\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{ id }\n\t);\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tvalue: blocks,\n\t\tonInput,\n\t\tonChange,\n\t\trenderAppender: hasInnerBlocks\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t\t__experimentalLayout: themeSupportsLayout ? usedLayout : undefined,\n\t} );\n\n\treturn <TagName { ...innerBlocksProps } />;\n}\n"]}
@@ -16,7 +16,7 @@ import { __, sprintf } from '@wordpress/i18n';
16
16
  import { useInstanceId } from '@wordpress/compose';
17
17
  import { useSelect } from '@wordpress/data';
18
18
  import { video as icon } from '@wordpress/icons';
19
- import { createBlock } from '@wordpress/blocks';
19
+ import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
@@ -233,7 +233,7 @@ function VideoEdit(_ref) {
233
233
  caption: value
234
234
  }),
235
235
  inlineToolbar: true,
236
- __unstableOnSplitAtEnd: () => insertBlocksAfter(createBlock('core/paragraph'))
236
+ __unstableOnSplitAtEnd: () => insertBlocksAfter(createBlock(getDefaultBlockName()))
237
237
  })));
238
238
  }
239
239
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/video/edit.js"],"names":["classnames","getBlobByURL","isBlobURL","BaseControl","Button","Disabled","PanelBody","Spinner","withNotices","BlockControls","BlockIcon","InspectorControls","MediaPlaceholder","MediaUpload","MediaUploadCheck","MediaReplaceFlow","RichText","useBlockProps","store","blockEditorStore","useRef","useEffect","__","sprintf","useInstanceId","useSelect","video","icon","createBlock","createUpgradedEmbedBlock","VideoCommonSettings","TracksEditor","Tracks","ALLOWED_MEDIA_TYPES","VIDEO_POSTER_ALLOWED_MEDIA_TYPES","VideoEdit","isSelected","noticeUI","attributes","className","setAttributes","insertBlocksAfter","onReplace","noticeOperations","instanceId","videoPlayer","posterImageButton","id","caption","controls","poster","src","tracks","isTemporaryVideo","mediaUpload","select","getSettings","file","filesList","onFileChange","media","onSelectVideo","onError","message","createErrorNotice","allowedTypes","current","load","url","undefined","image","onSelectURL","newSrc","embedBlock","onUploadError","removeAllNotices","classes","blockProps","onSelectPoster","onRemovePoster","focus","videoPosterDescription","newTracks","open","isEmpty","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,EAAuBC,SAAvB,QAAwC,iBAAxC;AACA,SACCC,WADD,EAECC,MAFD,EAGCC,QAHD,EAICC,SAJD,EAKCC,OALD,EAMCC,WAND,QAOO,uBAPP;AAQA,SACCC,aADD,EAECC,SAFD,EAGCC,iBAHD,EAICC,gBAJD,EAKCC,WALD,EAMCC,gBAND,EAOCC,gBAPD,EAQCC,QARD,EASCC,aATD,EAUCC,KAAK,IAAIC,gBAVV,QAWO,yBAXP;AAYA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,IAAlB,QAA8B,kBAA9B;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,eAAzC;AACA,OAAOC,mBAAP,MAAgC,wBAAhC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,MAAMC,gCAAgC,GAAG,CAAE,OAAF,CAAzC;;AAEA,SAASC,SAAT,OASI;AAAA,MATgB;AACnBC,IAAAA,UADmB;AAEnBC,IAAAA,QAFmB;AAGnBC,IAAAA,UAHmB;AAInBC,IAAAA,SAJmB;AAKnBC,IAAAA,aALmB;AAMnBC,IAAAA,iBANmB;AAOnBC,IAAAA,SAPmB;AAQnBC,IAAAA;AARmB,GAShB;AACH,QAAMC,UAAU,GAAGpB,aAAa,CAAEW,SAAF,CAAhC;AACA,QAAMU,WAAW,GAAGzB,MAAM,EAA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ApBD,EA6EC,wBAAauD,UAAb,EAMC,cAAC,QAAD;AAAU,IAAA,UAAU,EAAG,CAAEzC;AAAzB,KACC;AACC,IAAA,QAAQ,EAAGa,QADZ;AAEC,IAAA,MAAM,EAAGC,MAFV;AAGC,IAAA,GAAG,EAAGC,GAHP;AAIC,IAAA,GAAG,EAAGN;AAJP,KAMC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGO;AAAjB,IAND,CADD,CAND,EAgBGC,gBAAgB,IAAI,cAAC,OAAD,OAhBvB,EAiBG,CAAE,CAAErC,QAAQ,CAACoE,OAAT,CAAkBpC,OAAlB,CAAF,IAAiCZ,UAAnC,KACD,cAAC,QAAD;AACC,IAAA,OAAO,EAAC,YADT;AAEC,kBAAad,EAAE,CAAE,oBAAF,CAFhB;AAGC,IAAA,WAAW,EAAGA,EAAE,CAAE,aAAF,CAHjB;AAIC,IAAA,KAAK,EAAG0B,OAJT;AAKC,IAAA,QAAQ,EAAKqC,KAAF,IACV7C,aAAa,CAAE;AAAEQ,MAAAA,OAAO,EAAEqC;AAAX,KAAF,CANf;AAQC,IAAA,aAAa,MARd;AASC,IAAA,sBAAsB,EAAG,MACxB5C,iBAAiB,CAAEb,WAAW,CAAE,gBAAF,CAAb;AAVnB,IAlBF,CA7ED,CADD;AAiHA;;AAED,eAAepB,WAAW,CAAE2B,SAAF,CAA1B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL } from '@wordpress/blob';\nimport {\n\tBaseControl,\n\tButton,\n\tDisabled,\n\tPanelBody,\n\tSpinner,\n\twithNotices,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadCheck,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { video as icon } from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport VideoCommonSettings from './edit-common-settings';\nimport TracksEditor from './tracks-editor';\nimport Tracks from './tracks';\n\nconst ALLOWED_MEDIA_TYPES = [ 'video' ];\nconst VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nfunction VideoEdit( {\n\tisSelected,\n\tnoticeUI,\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tonReplace,\n\tnoticeOperations,\n} ) {\n\tconst instanceId = useInstanceId( VideoEdit );\n\tconst videoPlayer = useRef();\n\tconst posterImageButton = useRef();\n\tconst { id, caption, controls, poster, src, tracks } = attributes;\n\tconst isTemporaryVideo = ! id && isBlobURL( src );\n\tconst mediaUpload = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().mediaUpload,\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( ! id && isBlobURL( src ) ) {\n\t\t\tconst file = getBlobByURL( src );\n\t\t\tif ( file ) {\n\t\t\t\tmediaUpload( {\n\t\t\t\t\tfilesList: [ file ],\n\t\t\t\t\tonFileChange: ( [ media ] ) => onSelectVideo( media ),\n\t\t\t\t\tonError: ( message ) => {\n\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t},\n\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Placeholder may be rendered.\n\t\tif ( videoPlayer.current ) {\n\t\t\tvideoPlayer.current.load();\n\t\t}\n\t}, [ poster ] );\n\n\tfunction onSelectVideo( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error\n\t\t\t// previous attributes should be removed\n\t\t\t// because they may be temporary blob urls.\n\t\t\tsetAttributes( {\n\t\t\t\tsrc: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tposter: undefined,\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media.\n\t\tsetAttributes( {\n\t\t\tsrc: media.url,\n\t\t\tid: media.id,\n\t\t\tposter:\n\t\t\t\tmedia.image?.src !== media.icon ? media.image?.src : undefined,\n\t\t} );\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\tif ( newSrc !== src ) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tconst embedBlock = createUpgradedEmbedBlock( {\n\t\t\t\tattributes: { url: newSrc },\n\t\t\t} );\n\t\t\tif ( undefined !== embedBlock ) {\n\t\t\t\tonReplace( embedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetAttributes( { src: newSrc, id: undefined, poster: undefined } );\n\t\t}\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t}\n\n\tconst classes = classnames( className, {\n\t\t'is-transient': isTemporaryVideo,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\n\tif ( ! src ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectVideo }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"video/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tnotices={ noticeUI }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tfunction onSelectPoster( image ) {\n\t\tsetAttributes( { poster: image.url } );\n\t}\n\n\tfunction onRemovePoster() {\n\t\tsetAttributes( { poster: undefined } );\n\n\t\t// Move focus back to the Media Upload button.\n\t\tposterImageButton.current.focus();\n\t}\n\n\tconst videoPosterDescription = `video-block__poster-image-description-${ instanceId }`;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<TracksEditor\n\t\t\t\t\ttracks={ tracks }\n\t\t\t\t\tonChange={ ( newTracks ) => {\n\t\t\t\t\t\tsetAttributes( { tracks: newTracks } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ src }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\taccept=\"video/*\"\n\t\t\t\t\tonSelect={ onSelectVideo }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<VideoCommonSettings\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t<BaseControl className=\"editor-video-poster-control\">\n\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t{ __( 'Poster image' ) }\n\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\t\t\ttitle={ __( 'Select poster image' ) }\n\t\t\t\t\t\t\t\tonSelect={ onSelectPoster }\n\t\t\t\t\t\t\t\tallowedTypes={\n\t\t\t\t\t\t\t\t\tVIDEO_POSTER_ALLOWED_MEDIA_TYPES\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\tref={ posterImageButton }\n\t\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t\tvideoPosterDescription\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ ! poster\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Select' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t</Button>\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<p id={ videoPosterDescription } hidden>\n\t\t\t\t\t\t\t\t{ poster\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: poster image URL. */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'The current poster image url is %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tposter\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'There is no poster image currently selected'\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t{ !! poster && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ onRemovePoster }\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /*\n\t\t\t\t\tDisable the video tag if the block is not selected\n\t\t\t\t\tso the user clicking on it won't play the\n\t\t\t\t\tvideo when the controls are enabled.\n\t\t\t\t*/ }\n\t\t\t\t<Disabled isDisabled={ ! isSelected }>\n\t\t\t\t\t<video\n\t\t\t\t\t\tcontrols={ controls }\n\t\t\t\t\t\tposter={ poster }\n\t\t\t\t\t\tsrc={ src }\n\t\t\t\t\t\tref={ videoPlayer }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Tracks tracks={ tracks } />\n\t\t\t\t\t</video>\n\t\t\t\t</Disabled>\n\t\t\t\t{ isTemporaryVideo && <Spinner /> }\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Video caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter( createBlock( 'core/paragraph' ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t</>\n\t);\n}\n\nexport default withNotices( VideoEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/video/edit.js"],"names":["classnames","getBlobByURL","isBlobURL","BaseControl","Button","Disabled","PanelBody","Spinner","withNotices","BlockControls","BlockIcon","InspectorControls","MediaPlaceholder","MediaUpload","MediaUploadCheck","MediaReplaceFlow","RichText","useBlockProps","store","blockEditorStore","useRef","useEffect","__","sprintf","useInstanceId","useSelect","video","icon","createBlock","getDefaultBlockName","createUpgradedEmbedBlock","VideoCommonSettings","TracksEditor","Tracks","ALLOWED_MEDIA_TYPES","VIDEO_POSTER_ALLOWED_MEDIA_TYPES","VideoEdit","isSelected","noticeUI","attributes","className","setAttributes","insertBlocksAfter","onReplace","noticeOperations","instanceId","videoPlayer","posterImageButton","id","caption","controls","poster","src","tracks","isTemporaryVideo","mediaUpload","select","getSettings","file","filesList","onFileChange","media","onSelectVideo","onError","message","createErrorNotice","allowedTypes","current","load","url","undefined","image","onSelectURL","newSrc","embedBlock","onUploadError","removeAllNotices","classes","blockProps","onSelectPoster","onRemovePoster","focus","videoPosterDescription","newTracks","open","isEmpty","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,EAAuBC,SAAvB,QAAwC,iBAAxC;AACA,SACCC,WADD,EAECC,MAFD,EAGCC,QAHD,EAICC,SAJD,EAKCC,OALD,EAMCC,WAND,QAOO,uBAPP;AAQA,SACCC,aADD,EAECC,SAFD,EAGCC,iBAHD,EAICC,gBAJD,EAKCC,WALD,EAMCC,gBAND,EAOCC,gBAPD,EAQCC,QARD,EASCC,aATD,EAUCC,KAAK,IAAIC,gBAVV,QAWO,yBAXP;AAYA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,IAAlB,QAA8B,kBAA9B;AACA,SAASC,WAAT,EAAsBC,mBAAtB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,eAAzC;AACA,OAAOC,mBAAP,MAAgC,wBAAhC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,M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from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL } from '@wordpress/blob';\nimport {\n\tBaseControl,\n\tButton,\n\tDisabled,\n\tPanelBody,\n\tSpinner,\n\twithNotices,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadCheck,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { video as icon } from '@wordpress/icons';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport VideoCommonSettings from './edit-common-settings';\nimport TracksEditor from './tracks-editor';\nimport Tracks from './tracks';\n\nconst ALLOWED_MEDIA_TYPES = [ 'video' ];\nconst VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nfunction VideoEdit( {\n\tisSelected,\n\tnoticeUI,\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tonReplace,\n\tnoticeOperations,\n} ) {\n\tconst instanceId = useInstanceId( VideoEdit );\n\tconst videoPlayer = useRef();\n\tconst posterImageButton = useRef();\n\tconst { id, caption, controls, poster, src, tracks } = attributes;\n\tconst isTemporaryVideo = ! id && isBlobURL( src );\n\tconst mediaUpload = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().mediaUpload,\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( ! id && isBlobURL( src ) ) {\n\t\t\tconst file = getBlobByURL( src );\n\t\t\tif ( file ) {\n\t\t\t\tmediaUpload( {\n\t\t\t\t\tfilesList: [ file ],\n\t\t\t\t\tonFileChange: ( [ media ] ) => onSelectVideo( media ),\n\t\t\t\t\tonError: ( message ) => {\n\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t},\n\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Placeholder may be rendered.\n\t\tif ( videoPlayer.current ) {\n\t\t\tvideoPlayer.current.load();\n\t\t}\n\t}, [ poster ] );\n\n\tfunction onSelectVideo( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error\n\t\t\t// previous attributes should be removed\n\t\t\t// because they may be temporary blob urls.\n\t\t\tsetAttributes( {\n\t\t\t\tsrc: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tposter: undefined,\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media.\n\t\tsetAttributes( {\n\t\t\tsrc: media.url,\n\t\t\tid: media.id,\n\t\t\tposter:\n\t\t\t\tmedia.image?.src !== media.icon ? media.image?.src : undefined,\n\t\t} );\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\tif ( newSrc !== src ) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tconst embedBlock = createUpgradedEmbedBlock( {\n\t\t\t\tattributes: { url: newSrc },\n\t\t\t} );\n\t\t\tif ( undefined !== embedBlock ) {\n\t\t\t\tonReplace( embedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetAttributes( { src: newSrc, id: undefined, poster: undefined } );\n\t\t}\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t}\n\n\tconst classes = classnames( className, {\n\t\t'is-transient': isTemporaryVideo,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\n\tif ( ! src ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectVideo }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"video/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tnotices={ noticeUI }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tfunction onSelectPoster( image ) {\n\t\tsetAttributes( { poster: image.url } );\n\t}\n\n\tfunction onRemovePoster() {\n\t\tsetAttributes( { poster: undefined } );\n\n\t\t// Move focus back to the Media Upload button.\n\t\tposterImageButton.current.focus();\n\t}\n\n\tconst videoPosterDescription = `video-block__poster-image-description-${ instanceId }`;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<TracksEditor\n\t\t\t\t\ttracks={ tracks }\n\t\t\t\t\tonChange={ ( newTracks ) => {\n\t\t\t\t\t\tsetAttributes( { tracks: newTracks } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ src }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\taccept=\"video/*\"\n\t\t\t\t\tonSelect={ onSelectVideo }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<VideoCommonSettings\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t<BaseControl className=\"editor-video-poster-control\">\n\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t{ __( 'Poster image' ) }\n\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\t\t\ttitle={ __( 'Select poster image' ) }\n\t\t\t\t\t\t\t\tonSelect={ onSelectPoster }\n\t\t\t\t\t\t\t\tallowedTypes={\n\t\t\t\t\t\t\t\t\tVIDEO_POSTER_ALLOWED_MEDIA_TYPES\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\tref={ posterImageButton }\n\t\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t\tvideoPosterDescription\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ ! poster\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Select' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t</Button>\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<p id={ videoPosterDescription } hidden>\n\t\t\t\t\t\t\t\t{ poster\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: poster image URL. */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'The current poster image url is %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tposter\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'There is no poster image currently selected'\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t{ !! poster && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ onRemovePoster }\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /*\n\t\t\t\t\tDisable the video tag if the block is not selected\n\t\t\t\t\tso the user clicking on it won't play the\n\t\t\t\t\tvideo when the controls are enabled.\n\t\t\t\t*/ }\n\t\t\t\t<Disabled isDisabled={ ! isSelected }>\n\t\t\t\t\t<video\n\t\t\t\t\t\tcontrols={ controls }\n\t\t\t\t\t\tposter={ poster }\n\t\t\t\t\t\tsrc={ src }\n\t\t\t\t\t\tref={ videoPlayer }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Tracks tracks={ tracks } />\n\t\t\t\t\t</video>\n\t\t\t\t</Disabled>\n\t\t\t\t{ isTemporaryVideo && <Spinner /> }\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Video caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\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</figure>\n\t\t</>\n\t);\n}\n\nexport default withNotices( VideoEdit );\n"]}
@@ -1102,8 +1102,8 @@ figure.wp-block-image:not(.wp-block) {
1102
1102
  }
1103
1103
 
1104
1104
  .wp-block-image__zoom .components-popover__content {
1105
- overflow: visible;
1106
1105
  min-width: 260px;
1106
+ overflow: visible !important;
1107
1107
  }
1108
1108
  .wp-block-image__zoom .components-range-control {
1109
1109
  flex: 1;
@@ -1981,6 +1981,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
1981
1981
  }
1982
1982
  .block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots {
1983
1983
  background: none !important;
1984
+ border: none;
1984
1985
  }
1985
1986
 
1986
1987
  [data-type="core/shortcode"] .block-editor-plain-text {
@@ -2436,10 +2437,6 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2436
2437
  z-index: 159990;
2437
2438
  }
2438
2439
 
2439
- .block-library-video-tracks-editor > .components-popover__content {
2440
- width: 360px;
2441
- }
2442
-
2443
2440
  .block-library-video-tracks-editor__track-list-track {
2444
2441
  display: flex;
2445
2442
  place-content: space-between;
@@ -2478,7 +2475,8 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2478
2475
  display: block;
2479
2476
  }
2480
2477
 
2481
- .block-library-video-tracks-editor > .components-popover__content > div {
2478
+ .block-library-video-tracks-editor > .components-popover__content {
2479
+ width: 360px;
2482
2480
  padding: 0;
2483
2481
  }
2484
2482
 
@@ -1110,8 +1110,8 @@ figure.wp-block-image:not(.wp-block) {
1110
1110
  }
1111
1111
 
1112
1112
  .wp-block-image__zoom .components-popover__content {
1113
- overflow: visible;
1114
1113
  min-width: 260px;
1114
+ overflow: visible !important;
1115
1115
  }
1116
1116
  .wp-block-image__zoom .components-range-control {
1117
1117
  flex: 1;
@@ -1989,6 +1989,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
1989
1989
  }
1990
1990
  .block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots {
1991
1991
  background: none !important;
1992
+ border: none;
1992
1993
  }
1993
1994
 
1994
1995
  [data-type="core/shortcode"] .block-editor-plain-text {
@@ -2444,10 +2445,6 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2444
2445
  z-index: 159990;
2445
2446
  }
2446
2447
 
2447
- .block-library-video-tracks-editor > .components-popover__content {
2448
- width: 360px;
2449
- }
2450
-
2451
2448
  .block-library-video-tracks-editor__track-list-track {
2452
2449
  display: flex;
2453
2450
  place-content: space-between;
@@ -2486,7 +2483,8 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2486
2483
  display: block;
2487
2484
  }
2488
2485
 
2489
- .block-library-video-tracks-editor > .components-popover__content > div {
2486
+ .block-library-video-tracks-editor > .components-popover__content {
2487
+ width: 360px;
2490
2488
  padding: 0;
2491
2489
  }
2492
2490
 
@@ -175,8 +175,8 @@ figure.wp-block-image:not(.wp-block) {
175
175
  }
176
176
 
177
177
  .wp-block-image__zoom .components-popover__content {
178
- overflow: visible;
179
178
  min-width: 260px;
179
+ overflow: visible !important;
180
180
  }
181
181
  .wp-block-image__zoom .components-range-control {
182
182
  flex: 1;
@@ -175,8 +175,8 @@ figure.wp-block-image:not(.wp-block) {
175
175
  }
176
176
 
177
177
  .wp-block-image__zoom .components-popover__content {
178
- overflow: visible;
179
178
  min-width: 260px;
179
+ overflow: visible !important;
180
180
  }
181
181
  .wp-block-image__zoom .components-range-control {
182
182
  flex: 1;
@@ -74,6 +74,21 @@
74
74
  /**
75
75
  * Reset the WP Admin page styles for Gutenberg-like pages.
76
76
  */
77
+ .wp-block-post-comments {
78
+ /* utility classes */
79
+ /* end utility classes */
80
+ }
81
+ .wp-block-post-comments .alignleft {
82
+ float: right;
83
+ }
84
+ .wp-block-post-comments .alignright {
85
+ float: left;
86
+ }
87
+ .wp-block-post-comments .navigation::after {
88
+ content: "";
89
+ display: table;
90
+ clear: both;
91
+ }
77
92
  .wp-block-post-comments .commentlist {
78
93
  clear: both;
79
94
  list-style: none;
@@ -144,6 +159,13 @@
144
159
  .wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
145
160
  margin-top: 0.35em;
146
161
  }
162
+ .wp-block-post-comments .comment-reply-title {
163
+ margin-bottom: 0;
164
+ }
165
+ .wp-block-post-comments .comment-reply-title :where(small) {
166
+ font-size: var(--wp--preset--font-size--medium, smaller);
167
+ margin-right: 0.5em;
168
+ }
147
169
  .wp-block-post-comments .reply {
148
170
  font-size: 0.875em;
149
171
  margin-bottom: 1.4em;
@@ -74,6 +74,21 @@
74
74
  /**
75
75
  * Reset the WP Admin page styles for Gutenberg-like pages.
76
76
  */
77
+ .wp-block-post-comments {
78
+ /* utility classes */
79
+ /* end utility classes */
80
+ }
81
+ .wp-block-post-comments .alignleft {
82
+ float: left;
83
+ }
84
+ .wp-block-post-comments .alignright {
85
+ float: right;
86
+ }
87
+ .wp-block-post-comments .navigation::after {
88
+ content: "";
89
+ display: table;
90
+ clear: both;
91
+ }
77
92
  .wp-block-post-comments .commentlist {
78
93
  clear: both;
79
94
  list-style: none;
@@ -144,6 +159,13 @@
144
159
  .wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
145
160
  margin-top: 0.35em;
146
161
  }
162
+ .wp-block-post-comments .comment-reply-title {
163
+ margin-bottom: 0;
164
+ }
165
+ .wp-block-post-comments .comment-reply-title :where(small) {
166
+ font-size: var(--wp--preset--font-size--medium, smaller);
167
+ margin-left: 0.5em;
168
+ }
147
169
  .wp-block-post-comments .reply {
148
170
  font-size: 0.875em;
149
171
  margin-bottom: 1.4em;
@@ -130,11 +130,9 @@
130
130
  margin-top: 0.35em;
131
131
  }
132
132
  .wp-block-post-comments-form .comment-reply-title {
133
- align-items: baseline;
134
- display: flex;
135
- justify-content: space-between;
136
133
  margin-bottom: 0;
137
134
  }
138
135
  .wp-block-post-comments-form .comment-reply-title :where(small) {
139
136
  font-size: var(--wp--preset--font-size--medium, smaller);
137
+ margin-right: 0.5em;
140
138
  }
@@ -130,11 +130,9 @@
130
130
  margin-top: 0.35em;
131
131
  }
132
132
  .wp-block-post-comments-form .comment-reply-title {
133
- align-items: baseline;
134
- display: flex;
135
- justify-content: space-between;
136
133
  margin-bottom: 0;
137
134
  }
138
135
  .wp-block-post-comments-form .comment-reply-title :where(small) {
139
136
  font-size: var(--wp--preset--font-size--medium, smaller);
137
+ margin-left: 0.5em;
140
138
  }
@@ -80,4 +80,5 @@
80
80
  }
81
81
  .block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots {
82
82
  background: none !important;
83
+ border: none;
83
84
  }
@@ -80,4 +80,5 @@
80
80
  }
81
81
  .block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots {
82
82
  background: none !important;
83
+ border: none;
83
84
  }
@@ -2100,6 +2100,21 @@ p.has-background {
2100
2100
  margin: 0;
2101
2101
  }
2102
2102
 
2103
+ .wp-block-post-comments {
2104
+ /* utility classes */
2105
+ /* end utility classes */
2106
+ }
2107
+ .wp-block-post-comments .alignleft {
2108
+ float: right;
2109
+ }
2110
+ .wp-block-post-comments .alignright {
2111
+ float: left;
2112
+ }
2113
+ .wp-block-post-comments .navigation::after {
2114
+ content: "";
2115
+ display: table;
2116
+ clear: both;
2117
+ }
2103
2118
  .wp-block-post-comments .commentlist {
2104
2119
  clear: both;
2105
2120
  list-style: none;
@@ -2170,6 +2185,13 @@ p.has-background {
2170
2185
  .wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
2171
2186
  margin-top: 0.35em;
2172
2187
  }
2188
+ .wp-block-post-comments .comment-reply-title {
2189
+ margin-bottom: 0;
2190
+ }
2191
+ .wp-block-post-comments .comment-reply-title :where(small) {
2192
+ font-size: var(--wp--preset--font-size--medium, smaller);
2193
+ margin-right: 0.5em;
2194
+ }
2173
2195
  .wp-block-post-comments .reply {
2174
2196
  font-size: 0.875em;
2175
2197
  margin-bottom: 1.4em;
@@ -2244,13 +2266,11 @@ p.has-background {
2244
2266
  margin-top: 0.35em;
2245
2267
  }
2246
2268
  .wp-block-post-comments-form .comment-reply-title {
2247
- align-items: baseline;
2248
- display: flex;
2249
- justify-content: space-between;
2250
2269
  margin-bottom: 0;
2251
2270
  }
2252
2271
  .wp-block-post-comments-form .comment-reply-title :where(small) {
2253
2272
  font-size: var(--wp--preset--font-size--medium, smaller);
2273
+ margin-right: 0.5em;
2254
2274
  }
2255
2275
 
2256
2276
  .wp-block-post-excerpt__more-link {
@@ -2126,6 +2126,21 @@ p.has-background {
2126
2126
  margin: 0;
2127
2127
  }
2128
2128
 
2129
+ .wp-block-post-comments {
2130
+ /* utility classes */
2131
+ /* end utility classes */
2132
+ }
2133
+ .wp-block-post-comments .alignleft {
2134
+ float: left;
2135
+ }
2136
+ .wp-block-post-comments .alignright {
2137
+ float: right;
2138
+ }
2139
+ .wp-block-post-comments .navigation::after {
2140
+ content: "";
2141
+ display: table;
2142
+ clear: both;
2143
+ }
2129
2144
  .wp-block-post-comments .commentlist {
2130
2145
  clear: both;
2131
2146
  list-style: none;
@@ -2196,6 +2211,13 @@ p.has-background {
2196
2211
  .wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
2197
2212
  margin-top: 0.35em;
2198
2213
  }
2214
+ .wp-block-post-comments .comment-reply-title {
2215
+ margin-bottom: 0;
2216
+ }
2217
+ .wp-block-post-comments .comment-reply-title :where(small) {
2218
+ font-size: var(--wp--preset--font-size--medium, smaller);
2219
+ margin-left: 0.5em;
2220
+ }
2199
2221
  .wp-block-post-comments .reply {
2200
2222
  font-size: 0.875em;
2201
2223
  margin-bottom: 1.4em;
@@ -2270,13 +2292,11 @@ p.has-background {
2270
2292
  margin-top: 0.35em;
2271
2293
  }
2272
2294
  .wp-block-post-comments-form .comment-reply-title {
2273
- align-items: baseline;
2274
- display: flex;
2275
- justify-content: space-between;
2276
2295
  margin-bottom: 0;
2277
2296
  }
2278
2297
  .wp-block-post-comments-form .comment-reply-title :where(small) {
2279
2298
  font-size: var(--wp--preset--font-size--medium, smaller);
2299
+ margin-left: 0.5em;
2280
2300
  }
2281
2301
 
2282
2302
  .wp-block-post-excerpt__more-link {
@@ -103,10 +103,6 @@
103
103
  z-index: 159990;
104
104
  }
105
105
 
106
- .block-library-video-tracks-editor > .components-popover__content {
107
- width: 360px;
108
- }
109
-
110
106
  .block-library-video-tracks-editor__track-list-track {
111
107
  display: flex;
112
108
  place-content: space-between;
@@ -145,7 +141,8 @@
145
141
  display: block;
146
142
  }
147
143
 
148
- .block-library-video-tracks-editor > .components-popover__content > div {
144
+ .block-library-video-tracks-editor > .components-popover__content {
145
+ width: 360px;
149
146
  padding: 0;
150
147
  }
151
148