@wordpress/block-editor 8.1.2-next.f435e9e01b.0 → 8.2.1-next.a55ed9455a.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 (586) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +6 -26
  3. package/build/autocompleters/link.js +78 -0
  4. package/build/autocompleters/link.js.map +1 -0
  5. package/build/components/autocomplete/index.js +3 -1
  6. package/build/components/autocomplete/index.js.map +1 -1
  7. package/build/components/block-actions/index.js +1 -1
  8. package/build/components/block-actions/index.js.map +1 -1
  9. package/build/components/block-breadcrumb/index.js +4 -2
  10. package/build/components/block-breadcrumb/index.js.map +1 -1
  11. package/build/components/block-compare/index.js +2 -2
  12. package/build/components/block-compare/index.js.map +1 -1
  13. package/build/components/block-controls/index.js +1 -1
  14. package/build/components/block-controls/index.js.map +1 -1
  15. package/build/components/block-draggable/index.js +1 -1
  16. package/build/components/block-draggable/index.js.map +1 -1
  17. package/build/components/block-edit/edit.js +1 -1
  18. package/build/components/block-edit/edit.js.map +1 -1
  19. package/build/components/block-list/block-html.js +1 -1
  20. package/build/components/block-list/block-html.js.map +1 -1
  21. package/build/components/block-list/block-invalid-warning.js +1 -1
  22. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  23. package/build/components/block-list/block-list-item.native.js +4 -4
  24. package/build/components/block-list/block-list-item.native.js.map +1 -1
  25. package/build/components/block-list/block-selection-button.native.js +4 -3
  26. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  27. package/build/components/block-list/block.js +17 -3
  28. package/build/components/block-list/block.js.map +1 -1
  29. package/build/components/block-list/block.native.js +6 -6
  30. package/build/components/block-list/block.native.js.map +1 -1
  31. package/build/components/block-list/index.native.js +5 -5
  32. package/build/components/block-list/index.native.js.map +1 -1
  33. package/build/components/block-list/use-block-props/use-block-class-names.js +1 -1
  34. package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  35. package/build/components/block-list/use-block-props/use-focus-first-element.js +3 -0
  36. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  37. package/build/components/block-list/use-block-props/use-multi-selection.js +25 -27
  38. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  39. package/build/components/block-media-update-progress/index.native.js +4 -4
  40. package/build/components/block-media-update-progress/index.native.js.map +1 -1
  41. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  42. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  43. package/build/components/block-mobile-toolbar/index.native.js +1 -1
  44. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  45. package/build/components/block-mover/mover-description.js +4 -4
  46. package/build/components/block-mover/mover-description.js.map +1 -1
  47. package/build/components/block-mover/mover-description.native.js +5 -5
  48. package/build/components/block-mover/mover-description.native.js.map +1 -1
  49. package/build/components/block-settings/container.native.js +1 -5
  50. package/build/components/block-settings/container.native.js.map +1 -1
  51. package/build/components/block-settings-menu/block-settings-dropdown.js +7 -12
  52. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  53. package/build/components/block-styles/preview.native.js +1 -1
  54. package/build/components/block-styles/preview.native.js.map +1 -1
  55. package/build/components/block-switcher/index.js +2 -1
  56. package/build/components/block-switcher/index.js.map +1 -1
  57. package/build/components/block-switcher/use-transformed-patterns.js +0 -1
  58. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  59. package/build/components/block-title/index.js +7 -62
  60. package/build/components/block-title/index.js.map +1 -1
  61. package/build/components/block-title/use-block-display-title.js +94 -0
  62. package/build/components/block-title/use-block-display-title.js.map +1 -0
  63. package/build/components/block-toolbar/utils.js +9 -1
  64. package/build/components/block-toolbar/utils.js.map +1 -1
  65. package/build/components/block-tools/block-popover.js +1 -1
  66. package/build/components/block-tools/block-popover.js.map +1 -1
  67. package/build/components/block-tools/block-selection-button.js +2 -1
  68. package/build/components/block-tools/block-selection-button.js.map +1 -1
  69. package/build/components/block-types-list/index.native.js +1 -1
  70. package/build/components/block-types-list/index.native.js.map +1 -1
  71. package/build/components/border-radius-control/index.js +2 -2
  72. package/build/components/border-radius-control/index.js.map +1 -1
  73. package/build/components/border-radius-control/utils.js +10 -6
  74. package/build/components/border-radius-control/utils.js.map +1 -1
  75. package/build/components/contrast-checker/index.js +3 -3
  76. package/build/components/contrast-checker/index.js.map +1 -1
  77. package/build/components/convert-to-group-buttons/index.js +1 -1
  78. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  79. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
  80. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  81. package/build/components/copy-handler/index.js +3 -3
  82. package/build/components/copy-handler/index.js.map +1 -1
  83. package/build/components/font-sizes/with-font-sizes.js +3 -3
  84. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  85. package/build/components/index.js +9 -0
  86. package/build/components/index.js.map +1 -1
  87. package/build/components/index.native.js +38 -1
  88. package/build/components/index.native.js.map +1 -1
  89. package/build/components/inserter/block-patterns-tab.js +4 -4
  90. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  91. package/build/components/inserter/block-types-tab.js +1 -1
  92. package/build/components/inserter/block-types-tab.js.map +1 -1
  93. package/build/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  94. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  95. package/build/components/inserter/index.js +3 -3
  96. package/build/components/inserter/index.js.map +1 -1
  97. package/build/components/inserter/index.native.js +7 -7
  98. package/build/components/inserter/index.native.js.map +1 -1
  99. package/build/components/inserter/menu.js.map +1 -1
  100. package/build/components/inserter/menu.native.js +3 -3
  101. package/build/components/inserter/menu.native.js.map +1 -1
  102. package/build/components/inserter/quick-inserter.js +20 -8
  103. package/build/components/inserter/quick-inserter.js.map +1 -1
  104. package/build/components/inserter/search-items.js +1 -1
  105. package/build/components/inserter/search-items.js.map +1 -1
  106. package/build/components/inserter/search-results.js +28 -11
  107. package/build/components/inserter/search-results.js.map +1 -1
  108. package/build/components/keyboard-shortcuts/index.js +1 -1
  109. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  110. package/build/components/letter-spacing-control/index.js +3 -3
  111. package/build/components/letter-spacing-control/index.js.map +1 -1
  112. package/build/components/line-height-control/index.js +63 -45
  113. package/build/components/line-height-control/index.js.map +1 -1
  114. package/build/components/line-height-control/index.native.js +3 -1
  115. package/build/components/line-height-control/index.native.js.map +1 -1
  116. package/build/components/link-control/index.js +2 -2
  117. package/build/components/link-control/index.js.map +1 -1
  118. package/build/components/link-control/search-input.js +1 -1
  119. package/build/components/link-control/search-input.js.map +1 -1
  120. package/build/components/link-control/search-results.js +2 -2
  121. package/build/components/link-control/search-results.js.map +1 -1
  122. package/build/components/link-control/use-rich-url-data.js +1 -1
  123. package/build/components/link-control/use-rich-url-data.js.map +1 -1
  124. package/build/components/link-control/use-search-handler.js +2 -2
  125. package/build/components/link-control/use-search-handler.js.map +1 -1
  126. package/build/components/list-view/block-contents.js +8 -4
  127. package/build/components/list-view/block-contents.js.map +1 -1
  128. package/build/components/list-view/block-select-button.js +2 -2
  129. package/build/components/list-view/block-select-button.js.map +1 -1
  130. package/build/components/list-view/block.js +20 -9
  131. package/build/components/list-view/block.js.map +1 -1
  132. package/build/components/list-view/branch.js +2 -1
  133. package/build/components/list-view/branch.js.map +1 -1
  134. package/build/components/list-view/index.js +49 -41
  135. package/build/components/list-view/index.js.map +1 -1
  136. package/build/components/list-view/use-block-selection.js +139 -0
  137. package/build/components/list-view/use-block-selection.js.map +1 -0
  138. package/build/components/list-view/use-list-view-expand-selected-item.js +60 -0
  139. package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
  140. package/build/components/list-view/utils.js +29 -1
  141. package/build/components/list-view/utils.js.map +1 -1
  142. package/build/components/media-placeholder/index.native.js +7 -5
  143. package/build/components/media-placeholder/index.native.js.map +1 -1
  144. package/build/components/media-replace-flow/index.js +20 -24
  145. package/build/components/media-replace-flow/index.js.map +1 -1
  146. package/build/components/media-upload/index.native.js +4 -3
  147. package/build/components/media-upload/index.native.js.map +1 -1
  148. package/build/components/media-upload-progress/index.native.js +1 -1
  149. package/build/components/media-upload-progress/index.native.js.map +1 -1
  150. package/build/components/navigable-toolbar/index.js +3 -3
  151. package/build/components/navigable-toolbar/index.js.map +1 -1
  152. package/build/components/plain-text/index.native.js +3 -3
  153. package/build/components/plain-text/index.native.js.map +1 -1
  154. package/build/components/rich-text/format-toolbar-container.js +2 -2
  155. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  156. package/build/components/rich-text/format-toolbar-container.native.js +1 -1
  157. package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
  158. package/build/components/rich-text/index.js +7 -12
  159. package/build/components/rich-text/index.js.map +1 -1
  160. package/build/components/rich-text/index.native.js +3 -3
  161. package/build/components/rich-text/index.native.js.map +1 -1
  162. package/build/components/rich-text/use-paste-handler.js +7 -12
  163. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  164. package/build/components/url-input/index.js +11 -11
  165. package/build/components/url-input/index.js.map +1 -1
  166. package/build/components/use-moving-animation/index.js +1 -1
  167. package/build/components/use-moving-animation/index.js.map +1 -1
  168. package/build/components/use-on-block-drop/index.js +2 -2
  169. package/build/components/use-on-block-drop/index.js.map +1 -1
  170. package/build/components/writing-flow/index.js +1 -0
  171. package/build/components/writing-flow/index.js.map +1 -1
  172. package/build/components/writing-flow/use-multi-selection.js +22 -24
  173. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  174. package/build/components/writing-flow/use-select-all.js +3 -2
  175. package/build/components/writing-flow/use-select-all.js.map +1 -1
  176. package/build/components/writing-flow/use-tab-nav.js +4 -3
  177. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  178. package/build/hooks/align.js +1 -1
  179. package/build/hooks/align.js.map +1 -1
  180. package/build/hooks/anchor.js +1 -1
  181. package/build/hooks/anchor.js.map +1 -1
  182. package/build/hooks/border.js +2 -14
  183. package/build/hooks/border.js.map +1 -1
  184. package/build/hooks/color.js +2 -2
  185. package/build/hooks/color.js.map +1 -1
  186. package/build/hooks/custom-class-name.js +40 -0
  187. package/build/hooks/custom-class-name.js.map +1 -1
  188. package/build/hooks/generated-class-name.js +3 -3
  189. package/build/hooks/generated-class-name.js.map +1 -1
  190. package/build/hooks/line-height.js +2 -0
  191. package/build/hooks/line-height.js.map +1 -1
  192. package/build/hooks/lock.js +1 -1
  193. package/build/hooks/lock.js.map +1 -1
  194. package/build/hooks/style.js +32 -13
  195. package/build/hooks/style.js.map +1 -1
  196. package/build/layouts/flow.js +7 -5
  197. package/build/layouts/flow.js.map +1 -1
  198. package/build/store/actions.js +55 -48
  199. package/build/store/actions.js.map +1 -1
  200. package/build/store/defaults.js +2 -1
  201. package/build/store/defaults.js.map +1 -1
  202. package/build/store/index.js +1 -2
  203. package/build/store/index.js.map +1 -1
  204. package/build/store/reducer.js +13 -13
  205. package/build/store/reducer.js.map +1 -1
  206. package/build/store/selectors.js +6 -6
  207. package/build/store/selectors.js.map +1 -1
  208. package/build/utils/index.js +0 -14
  209. package/build/utils/index.js.map +1 -1
  210. package/build/utils/parse-css-unit-to-px.js +3 -3
  211. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  212. package/build/utils/pasting.js +91 -0
  213. package/build/utils/pasting.js.map +1 -0
  214. package/build/utils/transform-styles/ast/parse.js +5 -5
  215. package/build/utils/transform-styles/ast/parse.js.map +1 -1
  216. package/build/utils/transform-styles/transforms/url-rewrite.js +2 -2
  217. package/build/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  218. package/build-module/autocompleters/link.js +64 -0
  219. package/build-module/autocompleters/link.js.map +1 -0
  220. package/build-module/components/autocomplete/index.js +2 -1
  221. package/build-module/components/autocomplete/index.js.map +1 -1
  222. package/build-module/components/block-actions/index.js +1 -1
  223. package/build-module/components/block-actions/index.js.map +1 -1
  224. package/build-module/components/block-breadcrumb/index.js +4 -2
  225. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  226. package/build-module/components/block-compare/index.js +2 -2
  227. package/build-module/components/block-compare/index.js.map +1 -1
  228. package/build-module/components/block-controls/index.js +1 -1
  229. package/build-module/components/block-controls/index.js.map +1 -1
  230. package/build-module/components/block-draggable/index.js +1 -1
  231. package/build-module/components/block-draggable/index.js.map +1 -1
  232. package/build-module/components/block-edit/edit.js +1 -1
  233. package/build-module/components/block-edit/edit.js.map +1 -1
  234. package/build-module/components/block-list/block-html.js +1 -1
  235. package/build-module/components/block-list/block-html.js.map +1 -1
  236. package/build-module/components/block-list/block-invalid-warning.js +1 -1
  237. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  238. package/build-module/components/block-list/block-list-item.native.js +4 -4
  239. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  240. package/build-module/components/block-list/block-selection-button.native.js +4 -3
  241. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  242. package/build-module/components/block-list/block.js +18 -4
  243. package/build-module/components/block-list/block.js.map +1 -1
  244. package/build-module/components/block-list/block.native.js +7 -7
  245. package/build-module/components/block-list/block.native.js.map +1 -1
  246. package/build-module/components/block-list/index.native.js +5 -5
  247. package/build-module/components/block-list/index.native.js.map +1 -1
  248. package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -1
  249. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  250. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +2 -0
  251. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  252. package/build-module/components/block-list/use-block-props/use-multi-selection.js +23 -28
  253. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  254. package/build-module/components/block-media-update-progress/index.native.js +4 -4
  255. package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
  256. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  257. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  258. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  259. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  260. package/build-module/components/block-mover/mover-description.js +4 -4
  261. package/build-module/components/block-mover/mover-description.js.map +1 -1
  262. package/build-module/components/block-mover/mover-description.native.js +5 -5
  263. package/build-module/components/block-mover/mover-description.native.js.map +1 -1
  264. package/build-module/components/block-settings/container.native.js +2 -6
  265. package/build-module/components/block-settings/container.native.js.map +1 -1
  266. package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -13
  267. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  268. package/build-module/components/block-styles/preview.native.js +1 -1
  269. package/build-module/components/block-styles/preview.native.js.map +1 -1
  270. package/build-module/components/block-switcher/index.js +2 -1
  271. package/build-module/components/block-switcher/index.js.map +1 -1
  272. package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
  273. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  274. package/build-module/components/block-title/index.js +7 -58
  275. package/build-module/components/block-title/index.js.map +1 -1
  276. package/build-module/components/block-title/use-block-display-title.js +80 -0
  277. package/build-module/components/block-title/use-block-display-title.js.map +1 -0
  278. package/build-module/components/block-toolbar/utils.js +9 -1
  279. package/build-module/components/block-toolbar/utils.js.map +1 -1
  280. package/build-module/components/block-tools/block-popover.js +1 -1
  281. package/build-module/components/block-tools/block-popover.js.map +1 -1
  282. package/build-module/components/block-tools/block-selection-button.js +2 -1
  283. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  284. package/build-module/components/block-types-list/index.native.js +1 -1
  285. package/build-module/components/block-types-list/index.native.js.map +1 -1
  286. package/build-module/components/border-radius-control/index.js +3 -3
  287. package/build-module/components/border-radius-control/index.js.map +1 -1
  288. package/build-module/components/border-radius-control/utils.js +11 -7
  289. package/build-module/components/border-radius-control/utils.js.map +1 -1
  290. package/build-module/components/contrast-checker/index.js +3 -3
  291. package/build-module/components/contrast-checker/index.js.map +1 -1
  292. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  293. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  294. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
  295. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  296. package/build-module/components/copy-handler/index.js +2 -2
  297. package/build-module/components/copy-handler/index.js.map +1 -1
  298. package/build-module/components/font-sizes/with-font-sizes.js +3 -3
  299. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  300. package/build-module/components/index.js +1 -0
  301. package/build-module/components/index.js.map +1 -1
  302. package/build-module/components/index.native.js +5 -4
  303. package/build-module/components/index.native.js.map +1 -1
  304. package/build-module/components/inserter/block-patterns-tab.js +4 -4
  305. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  306. package/build-module/components/inserter/block-types-tab.js +1 -1
  307. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  308. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  309. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  310. package/build-module/components/inserter/index.js +3 -3
  311. package/build-module/components/inserter/index.js.map +1 -1
  312. package/build-module/components/inserter/index.native.js +7 -7
  313. package/build-module/components/inserter/index.native.js.map +1 -1
  314. package/build-module/components/inserter/menu.js.map +1 -1
  315. package/build-module/components/inserter/menu.native.js +3 -3
  316. package/build-module/components/inserter/menu.native.js.map +1 -1
  317. package/build-module/components/inserter/quick-inserter.js +20 -8
  318. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  319. package/build-module/components/inserter/search-items.js +1 -1
  320. package/build-module/components/inserter/search-items.js.map +1 -1
  321. package/build-module/components/inserter/search-results.js +28 -11
  322. package/build-module/components/inserter/search-results.js.map +1 -1
  323. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  324. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  325. package/build-module/components/letter-spacing-control/index.js +3 -3
  326. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  327. package/build-module/components/line-height-control/index.js +61 -45
  328. package/build-module/components/line-height-control/index.js.map +1 -1
  329. package/build-module/components/line-height-control/index.native.js +3 -1
  330. package/build-module/components/line-height-control/index.native.js.map +1 -1
  331. package/build-module/components/link-control/index.js +2 -2
  332. package/build-module/components/link-control/index.js.map +1 -1
  333. package/build-module/components/link-control/search-input.js +1 -1
  334. package/build-module/components/link-control/search-input.js.map +1 -1
  335. package/build-module/components/link-control/search-results.js +2 -2
  336. package/build-module/components/link-control/search-results.js.map +1 -1
  337. package/build-module/components/link-control/use-rich-url-data.js +1 -1
  338. package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
  339. package/build-module/components/link-control/use-search-handler.js +2 -2
  340. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  341. package/build-module/components/list-view/block-contents.js +8 -4
  342. package/build-module/components/list-view/block-contents.js.map +1 -1
  343. package/build-module/components/list-view/block-select-button.js +2 -2
  344. package/build-module/components/list-view/block-select-button.js.map +1 -1
  345. package/build-module/components/list-view/block.js +20 -9
  346. package/build-module/components/list-view/block.js.map +1 -1
  347. package/build-module/components/list-view/branch.js +2 -1
  348. package/build-module/components/list-view/branch.js.map +1 -1
  349. package/build-module/components/list-view/index.js +46 -42
  350. package/build-module/components/list-view/index.js.map +1 -1
  351. package/build-module/components/list-view/use-block-selection.js +123 -0
  352. package/build-module/components/list-view/use-block-selection.js.map +1 -0
  353. package/build-module/components/list-view/use-list-view-expand-selected-item.js +50 -0
  354. package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
  355. package/build-module/components/list-view/utils.js +25 -0
  356. package/build-module/components/list-view/utils.js.map +1 -1
  357. package/build-module/components/media-placeholder/index.native.js +7 -5
  358. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  359. package/build-module/components/media-replace-flow/index.js +22 -27
  360. package/build-module/components/media-replace-flow/index.js.map +1 -1
  361. package/build-module/components/media-upload/index.native.js +4 -3
  362. package/build-module/components/media-upload/index.native.js.map +1 -1
  363. package/build-module/components/media-upload-progress/index.native.js +1 -1
  364. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  365. package/build-module/components/navigable-toolbar/index.js +3 -3
  366. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  367. package/build-module/components/plain-text/index.native.js +3 -3
  368. package/build-module/components/plain-text/index.native.js.map +1 -1
  369. package/build-module/components/rich-text/format-toolbar-container.js +2 -2
  370. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  371. package/build-module/components/rich-text/format-toolbar-container.native.js +1 -1
  372. package/build-module/components/rich-text/format-toolbar-container.native.js.map +1 -1
  373. package/build-module/components/rich-text/index.js +7 -12
  374. package/build-module/components/rich-text/index.js.map +1 -1
  375. package/build-module/components/rich-text/index.native.js +3 -3
  376. package/build-module/components/rich-text/index.native.js.map +1 -1
  377. package/build-module/components/rich-text/use-paste-handler.js +6 -12
  378. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  379. package/build-module/components/url-input/index.js +11 -11
  380. package/build-module/components/url-input/index.js.map +1 -1
  381. package/build-module/components/use-moving-animation/index.js +1 -1
  382. package/build-module/components/use-moving-animation/index.js.map +1 -1
  383. package/build-module/components/use-on-block-drop/index.js +2 -2
  384. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  385. package/build-module/components/writing-flow/index.js +1 -0
  386. package/build-module/components/writing-flow/index.js.map +1 -1
  387. package/build-module/components/writing-flow/use-multi-selection.js +21 -21
  388. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  389. package/build-module/components/writing-flow/use-select-all.js +3 -2
  390. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  391. package/build-module/components/writing-flow/use-tab-nav.js +4 -3
  392. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  393. package/build-module/hooks/align.js +1 -1
  394. package/build-module/hooks/align.js.map +1 -1
  395. package/build-module/hooks/anchor.js +1 -1
  396. package/build-module/hooks/anchor.js.map +1 -1
  397. package/build-module/hooks/border.js +2 -14
  398. package/build-module/hooks/border.js.map +1 -1
  399. package/build-module/hooks/color.js +2 -2
  400. package/build-module/hooks/color.js.map +1 -1
  401. package/build-module/hooks/custom-class-name.js +38 -0
  402. package/build-module/hooks/custom-class-name.js.map +1 -1
  403. package/build-module/hooks/generated-class-name.js +3 -3
  404. package/build-module/hooks/generated-class-name.js.map +1 -1
  405. package/build-module/hooks/line-height.js +2 -0
  406. package/build-module/hooks/line-height.js.map +1 -1
  407. package/build-module/hooks/lock.js +1 -1
  408. package/build-module/hooks/lock.js.map +1 -1
  409. package/build-module/hooks/style.js +31 -13
  410. package/build-module/hooks/style.js.map +1 -1
  411. package/build-module/layouts/flow.js +7 -5
  412. package/build-module/layouts/flow.js.map +1 -1
  413. package/build-module/store/actions.js +52 -45
  414. package/build-module/store/actions.js.map +1 -1
  415. package/build-module/store/defaults.js +2 -1
  416. package/build-module/store/defaults.js.map +1 -1
  417. package/build-module/store/index.js +1 -2
  418. package/build-module/store/index.js.map +1 -1
  419. package/build-module/store/reducer.js +13 -13
  420. package/build-module/store/reducer.js.map +1 -1
  421. package/build-module/store/selectors.js +6 -6
  422. package/build-module/store/selectors.js.map +1 -1
  423. package/build-module/utils/index.js +0 -1
  424. package/build-module/utils/index.js.map +1 -1
  425. package/build-module/utils/parse-css-unit-to-px.js +3 -3
  426. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  427. package/build-module/utils/pasting.js +80 -0
  428. package/build-module/utils/pasting.js.map +1 -0
  429. package/build-module/utils/transform-styles/ast/parse.js +5 -5
  430. package/build-module/utils/transform-styles/ast/parse.js.map +1 -1
  431. package/build-module/utils/transform-styles/transforms/url-rewrite.js +2 -2
  432. package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  433. package/build-style/style-rtl.css +10 -12
  434. package/build-style/style.css +10 -12
  435. package/package.json +27 -26
  436. package/src/autocompleters/link.js +62 -0
  437. package/src/autocompleters/style.scss +8 -0
  438. package/src/components/alignment-control/test/index.js +2 -2
  439. package/src/components/autocomplete/index.js +2 -0
  440. package/src/components/block-actions/index.js +1 -1
  441. package/src/components/block-alignment-control/test/index.js +1 -1
  442. package/src/components/block-breadcrumb/index.js +5 -2
  443. package/src/components/block-compare/index.js +2 -2
  444. package/src/components/block-controls/index.js +1 -1
  445. package/src/components/block-draggable/index.js +1 -1
  446. package/src/components/block-draggable/stories/index.js +1 -1
  447. package/src/components/block-edit/edit.js +1 -1
  448. package/src/components/block-list/block-html.js +1 -1
  449. package/src/components/block-list/block-invalid-warning.js +1 -1
  450. package/src/components/block-list/block-list-item.native.js +4 -4
  451. package/src/components/block-list/block-selection-button.native.js +3 -3
  452. package/src/components/block-list/block.js +28 -4
  453. package/src/components/block-list/block.native.js +7 -6
  454. package/src/components/block-list/index.native.js +5 -5
  455. package/src/components/block-list/style.scss +3 -1
  456. package/src/components/block-list/use-block-props/use-block-class-names.js +1 -1
  457. package/src/components/block-list/use-block-props/use-focus-first-element.js +3 -0
  458. package/src/components/block-list/use-block-props/use-multi-selection.js +22 -30
  459. package/src/components/block-media-update-progress/index.native.js +4 -4
  460. package/src/components/block-media-update-progress/test/index.native.js +2 -2
  461. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  462. package/src/components/block-mobile-toolbar/index.native.js +2 -2
  463. package/src/components/block-mover/mover-description.js +4 -4
  464. package/src/components/block-mover/mover-description.native.js +5 -5
  465. package/src/components/block-settings/container.native.js +5 -6
  466. package/src/components/block-settings-menu/block-settings-dropdown.js +7 -8
  467. package/src/components/block-styles/preview.native.js +1 -1
  468. package/src/components/block-switcher/index.js +4 -1
  469. package/src/components/block-switcher/use-transformed-patterns.js +0 -1
  470. package/src/components/block-title/README.md +17 -1
  471. package/src/components/block-title/index.js +7 -62
  472. package/src/components/block-title/test/index.js +21 -3
  473. package/src/components/block-title/use-block-display-title.js +83 -0
  474. package/src/components/block-toolbar/utils.js +12 -2
  475. package/src/components/block-tools/block-popover.js +1 -1
  476. package/src/components/block-tools/block-selection-button.js +4 -1
  477. package/src/components/block-types-list/index.native.js +1 -1
  478. package/src/components/border-radius-control/index.js +5 -3
  479. package/src/components/border-radius-control/test/utils.js +10 -10
  480. package/src/components/border-radius-control/utils.js +10 -8
  481. package/src/components/contrast-checker/index.js +3 -3
  482. package/src/components/convert-to-group-buttons/index.js +1 -1
  483. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -6
  484. package/src/components/copy-handler/index.js +2 -2
  485. package/src/components/font-sizes/with-font-sizes.js +3 -3
  486. package/src/components/image-size-control/test/index.js +1 -1
  487. package/src/components/index.js +1 -0
  488. package/src/components/index.native.js +11 -4
  489. package/src/components/inserter/block-patterns-tab.js +13 -17
  490. package/src/components/inserter/block-types-tab.js +1 -1
  491. package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  492. package/src/components/inserter/index.js +3 -3
  493. package/src/components/inserter/index.native.js +7 -7
  494. package/src/components/inserter/menu.js +1 -1
  495. package/src/components/inserter/menu.native.js +3 -3
  496. package/src/components/inserter/quick-inserter.js +32 -10
  497. package/src/components/inserter/search-items.js +1 -1
  498. package/src/components/inserter/search-results.js +55 -43
  499. package/src/components/inserter/test/fixtures/index.native.js +1 -1
  500. package/src/components/inserter/test/reusable-blocks-tab.js +2 -2
  501. package/src/components/justify-content-control/README.md +1 -1
  502. package/src/components/keyboard-shortcuts/index.js +1 -1
  503. package/src/components/letter-spacing-control/index.js +1 -1
  504. package/src/components/line-height-control/README.md +13 -2
  505. package/src/components/line-height-control/index.js +66 -43
  506. package/src/components/line-height-control/index.native.js +2 -0
  507. package/src/components/line-height-control/stories/index.js +33 -0
  508. package/src/components/line-height-control/test/index.js +61 -0
  509. package/src/components/link-control/index.js +2 -2
  510. package/src/components/link-control/search-input.js +1 -1
  511. package/src/components/link-control/search-results.js +2 -2
  512. package/src/components/link-control/test/index.js +142 -144
  513. package/src/components/link-control/use-rich-url-data.js +1 -1
  514. package/src/components/link-control/use-search-handler.js +2 -2
  515. package/src/components/list-view/README.md +2 -2
  516. package/src/components/list-view/block-contents.js +10 -3
  517. package/src/components/list-view/block-select-button.js +1 -2
  518. package/src/components/list-view/block.js +30 -10
  519. package/src/components/list-view/branch.js +1 -0
  520. package/src/components/list-view/index.js +56 -30
  521. package/src/components/list-view/test/utils.js +50 -0
  522. package/src/components/list-view/use-block-selection.js +163 -0
  523. package/src/components/list-view/use-list-view-expand-selected-item.js +58 -0
  524. package/src/components/list-view/utils.js +31 -0
  525. package/src/components/media-placeholder/index.native.js +11 -9
  526. package/src/components/media-replace-flow/README.md +7 -0
  527. package/src/components/media-replace-flow/index.js +20 -26
  528. package/src/components/media-replace-flow/test/index.js +100 -0
  529. package/src/components/media-upload/index.native.js +3 -2
  530. package/src/components/media-upload-progress/index.native.js +1 -1
  531. package/src/components/navigable-toolbar/index.js +3 -3
  532. package/src/components/plain-text/index.native.js +3 -3
  533. package/src/components/responsive-block-control/test/index.js +6 -6
  534. package/src/components/rich-text/format-toolbar-container.js +2 -2
  535. package/src/components/rich-text/format-toolbar-container.native.js +1 -1
  536. package/src/components/rich-text/index.js +7 -14
  537. package/src/components/rich-text/index.native.js +3 -3
  538. package/src/components/rich-text/use-paste-handler.js +7 -14
  539. package/src/components/url-input/index.js +11 -11
  540. package/src/components/use-block-drop-zone/test/index.js +1 -1
  541. package/src/components/use-moving-animation/index.js +1 -1
  542. package/src/components/use-on-block-drop/index.js +2 -2
  543. package/src/components/writing-flow/index.js +1 -0
  544. package/src/components/writing-flow/use-multi-selection.js +17 -20
  545. package/src/components/writing-flow/use-select-all.js +6 -2
  546. package/src/components/writing-flow/use-tab-nav.js +6 -3
  547. package/src/hooks/align.js +1 -1
  548. package/src/hooks/anchor.js +1 -1
  549. package/src/hooks/border.js +8 -19
  550. package/src/hooks/color.js +2 -2
  551. package/src/hooks/custom-class-name.js +45 -0
  552. package/src/hooks/generated-class-name.js +3 -3
  553. package/src/hooks/line-height.js +2 -0
  554. package/src/hooks/lock.js +1 -1
  555. package/src/hooks/style.js +31 -13
  556. package/src/hooks/test/align.js +1 -1
  557. package/src/hooks/typography.scss +0 -4
  558. package/src/layouts/flow.js +10 -5
  559. package/src/store/actions.js +24 -14
  560. package/src/store/defaults.js +2 -2
  561. package/src/store/index.js +0 -1
  562. package/src/store/reducer.js +13 -12
  563. package/src/store/selectors.js +6 -6
  564. package/src/store/test/actions.js +2 -2
  565. package/src/store/test/reducer.js +10 -1
  566. package/src/store/test/selectors.js +1 -1
  567. package/src/style.scss +0 -1
  568. package/src/utils/index.js +0 -1
  569. package/src/utils/parse-css-unit-to-px.js +3 -3
  570. package/src/utils/pasting.js +77 -0
  571. package/src/utils/test/parse-css-unit-to-px.js +5 -5
  572. package/src/utils/test/pasting.js +84 -0
  573. package/src/utils/transform-styles/ast/parse.js +5 -5
  574. package/src/utils/transform-styles/transforms/url-rewrite.js +2 -2
  575. package/build/utils/get-paste-event-data.js +0 -56
  576. package/build/utils/get-paste-event-data.js.map +0 -1
  577. package/build/utils/theme.js +0 -63
  578. package/build/utils/theme.js.map +0 -1
  579. package/build-module/utils/get-paste-event-data.js +0 -47
  580. package/build-module/utils/get-paste-event-data.js.map +0 -1
  581. package/build-module/utils/theme.js +0 -53
  582. package/build-module/utils/theme.js.map +0 -1
  583. package/src/components/line-height-control/style.scss +0 -8
  584. package/src/components/writing-flow/test/use-multi-selection.js +0 -36
  585. package/src/utils/get-paste-event-data.js +0 -42
  586. package/src/utils/theme.js +0 -48
@@ -76,10 +76,10 @@ const BlockMobileToolbar = ( {
76
76
  <View style={ styles.spacer } />
77
77
 
78
78
  <BlockSettingsButton.Slot>
79
- { /* Render only one settings icon even if we have more than one fill - need for hooks with controls */ }
79
+ { /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
80
80
  { ( fills = [ null ] ) => (
81
81
  // The purpose of BlockSettingsButtonFill component is only to provide a way
82
- // to pass data upstream from the slot rendering
82
+ // to pass data upstream from the slot rendering.
83
83
  <BlockSettingsButtonFill
84
84
  fillsLength={ fills.length }
85
85
  onChangeFillsLength={ setFillsLength }
@@ -64,7 +64,7 @@ export function getBlockMoverDescription(
64
64
  }
65
65
 
66
66
  if ( dir > 0 && ! isLast ) {
67
- // moving down
67
+ // Moving down.
68
68
  const movementDirection = getMovementDirection( 'down' );
69
69
 
70
70
  if ( movementDirection === 'down' ) {
@@ -105,7 +105,7 @@ export function getBlockMoverDescription(
105
105
  }
106
106
 
107
107
  if ( dir > 0 && isLast ) {
108
- // moving down, and is the last item
108
+ // Moving down, and is the last item.
109
109
  const movementDirection = getMovementDirection( 'down' );
110
110
 
111
111
  if ( movementDirection === 'down' ) {
@@ -140,7 +140,7 @@ export function getBlockMoverDescription(
140
140
  }
141
141
 
142
142
  if ( dir < 0 && ! isFirst ) {
143
- // moving up
143
+ // Moving up.
144
144
  const movementDirection = getMovementDirection( 'up' );
145
145
 
146
146
  if ( movementDirection === 'up' ) {
@@ -179,7 +179,7 @@ export function getBlockMoverDescription(
179
179
  }
180
180
 
181
181
  if ( dir < 0 && isFirst ) {
182
- // moving up, and is the first item
182
+ // Moving up, and is the first item.
183
183
  const movementDirection = getMovementDirection( 'up' );
184
184
 
185
185
  if ( movementDirection === 'up' ) {
@@ -70,11 +70,11 @@ function switchButtonPropIfRTL(
70
70
  isStackedHorizontally
71
71
  ) {
72
72
  if ( I18nManager.isRTL && isStackedHorizontally ) {
73
- // for RTL and horizontal direction switch prop between forward and backward button
73
+ // For RTL and horizontal direction switch prop between forward and backward button.
74
74
  if ( isBackwardButton ) {
75
- return forwardButtonProp; // set forwardButtonProp for backward button
75
+ return forwardButtonProp; // Set forwardButtonProp for backward button.
76
76
  }
77
- return backwardButtonProp; // set backwardButtonProp for forward button
77
+ return backwardButtonProp; // Set backwardButtonProp for forward button.
78
78
  }
79
79
 
80
80
  return isBackwardButton ? backwardButtonProp : forwardButtonProp;
@@ -128,10 +128,10 @@ function getMoverActionTitle( isStackedHorizontally ) {
128
128
 
129
129
  function getMoverButtonTitle( isStackedHorizontally, { firstIndex } ) {
130
130
  const getIndexes = ( isBackwardButton ) => {
131
- const fromIndex = firstIndex + 1; // current position based on index
131
+ const fromIndex = firstIndex + 1; // Current position based on index
132
132
  // for backwardButton decrease index (move left/up) for forwardButton increase index (move right/down)
133
133
  const direction = isBackwardButton ? -1 : 1;
134
- const toIndex = fromIndex + direction; // position after move
134
+ const toIndex = fromIndex + direction; // Position after move.
135
135
  return [ fromIndex, toIndex ];
136
136
  };
137
137
 
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { InspectorControls, useSetting } from '@wordpress/block-editor';
4
+ import {
5
+ InspectorControls,
6
+ useMultipleOriginColorsAndGradients,
7
+ } from '@wordpress/block-editor';
5
8
  import {
6
9
  BottomSheet,
7
10
  ColorSettings,
@@ -28,13 +31,9 @@ export const blockSettingsScreens = {
28
31
  function BottomSheetSettings( {
29
32
  editorSidebarOpened,
30
33
  closeGeneralSidebar,
31
- settings,
32
34
  ...props
33
35
  } ) {
34
- const colorSettings = {
35
- colors: useSetting( 'color.palette' ) || settings.colors,
36
- gradients: useSetting( 'color.gradients' ) || settings.gradients,
37
- };
36
+ const colorSettings = useMultipleOriginColorsAndGradients();
38
37
 
39
38
  return (
40
39
  <BottomSheet
@@ -10,9 +10,8 @@ import { __, sprintf } from '@wordpress/i18n';
10
10
  import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
11
11
  import { useSelect } from '@wordpress/data';
12
12
  import { moreVertical } from '@wordpress/icons';
13
-
14
13
  import { Children, cloneElement, useCallback } from '@wordpress/element';
15
- import { serialize, store as blocksStore } from '@wordpress/blocks';
14
+ import { serialize } from '@wordpress/blocks';
16
15
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
17
16
  import { useCopyToClipboard } from '@wordpress/compose';
18
17
 
@@ -25,6 +24,7 @@ import BlockHTMLConvertButton from './block-html-convert-button';
25
24
  import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
26
25
  import BlockSettingsMenuControls from '../block-settings-menu-controls';
27
26
  import { store as blockEditorStore } from '../../store';
27
+ import useBlockDisplayTitle from '../block-title/use-block-display-title';
28
28
 
29
29
  const POPOVER_PROPS = {
30
30
  className: 'block-editor-block-settings-menu__popover',
@@ -46,14 +46,11 @@ export function BlockSettingsDropdown( {
46
46
  const blockClientIds = castArray( clientIds );
47
47
  const count = blockClientIds.length;
48
48
  const firstBlockClientId = blockClientIds[ 0 ];
49
- const { onlyBlock, title } = useSelect(
49
+ const { onlyBlock } = useSelect(
50
50
  ( select ) => {
51
- const { getBlockCount, getBlockName } = select( blockEditorStore );
52
- const { getBlockType } = select( blocksStore );
51
+ const { getBlockCount } = select( blockEditorStore );
53
52
  return {
54
53
  onlyBlock: 1 === getBlockCount(),
55
- title: getBlockType( getBlockName( firstBlockClientId ) )
56
- ?.title,
57
54
  };
58
55
  },
59
56
  [ firstBlockClientId ]
@@ -87,10 +84,12 @@ export function BlockSettingsDropdown( {
87
84
  [ __experimentalSelectBlock ]
88
85
  );
89
86
 
87
+ const blockTitle = useBlockDisplayTitle( firstBlockClientId, 25 );
88
+
90
89
  const label = sprintf(
91
90
  /* translators: %s: block name */
92
91
  __( 'Remove %s' ),
93
- title
92
+ blockTitle
94
93
  );
95
94
  const removeBlockLabel = count === 1 ? label : __( 'Remove blocks' );
96
95
 
@@ -32,7 +32,7 @@ function StylePreview( { onPress, isActive, style, url } ) {
32
32
 
33
33
  function onLayout() {
34
34
  const columnsNum =
35
- // To indicate scroll availabilty, there is a need to display additional half the column
35
+ // To indicate scroll availabilty, there is a need to display additional half the column.
36
36
  Math.floor( BottomSheet.getWidth() / MAX_ITEM_WIDTH ) + HALF_COLUMN;
37
37
  setItemWidth( BottomSheet.getWidth() / columnsNum );
38
38
  }
@@ -158,7 +158,10 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
158
158
  />
159
159
  { ( isReusable || isTemplate ) && (
160
160
  <span className="block-editor-block-switcher__toggle-text">
161
- <BlockTitle clientId={ clientIds } />
161
+ <BlockTitle
162
+ clientId={ clientIds }
163
+ maximumLength={ 35 }
164
+ />
162
165
  </span>
163
166
  ) }
164
167
  </>
@@ -92,7 +92,6 @@ export const getPatternTransformedBlocks = (
92
92
  * @param {WPBlock[]} selectedBlocks The currently selected blocks.
93
93
  * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks.
94
94
  */
95
- // TODO tests
96
95
  const useTransformedPatterns = ( patterns, selectedBlocks ) => {
97
96
  return useMemo(
98
97
  () =>
@@ -5,5 +5,21 @@ Renders the block's configured title as a string, or empty if the title cannot b
5
5
  ## Usage
6
6
 
7
7
  ```jsx
8
- <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" />
8
+ <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 12 }/>
9
9
  ```
10
+
11
+ ### Props
12
+
13
+ #### clientId
14
+
15
+ The client ID of a block.
16
+
17
+ - Type: `String`
18
+ - Required: Yes
19
+
20
+ #### maximumLength
21
+
22
+ The maximum length that the block title string may be before truncated. If `undefined` no truncation will take place.
23
+
24
+ - Type: `Number`
25
+ - Required: No
@@ -1,23 +1,8 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { truncate } from 'lodash';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { useSelect } from '@wordpress/data';
10
- import {
11
- getBlockType,
12
- __experimentalGetBlockLabel as getBlockLabel,
13
- isReusableBlock,
14
- } from '@wordpress/blocks';
15
-
16
1
  /**
17
2
  * Internal dependencies
18
3
  */
19
- import useBlockDisplayInformation from '../use-block-display-information';
20
- import { store as blockEditorStore } from '../../store';
4
+
5
+ import useBlockDisplayTitle from './use-block-display-title';
21
6
 
22
7
  /**
23
8
  * Renders the block's configured title as a string, or empty if the title
@@ -26,55 +11,15 @@ import { store as blockEditorStore } from '../../store';
26
11
  * @example
27
12
  *
28
13
  * ```jsx
29
- * <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" />
14
+ * <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 17 }/>
30
15
  * ```
31
16
  *
32
17
  * @param {Object} props
33
18
  * @param {string} props.clientId Client ID of block.
19
+ * @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated.
34
20
  *
35
- * @return {?string} Block title.
21
+ * @return {JSX.Element} Block title.
36
22
  */
37
- export default function BlockTitle( { clientId } ) {
38
- const { attributes, name, reusableBlockTitle } = useSelect(
39
- ( select ) => {
40
- if ( ! clientId ) {
41
- return {};
42
- }
43
- const {
44
- getBlockName,
45
- getBlockAttributes,
46
- __experimentalGetReusableBlockTitle,
47
- } = select( blockEditorStore );
48
- const blockName = getBlockName( clientId );
49
- if ( ! blockName ) {
50
- return {};
51
- }
52
- const isReusable = isReusableBlock( getBlockType( blockName ) );
53
- return {
54
- attributes: getBlockAttributes( clientId ),
55
- name: blockName,
56
- reusableBlockTitle:
57
- isReusable &&
58
- __experimentalGetReusableBlockTitle(
59
- getBlockAttributes( clientId ).ref
60
- ),
61
- };
62
- },
63
- [ clientId ]
64
- );
65
-
66
- const blockInformation = useBlockDisplayInformation( clientId );
67
- if ( ! name || ! blockInformation ) return null;
68
- const blockType = getBlockType( name );
69
- const blockLabel = blockType
70
- ? getBlockLabel( blockType, attributes )
71
- : null;
72
- const label = reusableBlockTitle || blockLabel;
73
- // Label will fallback to the title if no label is defined for the current
74
- // label context. If the label is defined we prioritize it over possible
75
- // possible block variation title match.
76
- if ( label && label !== blockType.title ) {
77
- return truncate( label, { length: 35 } );
78
- }
79
- return blockInformation.title;
23
+ export default function BlockTitle( { clientId, maximumLength } ) {
24
+ return useBlockDisplayTitle( clientId, maximumLength );
80
25
  }
@@ -55,7 +55,7 @@ jest.mock( '../../use-block-display-information', () => {
55
55
  } );
56
56
 
57
57
  jest.mock( '@wordpress/data/src/components/use-select', () => {
58
- // This allows us to tweak the returned value on each test
58
+ // This allows us to tweak the returned value on each test.
59
59
  const mock = jest.fn();
60
60
  return mock;
61
61
  } );
@@ -106,7 +106,23 @@ describe( 'BlockTitle', () => {
106
106
  expect( wrapper.text() ).toBe( 'Test Label' );
107
107
  } );
108
108
 
109
- it( 'truncates the label if it is too long', () => {
109
+ it( 'truncates the label with custom truncate length', () => {
110
+ useSelect.mockImplementation( () => ( {
111
+ name: 'name-with-long-label',
112
+ attributes: null,
113
+ } ) );
114
+
115
+ const wrapper = shallow(
116
+ <BlockTitle
117
+ clientId="id-name-with-long-label"
118
+ maximumLength={ 12 }
119
+ />
120
+ );
121
+
122
+ expect( wrapper.text() ).toBe( 'This is a...' );
123
+ } );
124
+
125
+ it( 'should not truncate the label if maximum length is undefined', () => {
110
126
  useSelect.mockImplementation( () => ( {
111
127
  name: 'name-with-long-label',
112
128
  attributes: null,
@@ -116,6 +132,8 @@ describe( 'BlockTitle', () => {
116
132
  <BlockTitle clientId="id-name-with-long-label" />
117
133
  );
118
134
 
119
- expect( wrapper.text() ).toBe( 'This is a longer label than typi...' );
135
+ expect( wrapper.text() ).toBe(
136
+ 'This is a longer label than typical for blocks to have.'
137
+ );
120
138
  } );
121
139
  } );
@@ -0,0 +1,83 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { truncate } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useSelect } from '@wordpress/data';
10
+ import {
11
+ getBlockType,
12
+ __experimentalGetBlockLabel as getBlockLabel,
13
+ isReusableBlock,
14
+ } from '@wordpress/blocks';
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+ import useBlockDisplayInformation from '../use-block-display-information';
20
+ import { store as blockEditorStore } from '../../store';
21
+
22
+ /**
23
+ * Returns the block's configured title as a string, or empty if the title
24
+ * cannot be determined.
25
+ *
26
+ * @example
27
+ *
28
+ * ```js
29
+ * useBlockDisplayTitle( 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', 17 );
30
+ * ```
31
+ *
32
+ * @param {string} clientId Client ID of block.
33
+ * @param {number|undefined} maximumLength The maximum length that the block title string may be before truncated.
34
+ * @return {?string} Block title.
35
+ */
36
+ export default function useBlockDisplayTitle( clientId, maximumLength ) {
37
+ const { attributes, name, reusableBlockTitle } = useSelect(
38
+ ( select ) => {
39
+ if ( ! clientId ) {
40
+ return {};
41
+ }
42
+ const {
43
+ getBlockName,
44
+ getBlockAttributes,
45
+ __experimentalGetReusableBlockTitle,
46
+ } = select( blockEditorStore );
47
+ const blockName = getBlockName( clientId );
48
+ if ( ! blockName ) {
49
+ return {};
50
+ }
51
+ const isReusable = isReusableBlock( getBlockType( blockName ) );
52
+ return {
53
+ attributes: getBlockAttributes( clientId ),
54
+ name: blockName,
55
+ reusableBlockTitle:
56
+ isReusable &&
57
+ __experimentalGetReusableBlockTitle(
58
+ getBlockAttributes( clientId ).ref
59
+ ),
60
+ };
61
+ },
62
+ [ clientId ]
63
+ );
64
+
65
+ const blockInformation = useBlockDisplayInformation( clientId );
66
+ if ( ! name || ! blockInformation ) {
67
+ return null;
68
+ }
69
+ const blockType = getBlockType( name );
70
+ const blockLabel = blockType
71
+ ? getBlockLabel( blockType, attributes )
72
+ : null;
73
+ const label = reusableBlockTitle || blockLabel;
74
+ // Label will fallback to the title if no label is defined for the current
75
+ // label context. If the label is defined we prioritize it over possible
76
+ // possible block variation title match.
77
+ if ( label && label !== blockType.title ) {
78
+ return maximumLength && maximumLength > 0
79
+ ? truncate( label, { length: maximumLength } )
80
+ : label;
81
+ }
82
+ return blockInformation.title;
83
+ }
@@ -44,7 +44,6 @@ export function useDebouncedShowMovers( {
44
44
 
45
45
  const shouldHideMovers = () => {
46
46
  const isHovered = getIsHovered();
47
-
48
47
  return ! isFocused && ! isHovered;
49
48
  };
50
49
 
@@ -82,7 +81,18 @@ export function useDebouncedShowMovers( {
82
81
  }, debounceTimeout );
83
82
  };
84
83
 
85
- useEffect( () => () => clearTimeoutRef(), [] );
84
+ useEffect(
85
+ () => () => {
86
+ /**
87
+ * We need to call the change handler with `isFocused`
88
+ * set to false on unmount because we also clear the
89
+ * timeout that would handle that.
90
+ */
91
+ handleOnChange( false );
92
+ clearTimeoutRef();
93
+ },
94
+ []
95
+ );
86
96
 
87
97
  return {
88
98
  showMovers,
@@ -297,7 +297,7 @@ function wrapperSelector( select ) {
297
297
  const { name, attributes = {}, isValid } = getBlock( clientId ) || {};
298
298
  const blockParentsClientIds = getBlockParents( clientId );
299
299
 
300
- // Get Block List Settings for all ancestors of the current Block clientId
300
+ // Get Block List Settings for all ancestors of the current Block clientId.
301
301
  const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(
302
302
  blockParentsClientIds
303
303
  );
@@ -262,7 +262,10 @@ function BlockSelectionButton( { clientId, rootClientId, blockElement } ) {
262
262
  label={ label }
263
263
  className="block-selection-button_select-button"
264
264
  >
265
- <BlockTitle clientId={ clientId } />
265
+ <BlockTitle
266
+ clientId={ clientId }
267
+ maximumLength={ 35 }
268
+ />
266
269
  </Button>
267
270
  </FlexItem>
268
271
  </Flex>
@@ -85,7 +85,7 @@ export default function BlockTypesList( {
85
85
  return (
86
86
  <FlatList
87
87
  onLayout={ onLayout }
88
- key={ `InserterUI-${ name }-${ numberOfColumns }` } //re-render when numberOfColumns changes
88
+ key={ `InserterUI-${ name }-${ numberOfColumns }` } // Re-render when numberOfColumns changes.
89
89
  testID={ `InserterUI-${ name }` }
90
90
  keyboardShouldPersistTaps="always"
91
91
  numColumns={ numberOfColumns }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import {
5
5
  RangeControl,
6
- __experimentalParseUnit as parseUnit,
6
+ __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
7
7
  __experimentalUseCustomUnits as useCustomUnits,
8
8
  } from '@wordpress/components';
9
9
  import { useState } from '@wordpress/element';
@@ -58,7 +58,9 @@ export default function BorderRadiusControl( { onChange, values } ) {
58
58
  const unitConfig = units && units.find( ( item ) => item.value === unit );
59
59
  const step = unitConfig?.step || 1;
60
60
 
61
- const [ allValue ] = parseUnit( getAllValue( values ) );
61
+ const [ allValue ] = parseQuantityAndUnitFromRawValue(
62
+ getAllValue( values )
63
+ );
62
64
 
63
65
  const toggleLinked = () => setIsLinked( ! isLinked );
64
66
 
@@ -82,7 +84,7 @@ export default function BorderRadiusControl( { onChange, values } ) {
82
84
  />
83
85
  <RangeControl
84
86
  className="components-border-radius-control__range-control"
85
- value={ allValue }
87
+ value={ allValue ?? '' }
86
88
  min={ MIN_BORDER_RADIUS_VALUE }
87
89
  max={ MAX_BORDER_RADIUS_VALUES[ unit ] }
88
90
  initialPosition={ 0 }
@@ -91,14 +91,14 @@ describe( 'getAllValue', () => {
91
91
  } );
92
92
 
93
93
  describe( 'when provided object based values', () => {
94
- it( 'should return null if values are mixed', () => {
94
+ it( 'should return undefined if values are mixed', () => {
95
95
  const values = {
96
96
  bottomLeft: '2em',
97
97
  bottomRight: '2em',
98
98
  topLeft: '0',
99
99
  topRight: '2px',
100
100
  };
101
- expect( getAllValue( values ) ).toBe( null );
101
+ expect( getAllValue( values ) ).toBe( undefined );
102
102
  } );
103
103
 
104
104
  it( 'should return the common value + unit when all values are the same', () => {
@@ -121,26 +121,26 @@ describe( 'getAllValue', () => {
121
121
  expect( getAllValue( values ) ).toBe( '1em' );
122
122
  } );
123
123
 
124
- it( 'should fall back to null when values are undefined', () => {
124
+ it( 'should fall back to undefined when values are undefined', () => {
125
125
  const values = {
126
126
  bottomLeft: undefined,
127
127
  bottomRight: undefined,
128
128
  topLeft: undefined,
129
129
  topRight: undefined,
130
130
  };
131
- expect( getAllValue( values ) ).toBe( null );
131
+ expect( getAllValue( values ) ).toBe( undefined );
132
132
  } );
133
133
  } );
134
134
 
135
135
  describe( 'when provided invalid values', () => {
136
- it( 'should return px when passed an array', () => {
137
- expect( getAllValue( [] ) ).toBe( null );
136
+ it( 'should return undefined when passed an array', () => {
137
+ expect( getAllValue( [] ) ).toBe( undefined );
138
138
  } );
139
- it( 'should return px when passed a boolean', () => {
140
- expect( getAllValue( false ) ).toBe( null );
139
+ it( 'should return undefined when passed a boolean', () => {
140
+ expect( getAllValue( false ) ).toBe( undefined );
141
141
  } );
142
- it( 'should return px when passed undefined', () => {
143
- expect( getAllValue( false ) ).toBe( null );
142
+ it( 'should return undefined when passed undefined', () => {
143
+ expect( getAllValue( undefined ) ).toBe( undefined );
144
144
  } );
145
145
  } );
146
146
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __experimentalParseUnit as parseUnit } from '@wordpress/components';
4
+ import { __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
5
5
 
6
6
  /**
7
7
  * Gets the (non-undefined) item with the highest occurrence within an array
@@ -36,12 +36,12 @@ export function mode( inputArray ) {
36
36
  */
37
37
  export function getAllUnit( values = {} ) {
38
38
  if ( typeof values === 'string' ) {
39
- const [ , unit ] = parseUnit( values );
39
+ const [ , unit ] = parseQuantityAndUnitFromRawValue( values );
40
40
  return unit || 'px';
41
41
  }
42
42
 
43
43
  const allUnits = Object.values( values ).map( ( value ) => {
44
- const [ , unit ] = parseUnit( value );
44
+ const [ , unit ] = parseQuantityAndUnitFromRawValue( value );
45
45
  return unit;
46
46
  } );
47
47
 
@@ -64,19 +64,21 @@ export function getAllValue( values = {} ) {
64
64
  return values;
65
65
  }
66
66
 
67
- const parsedValues = Object.values( values ).map( ( value ) =>
68
- parseUnit( value )
67
+ const parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) =>
68
+ parseQuantityAndUnitFromRawValue( value )
69
69
  );
70
70
 
71
- const allValues = parsedValues.map( ( value ) => value[ 0 ] );
72
- const allUnits = parsedValues.map( ( value ) => value[ 1 ] );
71
+ const allValues = parsedQuantitiesAndUnits.map(
72
+ ( value ) => value[ 0 ] ?? ''
73
+ );
74
+ const allUnits = parsedQuantitiesAndUnits.map( ( value ) => value[ 1 ] );
73
75
 
74
76
  const value = allValues.every( ( v ) => v === allValues[ 0 ] )
75
77
  ? allValues[ 0 ]
76
78
  : '';
77
79
  const unit = mode( allUnits );
78
80
 
79
- const allValue = value === 0 || value ? `${ value }${ unit }` : null;
81
+ const allValue = value === 0 || value ? `${ value }${ unit }` : undefined;
80
82
 
81
83
  return allValue;
82
84
  }
@@ -19,7 +19,7 @@ function ContrastChecker( {
19
19
  fallbackBackgroundColor,
20
20
  fallbackTextColor,
21
21
  fallbackLinkColor,
22
- fontSize, // font size value in pixels
22
+ fontSize, // Font size value in pixels.
23
23
  isLargeText,
24
24
  textColor,
25
25
  linkColor,
@@ -84,14 +84,14 @@ function ContrastChecker( {
84
84
  message =
85
85
  backgroundColorBrightness < colordTextColor.brightness()
86
86
  ? sprintf(
87
- // translators: %s is a type of text color, e.g., "text color" or "link color"
87
+ // translators: %s is a type of text color, e.g., "text color" or "link color".
88
88
  __(
89
89
  'This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'
90
90
  ),
91
91
  item.description
92
92
  )
93
93
  : sprintf(
94
- // translators: %s is a type of text color, e.g., "text color" or "link color"
94
+ // translators: %s is a type of text color, e.g., "text color" or "link color".
95
95
  __(
96
96
  'This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'
97
97
  ),
@@ -22,7 +22,7 @@ function ConvertToGroupButton( {
22
22
  } ) {
23
23
  const { replaceBlocks } = useDispatch( blockEditorStore );
24
24
  const onConvertToGroup = () => {
25
- // Activate the `transform` on the Grouping Block which does the conversion
25
+ // Activate the `transform` on the Grouping Block which does the conversion.
26
26
  const newBlocks = switchToBlockType(
27
27
  blocksSelection,
28
28
  groupingBlockName
@@ -64,12 +64,7 @@ export default function useConvertToGroupButtonProps() {
64
64
  // Do we have
65
65
  // 1. Grouping block available to be inserted?
66
66
  // 2. One or more blocks selected
67
- // (we allow single Blocks to become groups unless
68
- // they are a soltiary group block themselves)
69
- const _isGroupable =
70
- groupingBlockAvailable &&
71
- _blocksSelection.length &&
72
- ! isSingleGroupingBlock;
67
+ const _isGroupable = groupingBlockAvailable && _blocksSelection.length;
73
68
 
74
69
  // Do we have a single Group Block selected and does that group have inner blocks?
75
70
  const _isUngroupable =