@wordpress/block-library 8.18.0 → 8.19.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 (393) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -1
  3. package/build/block/edit.js +53 -2
  4. package/build/block/edit.js.map +1 -1
  5. package/build/button/edit.js +7 -4
  6. package/build/button/edit.js.map +1 -1
  7. package/build/button/index.js +11 -2
  8. package/build/button/index.js.map +1 -1
  9. package/build/button/save.js +10 -4
  10. package/build/button/save.js.map +1 -1
  11. package/build/buttons/edit.js +12 -3
  12. package/build/buttons/edit.js.map +1 -1
  13. package/build/code/edit.js +8 -2
  14. package/build/code/edit.js.map +1 -1
  15. package/build/code/index.js +7 -1
  16. package/build/code/index.js.map +1 -1
  17. package/build/column/edit.native.js +5 -5
  18. package/build/column/edit.native.js.map +1 -1
  19. package/build/column/index.js +1 -0
  20. package/build/column/index.js.map +1 -1
  21. package/build/columns/index.js +2 -0
  22. package/build/columns/index.js.map +1 -1
  23. package/build/file/edit.native.js +1 -1
  24. package/build/file/edit.native.js.map +1 -1
  25. package/build/file/index.js +2 -1
  26. package/build/file/index.js.map +1 -1
  27. package/build/file/utils/index.js +1 -15
  28. package/build/file/utils/index.js.map +1 -1
  29. package/build/file/view.js +14 -1
  30. package/build/file/view.js.map +1 -1
  31. package/build/footnotes/edit.js +14 -5
  32. package/build/footnotes/edit.js.map +1 -1
  33. package/build/gallery/edit.js +1 -1
  34. package/build/gallery/edit.js.map +1 -1
  35. package/build/group/edit.js +0 -1
  36. package/build/group/edit.js.map +1 -1
  37. package/build/group/index.js +5 -0
  38. package/build/group/index.js.map +1 -1
  39. package/build/heading/edit.js +0 -1
  40. package/build/heading/edit.js.map +1 -1
  41. package/build/heading/index.js +2 -0
  42. package/build/heading/index.js.map +1 -1
  43. package/build/heading/transforms.js +3 -6
  44. package/build/heading/transforms.js.map +1 -1
  45. package/build/image/deprecated.js +191 -7
  46. package/build/image/deprecated.js.map +1 -1
  47. package/build/image/edit.js +27 -12
  48. package/build/image/edit.js.map +1 -1
  49. package/build/image/image.js +75 -40
  50. package/build/image/image.js.map +1 -1
  51. package/build/image/index.js +7 -4
  52. package/build/image/index.js.map +1 -1
  53. package/build/image/{view-interactivity.js → view.js} +1 -1
  54. package/build/image/view.js.map +1 -0
  55. package/build/list/deprecated.js +93 -1
  56. package/build/list/deprecated.js.map +1 -1
  57. package/build/list/edit.js +10 -10
  58. package/build/list/edit.js.map +1 -1
  59. package/build/list/ordered-list-settings.js +10 -10
  60. package/build/list/ordered-list-settings.js.map +1 -1
  61. package/build/list/save.js +4 -2
  62. package/build/list/save.js.map +1 -1
  63. package/build/list/utils.js +21 -2
  64. package/build/list/utils.js.map +1 -1
  65. package/build/navigation/constants.js +1 -1
  66. package/build/navigation/constants.js.map +1 -1
  67. package/build/navigation/index.js +4 -2
  68. package/build/navigation/index.js.map +1 -1
  69. package/build/navigation/view.js +168 -82
  70. package/build/navigation/view.js.map +1 -1
  71. package/build/navigation-link/edit.js +3 -9
  72. package/build/navigation-link/edit.js.map +1 -1
  73. package/build/navigation-link/transforms.js +24 -0
  74. package/build/navigation-link/transforms.js.map +1 -1
  75. package/build/page-list/edit.js +2 -1
  76. package/build/page-list/edit.js.map +1 -1
  77. package/build/post-comments-form/edit.js +10 -2
  78. package/build/post-comments-form/edit.js.map +1 -1
  79. package/build/post-comments-form/form.js +5 -3
  80. package/build/post-comments-form/form.js.map +1 -1
  81. package/build/post-content/edit.js +8 -7
  82. package/build/post-content/edit.js.map +1 -1
  83. package/build/post-content/index.js +3 -0
  84. package/build/post-content/index.js.map +1 -1
  85. package/build/post-featured-image/overlay.js +2 -1
  86. package/build/post-featured-image/overlay.js.map +1 -1
  87. package/build/post-terms/use-post-terms.js +3 -2
  88. package/build/post-terms/use-post-terms.js.map +1 -1
  89. package/build/preformatted/edit.js +4 -1
  90. package/build/preformatted/edit.js.map +1 -1
  91. package/build/preformatted/index.js +1 -1
  92. package/build/preformatted/index.js.map +1 -1
  93. package/build/pullquote/deprecated.js +6 -7
  94. package/build/pullquote/deprecated.js.map +1 -1
  95. package/build/query/edit/enhanced-pagination-modal.js +56 -0
  96. package/build/query/edit/enhanced-pagination-modal.js.map +1 -0
  97. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +42 -0
  98. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -0
  99. package/build/query/edit/inspector-controls/index.js +8 -25
  100. package/build/query/edit/inspector-controls/index.js.map +1 -1
  101. package/build/query/edit/query-content.js +8 -2
  102. package/build/query/edit/query-content.js.map +1 -1
  103. package/build/query/utils.js +19 -0
  104. package/build/query/utils.js.map +1 -1
  105. package/build/query/view.js +4 -5
  106. package/build/query/view.js.map +1 -1
  107. package/build/search/index.js +1 -0
  108. package/build/search/index.js.map +1 -1
  109. package/build/search/view.js +81 -150
  110. package/build/search/view.js.map +1 -1
  111. package/build/social-link/edit.native.js +3 -1
  112. package/build/social-link/edit.native.js.map +1 -1
  113. package/build/table/edit.js +7 -7
  114. package/build/table/edit.js.map +1 -1
  115. package/build/table-of-contents/edit.js +2 -130
  116. package/build/table-of-contents/edit.js.map +1 -1
  117. package/build/table-of-contents/hooks.js +145 -0
  118. package/build/table-of-contents/hooks.js.map +1 -0
  119. package/build/table-of-contents/index.js +2 -1
  120. package/build/table-of-contents/index.js.map +1 -1
  121. package/build/verse/edit.js +4 -1
  122. package/build/verse/edit.js.map +1 -1
  123. package/build/verse/index.js +1 -1
  124. package/build/verse/index.js.map +1 -1
  125. package/build-module/block/edit.js +54 -3
  126. package/build-module/block/edit.js.map +1 -1
  127. package/build-module/button/edit.js +7 -4
  128. package/build-module/button/edit.js.map +1 -1
  129. package/build-module/button/index.js +11 -2
  130. package/build-module/button/index.js.map +1 -1
  131. package/build-module/button/save.js +10 -4
  132. package/build-module/button/save.js.map +1 -1
  133. package/build-module/buttons/edit.js +12 -3
  134. package/build-module/buttons/edit.js.map +1 -1
  135. package/build-module/code/edit.js +8 -2
  136. package/build-module/code/edit.js.map +1 -1
  137. package/build-module/code/index.js +7 -1
  138. package/build-module/code/index.js.map +1 -1
  139. package/build-module/column/edit.native.js +5 -5
  140. package/build-module/column/edit.native.js.map +1 -1
  141. package/build-module/column/index.js +1 -0
  142. package/build-module/column/index.js.map +1 -1
  143. package/build-module/columns/index.js +2 -0
  144. package/build-module/columns/index.js.map +1 -1
  145. package/build-module/file/edit.native.js +1 -1
  146. package/build-module/file/edit.native.js.map +1 -1
  147. package/build-module/file/index.js +2 -1
  148. package/build-module/file/index.js.map +1 -1
  149. package/build-module/file/utils/index.js +0 -13
  150. package/build-module/file/utils/index.js.map +1 -1
  151. package/build-module/file/view.js +14 -2
  152. package/build-module/file/view.js.map +1 -1
  153. package/build-module/footnotes/edit.js +14 -5
  154. package/build-module/footnotes/edit.js.map +1 -1
  155. package/build-module/gallery/edit.js +1 -1
  156. package/build-module/gallery/edit.js.map +1 -1
  157. package/build-module/group/edit.js +0 -1
  158. package/build-module/group/edit.js.map +1 -1
  159. package/build-module/group/index.js +5 -0
  160. package/build-module/group/index.js.map +1 -1
  161. package/build-module/heading/edit.js +0 -1
  162. package/build-module/heading/edit.js.map +1 -1
  163. package/build-module/heading/index.js +2 -0
  164. package/build-module/heading/index.js.map +1 -1
  165. package/build-module/heading/transforms.js +3 -6
  166. package/build-module/heading/transforms.js.map +1 -1
  167. package/build-module/image/deprecated.js +191 -7
  168. package/build-module/image/deprecated.js.map +1 -1
  169. package/build-module/image/edit.js +27 -12
  170. package/build-module/image/edit.js.map +1 -1
  171. package/build-module/image/image.js +77 -42
  172. package/build-module/image/image.js.map +1 -1
  173. package/build-module/image/index.js +7 -4
  174. package/build-module/image/index.js.map +1 -1
  175. package/build-module/image/{view-interactivity.js → view.js} +1 -1
  176. package/build-module/image/view.js.map +1 -0
  177. package/build-module/list/deprecated.js +95 -3
  178. package/build-module/list/deprecated.js.map +1 -1
  179. package/build-module/list/edit.js +10 -10
  180. package/build-module/list/edit.js.map +1 -1
  181. package/build-module/list/ordered-list-settings.js +10 -10
  182. package/build-module/list/ordered-list-settings.js.map +1 -1
  183. package/build-module/list/save.js +4 -2
  184. package/build-module/list/save.js.map +1 -1
  185. package/build-module/list/utils.js +20 -2
  186. package/build-module/list/utils.js.map +1 -1
  187. package/build-module/navigation/constants.js +1 -1
  188. package/build-module/navigation/constants.js.map +1 -1
  189. package/build-module/navigation/index.js +4 -2
  190. package/build-module/navigation/index.js.map +1 -1
  191. package/build-module/navigation/view.js +168 -83
  192. package/build-module/navigation/view.js.map +1 -1
  193. package/build-module/navigation-link/edit.js +3 -9
  194. package/build-module/navigation-link/edit.js.map +1 -1
  195. package/build-module/navigation-link/transforms.js +24 -0
  196. package/build-module/navigation-link/transforms.js.map +1 -1
  197. package/build-module/page-list/edit.js +2 -1
  198. package/build-module/page-list/edit.js.map +1 -1
  199. package/build-module/post-comments-form/edit.js +10 -2
  200. package/build-module/post-comments-form/edit.js.map +1 -1
  201. package/build-module/post-comments-form/form.js +5 -3
  202. package/build-module/post-comments-form/form.js.map +1 -1
  203. package/build-module/post-content/edit.js +8 -7
  204. package/build-module/post-content/edit.js.map +1 -1
  205. package/build-module/post-content/index.js +3 -0
  206. package/build-module/post-content/index.js.map +1 -1
  207. package/build-module/post-featured-image/overlay.js +2 -1
  208. package/build-module/post-featured-image/overlay.js.map +1 -1
  209. package/build-module/post-terms/use-post-terms.js +3 -2
  210. package/build-module/post-terms/use-post-terms.js.map +1 -1
  211. package/build-module/preformatted/edit.js +4 -1
  212. package/build-module/preformatted/edit.js.map +1 -1
  213. package/build-module/preformatted/index.js +1 -1
  214. package/build-module/preformatted/index.js.map +1 -1
  215. package/build-module/pullquote/deprecated.js +6 -7
  216. package/build-module/pullquote/deprecated.js.map +1 -1
  217. package/build-module/query/edit/enhanced-pagination-modal.js +50 -0
  218. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -0
  219. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +35 -0
  220. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -0
  221. package/build-module/query/edit/inspector-controls/index.js +9 -26
  222. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  223. package/build-module/query/edit/query-content.js +8 -2
  224. package/build-module/query/edit/query-content.js.map +1 -1
  225. package/build-module/query/utils.js +17 -0
  226. package/build-module/query/utils.js.map +1 -1
  227. package/build-module/query/view.js +4 -5
  228. package/build-module/query/view.js.map +1 -1
  229. package/build-module/search/index.js +1 -0
  230. package/build-module/search/index.js.map +1 -1
  231. package/build-module/search/view.js +81 -151
  232. package/build-module/search/view.js.map +1 -1
  233. package/build-module/social-link/edit.native.js +3 -1
  234. package/build-module/social-link/edit.native.js.map +1 -1
  235. package/build-module/table/edit.js +7 -7
  236. package/build-module/table/edit.js.map +1 -1
  237. package/build-module/table-of-contents/edit.js +3 -131
  238. package/build-module/table-of-contents/edit.js.map +1 -1
  239. package/build-module/table-of-contents/hooks.js +137 -0
  240. package/build-module/table-of-contents/hooks.js.map +1 -0
  241. package/build-module/table-of-contents/index.js +2 -1
  242. package/build-module/table-of-contents/index.js.map +1 -1
  243. package/build-module/verse/edit.js +4 -1
  244. package/build-module/verse/edit.js.map +1 -1
  245. package/build-module/verse/index.js +1 -1
  246. package/build-module/verse/index.js.map +1 -1
  247. package/build-style/cover/style-rtl.css +9 -0
  248. package/build-style/cover/style.css +9 -0
  249. package/build-style/editor-rtl.css +15 -9
  250. package/build-style/editor.css +15 -9
  251. package/build-style/file/style-rtl.css +5 -0
  252. package/build-style/file/style.css +5 -0
  253. package/build-style/heading/style-rtl.css +13 -0
  254. package/build-style/heading/style.css +13 -0
  255. package/build-style/navigation-link/editor-rtl.css +0 -9
  256. package/build-style/navigation-link/editor.css +0 -9
  257. package/build-style/paragraph/editor-rtl.css +5 -0
  258. package/build-style/paragraph/editor.css +5 -0
  259. package/build-style/paragraph/style-rtl.css +5 -0
  260. package/build-style/paragraph/style.css +5 -0
  261. package/build-style/post-navigation-link/style-rtl.css +3 -0
  262. package/build-style/post-navigation-link/style.css +3 -0
  263. package/build-style/query/editor-rtl.css +10 -0
  264. package/build-style/query/editor.css +10 -0
  265. package/build-style/query/style-rtl.css +1 -1
  266. package/build-style/query/style.css +1 -1
  267. package/build-style/reset-rtl.css +27 -27
  268. package/build-style/reset.css +27 -27
  269. package/build-style/style-rtl.css +35 -0
  270. package/build-style/style.css +35 -0
  271. package/package.json +32 -33
  272. package/src/audio/test/__snapshots__/edit.native.js.snap +78 -106
  273. package/src/avatar/index.php +2 -2
  274. package/src/block/edit.js +58 -2
  275. package/src/block/test/edit.native.js +2 -3
  276. package/src/button/block.json +11 -2
  277. package/src/button/edit.js +27 -11
  278. package/src/button/save.js +10 -4
  279. package/src/buttons/edit.js +13 -3
  280. package/src/buttons/test/edit.native.js +28 -24
  281. package/src/calendar/index.php +2 -2
  282. package/src/code/block.json +2 -1
  283. package/src/code/edit.js +13 -1
  284. package/src/code/index.js +5 -0
  285. package/src/column/block.json +1 -0
  286. package/src/column/edit.native.js +4 -4
  287. package/src/columns/block.json +2 -0
  288. package/src/columns/test/__snapshots__/edit.native.js.snap +14 -0
  289. package/src/columns/test/edit.native.js +47 -17
  290. package/src/comment-template/index.php +1 -1
  291. package/src/comments-pagination-next/index.php +1 -1
  292. package/src/comments-pagination-previous/index.php +1 -1
  293. package/src/cover/style.scss +12 -1
  294. package/src/cover/test/edit.js +7 -7
  295. package/src/cover/test/edit.native.js +18 -27
  296. package/src/embed/test/index.native.js +30 -45
  297. package/src/file/block.json +2 -1
  298. package/src/file/edit.native.js +1 -1
  299. package/src/file/index.php +19 -21
  300. package/src/file/style.scss +6 -1
  301. package/src/file/test/__snapshots__/edit.native.js.snap +162 -218
  302. package/src/file/utils/index.js +0 -15
  303. package/src/file/view.js +14 -5
  304. package/src/footnotes/edit.js +16 -2
  305. package/src/gallery/edit.js +1 -1
  306. package/src/gallery/index.php +1 -1
  307. package/src/group/block.json +5 -0
  308. package/src/group/edit.js +0 -1
  309. package/src/heading/block.json +2 -0
  310. package/src/heading/edit.js +0 -1
  311. package/src/heading/style.scss +4 -0
  312. package/src/heading/transforms.js +1 -6
  313. package/src/image/block.json +7 -4
  314. package/src/image/deprecated.js +210 -7
  315. package/src/image/edit.js +43 -29
  316. package/src/image/image.js +86 -43
  317. package/src/image/index.php +251 -28
  318. package/src/latest-posts/index.php +1 -1
  319. package/src/list/deprecated.js +84 -3
  320. package/src/list/edit.js +6 -3
  321. package/src/list/ordered-list-settings.js +20 -5
  322. package/src/list/save.js +10 -1
  323. package/src/list/test/edit.native.js +2 -4
  324. package/src/list/utils.js +22 -1
  325. package/src/navigation/block.json +4 -2
  326. package/src/navigation/constants.js +1 -0
  327. package/src/navigation/index.php +85 -123
  328. package/src/navigation/view.js +192 -96
  329. package/src/navigation-link/edit.js +21 -36
  330. package/src/navigation-link/editor.scss +0 -8
  331. package/src/navigation-link/transforms.js +22 -0
  332. package/src/page-list/edit.js +2 -1
  333. package/src/paragraph/editor.scss +5 -0
  334. package/src/paragraph/style.scss +5 -0
  335. package/src/pattern/index.php +2 -2
  336. package/src/post-comments-form/edit.js +10 -0
  337. package/src/post-comments-form/form.js +7 -1
  338. package/src/post-content/block.json +3 -0
  339. package/src/post-content/edit.js +14 -6
  340. package/src/post-excerpt/index.php +2 -2
  341. package/src/post-featured-image/index.php +2 -2
  342. package/src/post-featured-image/overlay.js +1 -0
  343. package/src/post-navigation-link/index.php +5 -1
  344. package/src/post-navigation-link/style.scss +4 -0
  345. package/src/post-template/index.php +1 -1
  346. package/src/post-terms/index.php +5 -2
  347. package/src/post-terms/use-post-terms.js +4 -2
  348. package/src/preformatted/edit.js +5 -0
  349. package/src/preformatted/index.js +1 -1
  350. package/src/pullquote/deprecated.js +8 -13
  351. package/src/query/edit/enhanced-pagination-modal.js +65 -0
  352. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +49 -0
  353. package/src/query/edit/inspector-controls/index.js +9 -45
  354. package/src/query/edit/query-content.js +8 -0
  355. package/src/query/editor.scss +10 -0
  356. package/src/query/index.php +29 -16
  357. package/src/query/style.scss +2 -2
  358. package/src/query/utils.js +22 -0
  359. package/src/query/view.js +5 -5
  360. package/src/query-pagination-next/index.php +1 -1
  361. package/src/query-pagination-previous/index.php +1 -1
  362. package/src/reset.scss +1 -1
  363. package/src/search/block.json +1 -0
  364. package/src/search/index.php +45 -4
  365. package/src/search/test/__snapshots__/edit.native.js.snap +265 -363
  366. package/src/search/view.js +70 -169
  367. package/src/social-link/edit.native.js +1 -1
  368. package/src/social-link/editor.native.scss +4 -0
  369. package/src/table/edit.js +21 -19
  370. package/src/table-of-contents/block.json +2 -1
  371. package/src/table-of-contents/edit.js +5 -162
  372. package/src/table-of-contents/hooks.js +156 -0
  373. package/src/verse/edit.js +5 -0
  374. package/src/verse/index.js +1 -1
  375. package/src/verse/test/edit.native.js +2 -3
  376. package/build/file/view-interactivity.js +0 -22
  377. package/build/file/view-interactivity.js.map +0 -1
  378. package/build/image/view-interactivity.js.map +0 -1
  379. package/build/navigation/view-interactivity.js +0 -172
  380. package/build/navigation/view-interactivity.js.map +0 -1
  381. package/build/navigation/view-modal.js +0 -115
  382. package/build/navigation/view-modal.js.map +0 -1
  383. package/build-module/file/view-interactivity.js +0 -18
  384. package/build-module/file/view-interactivity.js.map +0 -1
  385. package/build-module/image/view-interactivity.js.map +0 -1
  386. package/build-module/navigation/view-interactivity.js +0 -169
  387. package/build-module/navigation/view-interactivity.js.map +0 -1
  388. package/build-module/navigation/view-modal.js +0 -112
  389. package/build-module/navigation/view-modal.js.map +0 -1
  390. package/src/file/view-interactivity.js +0 -18
  391. package/src/navigation/view-interactivity.js +0 -196
  392. package/src/navigation/view-modal.js +0 -127
  393. /package/src/image/{view-interactivity.js → view.js} +0 -0
@@ -17,8 +17,7 @@ import {
17
17
  privateApis as blockEditorPrivateApis,
18
18
  } from '@wordpress/block-editor';
19
19
  import { debounce } from '@wordpress/compose';
20
- import { useEffect, useState, useCallback, useRef } from '@wordpress/element';
21
- import { speak } from '@wordpress/a11y';
20
+ import { useEffect, useState, useCallback } from '@wordpress/element';
22
21
 
23
22
  /**
24
23
  * Internal dependencies
@@ -28,6 +27,7 @@ import AuthorControl from './author-control';
28
27
  import ParentControl from './parent-control';
29
28
  import { TaxonomyControls } from './taxonomy-controls';
30
29
  import StickyControl from './sticky-control';
30
+ import EnhancedPaginationControl from './enhanced-pagination-control';
31
31
  import CreateNewPostLink from './create-new-post-link';
32
32
  import { unlock } from '../../../lock-unlock';
33
33
  import {
@@ -41,7 +41,8 @@ import {
41
41
  const { BlockInfo } = unlock( blockEditorPrivateApis );
42
42
 
43
43
  export default function QueryInspectorControls( props ) {
44
- const { attributes, setQuery, setDisplayLayout, setAttributes } = props;
44
+ const { attributes, setQuery, setDisplayLayout, setAttributes, clientId } =
45
+ props;
45
46
  const { query, displayLayout, enhancedPagination } = attributes;
46
47
  const {
47
48
  order,
@@ -124,18 +125,6 @@ export default function QueryInspectorControls( props ) {
124
125
  isControlAllowed( allowedControls, 'parents' ) &&
125
126
  isPostTypeHierarchical;
126
127
 
127
- const enhancedPaginationNotice = __(
128
- 'Enhanced Pagination might cause interactive blocks within the Post Template to stop working. Disable it if you experience any issues.'
129
- );
130
-
131
- const isFirstRender = useRef( true ); // Don't speak on first render.
132
- useEffect( () => {
133
- if ( ! isFirstRender.current && enhancedPagination ) {
134
- speak( enhancedPaginationNotice );
135
- }
136
- isFirstRender.current = false;
137
- }, [ enhancedPagination, enhancedPaginationNotice ] );
138
-
139
128
  const showFiltersPanel =
140
129
  showTaxControl ||
141
130
  showAuthorControl ||
@@ -215,6 +204,11 @@ export default function QueryInspectorControls( props ) {
215
204
  }
216
205
  />
217
206
  ) }
207
+ <EnhancedPaginationControl
208
+ enhancedPagination={ enhancedPagination }
209
+ setAttributes={ setAttributes }
210
+ clientId={ clientId }
211
+ />
218
212
  </PanelBody>
219
213
  </InspectorControls>
220
214
  ) }
@@ -293,36 +287,6 @@ export default function QueryInspectorControls( props ) {
293
287
  </ToolsPanel>
294
288
  </InspectorControls>
295
289
  ) }
296
- <InspectorControls>
297
- <PanelBody
298
- title={ __( 'User Experience' ) }
299
- initialOpen={ false }
300
- >
301
- <ToggleControl
302
- label={ __( 'Enhanced pagination' ) }
303
- help={ __(
304
- "Don't refresh the page when paginating to another page."
305
- ) }
306
- checked={ !! enhancedPagination }
307
- onChange={ ( value ) =>
308
- setAttributes( {
309
- enhancedPagination: !! value,
310
- } )
311
- }
312
- />
313
- { enhancedPagination && (
314
- <div>
315
- <Notice
316
- spokenMessage={ null }
317
- status="warning"
318
- isDismissible={ false }
319
- >
320
- { enhancedPaginationNotice }
321
- </Notice>
322
- </div>
323
- ) }
324
- </PanelBody>
325
- </InspectorControls>
326
290
  </>
327
291
  );
328
292
  }
@@ -20,6 +20,7 @@ import { store as coreStore } from '@wordpress/core-data';
20
20
  */
21
21
  import QueryToolbar from './query-toolbar';
22
22
  import QueryInspectorControls from './inspector-controls';
23
+ import EnhancedPaginationModal from './enhanced-pagination-modal';
23
24
 
24
25
  const DEFAULTS_POSTS_PER_PAGE = 3;
25
26
 
@@ -103,13 +104,20 @@ export default function QueryContent( {
103
104
  "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
104
105
  ),
105
106
  };
107
+
106
108
  return (
107
109
  <>
110
+ <EnhancedPaginationModal
111
+ attributes={ attributes }
112
+ setAttributes={ setAttributes }
113
+ clientId={ clientId }
114
+ />
108
115
  <QueryInspectorControls
109
116
  attributes={ attributes }
110
117
  setQuery={ updateQuery }
111
118
  setDisplayLayout={ updateDisplayLayout }
112
119
  setAttributes={ setAttributes }
120
+ clientId={ clientId }
113
121
  />
114
122
  <BlockControls>
115
123
  <QueryToolbar
@@ -52,3 +52,13 @@
52
52
  margin-bottom: $grid-unit-30;
53
53
  }
54
54
  }
55
+
56
+ .wp-block-query__enhanced-pagination-modal {
57
+ @include break-small() {
58
+ max-width: $break-mobile;
59
+ }
60
+ }
61
+
62
+ .wp-block-query__enhanced-pagination-notice {
63
+ margin: 0;
64
+ }
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * Modifies the static `core/query` block on the server.
10
10
  *
11
- * @since X.X.X
11
+ * @since 6.4.0
12
12
  *
13
13
  * @param array $attributes Block attributes.
14
14
  * @param string $content Block default content.
@@ -23,9 +23,19 @@ function render_block_core_query( $attributes, $content, $block ) {
23
23
  // Add the necessary directives.
24
24
  $p->set_attribute( 'data-wp-interactive', true );
25
25
  $p->set_attribute( 'data-wp-navigation-id', 'query-' . $attributes['queryId'] );
26
+ // Use context to send translated strings.
26
27
  $p->set_attribute(
27
28
  'data-wp-context',
28
- wp_json_encode( array( 'core' => array( 'query' => (object) array() ) ) )
29
+ wp_json_encode(
30
+ array(
31
+ 'core' => array(
32
+ 'query' => array(
33
+ 'loadingText' => __( 'Loading page, please wait.' ),
34
+ 'loadedText' => __( 'Page Loaded.' ),
35
+ ),
36
+ ),
37
+ )
38
+ )
29
39
  );
30
40
  $content = $p->get_updated_html();
31
41
 
@@ -49,20 +59,6 @@ function render_block_core_query( $attributes, $content, $block ) {
49
59
  $last_div_position,
50
60
  0
51
61
  );
52
-
53
- // Use state to send translated strings.
54
- wp_store(
55
- array(
56
- 'state' => array(
57
- 'core' => array(
58
- 'query' => array(
59
- 'loadingText' => __( 'Loading page, please wait.' ),
60
- 'loadedText' => __( 'Page Loaded.' ),
61
- ),
62
- ),
63
- ),
64
- )
65
- );
66
62
  }
67
63
  }
68
64
 
@@ -95,6 +91,23 @@ function render_block_core_query( $attributes, $content, $block ) {
95
91
  return $content;
96
92
  }
97
93
 
94
+ /**
95
+ * Ensure that the view script has the `wp-interactivity` dependency.
96
+ *
97
+ * @since 6.4.0
98
+ */
99
+ function block_core_query_ensure_interactivity_dependency() {
100
+ global $wp_scripts;
101
+ if (
102
+ isset( $wp_scripts->registered['wp-block-query-view'] ) &&
103
+ ! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-query-view']->deps, true )
104
+ ) {
105
+ $wp_scripts->registered['wp-block-query-view']->deps[] = 'wp-interactivity';
106
+ }
107
+ }
108
+
109
+ add_action( 'wp_print_scripts', 'block_core_query_ensure_interactivity_dependency' );
110
+
98
111
  /**
99
112
  * Registers the `core/query` block on the server.
100
113
  */
@@ -14,8 +14,8 @@
14
14
  animation:
15
15
  wp-block-query__enhanced-pagination-start-animation
16
16
  30s
17
- cubic-bezier(0, 1, 0, 1)
18
- infinite;
17
+ cubic-bezier(0.03, 0.5, 0, 1)
18
+ forwards;
19
19
  }
20
20
 
21
21
  &.finish-animation {
@@ -344,3 +344,25 @@ export const usePatterns = ( clientId, name ) => {
344
344
  [ name, clientId ]
345
345
  );
346
346
  };
347
+
348
+ /**
349
+ * Hook that returns whether the Query Loop with the given `clientId` contains
350
+ * any third-party block.
351
+ *
352
+ * @param {string} clientId The block's client ID.
353
+ * @return {boolean} True if it contains third-party blocks.
354
+ */
355
+ export const useContainsThirdPartyBlocks = ( clientId ) => {
356
+ return useSelect(
357
+ ( select ) => {
358
+ const { getClientIdsOfDescendants, getBlockName } =
359
+ select( blockEditorStore );
360
+
361
+ return getClientIdsOfDescendants( clientId ).some(
362
+ ( descendantClientId ) =>
363
+ ! getBlockName( descendantClientId ).startsWith( 'core/' )
364
+ );
365
+ },
366
+ [ clientId ]
367
+ );
368
+ };
package/src/query/view.js CHANGED
@@ -32,7 +32,7 @@ store( {
32
32
  actions: {
33
33
  core: {
34
34
  query: {
35
- navigate: async ( { event, ref, context, state } ) => {
35
+ navigate: async ( { event, ref, context } ) => {
36
36
  if ( isValidLink( ref ) && isValidEvent( event ) ) {
37
37
  event.preventDefault();
38
38
 
@@ -42,9 +42,9 @@ store( {
42
42
  // Don't announce the navigation immediately, wait 300 ms.
43
43
  const timeout = setTimeout( () => {
44
44
  context.core.query.message =
45
- state.core.query.loadingText;
45
+ context.core.query.loadingText;
46
46
  context.core.query.animation = 'start';
47
- }, 300 );
47
+ }, 400 );
48
48
 
49
49
  await navigate( ref.href );
50
50
 
@@ -55,9 +55,9 @@ store( {
55
55
  // same, we use a no-break space similar to the @wordpress/a11y
56
56
  // package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
57
57
  context.core.query.message =
58
- state.core.query.loadedText +
58
+ context.core.query.loadedText +
59
59
  ( context.core.query.message ===
60
- state.core.query.loadedText
60
+ context.core.query.loadedText
61
61
  ? '\u00A0'
62
62
  : '' );
63
63
 
@@ -37,7 +37,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
37
37
 
38
38
  // Check if the pagination is for Query that inherits the global context.
39
39
  if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
40
- $filter_link_attributes = static function() use ( $wrapper_attributes ) {
40
+ $filter_link_attributes = static function () use ( $wrapper_attributes ) {
41
41
  return $wrapper_attributes;
42
42
  };
43
43
  add_filter( 'next_posts_link_attributes', $filter_link_attributes );
@@ -35,7 +35,7 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
35
35
  // Check if the pagination is for Query that inherits the global context
36
36
  // and handle appropriately.
37
37
  if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
38
- $filter_link_attributes = static function() use ( $wrapper_attributes ) {
38
+ $filter_link_attributes = static function () use ( $wrapper_attributes ) {
39
39
  return $wrapper_attributes;
40
40
  };
41
41
 
package/src/reset.scss CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  // We use :where to keep specificity minimal.
9
9
  // https://css-tricks.com/almanac/selectors/w/where/
10
- html :where(.editor-styles-wrapper) {
10
+ :where(.editor-styles-wrapper) {
11
11
  /**
12
12
  * The following styles revert to the browser defaults overriding the WPAdmin styles.
13
13
  * This is only needed while the block editor is not being loaded in an iframe.
@@ -62,6 +62,7 @@
62
62
  "text": true
63
63
  }
64
64
  },
65
+ "interactivity": true,
65
66
  "typography": {
66
67
  "__experimentalSkipSerialization": true,
67
68
  "__experimentalSelector": ".wp-block-search__label, .wp-block-search__input, .wp-block-search__button",
@@ -46,6 +46,9 @@ function render_block_core_search( $attributes, $content, $block ) {
46
46
  'button-inside' === $attributes['buttonPosition'];
47
47
  // Border color classes need to be applied to the elements that have a border color.
48
48
  $border_color_classes = get_border_color_classes_for_block_core_search( $attributes );
49
+ // This variable is a constant and its value is always false at this moment.
50
+ // It is defined this way because some values depend on it, in case it changes in the future.
51
+ $open_by_default = 'false';
49
52
 
50
53
  $label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] );
51
54
  $label = new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) );
@@ -77,6 +80,9 @@ function render_block_core_search( $attributes, $content, $block ) {
77
80
 
78
81
  $is_expandable_searchfield = 'button-only' === $button_position && 'expand-searchfield' === $button_behavior;
79
82
  if ( $is_expandable_searchfield ) {
83
+ $input->set_attribute( 'data-wp-bind--aria-hidden', '!context.core.search.isSearchInputVisible' );
84
+ $input->set_attribute( 'data-wp-bind--tabindex', 'selectors.core.search.tabindex' );
85
+ // Adding these attributes manually is needed until the Interactivity API SSR logic is added to core.
80
86
  $input->set_attribute( 'aria-hidden', 'true' );
81
87
  $input->set_attribute( 'tabindex', '-1' );
82
88
  }
@@ -139,11 +145,16 @@ function render_block_core_search( $attributes, $content, $block ) {
139
145
  if ( $button->next_tag() ) {
140
146
  $button->add_class( implode( ' ', $button_classes ) );
141
147
  if ( 'expand-searchfield' === $attributes['buttonBehavior'] && 'button-only' === $attributes['buttonPosition'] ) {
148
+ $button->set_attribute( 'data-wp-bind--aria-label', 'selectors.core.search.ariaLabel' );
149
+ $button->set_attribute( 'data-wp-bind--aria-controls', 'selectors.core.search.ariaControls' );
150
+ $button->set_attribute( 'data-wp-bind--aria-expanded', 'context.core.search.isSearchInputVisible' );
151
+ $button->set_attribute( 'data-wp-bind--type', 'selectors.core.search.type' );
152
+ $button->set_attribute( 'data-wp-on--click', 'actions.core.search.openSearchInput' );
153
+ // Adding these attributes manually is needed until the Interactivity API SSR logic is added to core.
142
154
  $button->set_attribute( 'aria-label', __( 'Expand search field' ) );
143
- $button->set_attribute( 'data-toggled-aria-label', __( 'Submit Search' ) );
144
155
  $button->set_attribute( 'aria-controls', 'wp-block-search__input-' . $input_id );
145
156
  $button->set_attribute( 'aria-expanded', 'false' );
146
- $button->set_attribute( 'type', 'button' ); // Will be set to submit after clicking.
157
+ $button->set_attribute( 'type', 'button' );
147
158
  } else {
148
159
  $button->set_attribute( 'aria-label', wp_strip_all_tags( $attributes['buttonText'] ) );
149
160
  }
@@ -160,11 +171,24 @@ function render_block_core_search( $attributes, $content, $block ) {
160
171
  $wrapper_attributes = get_block_wrapper_attributes(
161
172
  array( 'class' => $classnames )
162
173
  );
174
+ $form_directives = '';
175
+ if ( $is_expandable_searchfield ) {
176
+ $aria_label_expanded = __( 'Submit Search' );
177
+ $aria_label_collapsed = __( 'Expand search field' );
178
+ $form_directives = '
179
+ data-wp-interactive
180
+ data-wp-context=\'{ "core": { "search": { "isSearchInputVisible": ' . $open_by_default . ', "inputId": "' . $input_id . '", "ariaLabelExpanded": "' . $aria_label_expanded . '", "ariaLabelCollapsed": "' . $aria_label_collapsed . '" } } }\'
181
+ data-wp-class--wp-block-search__searchfield-hidden="!context.core.search.isSearchInputVisible"
182
+ data-wp-on--keydown="actions.core.search.handleSearchKeydown"
183
+ data-wp-on--focusout="actions.core.search.handleSearchFocusout"
184
+ ';
185
+ }
163
186
 
164
187
  return sprintf(
165
- '<form role="search" method="get" action="%s" %s>%s</form>',
188
+ '<form role="search" method="get" action="%1s" %2s %3s>%4s</form>',
166
189
  esc_url( home_url( '/' ) ),
167
190
  $wrapper_attributes,
191
+ $form_directives,
168
192
  $label . $field_markup
169
193
  );
170
194
  }
@@ -182,6 +206,23 @@ function register_block_core_search() {
182
206
  }
183
207
  add_action( 'init', 'register_block_core_search' );
184
208
 
209
+ /**
210
+ * Ensure that the view script has the `wp-interactivity` dependency.
211
+ *
212
+ * @since 6.4.0
213
+ */
214
+ function block_core_search_ensure_interactivity_dependency() {
215
+ global $wp_scripts;
216
+ if (
217
+ isset( $wp_scripts->registered['wp-block-search-view'] ) &&
218
+ ! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-search-view']->deps, true )
219
+ ) {
220
+ $wp_scripts->registered['wp-block-search-view']->deps[] = 'wp-interactivity';
221
+ }
222
+ }
223
+
224
+ add_action( 'wp_print_scripts', 'block_core_search_ensure_interactivity_dependency' );
225
+
185
226
  /**
186
227
  * Builds the correct top level classnames for the 'core/search' block.
187
228
  *
@@ -242,7 +283,7 @@ function classnames_for_block_core_search( $attributes ) {
242
283
  * @return void
243
284
  */
244
285
  function apply_block_core_search_border_style( $attributes, $property, $side, &$wrapper_styles, &$button_styles, &$input_styles ) {
245
- $is_button_inside = 'button-inside' === _wp_array_get( $attributes, array( 'buttonPosition' ), false );
286
+ $is_button_inside = isset( $attributes['buttonPosition'] ) && 'button-inside' === $attributes['buttonPosition'];
246
287
 
247
288
  $path = array( 'style', 'border', $property );
248
289