@wordpress/block-editor 11.0.0 → 11.2.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 (470) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +2 -1
  4. package/build/components/alignment-control/ui.js +1 -7
  5. package/build/components/alignment-control/ui.js.map +1 -1
  6. package/build/components/block-actions/index.js +9 -0
  7. package/build/components/block-actions/index.js.map +1 -1
  8. package/build/components/block-alignment-control/use-available-alignments.js +4 -3
  9. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  10. package/build/components/block-icon/index.js +4 -2
  11. package/build/components/block-icon/index.js.map +1 -1
  12. package/build/components/block-inspector/index.js +58 -5
  13. package/build/components/block-inspector/index.js.map +1 -1
  14. package/build/components/block-list-appender/index.js +46 -34
  15. package/build/components/block-list-appender/index.js.map +1 -1
  16. package/build/components/block-list-appender/index.native.js +39 -34
  17. package/build/components/block-list-appender/index.native.js.map +1 -1
  18. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
  19. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  20. package/build/components/block-mobile-toolbar/index.native.js +1 -1
  21. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  22. package/build/components/block-pattern-setup/index.js +14 -7
  23. package/build/components/block-pattern-setup/index.js.map +1 -1
  24. package/build/components/block-preview/auto.js +1 -4
  25. package/build/components/block-preview/auto.js.map +1 -1
  26. package/build/components/block-settings-menu/block-settings-dropdown.js +4 -1
  27. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  28. package/build/components/block-styles/index.js +3 -1
  29. package/build/components/block-styles/index.js.map +1 -1
  30. package/build/components/block-styles/index.native.js +1 -3
  31. package/build/components/block-styles/index.native.js.map +1 -1
  32. package/build/components/block-styles/utils.js +7 -10
  33. package/build/components/block-styles/utils.js.map +1 -1
  34. package/build/components/block-toolbar/index.native.js +6 -8
  35. package/build/components/block-toolbar/index.native.js.map +1 -1
  36. package/build/components/block-tools/selected-block-popover.js +1 -3
  37. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  38. package/build/components/block-tools/use-block-toolbar-popover-props.js +43 -10
  39. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  40. package/build/components/block-variation-picker/index.js +1 -1
  41. package/build/components/block-variation-picker/index.js.map +1 -1
  42. package/build/components/colors/utils.js +2 -6
  43. package/build/components/colors/utils.js.map +1 -1
  44. package/build/components/colors-gradients/control.js +0 -3
  45. package/build/components/colors-gradients/control.js.map +1 -1
  46. package/build/components/colors-gradients/dropdown.js +0 -2
  47. package/build/components/colors-gradients/dropdown.js.map +1 -1
  48. package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
  49. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  50. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
  51. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  52. package/build/components/copy-handler/index.js +37 -9
  53. package/build/components/copy-handler/index.js.map +1 -1
  54. package/build/components/default-style-picker/index.js +1 -0
  55. package/build/components/default-style-picker/index.js.map +1 -1
  56. package/build/components/font-sizes/fluid-utils.js +5 -2
  57. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  58. package/build/components/font-sizes/utils.js +10 -4
  59. package/build/components/font-sizes/utils.js.map +1 -1
  60. package/build/components/font-sizes/with-font-sizes.js +14 -12
  61. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  62. package/build/components/gradients/use-gradient.js +2 -8
  63. package/build/components/gradients/use-gradient.js.map +1 -1
  64. package/build/components/iframe/index.js +48 -101
  65. package/build/components/iframe/index.js.map +1 -1
  66. package/build/components/iframe/use-compatibility-styles.js +98 -0
  67. package/build/components/iframe/use-compatibility-styles.js.map +1 -0
  68. package/build/components/image-size-control/index.js +1 -0
  69. package/build/components/image-size-control/index.js.map +1 -1
  70. package/build/components/inner-blocks/index.js +6 -2
  71. package/build/components/inner-blocks/index.js.map +1 -1
  72. package/build/components/inserter/block-patterns-tab.js +4 -4
  73. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  74. package/build/components/inserter/hooks/use-insertion-point.js +4 -3
  75. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  76. package/build/components/inserter/index.js +16 -6
  77. package/build/components/inserter/index.js.map +1 -1
  78. package/build/components/inserter/media-tab/hooks.js +8 -5
  79. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  80. package/build/components/inserter/menu.js +11 -5
  81. package/build/components/inserter/menu.js.map +1 -1
  82. package/build/components/inserter/quick-inserter.js +6 -3
  83. package/build/components/inserter/quick-inserter.js.map +1 -1
  84. package/build/components/inserter/search-items.js +15 -14
  85. package/build/components/inserter/search-items.js.map +1 -1
  86. package/build/components/inserter/search-results.js +4 -2
  87. package/build/components/inserter/search-results.js.map +1 -1
  88. package/build/components/inspector-controls/groups.js +3 -1
  89. package/build/components/inspector-controls/groups.js.map +1 -1
  90. package/build/components/inspector-controls-tabs/position-controls-panel.js +46 -0
  91. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
  92. package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
  93. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  94. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
  95. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  96. package/build/components/link-control/search-input.js +1 -0
  97. package/build/components/link-control/search-input.js.map +1 -1
  98. package/build/components/list-view/block-select-button.js +1 -1
  99. package/build/components/list-view/block-select-button.js.map +1 -1
  100. package/build/components/off-canvas-editor/appender.js +3 -44
  101. package/build/components/off-canvas-editor/appender.js.map +1 -1
  102. package/build/components/off-canvas-editor/block-contents.js +38 -5
  103. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  104. package/build/components/off-canvas-editor/block-select-button.js +3 -2
  105. package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
  106. package/build/components/off-canvas-editor/block.js +51 -57
  107. package/build/components/off-canvas-editor/block.js.map +1 -1
  108. package/build/components/off-canvas-editor/index.js +12 -5
  109. package/build/components/off-canvas-editor/index.js.map +1 -1
  110. package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
  111. package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  112. package/build/components/provider/index.js +3 -1
  113. package/build/components/provider/index.js.map +1 -1
  114. package/build/components/responsive-block-control/label.js.map +1 -1
  115. package/build/components/rich-text/format-edit.js +12 -10
  116. package/build/components/rich-text/format-edit.js.map +1 -1
  117. package/build/components/rich-text/index.js.map +1 -1
  118. package/build/components/rich-text/use-enter.js +4 -5
  119. package/build/components/rich-text/use-enter.js.map +1 -1
  120. package/build/components/rich-text/use-paste-handler.js +21 -12
  121. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  122. package/build/components/spacing-sizes-control/index.js +0 -1
  123. package/build/components/spacing-sizes-control/index.js.map +1 -1
  124. package/build/components/spacing-sizes-control/utils.js +1 -1
  125. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  126. package/build/components/typewriter/index.js +1 -1
  127. package/build/components/typewriter/index.js.map +1 -1
  128. package/build/components/url-input/button.js +1 -0
  129. package/build/components/url-input/button.js.map +1 -1
  130. package/build/components/url-input/index.js +15 -1
  131. package/build/components/url-input/index.js.map +1 -1
  132. package/build/components/url-popover/image-url-input-ui.js +2 -2
  133. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  134. package/build/components/url-popover/link-editor.js +1 -0
  135. package/build/components/url-popover/link-editor.js.map +1 -1
  136. package/build/components/use-paste-styles/index.js +188 -0
  137. package/build/components/use-paste-styles/index.js.map +1 -0
  138. package/build/components/writing-flow/index.js +1 -1
  139. package/build/components/writing-flow/index.js.map +1 -1
  140. package/build/components/writing-flow/use-arrow-nav.js +22 -29
  141. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  142. package/build/hooks/border.js +0 -1
  143. package/build/hooks/border.js.map +1 -1
  144. package/build/hooks/color-panel.js +0 -1
  145. package/build/hooks/color-panel.js.map +1 -1
  146. package/build/hooks/color.js +1 -2
  147. package/build/hooks/color.js.map +1 -1
  148. package/build/hooks/font-family.js +4 -4
  149. package/build/hooks/font-family.js.map +1 -1
  150. package/build/hooks/font-size.js +5 -3
  151. package/build/hooks/font-size.js.map +1 -1
  152. package/build/hooks/index.js +2 -0
  153. package/build/hooks/index.js.map +1 -1
  154. package/build/hooks/metadata.js +1 -1
  155. package/build/hooks/metadata.js.map +1 -1
  156. package/build/hooks/position.js +376 -0
  157. package/build/hooks/position.js.map +1 -0
  158. package/build/hooks/supports.js +328 -0
  159. package/build/hooks/supports.js.map +1 -0
  160. package/build/hooks/use-typography-props.js +11 -8
  161. package/build/hooks/use-typography-props.js.map +1 -1
  162. package/build/store/reducer.js +27 -9
  163. package/build/store/reducer.js.map +1 -1
  164. package/build/store/selectors.js +9 -7
  165. package/build/store/selectors.js.map +1 -1
  166. package/build/utils/pasting.js +6 -11
  167. package/build/utils/pasting.js.map +1 -1
  168. package/build-module/components/alignment-control/ui.js +1 -6
  169. package/build-module/components/alignment-control/ui.js.map +1 -1
  170. package/build-module/components/block-actions/index.js +6 -0
  171. package/build-module/components/block-actions/index.js.map +1 -1
  172. package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
  173. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  174. package/build-module/components/block-icon/index.js +4 -2
  175. package/build-module/components/block-icon/index.js.map +1 -1
  176. package/build-module/components/block-inspector/index.js +58 -6
  177. package/build-module/components/block-inspector/index.js.map +1 -1
  178. package/build-module/components/block-list-appender/index.js +46 -34
  179. package/build-module/components/block-list-appender/index.js.map +1 -1
  180. package/build-module/components/block-list-appender/index.native.js +39 -32
  181. package/build-module/components/block-list-appender/index.native.js.map +1 -1
  182. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
  183. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  184. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  185. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  186. package/build-module/components/block-pattern-setup/index.js +14 -7
  187. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  188. package/build-module/components/block-preview/auto.js +1 -4
  189. package/build-module/components/block-preview/auto.js.map +1 -1
  190. package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -1
  191. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  192. package/build-module/components/block-styles/index.js +2 -1
  193. package/build-module/components/block-styles/index.js.map +1 -1
  194. package/build-module/components/block-styles/index.native.js +1 -2
  195. package/build-module/components/block-styles/index.native.js.map +1 -1
  196. package/build-module/components/block-styles/utils.js +7 -9
  197. package/build-module/components/block-styles/utils.js.map +1 -1
  198. package/build-module/components/block-toolbar/index.native.js +6 -8
  199. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  200. package/build-module/components/block-tools/selected-block-popover.js +1 -2
  201. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  202. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +42 -11
  203. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  204. package/build-module/components/block-variation-picker/index.js +1 -1
  205. package/build-module/components/block-variation-picker/index.js.map +1 -1
  206. package/build-module/components/colors/utils.js +3 -7
  207. package/build-module/components/colors/utils.js.map +1 -1
  208. package/build-module/components/colors-gradients/control.js +0 -3
  209. package/build-module/components/colors-gradients/control.js.map +1 -1
  210. package/build-module/components/colors-gradients/dropdown.js +0 -2
  211. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  212. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
  213. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  214. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  215. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  216. package/build-module/components/copy-handler/index.js +38 -10
  217. package/build-module/components/copy-handler/index.js.map +1 -1
  218. package/build-module/components/default-style-picker/index.js +1 -0
  219. package/build-module/components/default-style-picker/index.js.map +1 -1
  220. package/build-module/components/font-sizes/fluid-utils.js +5 -2
  221. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  222. package/build-module/components/font-sizes/utils.js +11 -5
  223. package/build-module/components/font-sizes/utils.js.map +1 -1
  224. package/build-module/components/font-sizes/with-font-sizes.js +14 -11
  225. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  226. package/build-module/components/gradients/use-gradient.js +2 -7
  227. package/build-module/components/gradients/use-gradient.js.map +1 -1
  228. package/build-module/components/iframe/index.js +46 -102
  229. package/build-module/components/iframe/index.js.map +1 -1
  230. package/build-module/components/iframe/use-compatibility-styles.js +90 -0
  231. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
  232. package/build-module/components/image-size-control/index.js +1 -0
  233. package/build-module/components/image-size-control/index.js.map +1 -1
  234. package/build-module/components/inner-blocks/index.js +6 -2
  235. package/build-module/components/inner-blocks/index.js.map +1 -1
  236. package/build-module/components/inserter/block-patterns-tab.js +4 -4
  237. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  238. package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
  239. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  240. package/build-module/components/inserter/index.js +16 -6
  241. package/build-module/components/inserter/index.js.map +1 -1
  242. package/build-module/components/inserter/media-tab/hooks.js +8 -5
  243. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  244. package/build-module/components/inserter/menu.js +11 -5
  245. package/build-module/components/inserter/menu.js.map +1 -1
  246. package/build-module/components/inserter/quick-inserter.js +6 -3
  247. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  248. package/build-module/components/inserter/search-items.js +15 -13
  249. package/build-module/components/inserter/search-items.js.map +1 -1
  250. package/build-module/components/inserter/search-results.js +4 -2
  251. package/build-module/components/inserter/search-results.js.map +1 -1
  252. package/build-module/components/inspector-controls/groups.js +3 -1
  253. package/build-module/components/inspector-controls/groups.js.map +1 -1
  254. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +33 -0
  255. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
  256. package/build-module/components/inspector-controls-tabs/settings-tab.js +2 -1
  257. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  258. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
  259. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  260. package/build-module/components/link-control/search-input.js +1 -0
  261. package/build-module/components/link-control/search-input.js.map +1 -1
  262. package/build-module/components/list-view/block-select-button.js +1 -1
  263. package/build-module/components/list-view/block-select-button.js.map +1 -1
  264. package/build-module/components/off-canvas-editor/appender.js +5 -44
  265. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  266. package/build-module/components/off-canvas-editor/block-contents.js +37 -7
  267. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  268. package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
  269. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
  270. package/build-module/components/off-canvas-editor/block.js +54 -60
  271. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  272. package/build-module/components/off-canvas-editor/index.js +12 -5
  273. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  274. package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
  275. package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  276. package/build-module/components/provider/index.js +3 -1
  277. package/build-module/components/provider/index.js.map +1 -1
  278. package/build-module/components/responsive-block-control/label.js +1 -2
  279. package/build-module/components/responsive-block-control/label.js.map +1 -1
  280. package/build-module/components/rich-text/format-edit.js +12 -9
  281. package/build-module/components/rich-text/format-edit.js.map +1 -1
  282. package/build-module/components/rich-text/index.js.map +1 -1
  283. package/build-module/components/rich-text/use-enter.js +4 -5
  284. package/build-module/components/rich-text/use-enter.js.map +1 -1
  285. package/build-module/components/rich-text/use-paste-handler.js +22 -12
  286. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  287. package/build-module/components/spacing-sizes-control/index.js +0 -1
  288. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  289. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  290. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  291. package/build-module/components/typewriter/index.js +1 -1
  292. package/build-module/components/typewriter/index.js.map +1 -1
  293. package/build-module/components/url-input/button.js +1 -0
  294. package/build-module/components/url-input/button.js.map +1 -1
  295. package/build-module/components/url-input/index.js +14 -1
  296. package/build-module/components/url-input/index.js.map +1 -1
  297. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  298. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  299. package/build-module/components/url-popover/link-editor.js +1 -0
  300. package/build-module/components/url-popover/link-editor.js.map +1 -1
  301. package/build-module/components/use-paste-styles/index.js +174 -0
  302. package/build-module/components/use-paste-styles/index.js.map +1 -0
  303. package/build-module/components/writing-flow/index.js +1 -1
  304. package/build-module/components/writing-flow/index.js.map +1 -1
  305. package/build-module/components/writing-flow/use-arrow-nav.js +22 -29
  306. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  307. package/build-module/hooks/border.js +0 -1
  308. package/build-module/hooks/border.js.map +1 -1
  309. package/build-module/hooks/color-panel.js +0 -1
  310. package/build-module/hooks/color-panel.js.map +1 -1
  311. package/build-module/hooks/color.js +1 -2
  312. package/build-module/hooks/color.js.map +1 -1
  313. package/build-module/hooks/font-family.js +5 -5
  314. package/build-module/hooks/font-family.js.map +1 -1
  315. package/build-module/hooks/font-size.js +5 -3
  316. package/build-module/hooks/font-size.js.map +1 -1
  317. package/build-module/hooks/index.js +1 -0
  318. package/build-module/hooks/index.js.map +1 -1
  319. package/build-module/hooks/metadata.js +1 -1
  320. package/build-module/hooks/metadata.js.map +1 -1
  321. package/build-module/hooks/position.js +337 -0
  322. package/build-module/hooks/position.js.map +1 -0
  323. package/build-module/hooks/supports.js +257 -0
  324. package/build-module/hooks/supports.js.map +1 -0
  325. package/build-module/hooks/use-typography-props.js +11 -8
  326. package/build-module/hooks/use-typography-props.js.map +1 -1
  327. package/build-module/store/reducer.js +27 -8
  328. package/build-module/store/reducer.js.map +1 -1
  329. package/build-module/store/selectors.js +9 -7
  330. package/build-module/store/selectors.js.map +1 -1
  331. package/build-module/utils/pasting.js +6 -10
  332. package/build-module/utils/pasting.js.map +1 -1
  333. package/build-style/content-rtl.css +60 -3
  334. package/build-style/content.css +60 -3
  335. package/build-style/default-editor-styles-rtl.css +3 -3
  336. package/build-style/default-editor-styles.css +3 -3
  337. package/build-style/style-rtl.css +62 -69
  338. package/build-style/style.css +62 -69
  339. package/package.json +29 -29
  340. package/src/components/alignment-control/test/index.js +2 -0
  341. package/src/components/alignment-control/ui.js +1 -7
  342. package/src/components/block-actions/index.js +5 -0
  343. package/src/components/block-alignment-control/test/index.js +2 -0
  344. package/src/components/block-alignment-control/use-available-alignments.js +4 -3
  345. package/src/components/block-icon/index.js +4 -2
  346. package/src/components/block-icon/test/index.js +9 -5
  347. package/src/components/block-inspector/index.js +79 -4
  348. package/src/components/block-inspector/style.scss +7 -0
  349. package/src/components/block-list-appender/index.js +65 -54
  350. package/src/components/block-list-appender/index.native.js +45 -34
  351. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +18 -22
  352. package/src/components/block-mobile-toolbar/index.native.js +1 -1
  353. package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
  354. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
  355. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -0
  356. package/src/components/block-mover/test/index.native.js +157 -1
  357. package/src/components/block-pattern-setup/index.js +15 -6
  358. package/src/components/block-pattern-setup/style.scss +29 -1
  359. package/src/components/block-preview/auto.js +2 -4
  360. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
  361. package/src/components/block-styles/index.js +4 -1
  362. package/src/components/block-styles/index.native.js +1 -2
  363. package/src/components/block-styles/utils.js +5 -7
  364. package/src/components/block-switcher/test/index.js +3 -2
  365. package/src/components/block-toolbar/index.native.js +8 -11
  366. package/src/components/block-tools/selected-block-popover.js +1 -3
  367. package/src/components/block-tools/use-block-toolbar-popover-props.js +68 -12
  368. package/src/components/block-variation-picker/index.js +5 -1
  369. package/src/components/block-vertical-alignment-control/test/index.js +2 -0
  370. package/src/components/button-block-appender/{style.scss → content.scss} +0 -0
  371. package/src/components/colors/test/with-colors.js +2 -0
  372. package/src/components/colors/utils.js +5 -3
  373. package/src/components/colors-gradients/control.js +0 -7
  374. package/src/components/colors-gradients/dropdown.js +0 -2
  375. package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
  376. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  377. package/src/components/copy-handler/index.js +53 -7
  378. package/src/components/default-block-appender/test/index.js +2 -0
  379. package/src/components/default-style-picker/index.js +1 -0
  380. package/src/components/font-sizes/fluid-utils.js +7 -1
  381. package/src/components/font-sizes/utils.js +5 -3
  382. package/src/components/font-sizes/with-font-sizes.js +36 -36
  383. package/src/components/gradients/use-gradient.js +2 -7
  384. package/src/components/iframe/index.js +60 -122
  385. package/src/components/iframe/use-compatibility-styles.js +101 -0
  386. package/src/components/image-size-control/index.js +1 -0
  387. package/src/components/image-size-control/test/index.js +147 -79
  388. package/src/components/inner-blocks/index.js +4 -2
  389. package/src/components/inserter/block-patterns-tab.js +7 -4
  390. package/src/components/inserter/hooks/use-insertion-point.js +3 -2
  391. package/src/components/inserter/index.js +61 -43
  392. package/src/components/inserter/media-tab/hooks.js +5 -4
  393. package/src/components/inserter/menu.js +8 -4
  394. package/src/components/inserter/quick-inserter.js +3 -0
  395. package/src/components/inserter/search-items.js +1 -2
  396. package/src/components/inserter/search-results.js +2 -0
  397. package/src/components/inserter/test/__snapshots__/index.native.js.snap +117 -0
  398. package/src/components/inserter/test/index.native.js +255 -1
  399. package/src/components/inspector-controls/groups.js +2 -0
  400. package/src/components/inspector-controls-tabs/position-controls-panel.js +37 -0
  401. package/src/components/inspector-controls-tabs/settings-tab.js +2 -0
  402. package/src/components/inspector-controls-tabs/style.scss +15 -0
  403. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -8
  404. package/src/components/link-control/search-input.js +1 -0
  405. package/src/components/link-control/style.scss +1 -0
  406. package/src/components/link-control/test/index.js +18 -4
  407. package/src/components/list-view/block-select-button.js +1 -1
  408. package/src/components/list-view/style.scss +14 -10
  409. package/src/components/media-replace-flow/test/index.js +2 -0
  410. package/src/components/off-canvas-editor/appender.js +4 -49
  411. package/src/components/off-canvas-editor/block-contents.js +84 -23
  412. package/src/components/off-canvas-editor/block-select-button.js +6 -2
  413. package/src/components/off-canvas-editor/block.js +90 -105
  414. package/src/components/off-canvas-editor/index.js +21 -2
  415. package/src/components/off-canvas-editor/style.scss +5 -1
  416. package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
  417. package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
  418. package/src/components/provider/index.js +4 -1
  419. package/src/components/responsive-block-control/label.js +2 -3
  420. package/src/components/responsive-block-control/test/index.js +4 -2
  421. package/src/components/rich-text/format-edit.js +6 -10
  422. package/src/components/rich-text/index.js +1 -0
  423. package/src/components/rich-text/use-enter.js +4 -4
  424. package/src/components/rich-text/use-paste-handler.js +33 -14
  425. package/src/components/spacing-sizes-control/index.js +0 -1
  426. package/src/components/spacing-sizes-control/utils.js +1 -1
  427. package/src/components/typewriter/index.js +3 -1
  428. package/src/components/url-input/README.md +5 -0
  429. package/src/components/url-input/button.js +1 -0
  430. package/src/components/url-input/index.js +15 -1
  431. package/src/components/url-input/test/button.js +2 -0
  432. package/src/components/url-popover/image-url-input-ui.js +5 -4
  433. package/src/components/url-popover/link-editor.js +1 -0
  434. package/src/components/url-popover/test/index.js +21 -5
  435. package/src/components/use-paste-styles/index.js +230 -0
  436. package/src/components/warning/test/index.js +2 -0
  437. package/src/components/writing-flow/index.js +1 -1
  438. package/src/components/writing-flow/use-arrow-nav.js +20 -28
  439. package/src/content.scss +1 -0
  440. package/src/hooks/border.js +0 -1
  441. package/src/hooks/color-panel.js +0 -1
  442. package/src/hooks/color.js +0 -2
  443. package/src/hooks/font-family.js +3 -5
  444. package/src/hooks/font-size.js +13 -4
  445. package/src/hooks/index.js +1 -0
  446. package/src/hooks/metadata.js +1 -2
  447. package/src/hooks/position.js +375 -0
  448. package/src/hooks/position.scss +18 -0
  449. package/src/hooks/supports.js +302 -0
  450. package/src/hooks/test/__snapshots__/align.native.js.snap +73 -0
  451. package/src/hooks/test/align.native.js +133 -0
  452. package/src/hooks/test/use-typography-props.js +26 -0
  453. package/src/hooks/use-typography-props.js +15 -7
  454. package/src/store/reducer.js +20 -8
  455. package/src/store/selectors.js +7 -8
  456. package/src/store/test/reducer.js +45 -3
  457. package/src/store/test/selectors.js +12 -9
  458. package/src/style.scss +2 -1
  459. package/src/utils/pasting.js +3 -9
  460. package/tsconfig.tsbuildinfo +1 -1
  461. package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
  462. package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  463. package/build/components/rich-text/file-paste-handler.js +0 -21
  464. package/build/components/rich-text/file-paste-handler.js.map +0 -1
  465. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  466. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  467. package/build-module/components/rich-text/file-paste-handler.js +0 -13
  468. package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
  469. package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  470. package/src/components/rich-text/file-paste-handler.js +0 -13
@@ -2,7 +2,6 @@
2
2
  * External dependencies
3
3
  */
4
4
  import removeAccents from 'remove-accents';
5
- import { find } from 'lodash';
6
5
  import { noCase } from 'change-case';
7
6
 
8
7
  // Default search helpers.
@@ -88,7 +87,7 @@ export const searchBlockItems = (
88
87
 
89
88
  const config = {
90
89
  getCategory: ( item ) =>
91
- find( categories, { slug: item.category } )?.title,
90
+ categories.find( ( { slug } ) => slug === item.category )?.title,
92
91
  getCollection: ( item ) =>
93
92
  collections[ item.name.split( '/' )[ 0 ] ]?.title,
94
93
  };
@@ -50,6 +50,7 @@ function InserterSearchResults( {
50
50
  isDraggable = true,
51
51
  shouldFocusBlock = true,
52
52
  prioritizePatterns,
53
+ selectBlockOnInsert,
53
54
  } ) {
54
55
  const debouncedSpeak = useDebounce( speak, 500 );
55
56
 
@@ -60,6 +61,7 @@ function InserterSearchResults( {
60
61
  isAppender,
61
62
  insertionIndex: __experimentalInsertionIndex,
62
63
  shouldFocusBlock,
64
+ selectBlockOnInsert,
63
65
  } );
64
66
  const [
65
67
  blockTypes,
@@ -0,0 +1,117 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Inserter can add blocks adds new block at the end of post 1`] = `
4
+ "<!-- wp:spacer -->
5
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
6
+ <!-- /wp:spacer -->
7
+
8
+ <!-- wp:heading -->
9
+ <h2 class=\\"wp-block-heading\\"></h2>
10
+ <!-- /wp:heading -->"
11
+ `;
12
+
13
+ exports[`Inserter can add blocks after another block 1`] = `
14
+ "<!-- wp:spacer -->
15
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
16
+ <!-- /wp:spacer -->
17
+
18
+ <!-- wp:heading -->
19
+ <h2 class=\\"wp-block-heading\\"></h2>
20
+ <!-- /wp:heading -->
21
+
22
+ <!-- wp:more -->
23
+ <!--more-->
24
+ <!-- /wp:more -->
25
+
26
+ <!-- wp:paragraph -->
27
+ <p></p>
28
+ <!-- /wp:paragraph -->"
29
+ `;
30
+
31
+ exports[`Inserter can add blocks before another block 1`] = `
32
+ "<!-- wp:heading -->
33
+ <h2 class=\\"wp-block-heading\\"></h2>
34
+ <!-- /wp:heading -->
35
+
36
+ <!-- wp:paragraph -->
37
+ <p></p>
38
+ <!-- /wp:paragraph -->"
39
+ `;
40
+
41
+ exports[`Inserter can add blocks creates a new Paragraph block tapping on the empty area below the last block 1`] = `
42
+ "<!-- wp:spacer -->
43
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
44
+ <!-- /wp:spacer -->
45
+
46
+ <!-- wp:heading -->
47
+ <h2 class=\\"wp-block-heading\\"></h2>
48
+ <!-- /wp:heading -->
49
+
50
+ <!-- wp:paragraph -->
51
+ <p></p>
52
+ <!-- /wp:paragraph -->"
53
+ `;
54
+
55
+ exports[`Inserter can add blocks inserts between 2 existing blocks 1`] = `
56
+ "<!-- wp:spacer -->
57
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
58
+ <!-- /wp:spacer -->
59
+
60
+ <!-- wp:more -->
61
+ <!--more-->
62
+ <!-- /wp:more -->
63
+
64
+ <!-- wp:heading -->
65
+ <h2 class=\\"wp-block-heading\\"></h2>
66
+ <!-- /wp:heading -->"
67
+ `;
68
+
69
+ exports[`Inserter can add blocks inserts block at the end of post when no block is selected 1`] = `
70
+ "<!-- wp:spacer -->
71
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
72
+ <!-- /wp:spacer -->
73
+
74
+ <!-- wp:heading -->
75
+ <h2 class=\\"wp-block-heading\\"></h2>
76
+ <!-- /wp:heading -->
77
+
78
+ <!-- wp:more -->
79
+ <!--more-->
80
+ <!-- /wp:more -->"
81
+ `;
82
+
83
+ exports[`Inserter can add blocks to the beginning 1`] = `
84
+ "<!-- wp:more -->
85
+ <!--more-->
86
+ <!-- /wp:more -->
87
+
88
+ <!-- wp:spacer -->
89
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
90
+ <!-- /wp:spacer -->
91
+
92
+ <!-- wp:heading -->
93
+ <h2 class=\\"wp-block-heading\\"></h2>
94
+ <!-- /wp:heading -->
95
+
96
+ <!-- wp:paragraph -->
97
+ <p></p>
98
+ <!-- /wp:paragraph -->"
99
+ `;
100
+
101
+ exports[`Inserter can add blocks to the end 1`] = `
102
+ "<!-- wp:spacer -->
103
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
104
+ <!-- /wp:spacer -->
105
+
106
+ <!-- wp:heading -->
107
+ <h2 class=\\"wp-block-heading\\"></h2>
108
+ <!-- /wp:heading -->
109
+
110
+ <!-- wp:paragraph -->
111
+ <p></p>
112
+ <!-- /wp:paragraph -->
113
+
114
+ <!-- wp:more -->
115
+ <!--more-->
116
+ <!-- /wp:more -->"
117
+ `;
@@ -1,7 +1,20 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render } from 'test/helpers';
4
+ import {
5
+ addBlock,
6
+ fireEvent,
7
+ initializeEditor,
8
+ getBlock,
9
+ getEditorHtml,
10
+ render,
11
+ } from 'test/helpers';
12
+
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+ import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
17
+ import { registerCoreBlocks } from '@wordpress/block-library';
5
18
 
6
19
  /**
7
20
  * Internal dependencies
@@ -20,4 +33,245 @@ describe( 'Inserter', () => {
20
33
 
21
34
  expect( screen.getByTestId( 'add-block-button' ) ).toBeTruthy();
22
35
  } );
36
+
37
+ describe( 'can add blocks', () => {
38
+ beforeAll( () => {
39
+ // Register all core blocks
40
+ registerCoreBlocks();
41
+ } );
42
+
43
+ afterAll( () => {
44
+ // Clean up registered blocks
45
+ getBlockTypes().forEach( ( block ) => {
46
+ unregisterBlockType( block.name );
47
+ } );
48
+ } );
49
+
50
+ it( 'to the beginning', async () => {
51
+ const screen = await initializeEditor();
52
+ const { getByLabelText, getByTestId } = screen;
53
+
54
+ // Add Spacer block
55
+ await addBlock( screen, 'Spacer' );
56
+
57
+ // Add Heading block
58
+ await addBlock( screen, 'Heading' );
59
+
60
+ // Add Paragraph block
61
+ await addBlock( screen, 'Paragraph' );
62
+
63
+ // Get Inserter button
64
+ const addBlockButton = await getByTestId( 'add-block-button' );
65
+
66
+ // Long press the inserter button
67
+ fireEvent( addBlockButton, 'onLongPress' );
68
+
69
+ // Get Add To Beginning option
70
+ const addBlockToBeginningButton = await getByLabelText(
71
+ 'Add To Beginning'
72
+ );
73
+ expect( addBlockToBeginningButton ).toBeVisible();
74
+ fireEvent.press( addBlockToBeginningButton );
75
+
76
+ // Add another block at the beginning
77
+ await addBlock( screen, 'More', { isPickerOpened: true } );
78
+
79
+ expect( getEditorHtml() ).toMatchSnapshot();
80
+ } );
81
+
82
+ it( 'before another block', async () => {
83
+ const screen = await initializeEditor();
84
+ const { getByLabelText, getByTestId } = screen;
85
+
86
+ // Add Paragraph block
87
+ await addBlock( screen, 'Paragraph' );
88
+
89
+ // Get Paragraph block
90
+ const paragraphBlock = await getBlock( screen, 'Paragraph' );
91
+ fireEvent.press( paragraphBlock );
92
+
93
+ // Get Inserter button
94
+ const addBlockButton = await getByTestId( 'add-block-button' );
95
+
96
+ // Long press the inserter button
97
+ fireEvent( addBlockButton, 'onLongPress' );
98
+
99
+ // Get Add Block Before option
100
+ const addBlockBeforeButton = await getByLabelText(
101
+ 'Add Block Before'
102
+ );
103
+ expect( addBlockBeforeButton ).toBeVisible();
104
+ fireEvent.press( addBlockBeforeButton );
105
+
106
+ // Add another block before the first one
107
+ await addBlock( screen, 'Heading', { isPickerOpened: true } );
108
+
109
+ expect( getEditorHtml() ).toMatchSnapshot();
110
+ } );
111
+
112
+ it( 'after another block', async () => {
113
+ const screen = await initializeEditor();
114
+ const { getByLabelText, getByTestId } = screen;
115
+
116
+ // Add Spacer block
117
+ await addBlock( screen, 'Spacer' );
118
+
119
+ // Add Heading block
120
+ await addBlock( screen, 'Heading' );
121
+
122
+ // Add Paragraph block
123
+ await addBlock( screen, 'Paragraph' );
124
+
125
+ // Get Heading block
126
+ const headingBlock = await getBlock( screen, 'Heading', {
127
+ rowIndex: 2,
128
+ } );
129
+ fireEvent.press( headingBlock );
130
+
131
+ // Get Inserter button
132
+ const addBlockButton = await getByTestId( 'add-block-button' );
133
+
134
+ // Long press the inserter button
135
+ fireEvent( addBlockButton, 'onLongPress' );
136
+
137
+ // Get Add Block After option
138
+ const addBlockAfterButton = await getByLabelText(
139
+ 'Add Block After'
140
+ );
141
+ expect( addBlockAfterButton ).toBeVisible();
142
+ fireEvent.press( addBlockAfterButton );
143
+
144
+ // Add another block after the Heading block
145
+ await addBlock( screen, 'More', { isPickerOpened: true } );
146
+
147
+ expect( getEditorHtml() ).toMatchSnapshot();
148
+ } );
149
+
150
+ it( 'to the end', async () => {
151
+ const screen = await initializeEditor();
152
+ const { getByLabelText, getByTestId } = screen;
153
+
154
+ // Add Spacer block
155
+ await addBlock( screen, 'Spacer' );
156
+
157
+ // Add Heading block
158
+ await addBlock( screen, 'Heading' );
159
+
160
+ // Add Paragraph block
161
+ await addBlock( screen, 'Paragraph' );
162
+
163
+ // Get Spacer block
164
+ const spacerBlock = await getBlock( screen, 'Spacer' );
165
+ fireEvent.press( spacerBlock );
166
+
167
+ // Get Inserter button
168
+ const addBlockButton = await getByTestId( 'add-block-button' );
169
+
170
+ // Long press the inserter button
171
+ fireEvent( addBlockButton, 'onLongPress' );
172
+
173
+ // Get Add To End option
174
+ const addBlockToEndButton = await getByLabelText( 'Add To End' );
175
+ expect( addBlockToEndButton ).toBeVisible();
176
+ fireEvent.press( addBlockToEndButton );
177
+
178
+ // Add another block to the end after the Paragraph Block
179
+ await addBlock( screen, 'More', { isPickerOpened: true } );
180
+
181
+ expect( getEditorHtml() ).toMatchSnapshot();
182
+ } );
183
+
184
+ it( 'adds new block at the end of post', async () => {
185
+ const screen = await initializeEditor();
186
+
187
+ // Add Spacer block
188
+ await addBlock( screen, 'Spacer' );
189
+
190
+ // Add Heading block
191
+ await addBlock( screen, 'Heading' );
192
+
193
+ // Get Heading block
194
+ const headingBlock = await getBlock( screen, 'Heading', {
195
+ rowIndex: 2,
196
+ } );
197
+ expect( headingBlock ).toBeVisible();
198
+
199
+ expect( getEditorHtml() ).toMatchSnapshot();
200
+ } );
201
+
202
+ it( 'inserts between 2 existing blocks', async () => {
203
+ const screen = await initializeEditor();
204
+
205
+ // Add Spacer block
206
+ await addBlock( screen, 'Spacer' );
207
+
208
+ // Add Heading block
209
+ await addBlock( screen, 'Heading' );
210
+
211
+ // Get Spacer block
212
+ const spacerBlock = await getBlock( screen, 'Spacer' );
213
+ fireEvent.press( spacerBlock );
214
+
215
+ // Add More block
216
+ await addBlock( screen, 'More' );
217
+
218
+ // Get More block
219
+ const moreBlock = await getBlock( screen, 'More', { rowIndex: 2 } );
220
+ expect( moreBlock ).toBeVisible();
221
+
222
+ expect( getEditorHtml() ).toMatchSnapshot();
223
+ } );
224
+
225
+ it( 'inserts block at the end of post when no block is selected', async () => {
226
+ const screen = await initializeEditor();
227
+ const { getAllByLabelText } = screen;
228
+
229
+ // Add Spacer block
230
+ await addBlock( screen, 'Spacer' );
231
+
232
+ // Add Heading block
233
+ await addBlock( screen, 'Heading' );
234
+
235
+ // Select the title
236
+ const titleInputElement = await getAllByLabelText(
237
+ 'Post title. test'
238
+ )[ 0 ];
239
+ expect( titleInputElement ).toBeVisible();
240
+ fireEvent.press( titleInputElement );
241
+
242
+ // Add More block
243
+ await addBlock( screen, 'More' );
244
+
245
+ // Get More block
246
+ const moreBlock = await getBlock( screen, 'More', { rowIndex: 3 } );
247
+ expect( moreBlock ).toBeVisible();
248
+
249
+ expect( getEditorHtml() ).toMatchSnapshot();
250
+ } );
251
+
252
+ it( 'creates a new Paragraph block tapping on the empty area below the last block', async () => {
253
+ const screen = await initializeEditor();
254
+ const { getByLabelText } = screen;
255
+
256
+ // Add Spacer block
257
+ await addBlock( screen, 'Spacer' );
258
+
259
+ // Add Heading block
260
+ await addBlock( screen, 'Heading' );
261
+
262
+ // Get the empty paragraph placeholder
263
+ const paragraphPlaceholder = await getByLabelText(
264
+ 'Add paragraph block'
265
+ );
266
+ fireEvent.press( paragraphPlaceholder );
267
+
268
+ // Get Paragraph block
269
+ const paragraphBlock = await getBlock( screen, 'Paragraph', {
270
+ rowIndex: 3,
271
+ } );
272
+ expect( paragraphBlock ).toBeVisible();
273
+
274
+ expect( getEditorHtml() ).toMatchSnapshot();
275
+ } );
276
+ } );
23
277
  } );
@@ -10,6 +10,7 @@ const InspectorControlsColor = createSlotFill( 'InspectorControlsColor' );
10
10
  const InspectorControlsDimensions = createSlotFill(
11
11
  'InspectorControlsDimensions'
12
12
  );
13
+ const InspectorControlsPosition = createSlotFill( 'InspectorControlsPosition' );
13
14
  const InspectorControlsTypography = createSlotFill(
14
15
  'InspectorControlsTypography'
15
16
  );
@@ -23,6 +24,7 @@ const groups = {
23
24
  dimensions: InspectorControlsDimensions,
24
25
  list: InspectorControlsListView,
25
26
  typography: InspectorControlsTypography,
27
+ position: InspectorControlsPosition,
26
28
  };
27
29
 
28
30
  export default groups;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ PanelBody,
6
+ __experimentalUseSlotFills as useSlotFills,
7
+ } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import InspectorControlsGroups from '../inspector-controls/groups';
14
+ import { default as InspectorControls } from '../inspector-controls';
15
+
16
+ const PositionControls = () => {
17
+ const fills = useSlotFills(
18
+ InspectorControlsGroups.position.Slot.__unstableName
19
+ );
20
+ const hasFills = Boolean( fills && fills.length );
21
+
22
+ if ( ! hasFills ) {
23
+ return null;
24
+ }
25
+
26
+ return (
27
+ <PanelBody
28
+ className="block-editor-block-inspector__position"
29
+ title={ __( 'Position' ) }
30
+ initialOpen={ false }
31
+ >
32
+ <InspectorControls.Slot __experimentalGroup="position" />
33
+ </PanelBody>
34
+ );
35
+ };
36
+
37
+ export default PositionControls;
@@ -2,11 +2,13 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import AdvancedControls from './advanced-controls-panel';
5
+ import PositionControls from './position-controls-panel';
5
6
  import { default as InspectorControls } from '../inspector-controls';
6
7
 
7
8
  const SettingsTab = ( { showAdvancedControls = false } ) => (
8
9
  <>
9
10
  <InspectorControls.Slot />
11
+ <PositionControls />
10
12
  { showAdvancedControls && (
11
13
  <div>
12
14
  <AdvancedControls />
@@ -0,0 +1,15 @@
1
+ .show-icon-labels {
2
+ .block-editor-block-inspector__tabs .components-tab-panel__tabs {
3
+ .components-button.has-icon {
4
+ // Hide the button icons when labels are set to display...
5
+ svg {
6
+ display: none;
7
+ }
8
+ // ... and display labels.
9
+ // Uses ::before as ::after is already used for active tab styling.
10
+ &::before {
11
+ content: attr(aria-label);
12
+ }
13
+ }
14
+ }
15
+ }
@@ -16,12 +16,6 @@ import { store as blockEditorStore } from '../../store';
16
16
  const EMPTY_ARRAY = [];
17
17
 
18
18
  function getShowTabs( blockName, tabSettings = {} ) {
19
- // Don't allow settings to force the display of tabs if the block inspector
20
- // tabs experiment hasn't been opted into.
21
- if ( ! window?.__experimentalEnableBlockInspectorTabs ) {
22
- return false;
23
- }
24
-
25
19
  // Block specific setting takes precedence over generic default.
26
20
  if ( tabSettings[ blockName ] !== undefined ) {
27
21
  return tabSettings[ blockName ];
@@ -43,6 +37,7 @@ export default function useInspectorControlsTabs( blockName ) {
43
37
  default: defaultGroup,
44
38
  dimensions: dimensionsGroup,
45
39
  list: listGroup,
40
+ position: positionGroup,
46
41
  typography: typographyGroup,
47
42
  } = InspectorControlsGroups;
48
43
 
@@ -71,6 +66,7 @@ export default function useInspectorControlsTabs( blockName ) {
71
66
  // or Advanced Controls slot, then add this tab.
72
67
  const settingsFills = [
73
68
  ...( useSlotFills( defaultGroup.Slot.__unstableName ) || [] ),
69
+ ...( useSlotFills( positionGroup.Slot.__unstableName ) || [] ),
74
70
  ...( useSlotFills( InspectorAdvancedControls.slotName ) || [] ),
75
71
  ];
76
72
 
@@ -79,8 +75,7 @@ export default function useInspectorControlsTabs( blockName ) {
79
75
  }
80
76
 
81
77
  const tabSettings = useSelect( ( select ) => {
82
- return select( blockEditorStore ).getSettings()
83
- .__experimentalBlockInspectorTabs;
78
+ return select( blockEditorStore ).getSettings().blockInspectorTabs;
84
79
  }, [] );
85
80
 
86
81
  const showTabs = getShowTabs( blockName, tabSettings );
@@ -126,6 +126,7 @@ const LinkControlSearchInput = forwardRef(
126
126
  return (
127
127
  <div className="block-editor-link-control__search-input-container">
128
128
  <URLInput
129
+ __nextHasNoMarginBottom
129
130
  label={ useLabel ? 'URL' : undefined }
130
131
  className={ inputClasses }
131
132
  value={ value }
@@ -55,6 +55,7 @@ $preview-image-height: 140px;
55
55
  .components-base-control__label {
56
56
  margin-right: $grid-unit-20;
57
57
  margin-bottom: 0;
58
+ min-width: 29px; // align with search results.
58
59
  }
59
60
 
60
61
  input[type="text"],
@@ -376,9 +376,15 @@ describe( 'Searching for a link', () => {
376
376
  const searchResults = await screen.findByRole( 'listbox', {
377
377
  name: /Search results for.*/,
378
378
  } );
379
- const searchResultTextHighlightElements = Array.from(
380
- searchResults.querySelectorAll( 'button[role="option"] mark' )
381
- );
379
+
380
+ const searchResultTextHighlightElements = within( searchResults )
381
+ .getAllByRole( 'option' )
382
+ // TODO: Change to `getByRole( 'mark' )` when officially supported by
383
+ // WAI-ARIA 1.3 - see https://w3c.github.io/aria/#mark
384
+ // eslint-disable-next-line testing-library/no-node-access
385
+ .map( ( searchResult ) => searchResult.querySelector( 'mark' ) )
386
+ .flat()
387
+ .filter( Boolean );
382
388
 
383
389
  // Given we're mocking out the results we should always have 4 mark elements.
384
390
  expect( searchResultTextHighlightElements ).toHaveLength( 4 );
@@ -1092,6 +1098,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
1092
1098
 
1093
1099
  // Check human readable error notice is perceivable.
1094
1100
  expect( errorNotice ).toBeVisible();
1101
+ // eslint-disable-next-line testing-library/no-node-access
1095
1102
  expect( errorNotice.parentElement ).toHaveClass(
1096
1103
  'block-editor-link-control__search-error'
1097
1104
  );
@@ -1324,7 +1331,8 @@ describe( 'Selecting links', () => {
1324
1331
  } );
1325
1332
 
1326
1333
  // Make sure focus is retained after submission.
1327
- expect( container ).toContainElement( document.activeElement );
1334
+ // eslint-disable-next-line testing-library/no-node-access
1335
+ expect( container.firstChild ).toHaveFocus();
1328
1336
 
1329
1337
  expect( currentLink ).toBeVisible();
1330
1338
  expect(
@@ -1594,11 +1602,13 @@ describe( 'Rich link previews', () => {
1594
1602
  await waitFor( () => expect( linkPreview ).toHaveClass( 'is-rich' ) );
1595
1603
 
1596
1604
  // Todo: refactor to use user-facing queries.
1605
+ // eslint-disable-next-line testing-library/no-node-access
1597
1606
  const hasRichImagePreview = linkPreview.querySelector(
1598
1607
  '.block-editor-link-control__search-item-image'
1599
1608
  );
1600
1609
 
1601
1610
  // Todo: refactor to use user-facing queries.
1611
+ // eslint-disable-next-line testing-library/no-node-access
1602
1612
  const hasRichDescriptionPreview = linkPreview.querySelector(
1603
1613
  '.block-editor-link-control__search-item-description'
1604
1614
  );
@@ -1646,11 +1656,14 @@ describe( 'Rich link previews', () => {
1646
1656
 
1647
1657
  await waitFor( () => expect( linkPreview ).toHaveClass( 'is-rich' ) );
1648
1658
 
1659
+ // eslint-disable-next-line testing-library/no-node-access
1649
1660
  const iconPreview = linkPreview.querySelector(
1650
1661
  `.block-editor-link-control__search-item-icon`
1651
1662
  );
1652
1663
 
1664
+ // eslint-disable-next-line testing-library/no-node-access
1653
1665
  const fallBackIcon = iconPreview.querySelector( 'svg' );
1666
+ // eslint-disable-next-line testing-library/no-node-access
1654
1667
  const richIcon = iconPreview.querySelector( 'img' );
1655
1668
 
1656
1669
  expect( fallBackIcon ).toBeVisible();
@@ -1680,6 +1693,7 @@ describe( 'Rich link previews', () => {
1680
1693
  expect( linkPreview ).toHaveClass( 'is-rich' )
1681
1694
  );
1682
1695
 
1696
+ // eslint-disable-next-line testing-library/no-node-access
1683
1697
  const missingDataItem = linkPreview.querySelector(
1684
1698
  `.block-editor-link-control__search-item-${ dataItem }`
1685
1699
  );
@@ -12,7 +12,7 @@ import {
12
12
  __experimentalTruncate as Truncate,
13
13
  } from '@wordpress/components';
14
14
  import { forwardRef } from '@wordpress/element';
15
- import { Icon, lock } from '@wordpress/icons';
15
+ import { Icon, lockSmall as lock } from '@wordpress/icons';
16
16
  import { SPACE, ENTER } from '@wordpress/keycodes';
17
17
 
18
18
  /**
@@ -22,8 +22,18 @@
22
22
  &.is-selected.is-synced td {
23
23
  background: var(--wp-block-synced-color);
24
24
  }
25
- &.is-synced:not(.is-selected) .block-editor-list-view-block-contents .block-editor-block-icon {
26
- color: var(--wp-block-synced-color);
25
+ &.is-synced:not(.is-selected) .block-editor-list-view-block-contents {
26
+ &:hover,
27
+ &:focus,
28
+ .block-editor-block-icon {
29
+ color: var(--wp-block-synced-color);
30
+ }
31
+
32
+ &:focus::after {
33
+ box-shadow:
34
+ inset 0 0 0 1px $white,
35
+ 0 0 0 var(--wp-admin-border-width-focus) var(--wp-block-synced-color);
36
+ }
27
37
  }
28
38
  &.is-selected .block-editor-list-view-block-contents,
29
39
  &.is-selected .components-button.has-icon {
@@ -74,7 +84,7 @@
74
84
  &.is-branch-selected:not(.is-selected):not(.is-synced-branch) {
75
85
  background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
76
86
  }
77
- &.is-synced-branch:not(.is-selected) {
87
+ &.is-synced-branch.is-branch-selected {
78
88
  background: rgba(var(--wp-block-synced-color--rgb), 0.04);
79
89
  }
80
90
  &.is-branch-selected.is-first-selected td:first-child {
@@ -176,9 +186,8 @@
176
186
  }
177
187
 
178
188
  .block-editor-block-icon {
179
- align-self: flex-start;
180
189
  margin-right: $grid-unit-10;
181
- width: $icon-size;
190
+ flex: 0 0 $icon-size;
182
191
  }
183
192
 
184
193
  .block-editor-list-view-block__menu-cell,
@@ -319,11 +328,6 @@
319
328
 
320
329
  .block-editor-list-view-block-select-button__lock {
321
330
  line-height: 0;
322
- width: 24px;
323
- min-width: 24px;
324
- margin-left: auto;
325
- padding: 0;
326
- vertical-align: middle;
327
331
  }
328
332
  }
329
333