@wordpress/block-library 8.6.0 → 8.8.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 (425) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/buttons/index.js +1 -0
  3. package/build/buttons/index.js.map +1 -1
  4. package/build/buttons/transforms.js +1 -0
  5. package/build/buttons/transforms.js.map +1 -1
  6. package/build/column/index.js +2 -1
  7. package/build/column/index.js.map +1 -1
  8. package/build/columns/edit.js +28 -8
  9. package/build/columns/edit.js.map +1 -1
  10. package/build/columns/index.js +6 -1
  11. package/build/columns/index.js.map +1 -1
  12. package/build/columns/utils.js +4 -9
  13. package/build/columns/utils.js.map +1 -1
  14. package/build/cover/edit/index.js +46 -50
  15. package/build/cover/edit/index.js.map +1 -1
  16. package/build/cover/edit/inspector-controls.js +2 -2
  17. package/build/cover/edit/inspector-controls.js.map +1 -1
  18. package/build/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +32 -6
  19. package/build/cover/edit/resizable-cover-popover.js.map +1 -0
  20. package/build/cover/index.js +12 -0
  21. package/build/cover/index.js.map +1 -1
  22. package/build/details/edit.js +67 -0
  23. package/build/details/edit.js.map +1 -0
  24. package/build/details/index.js +110 -0
  25. package/build/details/index.js.map +1 -0
  26. package/build/details/save.js +33 -0
  27. package/build/details/save.js.map +1 -0
  28. package/build/details-content/edit.js +34 -0
  29. package/build/details-content/edit.js.map +1 -0
  30. package/build/details-content/index.js +94 -0
  31. package/build/details-content/index.js.map +1 -0
  32. package/build/details-content/save.js +20 -0
  33. package/build/details-content/save.js.map +1 -0
  34. package/build/details-summary/edit.js +42 -0
  35. package/build/details-summary/edit.js.map +1 -0
  36. package/build/details-summary/index.js +97 -0
  37. package/build/details-summary/index.js.map +1 -0
  38. package/build/details-summary/save.js +24 -0
  39. package/build/details-summary/save.js.map +1 -0
  40. package/build/embed/deprecated.js +4 -1
  41. package/build/embed/deprecated.js.map +1 -1
  42. package/build/embed/embed-link-settings.native.js +1 -1
  43. package/build/embed/embed-link-settings.native.js.map +1 -1
  44. package/build/embed/embed-placeholder.js +1 -1
  45. package/build/embed/embed-placeholder.js.map +1 -1
  46. package/build/embed/index.js +4 -1
  47. package/build/embed/index.js.map +1 -1
  48. package/build/embed/transforms.js +4 -1
  49. package/build/embed/transforms.js.map +1 -1
  50. package/build/embed/util.js +4 -1
  51. package/build/embed/util.js.map +1 -1
  52. package/build/file/edit.native.js +0 -2
  53. package/build/file/edit.native.js.map +1 -1
  54. package/build/gallery/edit.js +8 -5
  55. package/build/gallery/edit.js.map +1 -1
  56. package/build/gallery/use-get-media.native.js +2 -1
  57. package/build/gallery/use-get-media.native.js.map +1 -1
  58. package/build/gallery/use-image-sizes.js +1 -1
  59. package/build/gallery/use-image-sizes.js.map +1 -1
  60. package/build/group/deprecated.js +4 -2
  61. package/build/group/deprecated.js.map +1 -1
  62. package/build/group/edit.js +22 -5
  63. package/build/group/edit.js.map +1 -1
  64. package/build/group/placeholder.js +11 -1
  65. package/build/group/placeholder.js.map +1 -1
  66. package/build/group/variations.js +23 -3
  67. package/build/group/variations.js.map +1 -1
  68. package/build/image/edit.js +1 -1
  69. package/build/image/edit.js.map +1 -1
  70. package/build/image/edit.native.js +1 -1
  71. package/build/image/edit.native.js.map +1 -1
  72. package/build/image/image.js +8 -6
  73. package/build/image/image.js.map +1 -1
  74. package/build/image/index.js +9 -2
  75. package/build/image/index.js.map +1 -1
  76. package/build/index.js +24 -6
  77. package/build/index.js.map +1 -1
  78. package/build/latest-posts/edit.js +1 -0
  79. package/build/latest-posts/edit.js.map +1 -1
  80. package/build/media-text/deprecated.js +228 -18
  81. package/build/media-text/deprecated.js.map +1 -1
  82. package/build/media-text/edit.js +3 -3
  83. package/build/media-text/edit.js.map +1 -1
  84. package/build/media-text/index.js +1 -1
  85. package/build/media-text/media-container.js +2 -6
  86. package/build/media-text/media-container.js.map +1 -1
  87. package/build/media-text/media-container.native.js +3 -3
  88. package/build/media-text/media-container.native.js.map +1 -1
  89. package/build/navigation/deprecated.js +8 -11
  90. package/build/navigation/deprecated.js.map +1 -1
  91. package/build/navigation/edit/index.js +1 -12
  92. package/build/navigation/edit/index.js.map +1 -1
  93. package/build/navigation/edit/inner-blocks.js +1 -4
  94. package/build/navigation/edit/inner-blocks.js.map +1 -1
  95. package/build/navigation/edit/unsaved-inner-blocks.js +1 -14
  96. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  97. package/build/navigation/index.js +0 -1
  98. package/build/navigation/index.js.map +1 -1
  99. package/build/post-author/index.js +0 -1
  100. package/build/post-author/index.js.map +1 -1
  101. package/build/post-date/edit.js +2 -1
  102. package/build/post-date/edit.js.map +1 -1
  103. package/build/post-date/index.js +4 -1
  104. package/build/post-date/index.js.map +1 -1
  105. package/build/post-date/variations.js +28 -0
  106. package/build/post-date/variations.js.map +1 -0
  107. package/build/post-excerpt/edit.js +39 -10
  108. package/build/post-excerpt/edit.js.map +1 -1
  109. package/build/post-featured-image/dimension-controls.js +4 -3
  110. package/build/post-featured-image/dimension-controls.js.map +1 -1
  111. package/build/post-featured-image/edit.js +8 -22
  112. package/build/post-featured-image/edit.js.map +1 -1
  113. package/build/post-template/index.js +1 -1
  114. package/build/post-time-to-read/edit.js +1 -1
  115. package/build/post-time-to-read/edit.js.map +1 -1
  116. package/build/post-time-to-read/index.js +24 -1
  117. package/build/post-time-to-read/index.js.map +1 -1
  118. package/build/quote/index.js +1 -0
  119. package/build/quote/index.js.map +1 -1
  120. package/build/spacer/controls.js +25 -6
  121. package/build/spacer/controls.js.map +1 -1
  122. package/build/spacer/edit.js +27 -7
  123. package/build/spacer/edit.js.map +1 -1
  124. package/build/spacer/save.js +2 -2
  125. package/build/spacer/save.js.map +1 -1
  126. package/build/table/state.js +35 -35
  127. package/build/table/state.js.map +1 -1
  128. package/build/term-description/index.js +1 -2
  129. package/build/term-description/index.js.map +1 -1
  130. package/build/utils/clean-empty-object.js +5 -2
  131. package/build/utils/clean-empty-object.js.map +1 -1
  132. package/build-module/buttons/index.js +1 -0
  133. package/build-module/buttons/index.js.map +1 -1
  134. package/build-module/buttons/transforms.js +1 -0
  135. package/build-module/buttons/transforms.js.map +1 -1
  136. package/build-module/column/index.js +2 -1
  137. package/build-module/column/index.js.map +1 -1
  138. package/build-module/columns/edit.js +28 -8
  139. package/build-module/columns/edit.js.map +1 -1
  140. package/build-module/columns/index.js +6 -1
  141. package/build-module/columns/index.js.map +1 -1
  142. package/build-module/columns/utils.js +4 -8
  143. package/build-module/columns/utils.js.map +1 -1
  144. package/build-module/cover/edit/index.js +48 -52
  145. package/build-module/cover/edit/index.js.map +1 -1
  146. package/build-module/cover/edit/inspector-controls.js +2 -2
  147. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  148. package/build-module/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +31 -6
  149. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -0
  150. package/build-module/cover/index.js +12 -0
  151. package/build-module/cover/index.js.map +1 -1
  152. package/build-module/details/edit.js +52 -0
  153. package/build-module/details/edit.js.map +1 -0
  154. package/build-module/details/index.js +91 -0
  155. package/build-module/details/index.js.map +1 -0
  156. package/build-module/details/save.js +20 -0
  157. package/build-module/details/save.js.map +1 -0
  158. package/build-module/details-content/edit.js +23 -0
  159. package/build-module/details-content/edit.js.map +1 -0
  160. package/build-module/details-content/index.js +76 -0
  161. package/build-module/details-content/index.js.map +1 -0
  162. package/build-module/details-content/save.js +11 -0
  163. package/build-module/details-content/save.js.map +1 -0
  164. package/build-module/details-summary/edit.js +30 -0
  165. package/build-module/details-summary/edit.js.map +1 -0
  166. package/build-module/details-summary/index.js +79 -0
  167. package/build-module/details-summary/index.js.map +1 -0
  168. package/build-module/details-summary/save.js +16 -0
  169. package/build-module/details-summary/save.js.map +1 -0
  170. package/build-module/embed/deprecated.js +4 -1
  171. package/build-module/embed/deprecated.js.map +1 -1
  172. package/build-module/embed/embed-link-settings.native.js +1 -1
  173. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  174. package/build-module/embed/embed-placeholder.js +1 -1
  175. package/build-module/embed/embed-placeholder.js.map +1 -1
  176. package/build-module/embed/index.js +4 -1
  177. package/build-module/embed/index.js.map +1 -1
  178. package/build-module/embed/transforms.js +4 -1
  179. package/build-module/embed/transforms.js.map +1 -1
  180. package/build-module/embed/util.js +4 -1
  181. package/build-module/embed/util.js.map +1 -1
  182. package/build-module/file/edit.native.js +0 -2
  183. package/build-module/file/edit.native.js.map +1 -1
  184. package/build-module/gallery/edit.js +8 -5
  185. package/build-module/gallery/edit.js.map +1 -1
  186. package/build-module/gallery/use-get-media.native.js +2 -1
  187. package/build-module/gallery/use-get-media.native.js.map +1 -1
  188. package/build-module/gallery/use-image-sizes.js +1 -1
  189. package/build-module/gallery/use-image-sizes.js.map +1 -1
  190. package/build-module/group/deprecated.js +4 -2
  191. package/build-module/group/deprecated.js.map +1 -1
  192. package/build-module/group/edit.js +21 -5
  193. package/build-module/group/edit.js.map +1 -1
  194. package/build-module/group/placeholder.js +11 -1
  195. package/build-module/group/placeholder.js.map +1 -1
  196. package/build-module/group/variations.js +24 -1
  197. package/build-module/group/variations.js.map +1 -1
  198. package/build-module/image/edit.js +1 -1
  199. package/build-module/image/edit.js.map +1 -1
  200. package/build-module/image/edit.native.js +1 -1
  201. package/build-module/image/edit.native.js.map +1 -1
  202. package/build-module/image/image.js +8 -6
  203. package/build-module/image/image.js.map +1 -1
  204. package/build-module/image/index.js +9 -2
  205. package/build-module/image/index.js.map +1 -1
  206. package/build-module/index.js +21 -6
  207. package/build-module/index.js.map +1 -1
  208. package/build-module/latest-posts/edit.js +1 -0
  209. package/build-module/latest-posts/edit.js.map +1 -1
  210. package/build-module/media-text/deprecated.js +227 -18
  211. package/build-module/media-text/deprecated.js.map +1 -1
  212. package/build-module/media-text/edit.js +3 -3
  213. package/build-module/media-text/edit.js.map +1 -1
  214. package/build-module/media-text/index.js +1 -1
  215. package/build-module/media-text/media-container.js +1 -5
  216. package/build-module/media-text/media-container.js.map +1 -1
  217. package/build-module/media-text/media-container.native.js +1 -1
  218. package/build-module/media-text/media-container.native.js.map +1 -1
  219. package/build-module/navigation/deprecated.js +8 -10
  220. package/build-module/navigation/deprecated.js.map +1 -1
  221. package/build-module/navigation/edit/index.js +1 -12
  222. package/build-module/navigation/edit/index.js.map +1 -1
  223. package/build-module/navigation/edit/inner-blocks.js +1 -4
  224. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  225. package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -14
  226. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  227. package/build-module/navigation/index.js +0 -1
  228. package/build-module/navigation/index.js.map +1 -1
  229. package/build-module/post-author/index.js +0 -1
  230. package/build-module/post-author/index.js.map +1 -1
  231. package/build-module/post-date/edit.js +2 -1
  232. package/build-module/post-date/edit.js.map +1 -1
  233. package/build-module/post-date/index.js +3 -1
  234. package/build-module/post-date/index.js.map +1 -1
  235. package/build-module/post-date/variations.js +18 -0
  236. package/build-module/post-date/variations.js.map +1 -0
  237. package/build-module/post-excerpt/edit.js +38 -11
  238. package/build-module/post-excerpt/edit.js.map +1 -1
  239. package/build-module/post-featured-image/dimension-controls.js +4 -3
  240. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  241. package/build-module/post-featured-image/edit.js +8 -22
  242. package/build-module/post-featured-image/edit.js.map +1 -1
  243. package/build-module/post-template/index.js +1 -1
  244. package/build-module/post-time-to-read/edit.js +1 -1
  245. package/build-module/post-time-to-read/edit.js.map +1 -1
  246. package/build-module/post-time-to-read/index.js +24 -1
  247. package/build-module/post-time-to-read/index.js.map +1 -1
  248. package/build-module/quote/index.js +1 -0
  249. package/build-module/quote/index.js.map +1 -1
  250. package/build-module/spacer/controls.js +27 -9
  251. package/build-module/spacer/controls.js.map +1 -1
  252. package/build-module/spacer/edit.js +27 -8
  253. package/build-module/spacer/edit.js.map +1 -1
  254. package/build-module/spacer/save.js +3 -3
  255. package/build-module/spacer/save.js.map +1 -1
  256. package/build-module/table/state.js +35 -33
  257. package/build-module/table/state.js.map +1 -1
  258. package/build-module/term-description/index.js +1 -2
  259. package/build-module/term-description/index.js.map +1 -1
  260. package/build-module/utils/clean-empty-object.js +6 -3
  261. package/build-module/utils/clean-empty-object.js.map +1 -1
  262. package/build-style/categories/editor-rtl.css +5 -0
  263. package/build-style/categories/editor.css +5 -0
  264. package/build-style/categories/style-rtl.css +4 -0
  265. package/build-style/categories/style.css +4 -0
  266. package/build-style/columns/style-rtl.css +4 -1
  267. package/build-style/columns/style.css +4 -1
  268. package/build-style/common-rtl.css +1 -1
  269. package/build-style/common.css +1 -1
  270. package/build-style/cover/editor-rtl.css +11 -12
  271. package/build-style/cover/editor.css +11 -12
  272. package/build-style/cover/style-rtl.css +3 -2
  273. package/build-style/cover/style.css +3 -2
  274. package/build-style/details/style-rtl.css +91 -0
  275. package/build-style/details/style.css +91 -0
  276. package/build-style/details-summary/editor-rtl.css +91 -0
  277. package/build-style/details-summary/editor.css +91 -0
  278. package/build-style/details-summary/style-rtl.css +91 -0
  279. package/build-style/details-summary/style.css +91 -0
  280. package/build-style/editor-rtl.css +40 -48
  281. package/build-style/editor.css +40 -48
  282. package/build-style/file/style-rtl.css +4 -3
  283. package/build-style/file/style.css +4 -3
  284. package/build-style/navigation/style-rtl.css +2 -0
  285. package/build-style/navigation/style.css +2 -0
  286. package/build-style/post-excerpt/style-rtl.css +1 -1
  287. package/build-style/post-excerpt/style.css +1 -1
  288. package/build-style/post-featured-image/editor-rtl.css +1 -0
  289. package/build-style/post-featured-image/editor.css +1 -0
  290. package/build-style/post-template/style-rtl.css +1 -1
  291. package/build-style/post-template/style.css +1 -1
  292. package/build-style/post-time-to-read/style-rtl.css +91 -0
  293. package/build-style/post-time-to-read/style.css +91 -0
  294. package/build-style/pullquote/style-rtl.css +4 -1
  295. package/build-style/pullquote/style.css +4 -1
  296. package/build-style/search/style-rtl.css +8 -7
  297. package/build-style/search/style.css +8 -7
  298. package/build-style/shortcode/editor-rtl.css +15 -34
  299. package/build-style/shortcode/editor.css +15 -34
  300. package/build-style/spacer/editor-rtl.css +4 -2
  301. package/build-style/spacer/editor.css +4 -2
  302. package/build-style/style-rtl.css +44 -17
  303. package/build-style/style.css +44 -17
  304. package/package.json +31 -31
  305. package/src/buttons/block.json +1 -0
  306. package/src/categories/editor.scss +5 -0
  307. package/src/categories/style.scss +4 -0
  308. package/src/column/block.json +2 -1
  309. package/src/columns/block.json +6 -1
  310. package/src/columns/edit.js +35 -10
  311. package/src/columns/style.scss +5 -1
  312. package/src/columns/utils.js +8 -9
  313. package/src/comments/index.php +1 -0
  314. package/src/common.scss +1 -1
  315. package/src/cover/block.json +12 -0
  316. package/src/cover/edit/index.js +44 -37
  317. package/src/cover/edit/inspector-controls.js +4 -5
  318. package/src/cover/edit/resizable-cover-popover.js +82 -0
  319. package/src/cover/editor.scss +20 -13
  320. package/src/cover/index.php +9 -10
  321. package/src/cover/style.scss +2 -1
  322. package/src/cover/test/__snapshots__/transforms.native.js.snap +2 -2
  323. package/src/cover/test/edit.js +324 -0
  324. package/src/details/block.json +54 -0
  325. package/src/details/edit.js +59 -0
  326. package/src/details/index.js +35 -0
  327. package/src/details/save.js +15 -0
  328. package/src/details/style.scss +3 -0
  329. package/src/details-content/block.json +50 -0
  330. package/src/details-content/edit.js +29 -0
  331. package/src/details-content/index.js +23 -0
  332. package/src/details-content/save.js +12 -0
  333. package/src/details-summary/block.json +53 -0
  334. package/src/details-summary/edit.js +27 -0
  335. package/src/details-summary/editor.scss +3 -0
  336. package/src/details-summary/index.js +23 -0
  337. package/src/details-summary/save.js +13 -0
  338. package/src/details-summary/style.scss +3 -0
  339. package/src/editor.scss +1 -0
  340. package/src/embed/block.json +4 -1
  341. package/src/embed/embed-link-settings.native.js +1 -1
  342. package/src/embed/embed-placeholder.js +1 -1
  343. package/src/file/edit.native.js +0 -2
  344. package/src/file/style.scss +5 -2
  345. package/src/gallery/edit.js +5 -2
  346. package/src/gallery/test/use-get-media.native.js +24 -0
  347. package/src/gallery/use-get-media.native.js +1 -1
  348. package/src/gallery/use-image-sizes.js +1 -1
  349. package/src/group/deprecated.js +4 -2
  350. package/src/group/edit.js +27 -9
  351. package/src/group/placeholder.js +13 -1
  352. package/src/group/variations.js +14 -1
  353. package/src/home-link/index.php +2 -2
  354. package/src/image/block.json +9 -2
  355. package/src/image/edit.js +1 -1
  356. package/src/image/edit.native.js +1 -1
  357. package/src/image/image.js +15 -7
  358. package/src/image/index.php +7 -2
  359. package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
  360. package/src/index.js +13 -3
  361. package/src/latest-comments/style.scss +1 -1
  362. package/src/latest-posts/edit.js +3 -0
  363. package/src/media-text/block.json +1 -1
  364. package/src/media-text/deprecated.js +235 -3
  365. package/src/media-text/edit.js +7 -6
  366. package/src/media-text/media-container.js +1 -5
  367. package/src/media-text/media-container.native.js +1 -1
  368. package/src/media-text/test/__snapshots__/transforms.native.js.snap +4 -4
  369. package/src/navigation/block.json +0 -1
  370. package/src/navigation/deprecated.js +15 -19
  371. package/src/navigation/edit/index.js +0 -13
  372. package/src/navigation/edit/inner-blocks.js +0 -3
  373. package/src/navigation/edit/unsaved-inner-blocks.js +34 -46
  374. package/src/navigation/index.php +0 -4
  375. package/src/navigation/style.scss +6 -4
  376. package/src/navigation-link/index.php +2 -1
  377. package/src/navigation-submenu/index.php +30 -76
  378. package/src/paragraph/test/edit.native.js +356 -1
  379. package/src/post-author/block.json +0 -1
  380. package/src/post-author/index.php +1 -1
  381. package/src/post-date/edit.js +4 -1
  382. package/src/post-date/index.js +2 -0
  383. package/src/post-date/variations.js +20 -0
  384. package/src/post-excerpt/edit.js +48 -16
  385. package/src/post-excerpt/index.php +3 -3
  386. package/src/post-excerpt/style.scss +2 -1
  387. package/src/post-featured-image/dimension-controls.js +7 -3
  388. package/src/post-featured-image/edit.js +8 -29
  389. package/src/post-featured-image/editor.scss +1 -0
  390. package/src/post-template/block.json +1 -1
  391. package/src/post-template/style.scss +1 -1
  392. package/src/post-time-to-read/block.json +24 -1
  393. package/src/post-time-to-read/edit.js +1 -1
  394. package/src/post-time-to-read/index.php +3 -3
  395. package/src/post-time-to-read/style.scss +4 -0
  396. package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -2
  397. package/src/preformatted/test/edit.native.js +45 -2
  398. package/src/pullquote/style.scss +5 -1
  399. package/src/pullquote/test/edit.native.js +70 -0
  400. package/src/query-title/index.php +2 -5
  401. package/src/quote/block.json +1 -0
  402. package/src/quote/test/edit.native.js +92 -0
  403. package/src/search/index.php +1 -1
  404. package/src/search/style.scss +16 -12
  405. package/src/shortcode/editor.scss +26 -5
  406. package/src/spacer/controls.js +42 -17
  407. package/src/spacer/edit.js +41 -9
  408. package/src/spacer/editor.scss +2 -1
  409. package/src/spacer/save.js +3 -3
  410. package/src/style.scss +3 -0
  411. package/src/table/state.js +83 -66
  412. package/src/term-description/block.json +1 -2
  413. package/src/utils/clean-empty-object.js +4 -4
  414. package/src/verse/test/edit.native.js +33 -0
  415. package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
  416. package/tsconfig.tsbuildinfo +1 -1
  417. package/build/cover/edit/resizable-cover.js.map +0 -1
  418. package/build/media-text/media-container-icon.js +0 -27
  419. package/build/media-text/media-container-icon.js.map +0 -1
  420. package/build-module/cover/edit/resizable-cover.js.map +0 -1
  421. package/build-module/media-text/media-container-icon.js +0 -17
  422. package/build-module/media-text/media-container-icon.js.map +0 -1
  423. package/src/cover/edit/resizable-cover.js +0 -61
  424. package/src/cover/test/block-controls.js +0 -62
  425. package/src/media-text/media-container-icon.js +0 -12
@@ -0,0 +1,92 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ addBlock,
6
+ getBlock,
7
+ initializeEditor,
8
+ setupCoreBlocks,
9
+ getEditorHtml,
10
+ fireEvent,
11
+ within,
12
+ waitFor,
13
+ changeAndSelectTextOfRichText,
14
+ } from 'test/helpers';
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+ import { ENTER } from '@wordpress/keycodes';
20
+
21
+ setupCoreBlocks();
22
+
23
+ describe( 'Quote', () => {
24
+ it( 'should produce expected markup for multiline text', async () => {
25
+ // Arrange
26
+ const screen = await initializeEditor();
27
+ await addBlock( screen, 'Quote' );
28
+ const quoteBlock = getBlock( screen, 'Quote' );
29
+ // A layout event must be explicitly dispatched in BlockList component,
30
+ // otherwise the inner blocks are not rendered.
31
+ fireEvent(
32
+ within( quoteBlock ).getByTestId( 'block-list-wrapper' ),
33
+ 'layout',
34
+ {
35
+ nativeEvent: {
36
+ layout: {
37
+ width: 320,
38
+ },
39
+ },
40
+ }
41
+ );
42
+ // Await inner blocks to be rendered
43
+ const citationBlock = await waitFor( () =>
44
+ screen.getByPlaceholderText( 'Add citation' )
45
+ );
46
+
47
+ // Act
48
+ fireEvent.press( quoteBlock );
49
+ // screen.debug();
50
+ let quoteTextInput =
51
+ within( quoteBlock ).getByPlaceholderText( 'Start writing…' );
52
+ const string = 'A great statement.';
53
+ changeAndSelectTextOfRichText( quoteTextInput, string, {
54
+ selectionStart: string.length,
55
+ selectionEnd: string.length,
56
+ } );
57
+ fireEvent( quoteTextInput, 'onKeyDown', {
58
+ nativeEvent: {},
59
+ preventDefault() {},
60
+ keyCode: ENTER,
61
+ } );
62
+ quoteTextInput =
63
+ within( quoteBlock ).getAllByPlaceholderText(
64
+ 'Start writing…'
65
+ )[ 1 ];
66
+ changeAndSelectTextOfRichText( quoteTextInput, 'Again.' );
67
+ const citationTextInput =
68
+ within( citationBlock ).getByPlaceholderText( 'Add citation' );
69
+ changeAndSelectTextOfRichText( citationTextInput, 'A person', {
70
+ selectionStart: 2,
71
+ selectionEnd: 2,
72
+ } );
73
+ fireEvent( citationTextInput, 'onKeyDown', {
74
+ nativeEvent: {},
75
+ preventDefault() {},
76
+ keyCode: ENTER,
77
+ } );
78
+
79
+ // Assert
80
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
81
+ "<!-- wp:quote -->
82
+ <blockquote class="wp-block-quote"><!-- wp:paragraph -->
83
+ <p>A great statement.</p>
84
+ <!-- /wp:paragraph -->
85
+
86
+ <!-- wp:paragraph -->
87
+ <p>Again.</p>
88
+ <!-- /wp:paragraph --><cite>A <br>person</cite></blockquote>
89
+ <!-- /wp:quote -->"
90
+ ` );
91
+ } );
92
+ } );
@@ -116,7 +116,7 @@ function render_block_core_search( $attributes ) {
116
116
 
117
117
  $button_internal_markup =
118
118
  '<svg class="search-icon" viewBox="0 0 24 24" width="24" height="24">
119
- <path d="M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"></path>
119
+ <path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"></path>
120
120
  </svg>';
121
121
  }
122
122
 
@@ -1,5 +1,8 @@
1
+ $button-spacing-x: $grid-unit-10 + math.div($grid-unit-05, 2); // 10px
2
+ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
3
+
1
4
  .wp-block-search__button {
2
- margin-left: 0.625em;
5
+ margin-left: $button-spacing-x;
3
6
  word-break: normal;
4
7
 
5
8
  &.has-icon {
@@ -7,8 +10,8 @@
7
10
  }
8
11
 
9
12
  svg {
10
- min-width: 1.5em;
11
- min-height: 1.5em;
13
+ min-width: $grid-unit-30;
14
+ min-height: $grid-unit-30;
12
15
  fill: currentColor;
13
16
  vertical-align: text-bottom;
14
17
  }
@@ -17,8 +20,8 @@
17
20
  // These rules are set to zero specificity to keep the default styles for search buttons.
18
21
  // They are needed for backwards compatibility.
19
22
  :where(.wp-block-search__button) {
20
- border: 1px solid #ccc;
21
- padding: 0.375em 0.625em;
23
+ border: 1px solid $gray-400;
24
+ padding: $button-spacing-y $button-spacing-x;
22
25
  }
23
26
 
24
27
  .wp-block-search__inside-wrapper {
@@ -33,12 +36,12 @@
33
36
  }
34
37
 
35
38
  .wp-block-search__input {
36
- padding: 8px;
39
+ padding: $grid-unit-10;
37
40
  flex-grow: 1;
38
41
  margin-left: 0;
39
42
  margin-right: 0;
40
- min-width: 3em;
41
- border: 1px solid #949494;
43
+ min-width: 3rem;
44
+ border: 1px solid $gray-600;
42
45
  // !important used to forcibly prevent undesired application of
43
46
  // text-decoration styles on the input field.
44
47
  text-decoration: unset !important;
@@ -52,13 +55,14 @@
52
55
 
53
56
  // We are lowering the specificity so that the button element can override the rule for the button inside the search block.
54
57
  :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) {
55
- padding: 4px;
56
- border: 1px solid #949494;
58
+ padding: $grid-unit-05;
59
+ border: 1px solid $gray-600;
60
+ box-sizing: border-box;
57
61
 
58
62
  .wp-block-search__input {
59
63
  border-radius: 0;
60
64
  border: none;
61
- padding: 0 0 0 0.25em;
65
+ padding: 0 $grid-unit-05;
62
66
 
63
67
  &:focus {
64
68
  outline: none;
@@ -67,7 +71,7 @@
67
71
 
68
72
  // For lower specificity.
69
73
  :where(.wp-block-search__button) {
70
- padding: 0.125em 0.5em;
74
+ padding: $grid-unit-05 $grid-unit-10;
71
75
  }
72
76
  }
73
77
 
@@ -1,13 +1,34 @@
1
1
  [data-type="core/shortcode"] {
2
- .block-editor-plain-text {
3
- max-height: 250px;
4
- }
5
-
6
2
  &.components-placeholder {
7
3
  min-height: 0;
8
4
  }
9
5
  }
10
6
 
7
+ // The editing view for the Shortcode block is equivalent to block UI.
8
+ // Therefore we increase specificity to avoid theme styles bleeding in.
11
9
  .blocks-shortcode__textarea {
12
- @include input-control;
10
+ font-family: $editor-html-font !important;
11
+ color: $gray-900 !important;
12
+ background: $white !important;
13
+ padding: $grid-unit-15 !important;
14
+ border: $border-width solid $gray-900 !important;
15
+ box-shadow: none !important;
16
+ border-radius: $radius-block-ui !important;
17
+ box-sizing: border-box;
18
+ max-height: 250px;
19
+ resize: none;
20
+
21
+ /* Fonts smaller than 16px causes mobile safari to zoom. */
22
+ font-size: $mobile-text-min-font-size !important;
23
+ @include break-small {
24
+ font-size: $default-font-size !important;
25
+ }
26
+
27
+ &:focus {
28
+ border-color: var(--wp-admin-theme-color) !important;
29
+ box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;
30
+
31
+ // Windows High Contrast mode will show this outline, but not the box-shadow.
32
+ outline: 2px solid transparent !important;
33
+ }
13
34
  }
@@ -2,14 +2,21 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { InspectorControls, useSetting } from '@wordpress/block-editor';
6
5
  import {
6
+ InspectorControls,
7
+ useSetting,
8
+ __experimentalSpacingSizesControl as SpacingSizesControl,
9
+ isValueSpacingPreset,
10
+ } from '@wordpress/block-editor';
11
+ import {
12
+ BaseControl,
7
13
  PanelBody,
8
14
  __experimentalUseCustomUnits as useCustomUnits,
9
15
  __experimentalUnitControl as UnitControl,
10
16
  __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
11
17
  } from '@wordpress/components';
12
18
  import { useInstanceId } from '@wordpress/compose';
19
+ import { View } from '@wordpress/primitives';
13
20
 
14
21
  /**
15
22
  * Internal dependencies
@@ -18,7 +25,7 @@ import { MIN_SPACER_SIZE } from './constants';
18
25
 
19
26
  function DimensionInput( { label, onChange, isResizing, value = '' } ) {
20
27
  const inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );
21
-
28
+ const spacingSizes = useSetting( 'spacing.spacingSizes' );
22
29
  // In most contexts the spacer size cannot meaningfully be set to a
23
30
  // percentage, since this is relative to the parent container. This
24
31
  // unit is disabled from the UI.
@@ -38,28 +45,46 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
38
45
  } );
39
46
 
40
47
  const handleOnChange = ( unprocessedValue ) => {
41
- onChange( unprocessedValue );
48
+ onChange( unprocessedValue.all );
42
49
  };
43
50
 
44
51
  // Force the unit to update to `px` when the Spacer is being resized.
45
52
  const [ parsedQuantity, parsedUnit ] =
46
53
  parseQuantityAndUnitFromRawValue( value );
47
- const computedValue = [
48
- parsedQuantity,
49
- isResizing ? 'px' : parsedUnit,
50
- ].join( '' );
54
+ const computedValue = isValueSpacingPreset( value )
55
+ ? value
56
+ : [ parsedQuantity, isResizing ? 'px' : parsedUnit ].join( '' );
51
57
 
52
58
  return (
53
- <UnitControl
54
- label={ label }
55
- id={ inputId }
56
- isResetValueOnUnitChange
57
- min={ MIN_SPACER_SIZE }
58
- onChange={ handleOnChange }
59
- __unstableInputWidth={ '80px' }
60
- value={ computedValue }
61
- units={ units }
62
- />
59
+ <>
60
+ { ( ! spacingSizes || spacingSizes?.length === 0 ) && (
61
+ <BaseControl label={ label } id={ inputId }>
62
+ <UnitControl
63
+ id={ inputId }
64
+ isResetValueOnUnitChange
65
+ min={ MIN_SPACER_SIZE }
66
+ onChange={ handleOnChange }
67
+ style={ { maxWidth: 80 } }
68
+ value={ computedValue }
69
+ units={ units }
70
+ />
71
+ </BaseControl>
72
+ ) }
73
+
74
+ { spacingSizes?.length > 0 && (
75
+ <View className="tools-panel-item-spacing">
76
+ <SpacingSizesControl
77
+ values={ { all: computedValue } }
78
+ onChange={ handleOnChange }
79
+ label={ label }
80
+ sides={ [ 'all' ] }
81
+ units={ units }
82
+ allowReset={ false }
83
+ splitOnAxis={ false }
84
+ />
85
+ </View>
86
+ ) }
87
+ </>
63
88
  );
64
89
  }
65
90
 
@@ -6,10 +6,15 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useBlockProps } from '@wordpress/block-editor';
9
+ import {
10
+ useBlockProps,
11
+ getSpacingPresetCssVar,
12
+ store as blockEditorStore,
13
+ } from '@wordpress/block-editor';
10
14
  import { ResizableBox } from '@wordpress/components';
11
15
  import { useState, useEffect } from '@wordpress/element';
12
16
  import { View } from '@wordpress/primitives';
17
+ import { useSelect } from '@wordpress/data';
13
18
 
14
19
  /**
15
20
  * Internal dependencies
@@ -78,8 +83,21 @@ const SpacerEdit = ( {
78
83
  setAttributes,
79
84
  toggleSelection,
80
85
  context,
86
+ __unstableParentLayout: parentLayout,
87
+ className,
81
88
  } ) => {
89
+ const disableCustomSpacingSizes = useSelect( ( select ) => {
90
+ const editorSettings = select( blockEditorStore ).getSettings();
91
+ return editorSettings?.disableCustomSpacingSizes;
92
+ } );
82
93
  const { orientation } = context;
94
+ const { orientation: parentOrientation, type } = parentLayout || {};
95
+ // If the spacer is inside a flex container, it should either inherit the orientation
96
+ // of the parent or use the flex default orientation.
97
+ const inheritedOrientation =
98
+ ! parentOrientation && type === 'flex'
99
+ ? 'horizontal'
100
+ : parentOrientation || orientation;
83
101
  const { height, width } = attributes;
84
102
 
85
103
  const [ isResizing, setIsResizing ] = useState( false );
@@ -104,12 +122,19 @@ const SpacerEdit = ( {
104
122
 
105
123
  const style = {
106
124
  height:
107
- orientation === 'horizontal'
125
+ inheritedOrientation === 'horizontal'
108
126
  ? 24
109
- : temporaryHeight || height || undefined,
127
+ : temporaryHeight ||
128
+ getSpacingPresetCssVar( height ) ||
129
+ undefined,
110
130
  width:
111
- orientation === 'horizontal'
112
- ? temporaryWidth || width || undefined
131
+ inheritedOrientation === 'horizontal'
132
+ ? temporaryWidth || getSpacingPresetCssVar( width ) || undefined
133
+ : undefined,
134
+ // In vertical flex containers, the spacer shrinks to nothing without a minimum width.
135
+ minWidth:
136
+ inheritedOrientation === 'vertical' && type === 'flex'
137
+ ? 48
113
138
  : undefined,
114
139
  };
115
140
 
@@ -166,7 +191,7 @@ const SpacerEdit = ( {
166
191
  };
167
192
 
168
193
  useEffect( () => {
169
- if ( orientation === 'horizontal' && ! width ) {
194
+ if ( inheritedOrientation === 'horizontal' && ! width ) {
170
195
  setAttributes( {
171
196
  height: '0px',
172
197
  width: '72px',
@@ -176,14 +201,21 @@ const SpacerEdit = ( {
176
201
 
177
202
  return (
178
203
  <>
179
- <View { ...useBlockProps( { style } ) }>
180
- { resizableBoxWithOrientation( orientation ) }
204
+ <View
205
+ { ...useBlockProps( {
206
+ style,
207
+ className: classnames( className, {
208
+ 'custom-sizes-disabled': disableCustomSpacingSizes,
209
+ } ),
210
+ } ) }
211
+ >
212
+ { resizableBoxWithOrientation( inheritedOrientation ) }
181
213
  </View>
182
214
  <SpacerControls
183
215
  setAttributes={ setAttributes }
184
216
  height={ temporaryHeight || height }
185
217
  width={ temporaryWidth || width }
186
- orientation={ orientation }
218
+ orientation={ inheritedOrientation }
187
219
  isResizing={ isResizing }
188
220
  />
189
221
  </>
@@ -17,7 +17,8 @@
17
17
  }
18
18
 
19
19
  .wp-block-spacer.is-hovered .block-library-spacer__resize-container,
20
- .block-library-spacer__resize-container.has-show-handle {
20
+ .block-library-spacer__resize-container.has-show-handle,
21
+ .wp-block-spacer.is-selected.custom-sizes-disabled {
21
22
  background: rgba($black, 0.1);
22
23
 
23
24
  .is-dark-theme & {
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useBlockProps } from '@wordpress/block-editor';
4
+ import { useBlockProps, getSpacingPresetCssVar } from '@wordpress/block-editor';
5
5
 
6
6
  export default function save( { attributes: { height, width } } ) {
7
7
  return (
8
8
  <div
9
9
  { ...useBlockProps.save( {
10
10
  style: {
11
- height,
12
- width,
11
+ height: getSpacingPresetCssVar( height ),
12
+ width: getSpacingPresetCssVar( width ),
13
13
  },
14
14
  'aria-hidden': true,
15
15
  } ) }
package/src/style.scss CHANGED
@@ -11,6 +11,8 @@
11
11
  @import "./comments-pagination/style.scss";
12
12
  @import "./comment-template/style.scss";
13
13
  @import "./cover/style.scss";
14
+ @import "./details/style.scss";
15
+ @import "./details-summary/style.scss";
14
16
  @import "./embed/style.scss";
15
17
  @import "./file/style.scss";
16
18
  @import "./gallery/style.scss";
@@ -32,6 +34,7 @@
32
34
  @import "./post-featured-image/style.scss";
33
35
  @import "./post-navigation-link/style.scss";
34
36
  @import "./post-terms/style.scss";
37
+ @import "./post-time-to-read/style.scss";
35
38
  @import "./post-title/style.scss";
36
39
  @import "./preformatted/style.scss";
37
40
  @import "./pullquote/style.scss";
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { mapValues } from 'lodash';
5
-
6
1
  const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];
7
2
 
8
3
  /**
@@ -82,33 +77,45 @@ export function updateSelectedCell( state, selection, updateCell ) {
82
77
  const { sectionName: selectionSectionName, rowIndex: selectionRowIndex } =
83
78
  selection;
84
79
 
85
- return mapValues( tableSections, ( section, sectionName ) => {
86
- if ( selectionSectionName && selectionSectionName !== sectionName ) {
87
- return section;
88
- }
89
-
90
- return section.map( ( row, rowIndex ) => {
91
- if ( selectionRowIndex && selectionRowIndex !== rowIndex ) {
92
- return row;
80
+ return Object.fromEntries(
81
+ Object.entries( tableSections ).map( ( [ sectionName, section ] ) => {
82
+ if (
83
+ selectionSectionName &&
84
+ selectionSectionName !== sectionName
85
+ ) {
86
+ return [ sectionName, section ];
93
87
  }
94
88
 
95
- return {
96
- cells: row.cells.map( ( cellAttributes, columnIndex ) => {
97
- const cellLocation = {
98
- sectionName,
99
- columnIndex,
100
- rowIndex,
101
- };
102
-
103
- if ( ! isCellSelected( cellLocation, selection ) ) {
104
- return cellAttributes;
89
+ return [
90
+ sectionName,
91
+ section.map( ( row, rowIndex ) => {
92
+ if ( selectionRowIndex && selectionRowIndex !== rowIndex ) {
93
+ return row;
105
94
  }
106
95
 
107
- return updateCell( cellAttributes );
96
+ return {
97
+ cells: row.cells.map(
98
+ ( cellAttributes, columnIndex ) => {
99
+ const cellLocation = {
100
+ sectionName,
101
+ columnIndex,
102
+ rowIndex,
103
+ };
104
+
105
+ if (
106
+ ! isCellSelected( cellLocation, selection )
107
+ ) {
108
+ return cellAttributes;
109
+ }
110
+
111
+ return updateCell( cellAttributes );
112
+ }
113
+ ),
114
+ };
108
115
  } ),
109
- };
110
- } );
111
- } );
116
+ ];
117
+ } )
118
+ );
112
119
  }
113
120
 
114
121
  /**
@@ -224,31 +231,36 @@ export function insertColumn( state, { columnIndex } ) {
224
231
  )
225
232
  );
226
233
 
227
- return mapValues( tableSections, ( section, sectionName ) => {
228
- // Bail early if the table section is empty.
229
- if ( isEmptyTableSection( section ) ) {
230
- return section;
231
- }
232
-
233
- return section.map( ( row ) => {
234
- // Bail early if the row is empty or it's an attempt to insert past
235
- // the last possible index of the array.
236
- if ( isEmptyRow( row ) || row.cells.length < columnIndex ) {
237
- return row;
234
+ return Object.fromEntries(
235
+ Object.entries( tableSections ).map( ( [ sectionName, section ] ) => {
236
+ // Bail early if the table section is empty.
237
+ if ( isEmptyTableSection( section ) ) {
238
+ return [ sectionName, section ];
238
239
  }
239
240
 
240
- return {
241
- cells: [
242
- ...row.cells.slice( 0, columnIndex ),
243
- {
244
- content: '',
245
- tag: sectionName === 'head' ? 'th' : 'td',
246
- },
247
- ...row.cells.slice( columnIndex ),
248
- ],
249
- };
250
- } );
251
- } );
241
+ return [
242
+ sectionName,
243
+ section.map( ( row ) => {
244
+ // Bail early if the row is empty or it's an attempt to insert past
245
+ // the last possible index of the array.
246
+ if ( isEmptyRow( row ) || row.cells.length < columnIndex ) {
247
+ return row;
248
+ }
249
+
250
+ return {
251
+ cells: [
252
+ ...row.cells.slice( 0, columnIndex ),
253
+ {
254
+ content: '',
255
+ tag: sectionName === 'head' ? 'th' : 'td',
256
+ },
257
+ ...row.cells.slice( columnIndex ),
258
+ ],
259
+ };
260
+ } ),
261
+ ];
262
+ } )
263
+ );
252
264
  }
253
265
 
254
266
  /**
@@ -267,23 +279,28 @@ export function deleteColumn( state, { columnIndex } ) {
267
279
  )
268
280
  );
269
281
 
270
- return mapValues( tableSections, ( section ) => {
271
- // Bail early if the table section is empty.
272
- if ( isEmptyTableSection( section ) ) {
273
- return section;
274
- }
282
+ return Object.fromEntries(
283
+ Object.entries( tableSections ).map( ( [ sectionName, section ] ) => {
284
+ // Bail early if the table section is empty.
285
+ if ( isEmptyTableSection( section ) ) {
286
+ return [ sectionName, section ];
287
+ }
275
288
 
276
- return section
277
- .map( ( row ) => ( {
278
- cells:
279
- row.cells.length >= columnIndex
280
- ? row.cells.filter(
281
- ( cell, index ) => index !== columnIndex
282
- )
283
- : row.cells,
284
- } ) )
285
- .filter( ( row ) => row.cells.length );
286
- } );
289
+ return [
290
+ sectionName,
291
+ section
292
+ .map( ( row ) => ( {
293
+ cells:
294
+ row.cells.length >= columnIndex
295
+ ? row.cells.filter(
296
+ ( cell, index ) => index !== columnIndex
297
+ )
298
+ : row.cells,
299
+ } ) )
300
+ .filter( ( row ) => row.cells.length ),
301
+ ];
302
+ } )
303
+ );
287
304
  }
288
305
 
289
306
  /**
@@ -39,6 +39,5 @@
39
39
  "fontSize": true
40
40
  }
41
41
  }
42
- },
43
- "editorStyle": "wp-block-term-description-editor"
42
+ }
44
43
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { isEmpty, mapValues } from 'lodash';
4
+ import { isEmpty } from 'lodash';
5
5
 
6
6
  /**
7
7
  * Removed empty nodes from nested objects.
@@ -18,9 +18,9 @@ const cleanEmptyObject = ( object ) => {
18
18
  return object;
19
19
  }
20
20
  const cleanedNestedObjects = Object.fromEntries(
21
- Object.entries( mapValues( object, cleanEmptyObject ) ).filter(
22
- ( [ , value ] ) => Boolean( value )
23
- )
21
+ Object.entries( object )
22
+ .map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )
23
+ .filter( ( [ , value ] ) => Boolean( value ) )
24
24
  );
25
25
  return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
26
26
  };