@wordpress/block-library 8.20.1 → 8.21.1-next.f8d8eceb.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 (412) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +12 -0
  3. package/build/avatar/index.js +5 -1
  4. package/build/avatar/index.js.map +1 -1
  5. package/build/block/edit-title.native.js +11 -3
  6. package/build/block/edit-title.native.js.map +1 -1
  7. package/build/block/index.js +2 -1
  8. package/build/block/index.js.map +1 -1
  9. package/build/code/edit.native.js +8 -2
  10. package/build/code/edit.native.js.map +1 -1
  11. package/build/column/edit.js +2 -1
  12. package/build/column/edit.js.map +1 -1
  13. package/build/column/edit.native.js +2 -1
  14. package/build/column/edit.native.js.map +1 -1
  15. package/build/columns/edit.native.js +2 -1
  16. package/build/columns/edit.native.js.map +1 -1
  17. package/build/cover/controls.native.js +2 -1
  18. package/build/cover/controls.native.js.map +1 -1
  19. package/build/cover/deprecated.js +110 -1
  20. package/build/cover/deprecated.js.map +1 -1
  21. package/build/cover/edit/index.js +11 -4
  22. package/build/cover/edit/index.js.map +1 -1
  23. package/build/cover/edit/inspector-controls.js +3 -3
  24. package/build/cover/edit/inspector-controls.js.map +1 -1
  25. package/build/cover/index.js +0 -3
  26. package/build/cover/index.js.map +1 -1
  27. package/build/cover/save.js +2 -1
  28. package/build/cover/save.js.map +1 -1
  29. package/build/cover/shared.js +1 -1
  30. package/build/cover/shared.js.map +1 -1
  31. package/build/file/view.js +1 -1
  32. package/build/file/view.js.map +1 -1
  33. package/build/footnotes/index.js +1 -0
  34. package/build/footnotes/index.js.map +1 -1
  35. package/build/form/edit.js +138 -0
  36. package/build/form/edit.js.map +1 -0
  37. package/build/form/index.js +92 -0
  38. package/build/form/index.js.map +1 -0
  39. package/build/form/init.js +13 -0
  40. package/build/form/init.js.map +1 -0
  41. package/build/form/save.js +28 -0
  42. package/build/form/save.js.map +1 -0
  43. package/build/form/utils.js +24 -0
  44. package/build/form/utils.js.map +1 -0
  45. package/build/form/variations.js +95 -0
  46. package/build/form/variations.js.map +1 -0
  47. package/build/form/view.js +42 -0
  48. package/build/form/view.js.map +1 -0
  49. package/build/form-input/edit.js +124 -0
  50. package/build/form-input/edit.js.map +1 -0
  51. package/build/form-input/index.js +105 -0
  52. package/build/form-input/index.js.map +1 -0
  53. package/build/form-input/init.js +13 -0
  54. package/build/form-input/init.js.map +1 -0
  55. package/build/form-input/save.js +87 -0
  56. package/build/form-input/save.js.map +1 -0
  57. package/build/form-input/variations.js +93 -0
  58. package/build/form-input/variations.js.map +1 -0
  59. package/build/form-submission-notification/edit.js +59 -0
  60. package/build/form-submission-notification/edit.js.map +1 -0
  61. package/build/form-submission-notification/index.js +56 -0
  62. package/build/form-submission-notification/index.js.map +1 -0
  63. package/build/form-submission-notification/init.js +13 -0
  64. package/build/form-submission-notification/init.js.map +1 -0
  65. package/build/form-submission-notification/save.js +33 -0
  66. package/build/form-submission-notification/save.js.map +1 -0
  67. package/build/form-submission-notification/variations.js +63 -0
  68. package/build/form-submission-notification/variations.js.map +1 -0
  69. package/build/form-submit-button/edit.js +32 -0
  70. package/build/form-submit-button/edit.js.map +1 -0
  71. package/build/form-submit-button/index.js +44 -0
  72. package/build/form-submit-button/index.js.map +1 -0
  73. package/build/form-submit-button/init.js +13 -0
  74. package/build/form-submit-button/init.js.map +1 -0
  75. package/build/form-submit-button/save.js +22 -0
  76. package/build/form-submit-button/save.js.map +1 -0
  77. package/build/group/edit.js +2 -11
  78. package/build/group/edit.js.map +1 -1
  79. package/build/group/index.js +0 -1
  80. package/build/group/index.js.map +1 -1
  81. package/build/heading/index.js +3 -2
  82. package/build/heading/index.js.map +1 -1
  83. package/build/html/preview.js +2 -4
  84. package/build/html/preview.js.map +1 -1
  85. package/build/image/image.js +15 -6
  86. package/build/image/image.js.map +1 -1
  87. package/build/image/view.js +71 -39
  88. package/build/image/view.js.map +1 -1
  89. package/build/index.js +10 -0
  90. package/build/index.js.map +1 -1
  91. package/build/latest-posts/edit.js +6 -2
  92. package/build/latest-posts/edit.js.map +1 -1
  93. package/build/list-item/hooks/use-merge.js +15 -15
  94. package/build/list-item/hooks/use-merge.js.map +1 -1
  95. package/build/lock-unlock.js +1 -1
  96. package/build/lock-unlock.js.map +1 -1
  97. package/build/missing/edit.native.js +54 -64
  98. package/build/missing/edit.native.js.map +1 -1
  99. package/build/navigation/edit/index.js +0 -1
  100. package/build/navigation/edit/index.js.map +1 -1
  101. package/build/navigation/index.js +2 -1
  102. package/build/navigation/index.js.map +1 -1
  103. package/build/navigation/view.js +27 -5
  104. package/build/navigation/view.js.map +1 -1
  105. package/build/page-list-item/edit.js +3 -1
  106. package/build/page-list-item/edit.js.map +1 -1
  107. package/build/paragraph/edit.js +1 -1
  108. package/build/paragraph/edit.js.map +1 -1
  109. package/build/paragraph/index.js +7 -0
  110. package/build/paragraph/index.js.map +1 -1
  111. package/build/pattern/index.js +2 -1
  112. package/build/pattern/index.js.map +1 -1
  113. package/build/post-featured-image/dimension-controls.js +2 -2
  114. package/build/post-featured-image/dimension-controls.js.map +1 -1
  115. package/build/query/edit/enhanced-pagination-modal.js +27 -13
  116. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  117. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +15 -12
  118. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  119. package/build/query/utils.js +29 -8
  120. package/build/query/utils.js.map +1 -1
  121. package/build/query/view.js +4 -2
  122. package/build/query/view.js.map +1 -1
  123. package/build/search/edit.js +1 -2
  124. package/build/search/edit.js.map +1 -1
  125. package/build/social-link/edit.native.js +7 -19
  126. package/build/social-link/edit.native.js.map +1 -1
  127. package/build/spacer/controls.js +3 -3
  128. package/build/spacer/controls.js.map +1 -1
  129. package/build/spacer/controls.native.js +2 -1
  130. package/build/spacer/controls.native.js.map +1 -1
  131. package/build/spacer/edit.js +1 -1
  132. package/build/spacer/edit.js.map +1 -1
  133. package/build/spacer/edit.native.js +5 -1
  134. package/build/spacer/edit.native.js.map +1 -1
  135. package/build/tag-cloud/edit.js +2 -1
  136. package/build/tag-cloud/edit.js.map +1 -1
  137. package/build/template-part/edit/inner-blocks.js +2 -2
  138. package/build/template-part/edit/inner-blocks.js.map +1 -1
  139. package/build/template-part/index.js +2 -1
  140. package/build/template-part/index.js.map +1 -1
  141. package/build/term-description/index.js +0 -1
  142. package/build/term-description/index.js.map +1 -1
  143. package/build-module/avatar/index.js +5 -1
  144. package/build-module/avatar/index.js.map +1 -1
  145. package/build-module/block/edit-title.native.js +12 -4
  146. package/build-module/block/edit-title.native.js.map +1 -1
  147. package/build-module/block/index.js +2 -1
  148. package/build-module/block/index.js.map +1 -1
  149. package/build-module/code/edit.native.js +8 -2
  150. package/build-module/code/edit.native.js.map +1 -1
  151. package/build-module/column/edit.js +3 -2
  152. package/build-module/column/edit.js.map +1 -1
  153. package/build-module/column/edit.native.js +3 -2
  154. package/build-module/column/edit.native.js.map +1 -1
  155. package/build-module/columns/edit.native.js +3 -2
  156. package/build-module/columns/edit.native.js.map +1 -1
  157. package/build-module/cover/controls.native.js +3 -2
  158. package/build-module/cover/controls.native.js.map +1 -1
  159. package/build-module/cover/deprecated.js +110 -1
  160. package/build-module/cover/deprecated.js.map +1 -1
  161. package/build-module/cover/edit/index.js +12 -5
  162. package/build-module/cover/edit/index.js.map +1 -1
  163. package/build-module/cover/edit/inspector-controls.js +4 -4
  164. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  165. package/build-module/cover/index.js +0 -3
  166. package/build-module/cover/index.js.map +1 -1
  167. package/build-module/cover/save.js +2 -1
  168. package/build-module/cover/save.js.map +1 -1
  169. package/build-module/cover/shared.js +1 -1
  170. package/build-module/cover/shared.js.map +1 -1
  171. package/build-module/file/view.js +2 -2
  172. package/build-module/file/view.js.map +1 -1
  173. package/build-module/footnotes/index.js +1 -0
  174. package/build-module/footnotes/index.js.map +1 -1
  175. package/build-module/form/edit.js +130 -0
  176. package/build-module/form/edit.js.map +1 -0
  177. package/build-module/form/index.js +82 -0
  178. package/build-module/form/index.js.map +1 -0
  179. package/build-module/form/init.js +6 -0
  180. package/build-module/form/init.js.map +1 -0
  181. package/build-module/form/save.js +20 -0
  182. package/build-module/form/save.js.map +1 -0
  183. package/build-module/form/utils.js +15 -0
  184. package/build-module/form/utils.js.map +1 -0
  185. package/build-module/form/variations.js +86 -0
  186. package/build-module/form/variations.js.map +1 -0
  187. package/build-module/form/view.js +40 -0
  188. package/build-module/form/view.js.map +1 -0
  189. package/build-module/form-input/edit.js +115 -0
  190. package/build-module/form-input/edit.js.map +1 -0
  191. package/build-module/form-input/index.js +95 -0
  192. package/build-module/form-input/index.js.map +1 -0
  193. package/build-module/form-input/init.js +6 -0
  194. package/build-module/form-input/init.js.map +1 -0
  195. package/build-module/form-input/save.js +80 -0
  196. package/build-module/form-input/save.js.map +1 -0
  197. package/build-module/form-input/variations.js +85 -0
  198. package/build-module/form-input/variations.js.map +1 -0
  199. package/build-module/form-submission-notification/edit.js +50 -0
  200. package/build-module/form-submission-notification/edit.js.map +1 -0
  201. package/build-module/form-submission-notification/index.js +47 -0
  202. package/build-module/form-submission-notification/index.js.map +1 -0
  203. package/build-module/form-submission-notification/init.js +6 -0
  204. package/build-module/form-submission-notification/init.js.map +1 -0
  205. package/build-module/form-submission-notification/save.js +25 -0
  206. package/build-module/form-submission-notification/save.js.map +1 -0
  207. package/build-module/form-submission-notification/variations.js +55 -0
  208. package/build-module/form-submission-notification/variations.js.map +1 -0
  209. package/build-module/form-submit-button/edit.js +24 -0
  210. package/build-module/form-submit-button/edit.js.map +1 -0
  211. package/build-module/form-submit-button/index.js +34 -0
  212. package/build-module/form-submit-button/index.js.map +1 -0
  213. package/build-module/form-submit-button/init.js +6 -0
  214. package/build-module/form-submit-button/init.js.map +1 -0
  215. package/build-module/form-submit-button/save.js +14 -0
  216. package/build-module/form-submit-button/save.js.map +1 -0
  217. package/build-module/group/edit.js +3 -12
  218. package/build-module/group/edit.js.map +1 -1
  219. package/build-module/group/index.js +0 -1
  220. package/build-module/group/index.js.map +1 -1
  221. package/build-module/heading/index.js +3 -2
  222. package/build-module/heading/index.js.map +1 -1
  223. package/build-module/html/preview.js +2 -4
  224. package/build-module/html/preview.js.map +1 -1
  225. package/build-module/image/image.js +16 -7
  226. package/build-module/image/image.js.map +1 -1
  227. package/build-module/image/view.js +71 -39
  228. package/build-module/image/view.js.map +1 -1
  229. package/build-module/index.js +10 -0
  230. package/build-module/index.js.map +1 -1
  231. package/build-module/latest-posts/edit.js +6 -2
  232. package/build-module/latest-posts/edit.js.map +1 -1
  233. package/build-module/list-item/hooks/use-merge.js +15 -15
  234. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  235. package/build-module/lock-unlock.js +1 -1
  236. package/build-module/lock-unlock.js.map +1 -1
  237. package/build-module/missing/edit.native.js +58 -68
  238. package/build-module/missing/edit.native.js.map +1 -1
  239. package/build-module/navigation/edit/index.js +0 -1
  240. package/build-module/navigation/edit/index.js.map +1 -1
  241. package/build-module/navigation/index.js +2 -1
  242. package/build-module/navigation/index.js.map +1 -1
  243. package/build-module/navigation/view.js +27 -5
  244. package/build-module/navigation/view.js.map +1 -1
  245. package/build-module/page-list-item/edit.js +3 -1
  246. package/build-module/page-list-item/edit.js.map +1 -1
  247. package/build-module/paragraph/edit.js +2 -2
  248. package/build-module/paragraph/edit.js.map +1 -1
  249. package/build-module/paragraph/index.js +7 -0
  250. package/build-module/paragraph/index.js.map +1 -1
  251. package/build-module/pattern/index.js +2 -1
  252. package/build-module/pattern/index.js.map +1 -1
  253. package/build-module/post-featured-image/dimension-controls.js +3 -3
  254. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  255. package/build-module/query/edit/enhanced-pagination-modal.js +28 -14
  256. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  257. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +17 -14
  258. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  259. package/build-module/query/utils.js +27 -5
  260. package/build-module/query/utils.js.map +1 -1
  261. package/build-module/query/view.js +4 -2
  262. package/build-module/query/view.js.map +1 -1
  263. package/build-module/search/edit.js +2 -3
  264. package/build-module/search/edit.js.map +1 -1
  265. package/build-module/social-link/edit.native.js +8 -20
  266. package/build-module/social-link/edit.native.js.map +1 -1
  267. package/build-module/spacer/controls.js +4 -4
  268. package/build-module/spacer/controls.js.map +1 -1
  269. package/build-module/spacer/controls.native.js +3 -2
  270. package/build-module/spacer/controls.native.js.map +1 -1
  271. package/build-module/spacer/edit.js +2 -2
  272. package/build-module/spacer/edit.js.map +1 -1
  273. package/build-module/spacer/edit.native.js +6 -2
  274. package/build-module/spacer/edit.native.js.map +1 -1
  275. package/build-module/tag-cloud/edit.js +3 -2
  276. package/build-module/tag-cloud/edit.js.map +1 -1
  277. package/build-module/template-part/edit/inner-blocks.js +3 -3
  278. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  279. package/build-module/template-part/index.js +2 -1
  280. package/build-module/template-part/index.js.map +1 -1
  281. package/build-module/term-description/index.js +0 -1
  282. package/build-module/term-description/index.js.map +1 -1
  283. package/build-style/editor-rtl.css +50 -0
  284. package/build-style/editor.css +50 -0
  285. package/build-style/file/style-rtl.css +0 -5
  286. package/build-style/file/style.css +0 -5
  287. package/build-style/form-input/editor-rtl.css +106 -0
  288. package/build-style/form-input/editor.css +106 -0
  289. package/build-style/form-input/style-rtl.css +135 -0
  290. package/build-style/form-input/style.css +135 -0
  291. package/build-style/form-submission-notification/editor-rtl.css +118 -0
  292. package/build-style/form-submission-notification/editor.css +118 -0
  293. package/build-style/form-submit-button/style-rtl.css +91 -0
  294. package/build-style/form-submit-button/style.css +91 -0
  295. package/build-style/image/style-rtl.css +39 -5
  296. package/build-style/image/style.css +39 -5
  297. package/build-style/navigation/style-rtl.css +5 -0
  298. package/build-style/navigation/style.css +5 -0
  299. package/build-style/query/style-rtl.css +0 -10
  300. package/build-style/query/style.css +0 -10
  301. package/build-style/style-rtl.css +92 -10
  302. package/build-style/style.css +92 -10
  303. package/package.json +32 -32
  304. package/src/avatar/block.json +5 -1
  305. package/src/block/block.json +2 -1
  306. package/src/block/edit-title.native.js +16 -13
  307. package/src/calendar/index.php +2 -6
  308. package/src/code/edit.native.js +15 -1
  309. package/src/column/edit.js +3 -8
  310. package/src/column/edit.native.js +3 -8
  311. package/src/columns/edit.native.js +3 -8
  312. package/src/comment-author-avatar/index.php +1 -1
  313. package/src/cover/block.json +0 -3
  314. package/src/cover/controls.native.js +3 -8
  315. package/src/cover/deprecated.js +151 -1
  316. package/src/cover/edit/index.js +15 -5
  317. package/src/cover/edit/inspector-controls.js +22 -33
  318. package/src/cover/save.js +2 -1
  319. package/src/cover/shared.js +1 -1
  320. package/src/editor.scss +2 -0
  321. package/src/file/index.php +2 -1
  322. package/src/file/style.scss +0 -6
  323. package/src/file/view.js +2 -2
  324. package/src/footnotes/block.json +1 -0
  325. package/src/form/block.json +60 -0
  326. package/src/form/edit.js +179 -0
  327. package/src/form/index.js +20 -0
  328. package/src/form/index.php +214 -0
  329. package/src/form/init.js +6 -0
  330. package/src/form/save.js +20 -0
  331. package/src/form/utils.js +39 -0
  332. package/src/form/variations.js +139 -0
  333. package/src/form/view.js +41 -0
  334. package/src/form-input/block.json +73 -0
  335. package/src/form-input/edit.js +151 -0
  336. package/src/form-input/editor.scss +24 -0
  337. package/src/form-input/index.js +20 -0
  338. package/src/form-input/index.php +45 -0
  339. package/src/form-input/init.js +6 -0
  340. package/src/form-input/save.js +83 -0
  341. package/src/form-input/style.scss +61 -0
  342. package/src/form-input/variations.js +82 -0
  343. package/src/form-submission-notification/block.json +19 -0
  344. package/src/form-submission-notification/edit.js +63 -0
  345. package/src/form-submission-notification/editor.scss +45 -0
  346. package/src/form-submission-notification/index.js +26 -0
  347. package/src/form-submission-notification/index.php +48 -0
  348. package/src/form-submission-notification/init.js +6 -0
  349. package/src/form-submission-notification/save.js +28 -0
  350. package/src/form-submission-notification/variations.js +59 -0
  351. package/src/form-submit-button/block.json +14 -0
  352. package/src/form-submit-button/edit.js +33 -0
  353. package/src/form-submit-button/index.js +18 -0
  354. package/src/form-submit-button/init.js +6 -0
  355. package/src/form-submit-button/save.js +14 -0
  356. package/src/form-submit-button/style.scss +3 -0
  357. package/src/freeform/test/__snapshots__/index.native.js.snap +7 -0
  358. package/src/freeform/test/index.native.js +57 -0
  359. package/src/group/block.json +0 -1
  360. package/src/group/edit.js +2 -7
  361. package/src/heading/index.js +4 -2
  362. package/src/html/preview.js +9 -4
  363. package/src/image/image.js +27 -6
  364. package/src/image/index.php +128 -83
  365. package/src/image/style.scss +49 -5
  366. package/src/image/view.js +93 -51
  367. package/src/index.js +10 -0
  368. package/src/latest-posts/edit.js +11 -2
  369. package/src/latest-posts/index.php +17 -8
  370. package/src/list-item/hooks/use-merge.js +20 -23
  371. package/src/lock-unlock.js +1 -1
  372. package/src/missing/edit.native.js +56 -117
  373. package/src/missing/style.native.scss +0 -67
  374. package/src/missing/test/edit-integration.native.js +135 -49
  375. package/src/missing/test/edit.native.js +0 -41
  376. package/src/navigation/block.json +2 -1
  377. package/src/navigation/edit/index.js +0 -1
  378. package/src/navigation/index.php +28 -8
  379. package/src/navigation/style.scss +6 -1
  380. package/src/navigation/view.js +25 -6
  381. package/src/page-list-item/edit.js +2 -0
  382. package/src/paragraph/edit.js +2 -2
  383. package/src/paragraph/index.js +10 -0
  384. package/src/pattern/block.json +2 -1
  385. package/src/pattern/index.php +0 -3
  386. package/src/post-featured-image/dimension-controls.js +3 -3
  387. package/src/post-navigation-link/index.php +2 -1
  388. package/src/preformatted/test/edit.native.js +38 -0
  389. package/src/query/edit/enhanced-pagination-modal.js +37 -21
  390. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +18 -22
  391. package/src/query/index.php +100 -10
  392. package/src/query/style.scss +0 -11
  393. package/src/query/utils.js +29 -8
  394. package/src/query/view.js +11 -2
  395. package/src/query-pagination-next/index.php +1 -1
  396. package/src/query-pagination-previous/index.php +1 -1
  397. package/src/search/edit.js +5 -3
  398. package/src/search/index.php +0 -4
  399. package/src/social-link/edit.native.js +12 -26
  400. package/src/social-link/editor.native.scss +0 -9
  401. package/src/social-link/index.php +2 -2
  402. package/src/spacer/controls.js +9 -12
  403. package/src/spacer/controls.native.js +3 -8
  404. package/src/spacer/edit.js +2 -2
  405. package/src/spacer/edit.native.js +6 -5
  406. package/src/style.scss +1 -0
  407. package/src/tag-cloud/edit.js +3 -7
  408. package/src/template-part/block.json +2 -1
  409. package/src/template-part/edit/inner-blocks.js +3 -3
  410. package/src/template-part/index.php +4 -7
  411. package/src/term-description/block.json +0 -1
  412. package/src/verse/test/edit.native.js +37 -0
@@ -317,7 +317,9 @@ button.wp-block-navigation-item__content {
317
317
  // When set to open on click, a button element is used.
318
318
  // We pad it to include the arrow icon in the clickable area.
319
319
  // The padding can be blanket for click, since you can't set click and hide the icon.
320
+ // This is only applied to the submenu in the page list block.
320
321
  .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle {
322
+ padding-left: 0; // Remove the browser default padding.
321
323
  padding-right: 0.6em + 0.25em; // Same size as icon plus margin.
322
324
 
323
325
  + .wp-block-navigation__submenu-icon {
@@ -325,7 +327,10 @@ button.wp-block-navigation-item__content {
325
327
  pointer-events: none; // Make the icon inert to allow click on the button.
326
328
  }
327
329
  }
328
-
330
+ // Remove the browser default padding on the button element used in the navigation link submenu.
331
+ .wp-block-navigation-item.open-on-click button.wp-block-navigation-item__content:not(.wp-block-navigation-submenu__toggle) {
332
+ padding: 0;
333
+ }
329
334
 
330
335
  /**
331
336
  * Margins
@@ -13,10 +13,14 @@ const focusableSelectors = [
13
13
  '[tabindex]:not([tabindex^="-"])',
14
14
  ];
15
15
 
16
+ // This is a fix for Safari in iOS/iPadOS. Without it, Safari doesn't focus out
17
+ // when the user taps in the body. It can be removed once we add an overlay to
18
+ // capture the clicks, instead of relying on the focusout event.
19
+ document.addEventListener( 'click', () => {} );
20
+
16
21
  const openMenu = ( store, menuOpenedOn ) => {
17
- const { context, ref, selectors } = store;
22
+ const { context, selectors } = store;
18
23
  selectors.core.navigation.menuOpenedBy( store )[ menuOpenedOn ] = true;
19
- context.core.navigation.previousFocus = ref;
20
24
  if ( context.core.navigation.type === 'overlay' ) {
21
25
  // Add a `has-modal-open` class to the <html> root.
22
26
  document.documentElement.classList.add( 'has-modal-open' );
@@ -33,7 +37,7 @@ const closeMenu = ( store, menuClosedOn ) => {
33
37
  window.document.activeElement
34
38
  )
35
39
  ) {
36
- context.core.navigation.previousFocus.focus();
40
+ context.core.navigation.previousFocus?.focus();
37
41
  }
38
42
  context.core.navigation.modal = null;
39
43
  context.core.navigation.previousFocus = null;
@@ -87,6 +91,13 @@ wpStore( {
87
91
  ? 'true'
88
92
  : null;
89
93
  },
94
+ ariaLabel: ( store ) => {
95
+ const { context, selectors } = store;
96
+ return context.core.navigation.type === 'overlay' &&
97
+ selectors.core.navigation.isMenuOpen( store )
98
+ ? context.core.navigation.ariaLabel
99
+ : null;
100
+ },
90
101
  isMenuOpen: ( { context } ) =>
91
102
  // The menu is opened if either `click`, `hover` or `focus` is true.
92
103
  Object.values(
@@ -123,6 +134,8 @@ wpStore( {
123
134
  closeMenu( store, 'hover' );
124
135
  },
125
136
  openMenuOnClick( store ) {
137
+ const { context, ref } = store;
138
+ context.core.navigation.previousFocus = ref;
126
139
  openMenu( store, 'click' );
127
140
  },
128
141
  closeMenuOnClick( store ) {
@@ -133,13 +146,16 @@ wpStore( {
133
146
  openMenu( store, 'focus' );
134
147
  },
135
148
  toggleMenuOnClick: ( store ) => {
136
- const { selectors } = store;
149
+ const { selectors, context, ref } = store;
150
+ // Safari won't send focus to the clicked element, so we need to manually place it: https://bugs.webkit.org/show_bug.cgi?id=22261
151
+ if ( window.document.activeElement !== ref ) ref.focus();
137
152
  const menuOpenedBy =
138
153
  selectors.core.navigation.menuOpenedBy( store );
139
154
  if ( menuOpenedBy.click || menuOpenedBy.focus ) {
140
155
  closeMenu( store, 'click' );
141
156
  closeMenu( store, 'focus' );
142
157
  } else {
158
+ context.core.navigation.previousFocus = ref;
143
159
  openMenu( store, 'click' );
144
160
  }
145
161
  },
@@ -187,11 +203,14 @@ wpStore( {
187
203
  // event.relatedTarget === The element receiving focus (if any)
188
204
  // When focusout is outsite the document,
189
205
  // `window.document.activeElement` doesn't change.
206
+
207
+ // The event.relatedTarget is null when something outside the navigation menu is clicked. This is only necessary for Safari.
190
208
  if (
191
- ! context.core.navigation.modal?.contains(
209
+ event.relatedTarget === null ||
210
+ ( ! context.core.navigation.modal?.contains(
192
211
  event.relatedTarget
193
212
  ) &&
194
- event.target !== window.document.activeElement
213
+ event.target !== window.document.activeElement )
195
214
  ) {
196
215
  closeMenu( store, 'click' );
197
216
  closeMenu( store, 'focus' );
@@ -64,6 +64,7 @@ export default function PageListItemEdit( { context, attributes } ) {
64
64
  { hasChildren && context.openSubmenusOnClick ? (
65
65
  <>
66
66
  <button
67
+ type="button"
67
68
  className="wp-block-navigation-item__content wp-block-navigation-submenu__toggle"
68
69
  aria-expanded="false"
69
70
  >
@@ -90,6 +91,7 @@ export default function PageListItemEdit( { context, attributes } ) {
90
91
  <button
91
92
  className="wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
92
93
  aria-expanded="false"
94
+ type="button"
93
95
  >
94
96
  <ItemSubmenuIcon />
95
97
  </button>
@@ -18,7 +18,7 @@ import {
18
18
  InspectorControls,
19
19
  RichText,
20
20
  useBlockProps,
21
- useSetting,
21
+ useSettings,
22
22
  } from '@wordpress/block-editor';
23
23
  import { createBlock } from '@wordpress/blocks';
24
24
  import { formatLtr } from '@wordpress/icons';
@@ -58,7 +58,7 @@ function ParagraphBlock( {
58
58
  clientId,
59
59
  } ) {
60
60
  const { align, content, direction, dropCap, placeholder } = attributes;
61
- const isDropCapFeatureEnabled = useSetting( 'typography.dropCap' );
61
+ const [ isDropCapFeatureEnabled ] = useSettings( 'typography.dropCap' );
62
62
  const blockProps = useBlockProps( {
63
63
  ref: useOnEnter( { clientId, content } ),
64
64
  className: classnames( {
@@ -28,7 +28,17 @@ export const settings = {
28
28
  },
29
29
  },
30
30
  __experimentalLabel( attributes, { context } ) {
31
+ const customName = attributes?.metadata?.name;
32
+
33
+ if ( context === 'list-view' && customName ) {
34
+ return customName;
35
+ }
36
+
31
37
  if ( context === 'accessibility' ) {
38
+ if ( customName ) {
39
+ return customName;
40
+ }
41
+
32
42
  const { content } = attributes;
33
43
  return ! content || content.length === 0 ? __( 'Empty' ) : content;
34
44
  }
@@ -7,7 +7,8 @@
7
7
  "description": "Show a block pattern.",
8
8
  "supports": {
9
9
  "html": false,
10
- "inserter": false
10
+ "inserter": false,
11
+ "renaming": false
11
12
  },
12
13
  "textdomain": "default",
13
14
  "attributes": {
@@ -7,8 +7,6 @@
7
7
 
8
8
  /**
9
9
  * Registers the `core/pattern` block on the server.
10
- *
11
- * @return void
12
10
  */
13
11
  function register_block_core_pattern() {
14
12
  register_block_type_from_metadata(
@@ -46,7 +44,6 @@ function render_block_core_pattern( $attributes ) {
46
44
  // Backward compatibility for handling Block Hooks and injecting the theme attribute in the Gutenberg plugin.
47
45
  // This can be removed when the minimum supported WordPress is >= 6.4.
48
46
  if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && ! function_exists( 'traverse_and_serialize_blocks' ) ) {
49
- $content = _inject_theme_attribute_in_block_template_content( $content );
50
47
  $blocks = parse_blocks( $content );
51
48
  $content = gutenberg_serialize_blocks( $blocks );
52
49
  }
@@ -10,7 +10,7 @@ import {
10
10
  __experimentalUseCustomUnits as useCustomUnits,
11
11
  __experimentalToolsPanelItem as ToolsPanelItem,
12
12
  } from '@wordpress/components';
13
- import { InspectorControls, useSetting } from '@wordpress/block-editor';
13
+ import { InspectorControls, useSettings } from '@wordpress/block-editor';
14
14
 
15
15
  const SCALE_OPTIONS = (
16
16
  <>
@@ -53,9 +53,9 @@ const DimensionControls = ( {
53
53
  setAttributes,
54
54
  imageSizeOptions = [],
55
55
  } ) => {
56
- const defaultUnits = [ 'px', '%', 'vw', 'em', 'rem' ];
56
+ const [ availableUnits ] = useSettings( 'spacing.units' );
57
57
  const units = useCustomUnits( {
58
- availableUnits: useSetting( 'spacing.units' ) || defaultUnits,
58
+ availableUnits: availableUnits || [ 'px', '%', 'vw', 'em', 'rem' ],
59
59
  } );
60
60
  const onDimensionChange = ( dimension, nextValue ) => {
61
61
  const parsedValue = parseFloat( nextValue );
@@ -38,6 +38,7 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
38
38
  $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link' ) : _x( 'Previous', 'label for previous post link' );
39
39
  $label = '';
40
40
 
41
+ // Only use hardcoded values here, otherwise we need to add escaping where these values are used.
41
42
  $arrow_map = array(
42
43
  'none' => '',
43
44
  'arrow' => array(
@@ -88,7 +89,7 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
88
89
  }
89
90
 
90
91
  // Display arrows.
91
- if ( isset( $attributes['arrow'] ) && ! empty( $attributes['arrow'] ) && 'none' !== $attributes['arrow'] ) {
92
+ if ( isset( $attributes['arrow'] ) && 'none' !== $attributes['arrow'] && isset( $arrow_map[ $attributes['arrow'] ] ) ) {
92
93
  $arrow = $arrow_map[ $attributes['arrow'] ][ $navigation_type ];
93
94
 
94
95
  if ( 'next' === $navigation_type ) {
@@ -70,4 +70,42 @@ describe( 'Preformatted', () => {
70
70
  <!-- /wp:preformatted -->"
71
71
  ` );
72
72
  } );
73
+
74
+ it( 'should split on triple Enter', async () => {
75
+ // Arrange
76
+ const screen = await initializeEditor();
77
+
78
+ // Act
79
+ await addBlock( screen, 'Preformatted' );
80
+ const preformattedTextInput = await screen.findByPlaceholderText(
81
+ 'Write preformatted text…'
82
+ );
83
+ typeInRichText( preformattedTextInput, 'Hello' );
84
+ fireEvent( preformattedTextInput, 'onKeyDown', {
85
+ nativeEvent: {},
86
+ preventDefault() {},
87
+ keyCode: ENTER,
88
+ } );
89
+ fireEvent( preformattedTextInput, 'onKeyDown', {
90
+ nativeEvent: {},
91
+ preventDefault() {},
92
+ keyCode: ENTER,
93
+ } );
94
+ fireEvent( preformattedTextInput, 'onKeyDown', {
95
+ nativeEvent: {},
96
+ preventDefault() {},
97
+ keyCode: ENTER,
98
+ } );
99
+
100
+ // Assert
101
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
102
+ "<!-- wp:preformatted -->
103
+ <pre class="wp-block-preformatted">Hello</pre>
104
+ <!-- /wp:preformatted -->
105
+
106
+ <!-- wp:paragraph -->
107
+ <p></p>
108
+ <!-- /wp:paragraph -->"
109
+ ` );
110
+ } );
73
111
  } );
@@ -12,11 +12,7 @@ import { useState, useEffect } from '@wordpress/element';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import { useContainsThirdPartyBlocks } from '../utils';
16
-
17
- const disableEnhancedPaginationDescription = __(
18
- 'Plugin blocks are not supported yet. For the enhanced pagination to work, remove the plugin block, then re-enable "Enhanced pagination" in the Query Block settings.'
19
- );
15
+ import { useUnsupportedBlocks } from '../utils';
20
16
 
21
17
  const modalDescriptionId =
22
18
  'wp-block-query-enhanced-pagination-modal__description';
@@ -27,35 +23,55 @@ export default function EnhancedPaginationModal( {
27
23
  setAttributes,
28
24
  } ) {
29
25
  const [ isOpen, setOpen ] = useState( false );
30
-
31
- const containsThirdPartyBlocks = useContainsThirdPartyBlocks( clientId );
26
+ const { hasBlocksFromPlugins, hasPostContentBlock, hasUnsupportedBlocks } =
27
+ useUnsupportedBlocks( clientId );
32
28
 
33
29
  useEffect( () => {
34
- setOpen( containsThirdPartyBlocks && enhancedPagination );
35
- }, [ containsThirdPartyBlocks, enhancedPagination, setOpen ] );
30
+ if ( enhancedPagination && hasUnsupportedBlocks ) {
31
+ setAttributes( { enhancedPagination: false } );
32
+ setOpen( true );
33
+ }
34
+ }, [ enhancedPagination, hasUnsupportedBlocks, setAttributes ] );
35
+
36
+ const closeModal = () => {
37
+ setOpen( false );
38
+ };
39
+
40
+ let notice = __(
41
+ 'If you still want to prevent full page reloads, remove that block, then disable "Force page reload" again in the Query Block settings.'
42
+ );
43
+ if ( hasBlocksFromPlugins ) {
44
+ notice =
45
+ __(
46
+ 'Currently, avoiding full page reloads is not possible when blocks from plugins are present inside the Query block.'
47
+ ) +
48
+ ' ' +
49
+ notice;
50
+ } else if ( hasPostContentBlock ) {
51
+ notice =
52
+ __(
53
+ 'Currently, avoiding full page reloads is not possible when a Content block is present inside the Query block.'
54
+ ) +
55
+ ' ' +
56
+ notice;
57
+ }
36
58
 
37
59
  return (
38
60
  isOpen && (
39
61
  <Modal
40
- title={ __( 'Enhanced pagination will be disabled' ) }
62
+ title={ __( 'Query block: Force page reload enabled' ) }
41
63
  className="wp-block-query__enhanced-pagination-modal"
42
64
  aria={ {
43
65
  describedby: modalDescriptionId,
44
66
  } }
67
+ role="alertdialog"
68
+ focusOnMount="firstElement"
45
69
  isDismissible={ false }
46
- shouldCloseOnEsc={ false }
47
- shouldCloseOnClickOutside={ false }
70
+ onRequestClose={ closeModal }
48
71
  >
49
72
  <VStack alignment="right" spacing={ 5 }>
50
- <span id={ modalDescriptionId }>
51
- { disableEnhancedPaginationDescription }
52
- </span>
53
- <Button
54
- variant="primary"
55
- onClick={ () => {
56
- setAttributes( { enhancedPagination: false } );
57
- } }
58
- >
73
+ <span id={ modalDescriptionId }>{ notice }</span>
74
+ <Button variant="primary" onClick={ closeModal }>
59
75
  { __( 'OK' ) }
60
76
  </Button>
61
77
  </VStack>
@@ -1,49 +1,45 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { ToggleControl, Notice } from '@wordpress/components';
4
+ import { ToggleControl } from '@wordpress/components';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
- import { useContainsThirdPartyBlocks } from '../../utils';
10
+ import { useUnsupportedBlocks } from '../../utils';
11
11
 
12
12
  export default function EnhancedPaginationControl( {
13
13
  enhancedPagination,
14
14
  setAttributes,
15
15
  clientId,
16
16
  } ) {
17
- const enhancedPaginationNotice = __(
18
- "Enhanced pagination doesn't support plugin blocks yet. If you want to enable it, you have to remove all plugin blocks from the Query Loop."
19
- );
17
+ const { hasUnsupportedBlocks } = useUnsupportedBlocks( clientId );
20
18
 
21
- const containsThirdPartyBlocks = useContainsThirdPartyBlocks( clientId );
19
+ let help = __( 'Browsing between pages requires a full page reload.' );
20
+ if ( enhancedPagination ) {
21
+ help = __(
22
+ "Browsing between pages won't require a full page reload, unless non-compatible blocks are detected."
23
+ );
24
+ } else if ( hasUnsupportedBlocks ) {
25
+ help = __(
26
+ "Force page reload can't be disabled because there are non-compatible blocks inside the Query block."
27
+ );
28
+ }
22
29
 
23
30
  return (
24
31
  <>
25
32
  <ToggleControl
26
- label={ __( 'Enhanced pagination' ) }
27
- help={ __(
28
- 'Browsing between pages won’t require a full page reload.'
29
- ) }
30
- checked={ !! enhancedPagination }
31
- disabled={ containsThirdPartyBlocks }
33
+ label={ __( 'Force page reload' ) }
34
+ help={ help }
35
+ checked={ ! enhancedPagination }
36
+ disabled={ hasUnsupportedBlocks }
32
37
  onChange={ ( value ) => {
33
38
  setAttributes( {
34
- enhancedPagination: !! value,
39
+ enhancedPagination: ! value,
35
40
  } );
36
41
  } }
37
42
  />
38
- { containsThirdPartyBlocks && (
39
- <Notice
40
- status="warning"
41
- isDismissible={ false }
42
- className="wp-block-query__enhanced-pagination-notice"
43
- >
44
- { enhancedPaginationNotice }
45
- </Notice>
46
- ) }
47
43
  </>
48
44
  );
49
45
  }
@@ -10,14 +10,14 @@
10
10
  *
11
11
  * @since 6.4.0
12
12
  *
13
- * @param array $attributes Block attributes.
14
- * @param string $content Block default content.
15
- * @param string $block Block instance.
13
+ * @param array $attributes Block attributes.
14
+ * @param string $content Block default content.
15
+ * @param WP_Block $block The block instance.
16
16
  *
17
17
  * @return string Returns the modified output of the query block.
18
18
  */
19
19
  function render_block_core_query( $attributes, $content, $block ) {
20
- if ( $attributes['enhancedPagination'] ) {
20
+ if ( $attributes['enhancedPagination'] && isset( $attributes['queryId'] ) ) {
21
21
  $p = new WP_HTML_Tag_Processor( $content );
22
22
  if ( $p->next_tag() ) {
23
23
  // Add the necessary directives.
@@ -34,7 +34,8 @@ function render_block_core_query( $attributes, $content, $block ) {
34
34
  'loadedText' => __( 'Page Loaded.' ),
35
35
  ),
36
36
  ),
37
- )
37
+ ),
38
+ JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
38
39
  )
39
40
  );
40
41
  $content = $p->get_updated_html();
@@ -47,7 +48,7 @@ function render_block_core_query( $attributes, $content, $block ) {
47
48
  $content = substr_replace(
48
49
  $content,
49
50
  '<div
50
- class="wp-block-query__enhanced-pagination-navigation-announce"
51
+ class="screen-reader-text"
51
52
  aria-live="polite"
52
53
  data-wp-text="context.core.query.message"
53
54
  ></div>
@@ -66,11 +67,14 @@ function render_block_core_query( $attributes, $content, $block ) {
66
67
  if ( ! wp_script_is( $view_asset ) ) {
67
68
  $script_handles = $block->block_type->view_script_handles;
68
69
  // If the script is not needed, and it is still in the `view_script_handles`, remove it.
69
- if ( ! $attributes['enhancedPagination'] && in_array( $view_asset, $script_handles, true ) ) {
70
+ if (
71
+ ( ! $attributes['enhancedPagination'] || ! isset( $attributes['queryId'] ) )
72
+ && in_array( $view_asset, $script_handles, true )
73
+ ) {
70
74
  $block->block_type->view_script_handles = array_diff( $script_handles, array( $view_asset ) );
71
75
  }
72
76
  // If the script is needed, but it was previously removed, add it again.
73
- if ( $attributes['enhancedPagination'] && ! in_array( $view_asset, $script_handles, true ) ) {
77
+ if ( $attributes['enhancedPagination'] && isset( $attributes['queryId'] ) && ! in_array( $view_asset, $script_handles, true ) ) {
74
78
  $block->block_type->view_script_handles = array_merge( $script_handles, array( $view_asset ) );
75
79
  }
76
80
  }
@@ -79,11 +83,14 @@ function render_block_core_query( $attributes, $content, $block ) {
79
83
  if ( ! wp_style_is( $style_asset ) ) {
80
84
  $style_handles = $block->block_type->style_handles;
81
85
  // If the styles are not needed, and they are still in the `style_handles`, remove them.
82
- if ( ! $attributes['enhancedPagination'] && in_array( $style_asset, $style_handles, true ) ) {
86
+ if (
87
+ ( ! $attributes['enhancedPagination'] || ! isset( $attributes['queryId'] ) )
88
+ && in_array( $style_asset, $style_handles, true )
89
+ ) {
83
90
  $block->block_type->style_handles = array_diff( $style_handles, array( $style_asset ) );
84
91
  }
85
92
  // If the styles are needed, but they were previously removed, add them again.
86
- if ( $attributes['enhancedPagination'] && ! in_array( $style_asset, $style_handles, true ) ) {
93
+ if ( $attributes['enhancedPagination'] && isset( $attributes['queryId'] ) && ! in_array( $style_asset, $style_handles, true ) ) {
87
94
  $block->block_type->style_handles = array_merge( $style_handles, array( $style_asset ) );
88
95
  }
89
96
  }
@@ -122,3 +129,86 @@ function register_block_core_query() {
122
129
  );
123
130
  }
124
131
  add_action( 'init', 'register_block_core_query' );
132
+
133
+ /**
134
+ * Traverse the tree of blocks looking for any plugin block (i.e., a block from
135
+ * an installed plugin) inside a Query block with the enhanced pagination
136
+ * enabled. If at least one is found, the enhanced pagination is effectively
137
+ * disabled to prevent any potential incompatibilities.
138
+ *
139
+ * @since 6.4.0
140
+ *
141
+ * @param array $parsed_block The block being rendered.
142
+ * @return string Returns the parsed block, unmodified.
143
+ */
144
+ function block_core_query_disable_enhanced_pagination( $parsed_block ) {
145
+ static $enhanced_query_stack = array();
146
+ static $dirty_enhanced_queries = array();
147
+ static $render_query_callback = null;
148
+
149
+ $block_name = $parsed_block['blockName'];
150
+
151
+ if (
152
+ 'core/query' === $block_name &&
153
+ isset( $parsed_block['attrs']['enhancedPagination'] ) &&
154
+ true === $parsed_block['attrs']['enhancedPagination'] &&
155
+ isset( $parsed_block['attrs']['queryId'] )
156
+ ) {
157
+ $enhanced_query_stack[] = $parsed_block['attrs']['queryId'];
158
+
159
+ if ( ! isset( $render_query_callback ) ) {
160
+ /**
161
+ * Filter that disables the enhanced pagination feature during block
162
+ * rendering when a plugin block has been found inside. It does so
163
+ * by adding an attribute called `data-wp-navigation-disabled` which
164
+ * is later handled by the front-end logic.
165
+ *
166
+ * @param string $content The block content.
167
+ * @param array $block The full block, including name and attributes.
168
+ * @return string Returns the modified output of the query block.
169
+ */
170
+ $render_query_callback = static function ( $content, $block ) use ( &$enhanced_query_stack, &$dirty_enhanced_queries, &$render_query_callback ) {
171
+ $has_enhanced_pagination =
172
+ isset( $block['attrs']['enhancedPagination'] ) &&
173
+ true === $block['attrs']['enhancedPagination'] &&
174
+ isset( $block['attrs']['queryId'] );
175
+
176
+ if ( ! $has_enhanced_pagination ) {
177
+ return $content;
178
+ }
179
+
180
+ if ( isset( $dirty_enhanced_queries[ $block['attrs']['queryId'] ] ) ) {
181
+ $p = new WP_HTML_Tag_Processor( $content );
182
+ if ( $p->next_tag() ) {
183
+ $p->set_attribute( 'data-wp-navigation-disabled', 'true' );
184
+ }
185
+ $content = $p->get_updated_html();
186
+ $dirty_enhanced_queries[ $block['attrs']['queryId'] ] = null;
187
+ }
188
+
189
+ array_pop( $enhanced_query_stack );
190
+
191
+ if ( empty( $enhanced_query_stack ) ) {
192
+ remove_filter( 'render_block_core/query', $render_query_callback );
193
+ $render_query_callback = null;
194
+ }
195
+
196
+ return $content;
197
+ };
198
+
199
+ add_filter( 'render_block_core/query', $render_query_callback, 10, 2 );
200
+ }
201
+ } elseif (
202
+ ! empty( $enhanced_query_stack ) &&
203
+ isset( $block_name ) &&
204
+ ( ! str_starts_with( $block_name, 'core/' ) || 'core/post-content' === $block_name )
205
+ ) {
206
+ foreach ( $enhanced_query_stack as $query_id ) {
207
+ $dirty_enhanced_queries[ $query_id ] = true;
208
+ }
209
+ }
210
+
211
+ return $parsed_block;
212
+ }
213
+
214
+ add_filter( 'render_block_data', 'block_core_query_disable_enhanced_pagination', 10, 1 );
@@ -50,14 +50,3 @@
50
50
  opacity: 0;
51
51
  }
52
52
  }
53
-
54
- .wp-block-query__enhanced-pagination-navigation-announce {
55
- position: absolute;
56
- clip: rect(0, 0, 0, 0);
57
- width: 1px;
58
- height: 1px;
59
- padding: 0;
60
- margin: -1px;
61
- overflow: hidden;
62
- border: 0;
63
- }
@@ -346,22 +346,43 @@ export const usePatterns = ( clientId, name ) => {
346
346
  };
347
347
 
348
348
  /**
349
- * Hook that returns whether the Query Loop with the given `clientId` contains
350
- * any third-party block.
349
+ * The object returned by useUnsupportedBlocks with info about the type of
350
+ * unsupported blocks present inside the Query block.
351
+ *
352
+ * @typedef {Object} UnsupportedBlocksInfo
353
+ * @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.
354
+ * @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.
355
+ * @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.
356
+ */
357
+
358
+ /**
359
+ * Hook that returns an object with information about the unsupported blocks
360
+ * present inside a Query Loop with the given `clientId`. The returned object
361
+ * contains props that are true when a certain type of unsupported block is
362
+ * present.
351
363
  *
352
364
  * @param {string} clientId The block's client ID.
353
- * @return {boolean} True if it contains third-party blocks.
365
+ * @return {UnsupportedBlocksInfo} The object containing the information.
354
366
  */
355
- export const useContainsThirdPartyBlocks = ( clientId ) => {
367
+ export const useUnsupportedBlocks = ( clientId ) => {
356
368
  return useSelect(
357
369
  ( select ) => {
358
370
  const { getClientIdsOfDescendants, getBlockName } =
359
371
  select( blockEditorStore );
360
-
361
- return getClientIdsOfDescendants( clientId ).some(
362
- ( descendantClientId ) =>
363
- ! getBlockName( descendantClientId ).startsWith( 'core/' )
372
+ const blocks = {};
373
+ getClientIdsOfDescendants( clientId ).forEach(
374
+ ( descendantClientId ) => {
375
+ const blockName = getBlockName( descendantClientId );
376
+ if ( ! blockName.startsWith( 'core/' ) ) {
377
+ blocks.hasBlocksFromPlugins = true;
378
+ } else if ( blockName === 'core/post-content' ) {
379
+ blocks.hasPostContentBlock = true;
380
+ }
381
+ }
364
382
  );
383
+ blocks.hasUnsupportedBlocks =
384
+ blocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;
385
+ return blocks;
365
386
  },
366
387
  [ clientId ]
367
388
  );