@wordpress/block-editor 8.1.2 → 8.3.0-next.e230fbab09.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 (591) hide show
  1. package/CHANGELOG.md +10 -0
  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 +2 -2
  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/duotone.js +22 -4
  189. package/build/hooks/duotone.js.map +1 -1
  190. package/build/hooks/generated-class-name.js +3 -3
  191. package/build/hooks/generated-class-name.js.map +1 -1
  192. package/build/hooks/line-height.js +2 -0
  193. package/build/hooks/line-height.js.map +1 -1
  194. package/build/hooks/lock.js +1 -1
  195. package/build/hooks/lock.js.map +1 -1
  196. package/build/hooks/style.js +32 -13
  197. package/build/hooks/style.js.map +1 -1
  198. package/build/layouts/flow.js +7 -5
  199. package/build/layouts/flow.js.map +1 -1
  200. package/build/store/actions.js +55 -48
  201. package/build/store/actions.js.map +1 -1
  202. package/build/store/defaults.js +2 -1
  203. package/build/store/defaults.js.map +1 -1
  204. package/build/store/index.js +1 -2
  205. package/build/store/index.js.map +1 -1
  206. package/build/store/reducer.js +13 -13
  207. package/build/store/reducer.js.map +1 -1
  208. package/build/store/selectors.js +6 -6
  209. package/build/store/selectors.js.map +1 -1
  210. package/build/utils/index.js +0 -14
  211. package/build/utils/index.js.map +1 -1
  212. package/build/utils/parse-css-unit-to-px.js +3 -3
  213. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  214. package/build/utils/pasting.js +91 -0
  215. package/build/utils/pasting.js.map +1 -0
  216. package/build/utils/transform-styles/ast/parse.js +5 -5
  217. package/build/utils/transform-styles/ast/parse.js.map +1 -1
  218. package/build/utils/transform-styles/transforms/url-rewrite.js +2 -2
  219. package/build/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  220. package/build-module/autocompleters/link.js +64 -0
  221. package/build-module/autocompleters/link.js.map +1 -0
  222. package/build-module/components/autocomplete/index.js +2 -1
  223. package/build-module/components/autocomplete/index.js.map +1 -1
  224. package/build-module/components/block-actions/index.js +1 -1
  225. package/build-module/components/block-actions/index.js.map +1 -1
  226. package/build-module/components/block-breadcrumb/index.js +4 -2
  227. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  228. package/build-module/components/block-compare/index.js +2 -2
  229. package/build-module/components/block-compare/index.js.map +1 -1
  230. package/build-module/components/block-controls/index.js +1 -1
  231. package/build-module/components/block-controls/index.js.map +1 -1
  232. package/build-module/components/block-draggable/index.js +1 -1
  233. package/build-module/components/block-draggable/index.js.map +1 -1
  234. package/build-module/components/block-edit/edit.js +1 -1
  235. package/build-module/components/block-edit/edit.js.map +1 -1
  236. package/build-module/components/block-list/block-html.js +1 -1
  237. package/build-module/components/block-list/block-html.js.map +1 -1
  238. package/build-module/components/block-list/block-invalid-warning.js +1 -1
  239. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  240. package/build-module/components/block-list/block-list-item.native.js +4 -4
  241. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  242. package/build-module/components/block-list/block-selection-button.native.js +4 -3
  243. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  244. package/build-module/components/block-list/block.js +18 -4
  245. package/build-module/components/block-list/block.js.map +1 -1
  246. package/build-module/components/block-list/block.native.js +7 -7
  247. package/build-module/components/block-list/block.native.js.map +1 -1
  248. package/build-module/components/block-list/index.native.js +5 -5
  249. package/build-module/components/block-list/index.native.js.map +1 -1
  250. package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -1
  251. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  252. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +2 -0
  253. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  254. package/build-module/components/block-list/use-block-props/use-multi-selection.js +23 -28
  255. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  256. package/build-module/components/block-media-update-progress/index.native.js +4 -4
  257. package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
  258. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  259. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  260. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  261. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  262. package/build-module/components/block-mover/mover-description.js +4 -4
  263. package/build-module/components/block-mover/mover-description.js.map +1 -1
  264. package/build-module/components/block-mover/mover-description.native.js +5 -5
  265. package/build-module/components/block-mover/mover-description.native.js.map +1 -1
  266. package/build-module/components/block-settings/container.native.js +2 -6
  267. package/build-module/components/block-settings/container.native.js.map +1 -1
  268. package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -13
  269. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  270. package/build-module/components/block-styles/preview.native.js +1 -1
  271. package/build-module/components/block-styles/preview.native.js.map +1 -1
  272. package/build-module/components/block-switcher/index.js +2 -1
  273. package/build-module/components/block-switcher/index.js.map +1 -1
  274. package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
  275. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  276. package/build-module/components/block-title/index.js +7 -58
  277. package/build-module/components/block-title/index.js.map +1 -1
  278. package/build-module/components/block-title/use-block-display-title.js +80 -0
  279. package/build-module/components/block-title/use-block-display-title.js.map +1 -0
  280. package/build-module/components/block-toolbar/utils.js +9 -1
  281. package/build-module/components/block-toolbar/utils.js.map +1 -1
  282. package/build-module/components/block-tools/block-popover.js +1 -1
  283. package/build-module/components/block-tools/block-popover.js.map +1 -1
  284. package/build-module/components/block-tools/block-selection-button.js +2 -1
  285. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  286. package/build-module/components/block-types-list/index.native.js +1 -1
  287. package/build-module/components/block-types-list/index.native.js.map +1 -1
  288. package/build-module/components/border-radius-control/index.js +3 -3
  289. package/build-module/components/border-radius-control/index.js.map +1 -1
  290. package/build-module/components/border-radius-control/utils.js +11 -7
  291. package/build-module/components/border-radius-control/utils.js.map +1 -1
  292. package/build-module/components/contrast-checker/index.js +3 -3
  293. package/build-module/components/contrast-checker/index.js.map +1 -1
  294. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  295. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  296. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
  297. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  298. package/build-module/components/copy-handler/index.js +2 -2
  299. package/build-module/components/copy-handler/index.js.map +1 -1
  300. package/build-module/components/font-sizes/with-font-sizes.js +3 -3
  301. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  302. package/build-module/components/index.js +1 -0
  303. package/build-module/components/index.js.map +1 -1
  304. package/build-module/components/index.native.js +5 -4
  305. package/build-module/components/index.native.js.map +1 -1
  306. package/build-module/components/inserter/block-patterns-tab.js +4 -4
  307. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  308. package/build-module/components/inserter/block-types-tab.js +1 -1
  309. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  310. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  311. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  312. package/build-module/components/inserter/index.js +3 -3
  313. package/build-module/components/inserter/index.js.map +1 -1
  314. package/build-module/components/inserter/index.native.js +7 -7
  315. package/build-module/components/inserter/index.native.js.map +1 -1
  316. package/build-module/components/inserter/menu.js.map +1 -1
  317. package/build-module/components/inserter/menu.native.js +3 -3
  318. package/build-module/components/inserter/menu.native.js.map +1 -1
  319. package/build-module/components/inserter/quick-inserter.js +20 -8
  320. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  321. package/build-module/components/inserter/search-items.js +1 -1
  322. package/build-module/components/inserter/search-items.js.map +1 -1
  323. package/build-module/components/inserter/search-results.js +28 -11
  324. package/build-module/components/inserter/search-results.js.map +1 -1
  325. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  326. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  327. package/build-module/components/letter-spacing-control/index.js +3 -3
  328. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  329. package/build-module/components/line-height-control/index.js +61 -45
  330. package/build-module/components/line-height-control/index.js.map +1 -1
  331. package/build-module/components/line-height-control/index.native.js +3 -1
  332. package/build-module/components/line-height-control/index.native.js.map +1 -1
  333. package/build-module/components/link-control/index.js +2 -2
  334. package/build-module/components/link-control/index.js.map +1 -1
  335. package/build-module/components/link-control/search-input.js +1 -1
  336. package/build-module/components/link-control/search-input.js.map +1 -1
  337. package/build-module/components/link-control/search-results.js +2 -2
  338. package/build-module/components/link-control/search-results.js.map +1 -1
  339. package/build-module/components/link-control/use-rich-url-data.js +1 -1
  340. package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
  341. package/build-module/components/link-control/use-search-handler.js +2 -2
  342. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  343. package/build-module/components/list-view/block-contents.js +8 -4
  344. package/build-module/components/list-view/block-contents.js.map +1 -1
  345. package/build-module/components/list-view/block-select-button.js +2 -2
  346. package/build-module/components/list-view/block-select-button.js.map +1 -1
  347. package/build-module/components/list-view/block.js +20 -9
  348. package/build-module/components/list-view/block.js.map +1 -1
  349. package/build-module/components/list-view/branch.js +2 -1
  350. package/build-module/components/list-view/branch.js.map +1 -1
  351. package/build-module/components/list-view/index.js +46 -42
  352. package/build-module/components/list-view/index.js.map +1 -1
  353. package/build-module/components/list-view/use-block-selection.js +123 -0
  354. package/build-module/components/list-view/use-block-selection.js.map +1 -0
  355. package/build-module/components/list-view/use-list-view-expand-selected-item.js +50 -0
  356. package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
  357. package/build-module/components/list-view/utils.js +25 -0
  358. package/build-module/components/list-view/utils.js.map +1 -1
  359. package/build-module/components/media-placeholder/index.native.js +7 -5
  360. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  361. package/build-module/components/media-replace-flow/index.js +22 -27
  362. package/build-module/components/media-replace-flow/index.js.map +1 -1
  363. package/build-module/components/media-upload/index.native.js +4 -3
  364. package/build-module/components/media-upload/index.native.js.map +1 -1
  365. package/build-module/components/media-upload-progress/index.native.js +2 -2
  366. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  367. package/build-module/components/navigable-toolbar/index.js +3 -3
  368. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  369. package/build-module/components/plain-text/index.native.js +3 -3
  370. package/build-module/components/plain-text/index.native.js.map +1 -1
  371. package/build-module/components/rich-text/format-toolbar-container.js +2 -2
  372. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  373. package/build-module/components/rich-text/format-toolbar-container.native.js +1 -1
  374. package/build-module/components/rich-text/format-toolbar-container.native.js.map +1 -1
  375. package/build-module/components/rich-text/index.js +7 -12
  376. package/build-module/components/rich-text/index.js.map +1 -1
  377. package/build-module/components/rich-text/index.native.js +3 -3
  378. package/build-module/components/rich-text/index.native.js.map +1 -1
  379. package/build-module/components/rich-text/use-paste-handler.js +6 -12
  380. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  381. package/build-module/components/url-input/index.js +11 -11
  382. package/build-module/components/url-input/index.js.map +1 -1
  383. package/build-module/components/use-moving-animation/index.js +1 -1
  384. package/build-module/components/use-moving-animation/index.js.map +1 -1
  385. package/build-module/components/use-on-block-drop/index.js +2 -2
  386. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  387. package/build-module/components/writing-flow/index.js +1 -0
  388. package/build-module/components/writing-flow/index.js.map +1 -1
  389. package/build-module/components/writing-flow/use-multi-selection.js +21 -21
  390. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  391. package/build-module/components/writing-flow/use-select-all.js +3 -2
  392. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  393. package/build-module/components/writing-flow/use-tab-nav.js +4 -3
  394. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  395. package/build-module/hooks/align.js +1 -1
  396. package/build-module/hooks/align.js.map +1 -1
  397. package/build-module/hooks/anchor.js +1 -1
  398. package/build-module/hooks/anchor.js.map +1 -1
  399. package/build-module/hooks/border.js +2 -14
  400. package/build-module/hooks/border.js.map +1 -1
  401. package/build-module/hooks/color.js +2 -2
  402. package/build-module/hooks/color.js.map +1 -1
  403. package/build-module/hooks/custom-class-name.js +38 -0
  404. package/build-module/hooks/custom-class-name.js.map +1 -1
  405. package/build-module/hooks/duotone.js +23 -5
  406. package/build-module/hooks/duotone.js.map +1 -1
  407. package/build-module/hooks/generated-class-name.js +3 -3
  408. package/build-module/hooks/generated-class-name.js.map +1 -1
  409. package/build-module/hooks/line-height.js +2 -0
  410. package/build-module/hooks/line-height.js.map +1 -1
  411. package/build-module/hooks/lock.js +1 -1
  412. package/build-module/hooks/lock.js.map +1 -1
  413. package/build-module/hooks/style.js +31 -13
  414. package/build-module/hooks/style.js.map +1 -1
  415. package/build-module/layouts/flow.js +7 -5
  416. package/build-module/layouts/flow.js.map +1 -1
  417. package/build-module/store/actions.js +52 -45
  418. package/build-module/store/actions.js.map +1 -1
  419. package/build-module/store/defaults.js +2 -1
  420. package/build-module/store/defaults.js.map +1 -1
  421. package/build-module/store/index.js +1 -2
  422. package/build-module/store/index.js.map +1 -1
  423. package/build-module/store/reducer.js +13 -13
  424. package/build-module/store/reducer.js.map +1 -1
  425. package/build-module/store/selectors.js +6 -6
  426. package/build-module/store/selectors.js.map +1 -1
  427. package/build-module/utils/index.js +0 -1
  428. package/build-module/utils/index.js.map +1 -1
  429. package/build-module/utils/parse-css-unit-to-px.js +3 -3
  430. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  431. package/build-module/utils/pasting.js +80 -0
  432. package/build-module/utils/pasting.js.map +1 -0
  433. package/build-module/utils/transform-styles/ast/parse.js +5 -5
  434. package/build-module/utils/transform-styles/ast/parse.js.map +1 -1
  435. package/build-module/utils/transform-styles/transforms/url-rewrite.js +2 -2
  436. package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  437. package/build-style/style-rtl.css +10 -12
  438. package/build-style/style.css +10 -12
  439. package/package.json +27 -26
  440. package/src/autocompleters/link.js +62 -0
  441. package/src/autocompleters/style.scss +8 -0
  442. package/src/components/alignment-control/test/index.js +2 -2
  443. package/src/components/autocomplete/index.js +2 -0
  444. package/src/components/block-actions/index.js +1 -1
  445. package/src/components/block-alignment-control/test/index.js +1 -1
  446. package/src/components/block-breadcrumb/index.js +5 -2
  447. package/src/components/block-compare/index.js +2 -2
  448. package/src/components/block-controls/index.js +1 -1
  449. package/src/components/block-draggable/index.js +1 -1
  450. package/src/components/block-draggable/stories/index.js +1 -1
  451. package/src/components/block-edit/edit.js +1 -1
  452. package/src/components/block-list/block-html.js +1 -1
  453. package/src/components/block-list/block-invalid-warning.js +1 -1
  454. package/src/components/block-list/block-list-item.native.js +4 -4
  455. package/src/components/block-list/block-selection-button.native.js +3 -3
  456. package/src/components/block-list/block.js +28 -4
  457. package/src/components/block-list/block.native.js +7 -6
  458. package/src/components/block-list/index.native.js +5 -5
  459. package/src/components/block-list/style.scss +3 -1
  460. package/src/components/block-list/use-block-props/use-block-class-names.js +1 -1
  461. package/src/components/block-list/use-block-props/use-focus-first-element.js +3 -0
  462. package/src/components/block-list/use-block-props/use-multi-selection.js +22 -30
  463. package/src/components/block-media-update-progress/index.native.js +4 -4
  464. package/src/components/block-media-update-progress/test/index.native.js +2 -2
  465. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  466. package/src/components/block-mobile-toolbar/index.native.js +2 -2
  467. package/src/components/block-mover/mover-description.js +4 -4
  468. package/src/components/block-mover/mover-description.native.js +5 -5
  469. package/src/components/block-settings/container.native.js +5 -6
  470. package/src/components/block-settings-menu/block-settings-dropdown.js +7 -8
  471. package/src/components/block-styles/preview.native.js +1 -1
  472. package/src/components/block-switcher/index.js +4 -1
  473. package/src/components/block-switcher/use-transformed-patterns.js +0 -1
  474. package/src/components/block-title/README.md +17 -1
  475. package/src/components/block-title/index.js +7 -62
  476. package/src/components/block-title/test/index.js +21 -3
  477. package/src/components/block-title/use-block-display-title.js +83 -0
  478. package/src/components/block-toolbar/utils.js +12 -2
  479. package/src/components/block-tools/block-popover.js +1 -1
  480. package/src/components/block-tools/block-selection-button.js +4 -1
  481. package/src/components/block-types-list/index.native.js +1 -1
  482. package/src/components/border-radius-control/index.js +5 -3
  483. package/src/components/border-radius-control/test/utils.js +10 -10
  484. package/src/components/border-radius-control/utils.js +10 -8
  485. package/src/components/contrast-checker/index.js +3 -3
  486. package/src/components/convert-to-group-buttons/index.js +1 -1
  487. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -6
  488. package/src/components/copy-handler/index.js +2 -2
  489. package/src/components/font-sizes/with-font-sizes.js +3 -3
  490. package/src/components/image-size-control/test/index.js +1 -1
  491. package/src/components/index.js +1 -0
  492. package/src/components/index.native.js +11 -4
  493. package/src/components/inserter/block-patterns-tab.js +13 -17
  494. package/src/components/inserter/block-types-tab.js +1 -1
  495. package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  496. package/src/components/inserter/index.js +3 -3
  497. package/src/components/inserter/index.native.js +7 -7
  498. package/src/components/inserter/menu.js +1 -1
  499. package/src/components/inserter/menu.native.js +3 -3
  500. package/src/components/inserter/quick-inserter.js +32 -10
  501. package/src/components/inserter/search-items.js +1 -1
  502. package/src/components/inserter/search-results.js +55 -43
  503. package/src/components/inserter/test/fixtures/index.native.js +1 -1
  504. package/src/components/inserter/test/reusable-blocks-tab.js +2 -2
  505. package/src/components/justify-content-control/README.md +1 -1
  506. package/src/components/keyboard-shortcuts/index.js +1 -1
  507. package/src/components/letter-spacing-control/index.js +1 -1
  508. package/src/components/line-height-control/README.md +13 -2
  509. package/src/components/line-height-control/index.js +66 -43
  510. package/src/components/line-height-control/index.native.js +2 -0
  511. package/src/components/line-height-control/stories/index.js +33 -0
  512. package/src/components/line-height-control/test/index.js +61 -0
  513. package/src/components/link-control/index.js +2 -2
  514. package/src/components/link-control/search-input.js +1 -1
  515. package/src/components/link-control/search-results.js +2 -2
  516. package/src/components/link-control/test/index.js +142 -144
  517. package/src/components/link-control/use-rich-url-data.js +1 -1
  518. package/src/components/link-control/use-search-handler.js +2 -2
  519. package/src/components/list-view/README.md +2 -2
  520. package/src/components/list-view/block-contents.js +10 -3
  521. package/src/components/list-view/block-select-button.js +1 -2
  522. package/src/components/list-view/block.js +30 -10
  523. package/src/components/list-view/branch.js +1 -0
  524. package/src/components/list-view/index.js +56 -30
  525. package/src/components/list-view/test/utils.js +50 -0
  526. package/src/components/list-view/use-block-selection.js +163 -0
  527. package/src/components/list-view/use-list-view-expand-selected-item.js +58 -0
  528. package/src/components/list-view/utils.js +31 -0
  529. package/src/components/media-placeholder/index.native.js +11 -9
  530. package/src/components/media-replace-flow/README.md +7 -0
  531. package/src/components/media-replace-flow/index.js +20 -26
  532. package/src/components/media-replace-flow/test/index.js +100 -0
  533. package/src/components/media-upload/index.native.js +3 -2
  534. package/src/components/media-upload-progress/index.native.js +2 -2
  535. package/src/components/navigable-toolbar/index.js +3 -3
  536. package/src/components/plain-text/index.native.js +3 -3
  537. package/src/components/responsive-block-control/test/index.js +6 -6
  538. package/src/components/rich-text/format-toolbar-container.js +2 -2
  539. package/src/components/rich-text/format-toolbar-container.native.js +1 -1
  540. package/src/components/rich-text/index.js +7 -14
  541. package/src/components/rich-text/index.native.js +3 -3
  542. package/src/components/rich-text/use-paste-handler.js +7 -14
  543. package/src/components/url-input/index.js +11 -11
  544. package/src/components/use-block-drop-zone/test/index.js +1 -1
  545. package/src/components/use-moving-animation/index.js +1 -1
  546. package/src/components/use-on-block-drop/index.js +2 -2
  547. package/src/components/writing-flow/index.js +1 -0
  548. package/src/components/writing-flow/use-multi-selection.js +17 -20
  549. package/src/components/writing-flow/use-select-all.js +6 -2
  550. package/src/components/writing-flow/use-tab-nav.js +6 -3
  551. package/src/hooks/align.js +1 -1
  552. package/src/hooks/anchor.js +1 -1
  553. package/src/hooks/border.js +8 -19
  554. package/src/hooks/color.js +2 -2
  555. package/src/hooks/custom-class-name.js +45 -0
  556. package/src/hooks/duotone.js +27 -3
  557. package/src/hooks/generated-class-name.js +3 -3
  558. package/src/hooks/line-height.js +2 -0
  559. package/src/hooks/lock.js +1 -1
  560. package/src/hooks/style.js +31 -13
  561. package/src/hooks/test/align.js +1 -1
  562. package/src/hooks/typography.scss +0 -4
  563. package/src/layouts/flow.js +10 -5
  564. package/src/store/actions.js +24 -14
  565. package/src/store/defaults.js +2 -2
  566. package/src/store/index.js +0 -1
  567. package/src/store/reducer.js +13 -12
  568. package/src/store/selectors.js +6 -6
  569. package/src/store/test/actions.js +2 -2
  570. package/src/store/test/reducer.js +10 -1
  571. package/src/store/test/selectors.js +1 -1
  572. package/src/style.scss +0 -1
  573. package/src/utils/index.js +0 -1
  574. package/src/utils/parse-css-unit-to-px.js +3 -3
  575. package/src/utils/pasting.js +77 -0
  576. package/src/utils/test/parse-css-unit-to-px.js +5 -5
  577. package/src/utils/test/pasting.js +84 -0
  578. package/src/utils/transform-styles/ast/parse.js +5 -5
  579. package/src/utils/transform-styles/transforms/url-rewrite.js +2 -2
  580. package/build/utils/get-paste-event-data.js +0 -56
  581. package/build/utils/get-paste-event-data.js.map +0 -1
  582. package/build/utils/theme.js +0 -63
  583. package/build/utils/theme.js.map +0 -1
  584. package/build-module/utils/get-paste-event-data.js +0 -47
  585. package/build-module/utils/get-paste-event-data.js.map +0 -1
  586. package/build-module/utils/theme.js +0 -53
  587. package/build-module/utils/theme.js.map +0 -1
  588. package/src/components/line-height-control/style.scss +0 -8
  589. package/src/components/writing-flow/test/use-multi-selection.js +0 -36
  590. package/src/utils/get-paste-event-data.js +0 -42
  591. package/src/utils/theme.js +0 -48
@@ -0,0 +1,62 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import apiFetch from '@wordpress/api-fetch';
5
+ import { addQueryArgs } from '@wordpress/url';
6
+ import { Icon, page, post } from '@wordpress/icons';
7
+
8
+ const SHOWN_SUGGESTIONS = 10;
9
+
10
+ /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
11
+
12
+ /**
13
+ * Creates a suggestion list for links to posts or pages.
14
+ *
15
+ * @return {WPCompleter} A links completer.
16
+ */
17
+ function createLinkCompleter() {
18
+ return {
19
+ name: 'links',
20
+ className: 'block-editor-autocompleters__link',
21
+ triggerPrefix: '[[',
22
+ options: async ( letters ) => {
23
+ let options = await apiFetch( {
24
+ path: addQueryArgs( '/wp/v2/search', {
25
+ per_page: SHOWN_SUGGESTIONS,
26
+ search: letters,
27
+ type: 'post',
28
+ order_by: 'menu_order',
29
+ } ),
30
+ } );
31
+
32
+ options = options.filter( ( option ) => option.title !== '' );
33
+
34
+ return options;
35
+ },
36
+ getOptionKeywords( item ) {
37
+ const expansionWords = item.title.split( /\s+/ );
38
+ return [ ...expansionWords ];
39
+ },
40
+ getOptionLabel( item ) {
41
+ return (
42
+ <>
43
+ <Icon
44
+ key="icon"
45
+ icon={ item.subtype === 'page' ? page : post }
46
+ />
47
+ { item.title }
48
+ </>
49
+ );
50
+ },
51
+ getOptionCompletion( item ) {
52
+ return <a href={ item.url }>{ item.title }</a>;
53
+ },
54
+ };
55
+ }
56
+
57
+ /**
58
+ * Creates a suggestion list for links to posts or pages..
59
+ *
60
+ * @return {WPCompleter} A link completer.
61
+ */
62
+ export default createLinkCompleter();
@@ -5,3 +5,11 @@
5
5
  margin-right: $grid-unit-10;
6
6
  }
7
7
  }
8
+
9
+ .block-editor-autocompleters__link {
10
+ white-space: nowrap;
11
+
12
+ .block-editor-block-icon {
13
+ margin-right: $grid-unit-10;
14
+ }
15
+ }
@@ -75,7 +75,7 @@ describe( 'AlignmentUI', () => {
75
75
  const customControls = wrapperCustomControls.props().controls;
76
76
  expect( customControls ).toHaveLength( 2 );
77
77
 
78
- // should correctly call on change when right alignment is pressed (active alignment)
78
+ // Should correctly call on change when right alignment is pressed (active alignment)
79
79
  const rightControl = customControls.find(
80
80
  ( { align } ) => align === 'custom-right'
81
81
  );
@@ -85,7 +85,7 @@ describe( 'AlignmentUI', () => {
85
85
  expect( onChangeSpy ).toHaveBeenCalledWith( undefined );
86
86
  onChangeSpy.mockClear();
87
87
 
88
- // should correctly call on change when right alignment is pressed (inactive alignment)
88
+ // Should correctly call on change when right alignment is pressed (inactive alignment)
89
89
  const leftControl = customControls.find(
90
90
  ( { align } ) => align === 'custom-left'
91
91
  );
@@ -19,6 +19,7 @@ import { getDefaultBlockName, getBlockSupport } from '@wordpress/blocks';
19
19
  */
20
20
  import { useBlockEditContext } from '../block-edit/context';
21
21
  import blockAutocompleter from '../../autocompleters/block';
22
+ import linkAutocompleter from '../../autocompleters/link';
22
23
 
23
24
  /**
24
25
  * Shared reference to an empty array for cases where it is important to avoid
@@ -39,6 +40,7 @@ function useCompleters( { completers = EMPTY_ARRAY } ) {
39
40
  ) {
40
41
  filteredCompleters = filteredCompleters.concat( [
41
42
  blockAutocompleter,
43
+ linkAutocompleter,
42
44
  ] );
43
45
  }
44
46
 
@@ -98,7 +98,7 @@ export default function BlockActions( {
98
98
 
99
99
  const groupingBlockName = getGroupingBlockName();
100
100
 
101
- // Activate the `transform` on `core/group` which does the conversion
101
+ // Activate the `transform` on `core/group` which does the conversion.
102
102
  const newBlocks = switchToBlockType( blocks, groupingBlockName );
103
103
 
104
104
  if ( ! newBlocks ) {
@@ -14,7 +14,7 @@ import { useSelect } from '@wordpress/data';
14
14
  import BlockAlignmentUI from '../ui';
15
15
 
16
16
  jest.mock( '@wordpress/data/src/components/use-select', () => {
17
- // This allows us to tweak the returned value on each test
17
+ // This allows us to tweak the returned value on each test.
18
18
  const mock = jest.fn();
19
19
  return mock;
20
20
  } );
@@ -80,7 +80,10 @@ function BlockBreadcrumb( { rootLabelText } ) {
80
80
  variant="tertiary"
81
81
  onClick={ () => selectBlock( parentClientId ) }
82
82
  >
83
- <BlockTitle clientId={ parentClientId } />
83
+ <BlockTitle
84
+ clientId={ parentClientId }
85
+ maximumLength={ 35 }
86
+ />
84
87
  </Button>
85
88
  <Icon
86
89
  icon={ chevronRightSmall }
@@ -93,7 +96,7 @@ function BlockBreadcrumb( { rootLabelText } ) {
93
96
  className="block-editor-block-breadcrumb__current"
94
97
  aria-current="true"
95
98
  >
96
- <BlockTitle clientId={ clientId } />
99
+ <BlockTitle clientId={ clientId } maximumLength={ 35 } />
97
100
  </li>
98
101
  ) }
99
102
  </ul>
@@ -43,10 +43,10 @@ function BlockCompare( {
43
43
  }
44
44
 
45
45
  function getConvertedContent( convertedBlock ) {
46
- // The convertor may return an array of items or a single item
46
+ // The convertor may return an array of items or a single item.
47
47
  const newBlocks = castArray( convertedBlock );
48
48
 
49
- // Get converted block details
49
+ // Get converted block details.
50
50
  const newContent = newBlocks.map( ( item ) =>
51
51
  getSaveContent( item.name, item.attributes, item.innerBlocks )
52
52
  );
@@ -8,7 +8,7 @@ const BlockControls = BlockControlsFill;
8
8
 
9
9
  BlockControls.Slot = BlockControlsSlot;
10
10
 
11
- // This is just here for backward compatibility
11
+ // This is just here for backward compatibility.
12
12
  export const BlockFormatControls = ( props ) => {
13
13
  return <BlockControlsFill group="inline" { ...props } />;
14
14
  };
@@ -52,7 +52,7 @@ const BlockDraggable = ( {
52
52
  blockEditorStore
53
53
  );
54
54
 
55
- // Stop dragging blocks if the block draggable is unmounted
55
+ // Stop dragging blocks if the block draggable is unmounted.
56
56
  useEffect( () => {
57
57
  return () => {
58
58
  if ( isDragging.current ) {
@@ -6,7 +6,7 @@ import BlockDraggableChip from '../draggable-chip';
6
6
  export default { title: 'BlockEditor/BlockDraggable' };
7
7
 
8
8
  export const _default = () => {
9
- // create a wrapper box for the absolutely-positioned child component
9
+ // Create a wrapper box for the absolutely-positioned child component.
10
10
  const wrapperStyle = { margin: '24px 0', position: 'relative' };
11
11
  return (
12
12
  <div style={ wrapperStyle }>
@@ -55,7 +55,7 @@ export const Edit = ( props ) => {
55
55
  return <Component { ...props } context={ context } />;
56
56
  }
57
57
 
58
- // Generate a class name for the block's editable form
58
+ // Generate a class name for the block's editable form.
59
59
  const generatedClassName = hasBlockSupport( blockType, 'className', true )
60
60
  ? getBlockDefaultClassName( name )
61
61
  : null;
@@ -53,7 +53,7 @@ function BlockHTML( { clientId } ) {
53
53
  isValid,
54
54
  } );
55
55
 
56
- // Ensure the state is updated if we reset so it displays the default content
56
+ // Ensure the state is updated if we reset so it displays the default content.
57
57
  if ( ! html ) {
58
58
  setHtml( { content } );
59
59
  }
@@ -28,7 +28,7 @@ export function BlockInvalidWarning( {
28
28
  const onCompare = useCallback( () => setCompare( true ), [] );
29
29
  const onCompareClose = useCallback( () => setCompare( false ), [] );
30
30
 
31
- // We memo the array here to prevent the children components from being updated unexpectedly
31
+ // We memo the array here to prevent the children components from being updated unexpectedly.
32
32
  const hiddenActions = useMemo(
33
33
  () =>
34
34
  [
@@ -209,18 +209,18 @@ export default compose( [
209
209
  ! isStackedHorizontally &&
210
210
  blockInsertionPointIsVisible &&
211
211
  insertionPoint.rootClientId === rootClientId &&
212
- // if list is empty, show the insertion point (via the default appender)
212
+ // If list is empty, show the insertion point (via the default appender)
213
213
  ( blockClientIds.length === 0 ||
214
- // or if the insertion point is right before the denoted block
214
+ // Or if the insertion point is right before the denoted block.
215
215
  blockClientIds[ insertionPoint.index ] === clientId );
216
216
 
217
217
  const shouldShowInsertionPointAfter =
218
218
  ! isStackedHorizontally &&
219
219
  blockInsertionPointIsVisible &&
220
220
  insertionPoint.rootClientId === rootClientId &&
221
- // if the insertion point is at the end of the list
221
+ // If the insertion point is at the end of the list.
222
222
  blockClientIds.length === insertionPoint.index &&
223
- // and the denoted block is the last one on the list, show the indicator at the end of the block
223
+ // And the denoted block is the last one on the list, show the indicator at the end of the block.
224
224
  blockClientIds[ insertionPoint.index - 1 ] === clientId;
225
225
 
226
226
  const isReadOnly = getSettings().readOnly;
@@ -38,11 +38,11 @@ const BlockSelectionButton = ( {
38
38
  <TouchableOpacity
39
39
  style={ styles.button }
40
40
  onPress={ () => {
41
- /* Open BottomSheet with markup */
41
+ /* Open BottomSheet with markup. */
42
42
  } }
43
43
  disabled={
44
44
  true
45
- } /* Disable temporarily since onPress function is empty */
45
+ } /* Disable temporarily since onPress function is empty. */
46
46
  >
47
47
  { rootClientId &&
48
48
  rootBlockIcon && [
@@ -72,7 +72,7 @@ const BlockSelectionButton = ( {
72
72
  numberOfLines={ 1 }
73
73
  style={ styles.selectionButtonTitle }
74
74
  >
75
- <BlockTitle clientId={ clientId } />
75
+ <BlockTitle clientId={ clientId } maximumLength={ 35 } />
76
76
  </Text>
77
77
  </TouchableOpacity>
78
78
  </View>
@@ -19,7 +19,12 @@ import {
19
19
  isUnmodifiedDefaultBlock,
20
20
  } from '@wordpress/blocks';
21
21
  import { withFilters } from '@wordpress/components';
22
- import { withDispatch, withSelect, useDispatch } from '@wordpress/data';
22
+ import {
23
+ withDispatch,
24
+ withSelect,
25
+ useDispatch,
26
+ useSelect,
27
+ } from '@wordpress/data';
23
28
  import { compose, pure, ifCondition } from '@wordpress/compose';
24
29
  import { safeHTML } from '@wordpress/dom';
25
30
 
@@ -86,6 +91,10 @@ function BlockListBlock( {
86
91
  onMerge,
87
92
  toggleSelection,
88
93
  } ) {
94
+ const themeSupportsLayout = useSelect( ( select ) => {
95
+ const { getSettings } = select( blockEditorStore );
96
+ return getSettings().supportsLayout;
97
+ }, [] );
89
98
  const { removeBlock } = useDispatch( blockEditorStore );
90
99
  const onRemove = useCallback( () => removeBlock( clientId ), [ clientId ] );
91
100
 
@@ -119,10 +128,19 @@ function BlockListBlock( {
119
128
  );
120
129
  }
121
130
 
122
- const isAligned = wrapperProps && !! wrapperProps[ 'data-align' ];
131
+ const isAligned =
132
+ wrapperProps &&
133
+ !! wrapperProps[ 'data-align' ] &&
134
+ ! themeSupportsLayout;
123
135
 
124
136
  // For aligned blocks, provide a wrapper element so the block can be
125
137
  // positioned relative to the block column.
138
+ // This is only kept for classic themes that don't support layout
139
+ // Historically we used to rely on extra divs and data-align to
140
+ // provide the alignments styles in the editor.
141
+ // Due to the differences between frontend and backend, we migrated
142
+ // to the layout feature, and we're now aligning the markup of frontend
143
+ // and backend.
126
144
  if ( isAligned ) {
127
145
  blockEdit = (
128
146
  <div
@@ -164,7 +182,13 @@ function BlockListBlock( {
164
182
 
165
183
  const value = {
166
184
  clientId,
167
- className,
185
+ className:
186
+ wrapperProps?.[ 'data-align' ] && themeSupportsLayout
187
+ ? classnames(
188
+ className,
189
+ `align${ wrapperProps[ 'data-align' ] }`
190
+ )
191
+ : className,
168
192
  wrapperProps: omit( wrapperProps, [ 'data-align' ] ),
169
193
  isAligned,
170
194
  };
@@ -306,7 +330,7 @@ export default compose(
306
330
  pure,
307
331
  applyWithSelect,
308
332
  applyWithDispatch,
309
- // block is sometimes not mounted at the right time, causing it be undefined
333
+ // Block is sometimes not mounted at the right time, causing it be undefined
310
334
  // see issue for more info
311
335
  // https://github.com/WordPress/gutenberg/issues/17013
312
336
  ifCondition( ( { block } ) => !! block ),
@@ -11,6 +11,7 @@ import { Component, createRef, useMemo } from '@wordpress/element';
11
11
  import {
12
12
  GlobalStylesContext,
13
13
  getMergedGlobalStyles,
14
+ useMobileGlobalStylesColors,
14
15
  alignmentHelpers,
15
16
  useGlobalStyles,
16
17
  } from '@wordpress/components';
@@ -50,7 +51,7 @@ function BlockForType( {
50
51
  blockWidth,
51
52
  baseGlobalStyles,
52
53
  } ) {
53
- const defaultColors = useSetting( 'color.palette' ) || emptyArray;
54
+ const defaultColors = useMobileGlobalStylesColors();
54
55
  const fontSizes = useSetting( 'typography.fontSizes' ) || emptyArray;
55
56
  const globalStyle = useGlobalStyles();
56
57
  const mergedStyle = useMemo( () => {
@@ -85,9 +86,9 @@ function BlockForType( {
85
86
  onReplace={ onReplace }
86
87
  insertBlocksAfter={ insertBlocksAfter }
87
88
  mergeBlocks={ mergeBlocks }
88
- // Block level styles
89
+ // Block level styles.
89
90
  wrapperProps={ wrapperProps }
90
- // inherited styles merged with block level styles
91
+ // Inherited styles merged with block level styles.
91
92
  style={ mergedStyle }
92
93
  clientId={ clientId }
93
94
  parentWidth={ parentWidth }
@@ -126,7 +127,7 @@ class BlockListBlock extends Component {
126
127
  this.props.onInsertBlocks( blocks, this.props.order + 1 );
127
128
 
128
129
  if ( blocks[ 0 ] ) {
129
- // focus on the first block inserted
130
+ // Focus on the first block inserted.
130
131
  this.props.onSelect( blocks[ 0 ].clientId );
131
132
  }
132
133
  }
@@ -285,7 +286,7 @@ class BlockListBlock extends Component {
285
286
  }
286
287
  }
287
288
 
288
- // Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference
289
+ // Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference.
289
290
  const wrapperPropsCache = new WeakMap();
290
291
  const emptyObj = {};
291
292
  function getWrapperProps( value, getWrapperPropsFunction ) {
@@ -338,7 +339,7 @@ export default compose( [
338
339
  : parents[ parents.length - 1 ];
339
340
 
340
341
  const isParentSelected =
341
- // set false as a default value to prevent re-render when it's changed from null to false
342
+ // Set false as a default value to prevent re-render when it's changed from null to false.
342
343
  ( selectedBlockClientId || false ) &&
343
344
  selectedBlockClientId === parentId;
344
345
 
@@ -171,7 +171,7 @@ export class BlockList extends Component {
171
171
 
172
172
  render() {
173
173
  const { isRootList } = this.props;
174
- // Use of Context to propagate the main scroll ref to its children e.g InnerBlocks
174
+ // Use of Context to propagate the main scroll ref to its children e.g InnerBlocks.
175
175
  const blockList = isRootList ? (
176
176
  <BlockListContext.Provider value={ this.scrollViewRef }>
177
177
  { this.renderList() }
@@ -223,7 +223,7 @@ export class BlockList extends Component {
223
223
 
224
224
  const containerStyle = {
225
225
  flex: isRootList ? 1 : 0,
226
- // We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks
226
+ // We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
227
227
  marginVertical: isRootList ? 0 : -marginVertical,
228
228
  marginHorizontal: isRootList ? 0 : -marginHorizontal,
229
229
  };
@@ -388,7 +388,7 @@ export default compose( [
388
388
  const selectedBlockClientId = getSelectedBlockClientId();
389
389
 
390
390
  let blockClientIds = getBlockOrder( rootClientId );
391
- // Display only block which fulfill the condition in passed `filterInnerBlocks` function
391
+ // Display only block which fulfill the condition in passed `filterInnerBlocks` function.
392
392
  if ( filterInnerBlocks ) {
393
393
  blockClientIds = filterInnerBlocks( blockClientIds );
394
394
  }
@@ -477,9 +477,9 @@ const EmptyListComponentCompose = compose( [
477
477
  ! isStackedHorizontally &&
478
478
  blockInsertionPointIsVisible &&
479
479
  insertionPoint.rootClientId === rootClientId &&
480
- // if list is empty, show the insertion point (via the default appender)
480
+ // If list is empty, show the insertion point (via the default appender)
481
481
  ( blockClientIds.length === 0 ||
482
- // or if the insertion point is right before the denoted block
482
+ // Or if the insertion point is right before the denoted block.
483
483
  ! blockClientIds[ insertionPoint.index ] );
484
484
 
485
485
  return {
@@ -321,7 +321,9 @@
321
321
  }
322
322
 
323
323
  .wp-block[data-align="left"] > *,
324
- .wp-block[data-align="right"] > * {
324
+ .wp-block[data-align="right"] > *,
325
+ .wp-block.alignleft,
326
+ .wp-block.alignright {
325
327
  // Without z-index, won't be clickable as "above" adjacent content.
326
328
  z-index: z-index("{core/image aligned left or right} .wp-block");
327
329
  }
@@ -43,7 +43,7 @@ export function useBlockClassNames( clientId ) {
43
43
  const isSelected = isBlockSelected( clientId );
44
44
  const name = getBlockName( clientId );
45
45
  const checkDeep = true;
46
- // "ancestor" is the more appropriate label due to "deep" check
46
+ // "ancestor" is the more appropriate label due to "deep" check.
47
47
  const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
48
48
  clientId,
49
49
  checkDeep
@@ -15,6 +15,7 @@ import { useSelect } from '@wordpress/data';
15
15
  */
16
16
  import { isInsideRootBlock } from '../../../utils/dom';
17
17
  import { store as blockEditorStore } from '../../../store';
18
+ import { setContentEditableWrapper } from './use-multi-selection';
18
19
 
19
20
  /** @typedef {import('@wordpress/element').RefObject} RefObject */
20
21
 
@@ -95,6 +96,8 @@ export function useFocusFirstElement( clientId ) {
95
96
  return;
96
97
  }
97
98
 
99
+ setContentEditableWrapper( ref.current, false );
100
+
98
101
  placeCaretAtHorizontalEdge( target, isReverse );
99
102
  }, [ initialPosition ] );
100
103
 
@@ -10,18 +10,15 @@ import { useRefEffect } from '@wordpress/compose';
10
10
  import { store as blockEditorStore } from '../../../store';
11
11
  import { getBlockClientId } from '../../../utils/dom';
12
12
 
13
- function toggleRichText( container, toggle ) {
14
- Array.from(
15
- container
16
- .closest( '.is-root-container' )
17
- .querySelectorAll( '.rich-text' )
18
- ).forEach( ( node ) => {
19
- if ( toggle ) {
20
- node.setAttribute( 'contenteditable', true );
21
- } else {
22
- node.removeAttribute( 'contenteditable' );
23
- }
24
- } );
13
+ /**
14
+ * Sets the `contenteditable` wrapper element to `value`.
15
+ *
16
+ * @param {HTMLElement} node Block element.
17
+ * @param {boolean} value `contentEditable` value (true or false)
18
+ */
19
+ export function setContentEditableWrapper( node, value ) {
20
+ // Since `closest` considers `node` as a candidate, use `parentElement`.
21
+ node.parentElement.closest( '[contenteditable]' ).contentEditable = value;
25
22
  }
26
23
 
27
24
  /**
@@ -54,10 +51,10 @@ export function useMultiSelection( clientId ) {
54
51
  function onSelectionChange( { isSelectionEnd } ) {
55
52
  const selection = defaultView.getSelection();
56
53
 
57
- // If no selection is found, end multi selection and enable all rich
58
- // text areas.
54
+ // If no selection is found, end multi selection and disable the
55
+ // contentEditable wrapper.
59
56
  if ( ! selection.rangeCount || selection.isCollapsed ) {
60
- toggleRichText( node, true );
57
+ setContentEditableWrapper( node, false );
61
58
  return;
62
59
  }
63
60
 
@@ -70,10 +67,10 @@ export function useMultiSelection( clientId ) {
70
67
  // If the selection is complete (on mouse up), and no
71
68
  // multiple blocks have been selected, set focus back to the
72
69
  // anchor element. if the anchor element contains the
73
- // selection. Additionally, rich text elements that were
74
- // previously disabled can now be enabled again.
70
+ // selection. Additionally, the contentEditable wrapper can
71
+ // now be disabled again.
75
72
  if ( isSelectionEnd ) {
76
- toggleRichText( node, true );
73
+ setContentEditableWrapper( node, false );
77
74
 
78
75
  if ( selection.rangeCount ) {
79
76
  const {
@@ -144,16 +141,11 @@ export function useMultiSelection( clientId ) {
144
141
  );
145
142
  defaultView.addEventListener( 'mouseup', onSelectionEnd );
146
143
 
147
- // Removing the contenteditable attributes within the block
148
- // editor is essential for selection to work across editable
149
- // areas. The edible hosts are removed, allowing selection to be
150
- // extended outside the DOM element. `startMultiSelect` sets a
151
- // flag in the store so the rich text components are updated,
152
- // but the rerender may happen very slowly, especially in Safari
153
- // for the blocks that are asynchonously rendered. To ensure the
154
- // browser instantly removes the selection boundaries, we remove
155
- // the contenteditable attributes manually.
156
- toggleRichText( node, false );
144
+ // Allow cross contentEditable selection by temporarily making
145
+ // all content editable. We can't rely on using the store and
146
+ // React because re-rending happens too slowly. We need to be
147
+ // able to select across instances immediately.
148
+ setContentEditableWrapper( node, true );
157
149
  }
158
150
 
159
151
  function onMouseDown( event ) {
@@ -189,9 +181,9 @@ export function useMultiSelection( clientId ) {
189
181
  const start = startPath[ depth ];
190
182
  const end = endPath[ depth ];
191
183
  // Handle the case of having selected a parent block and
192
- // then sfift+click on a child.
184
+ // then shift+click on a child.
193
185
  if ( start !== end ) {
194
- toggleRichText( node, false );
186
+ setContentEditableWrapper( node, true );
195
187
  multiSelect( start, end );
196
188
  event.preventDefault();
197
189
  }
@@ -124,7 +124,7 @@ export class BlockMediaUpdateProgress extends Component {
124
124
  }
125
125
  }
126
126
 
127
- // ---- Block media save actions
127
+ // ---- Block media save actions.
128
128
  updateMediaSaveProgress( payload ) {
129
129
  this.setState( {
130
130
  progress: payload.progress,
@@ -184,7 +184,7 @@ export class BlockMediaUpdateProgress extends Component {
184
184
  }
185
185
  }
186
186
 
187
- // ---- Block media upload actions
187
+ // ---- Block media upload actions.
188
188
  updateMediaUploadProgress( payload ) {
189
189
  this.setState( {
190
190
  progress: payload.progress,
@@ -220,7 +220,7 @@ export class BlockMediaUpdateProgress extends Component {
220
220
  }
221
221
 
222
222
  addMediaUploadListener() {
223
- //if we already have a subscription not worth doing it again
223
+ // If we already have a subscription not worth doing it again.
224
224
  if ( this.subscriptionParentMediaUpload ) {
225
225
  return;
226
226
  }
@@ -238,7 +238,7 @@ export class BlockMediaUpdateProgress extends Component {
238
238
  }
239
239
 
240
240
  addMediaSaveListener() {
241
- //if we already have a subscription not worth doing it again
241
+ // If we already have a subscription not worth doing it again.
242
242
  if ( this.subscriptionParentMediaSave ) {
243
243
  return;
244
244
  }
@@ -130,7 +130,7 @@ describe( 'BlockMediaUpdateProgress component', () => {
130
130
  expect( onUpdateMediaUploadProgress ).toHaveBeenCalledWith( payload );
131
131
  } );
132
132
 
133
- // UPLOAD tests
133
+ // UPLOAD tests.
134
134
  it( 'upload does not get affected by unrelated media uploads', () => {
135
135
  const payload = {
136
136
  state: MEDIA_UPLOAD_STATE_UPLOADING,
@@ -276,7 +276,7 @@ describe( 'BlockMediaUpdateProgress component', () => {
276
276
  expect( onMediaUploadStateReset ).toHaveBeenCalledWith( payloadReset );
277
277
  } );
278
278
 
279
- // SAVE tests
279
+ // SAVE tests.
280
280
  it( 'save does not get affected by unrelated media save events', () => {
281
281
  const payload = {
282
282
  state: MEDIA_SAVE_STATE_SAVING,
@@ -39,7 +39,7 @@ import { store as blockEditorStore } from '../../store';
39
39
  import BlockTransformationsMenu from '../block-switcher/block-transformations-menu';
40
40
 
41
41
  const BlockActionsMenu = ( {
42
- // Select
42
+ // Select.
43
43
  blockTitle,
44
44
  canInsertBlockType,
45
45
  getBlocksByClientId,
@@ -53,7 +53,7 @@ const BlockActionsMenu = ( {
53
53
  rootClientId,
54
54
  selectedBlockClientId,
55
55
  selectedBlockPossibleTransformations,
56
- // Dispatch
56
+ // Dispatch.
57
57
  createSuccessNotice,
58
58
  convertToRegularBlocks,
59
59
  duplicateBlock,
@@ -62,7 +62,7 @@ const BlockActionsMenu = ( {
62
62
  openGeneralSidebar,
63
63
  pasteBlock,
64
64
  removeBlocks,
65
- // Passed in
65
+ // Passed in.
66
66
  anchorNodeRef,
67
67
  isStackedHorizontally,
68
68
  onDelete,