@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.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 (453) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +33 -3
  3. package/build/components/block-canvas/index.js +107 -0
  4. package/build/components/block-canvas/index.js.map +1 -0
  5. package/build/components/block-inspector/index.js +4 -1
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-patterns-list/index.js +19 -4
  8. package/build/components/block-patterns-list/index.js.map +1 -1
  9. package/build/components/block-patterns-paging/index.js +66 -0
  10. package/build/components/block-patterns-paging/index.js.map +1 -0
  11. package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
  12. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  13. package/build/components/block-settings-menu-controls/index.js +4 -7
  14. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  15. package/build/components/block-styles/index.js +1 -0
  16. package/build/components/block-styles/index.js.map +1 -1
  17. package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  18. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  19. package/build/components/block-tools/block-contextual-toolbar.js +18 -7
  20. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  21. package/build/components/block-tools/block-selection-button.js +5 -1
  22. package/build/components/block-tools/block-selection-button.js.map +1 -1
  23. package/build/components/border-radius-control/input-controls.js +1 -1
  24. package/build/components/border-radius-control/input-controls.js.map +1 -1
  25. package/build/components/border-radius-control/linked-button.js +2 -4
  26. package/build/components/border-radius-control/linked-button.js.map +1 -1
  27. package/build/components/colors/with-colors.js.map +1 -1
  28. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  29. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  30. package/build/components/default-block-appender/index.native.js +20 -1
  31. package/build/components/default-block-appender/index.native.js.map +1 -1
  32. package/build/components/duotone/utils.js +68 -0
  33. package/build/components/duotone/utils.js.map +1 -1
  34. package/build/components/editor-styles/index.js +28 -9
  35. package/build/components/editor-styles/index.js.map +1 -1
  36. package/build/components/global-styles/hooks.js +2 -101
  37. package/build/components/global-styles/hooks.js.map +1 -1
  38. package/build/components/global-styles/image-settings-panel.js +61 -0
  39. package/build/components/global-styles/image-settings-panel.js.map +1 -0
  40. package/build/components/global-styles/index.js +11 -17
  41. package/build/components/global-styles/index.js.map +1 -1
  42. package/build/components/global-styles/use-global-styles-output.js +19 -15
  43. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  44. package/build/components/global-styles/utils.js +1 -1
  45. package/build/components/global-styles/utils.js.map +1 -1
  46. package/build/components/iframe/index.js +67 -33
  47. package/build/components/iframe/index.js.map +1 -1
  48. package/build/components/image-editor/use-save-image.js +2 -5
  49. package/build/components/image-editor/use-save-image.js.map +1 -1
  50. package/build/components/image-editor/use-transform-image.js +9 -9
  51. package/build/components/image-editor/use-transform-image.js.map +1 -1
  52. package/build/components/index.js +8 -12
  53. package/build/components/index.js.map +1 -1
  54. package/build/components/index.native.js +6 -5
  55. package/build/components/index.native.js.map +1 -1
  56. package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
  57. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  58. package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
  59. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  60. package/build/components/inserter/block-patterns-explorer/patterns-list.js +57 -23
  61. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  62. package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
  63. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  64. package/build/components/inserter/block-patterns-source-filter.js +54 -0
  65. package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
  66. package/build/components/inserter/block-patterns-sync-filter.js +46 -0
  67. package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
  68. package/build/components/inserter/block-patterns-tab.js +91 -45
  69. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  70. package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
  71. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  72. package/build/components/inserter/hooks/use-patterns-state.js +21 -10
  73. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  74. package/build/components/inserter/menu.js +13 -11
  75. package/build/components/inserter/menu.js.map +1 -1
  76. package/build/components/inserter/search-results.js +4 -3
  77. package/build/components/inserter/search-results.js.map +1 -1
  78. package/build/components/inserter/tabs.js +1 -12
  79. package/build/components/inserter/tabs.js.map +1 -1
  80. package/build/components/inspector-controls/block-support-slot-container.js +12 -1
  81. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  82. package/build/components/inspector-controls/fill.js +24 -13
  83. package/build/components/inspector-controls/fill.js.map +1 -1
  84. package/build/components/inspector-controls/groups.js +5 -3
  85. package/build/components/inspector-controls/groups.js.map +1 -1
  86. package/build/components/inspector-controls/slot.js +13 -0
  87. package/build/components/inspector-controls/slot.js.map +1 -1
  88. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  89. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  90. package/build/components/link-control/index.js +12 -2
  91. package/build/components/link-control/index.js.map +1 -1
  92. package/build/components/list-view/block-select-button.js +1 -3
  93. package/build/components/list-view/block-select-button.js.map +1 -1
  94. package/build/components/list-view/block.js +13 -1
  95. package/build/components/list-view/block.js.map +1 -1
  96. package/build/components/list-view/use-block-selection.js +29 -24
  97. package/build/components/list-view/use-block-selection.js.map +1 -1
  98. package/build/components/media-placeholder/index.js +2 -2
  99. package/build/components/media-placeholder/index.js.map +1 -1
  100. package/build/components/media-placeholder/index.native.js +11 -11
  101. package/build/components/media-placeholder/index.native.js.map +1 -1
  102. package/build/components/media-replace-flow/index.js +2 -3
  103. package/build/components/media-replace-flow/index.js.map +1 -1
  104. package/build/components/media-upload/constants.js +30 -0
  105. package/build/components/media-upload/constants.js.map +1 -0
  106. package/build/components/media-upload/index.native.js +63 -53
  107. package/build/components/media-upload/index.native.js.map +1 -1
  108. package/build/components/preview-options/index.js +1 -1
  109. package/build/components/preview-options/index.js.map +1 -1
  110. package/build/components/rich-text/index.js +34 -35
  111. package/build/components/rich-text/index.js.map +1 -1
  112. package/build/components/rich-text/index.native.js +14 -32
  113. package/build/components/rich-text/index.native.js.map +1 -1
  114. package/build/components/rich-text/multiline.js +95 -0
  115. package/build/components/rich-text/multiline.js.map +1 -0
  116. package/build/components/rich-text/split-value.js +10 -16
  117. package/build/components/rich-text/split-value.js.map +1 -1
  118. package/build/components/rich-text/use-enter.js +31 -40
  119. package/build/components/rich-text/use-enter.js.map +1 -1
  120. package/build/components/rich-text/use-paste-handler.js +18 -33
  121. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  122. package/build/components/spacing-sizes-control/utils.js +1 -1
  123. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  124. package/build/components/use-block-commands/index.js +30 -18
  125. package/build/components/use-block-commands/index.js.map +1 -1
  126. package/build/components/use-block-display-information/index.js +5 -2
  127. package/build/components/use-block-display-information/index.js.map +1 -1
  128. package/build/hooks/background.js +258 -0
  129. package/build/hooks/background.js.map +1 -0
  130. package/build/hooks/block-hooks.js +188 -0
  131. package/build/hooks/block-hooks.js.map +1 -0
  132. package/build/hooks/block-rename-ui.js +160 -0
  133. package/build/hooks/block-rename-ui.js.map +1 -0
  134. package/build/hooks/duotone.js +29 -42
  135. package/build/hooks/duotone.js.map +1 -1
  136. package/build/hooks/index.js +2 -2
  137. package/build/hooks/index.js.map +1 -1
  138. package/build/hooks/layout.js +31 -14
  139. package/build/hooks/layout.js.map +1 -1
  140. package/build/hooks/position.js +4 -2
  141. package/build/hooks/position.js.map +1 -1
  142. package/build/hooks/style.js +10 -3
  143. package/build/hooks/style.js.map +1 -1
  144. package/build/private-apis.js +2 -0
  145. package/build/private-apis.js.map +1 -1
  146. package/build/store/actions.js +33 -10
  147. package/build/store/actions.js.map +1 -1
  148. package/build/store/private-actions.js +42 -8
  149. package/build/store/private-actions.js.map +1 -1
  150. package/build/store/private-selectors.js +23 -0
  151. package/build/store/private-selectors.js.map +1 -1
  152. package/build/store/reducer.js +43 -1
  153. package/build/store/reducer.js.map +1 -1
  154. package/build/store/selectors.js +84 -23
  155. package/build/store/selectors.js.map +1 -1
  156. package/build/store/utils.js +0 -4
  157. package/build/store/utils.js.map +1 -1
  158. package/build-module/components/block-canvas/index.js +97 -0
  159. package/build-module/components/block-canvas/index.js.map +1 -0
  160. package/build-module/components/block-inspector/index.js +4 -1
  161. package/build-module/components/block-inspector/index.js.map +1 -1
  162. package/build-module/components/block-patterns-list/index.js +20 -5
  163. package/build-module/components/block-patterns-list/index.js.map +1 -1
  164. package/build-module/components/block-patterns-paging/index.js +59 -0
  165. package/build-module/components/block-patterns-paging/index.js.map +1 -0
  166. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
  167. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  168. package/build-module/components/block-settings-menu-controls/index.js +4 -7
  169. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  170. package/build-module/components/block-styles/index.js +1 -0
  171. package/build-module/components/block-styles/index.js.map +1 -1
  172. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  173. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  174. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
  175. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  176. package/build-module/components/block-tools/block-selection-button.js +5 -1
  177. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  178. package/build-module/components/border-radius-control/input-controls.js +1 -1
  179. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  180. package/build-module/components/border-radius-control/linked-button.js +2 -4
  181. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  182. package/build-module/components/colors/with-colors.js.map +1 -1
  183. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  184. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  185. package/build-module/components/default-block-appender/index.native.js +20 -1
  186. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  187. package/build-module/components/duotone/utils.js +65 -0
  188. package/build-module/components/duotone/utils.js.map +1 -1
  189. package/build-module/components/editor-styles/index.js +28 -9
  190. package/build-module/components/editor-styles/index.js.map +1 -1
  191. package/build-module/components/global-styles/hooks.js +3 -100
  192. package/build-module/components/global-styles/hooks.js.map +1 -1
  193. package/build-module/components/global-styles/image-settings-panel.js +53 -0
  194. package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
  195. package/build-module/components/global-styles/index.js +2 -2
  196. package/build-module/components/global-styles/index.js.map +1 -1
  197. package/build-module/components/global-styles/use-global-styles-output.js +18 -16
  198. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  199. package/build-module/components/global-styles/utils.js +1 -1
  200. package/build-module/components/global-styles/utils.js.map +1 -1
  201. package/build-module/components/iframe/index.js +66 -33
  202. package/build-module/components/iframe/index.js.map +1 -1
  203. package/build-module/components/image-editor/use-save-image.js +2 -5
  204. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  205. package/build-module/components/image-editor/use-transform-image.js +9 -9
  206. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  207. package/build-module/components/index.js +1 -1
  208. package/build-module/components/index.js.map +1 -1
  209. package/build-module/components/index.native.js +2 -1
  210. package/build-module/components/index.native.js.map +1 -1
  211. package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
  212. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  213. package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
  214. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
  216. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  217. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
  218. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  219. package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
  220. package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
  221. package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
  222. package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
  223. package/build-module/components/inserter/block-patterns-tab.js +87 -46
  224. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  225. package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
  226. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  227. package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
  228. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  229. package/build-module/components/inserter/menu.js +13 -11
  230. package/build-module/components/inserter/menu.js.map +1 -1
  231. package/build-module/components/inserter/search-results.js +4 -3
  232. package/build-module/components/inserter/search-results.js.map +1 -1
  233. package/build-module/components/inserter/tabs.js +1 -12
  234. package/build-module/components/inserter/tabs.js.map +1 -1
  235. package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
  236. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  237. package/build-module/components/inspector-controls/fill.js +25 -14
  238. package/build-module/components/inspector-controls/fill.js.map +1 -1
  239. package/build-module/components/inspector-controls/groups.js +5 -3
  240. package/build-module/components/inspector-controls/groups.js.map +1 -1
  241. package/build-module/components/inspector-controls/slot.js +15 -1
  242. package/build-module/components/inspector-controls/slot.js.map +1 -1
  243. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  244. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  245. package/build-module/components/link-control/index.js +12 -2
  246. package/build-module/components/link-control/index.js.map +1 -1
  247. package/build-module/components/list-view/block-select-button.js +1 -3
  248. package/build-module/components/list-view/block-select-button.js.map +1 -1
  249. package/build-module/components/list-view/block.js +13 -1
  250. package/build-module/components/list-view/block.js.map +1 -1
  251. package/build-module/components/list-view/use-block-selection.js +30 -25
  252. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  253. package/build-module/components/media-placeholder/index.js +2 -2
  254. package/build-module/components/media-placeholder/index.js.map +1 -1
  255. package/build-module/components/media-placeholder/index.native.js +7 -7
  256. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  257. package/build-module/components/media-replace-flow/index.js +2 -3
  258. package/build-module/components/media-replace-flow/index.js.map +1 -1
  259. package/build-module/components/media-upload/constants.js +14 -0
  260. package/build-module/components/media-upload/constants.js.map +1 -0
  261. package/build-module/components/media-upload/index.native.js +53 -34
  262. package/build-module/components/media-upload/index.native.js.map +1 -1
  263. package/build-module/components/preview-options/index.js +1 -1
  264. package/build-module/components/preview-options/index.js.map +1 -1
  265. package/build-module/components/rich-text/index.js +35 -37
  266. package/build-module/components/rich-text/index.js.map +1 -1
  267. package/build-module/components/rich-text/index.native.js +15 -33
  268. package/build-module/components/rich-text/index.native.js.map +1 -1
  269. package/build-module/components/rich-text/multiline.js +87 -0
  270. package/build-module/components/rich-text/multiline.js.map +1 -0
  271. package/build-module/components/rich-text/split-value.js +10 -16
  272. package/build-module/components/rich-text/split-value.js.map +1 -1
  273. package/build-module/components/rich-text/use-enter.js +33 -42
  274. package/build-module/components/rich-text/use-enter.js.map +1 -1
  275. package/build-module/components/rich-text/use-paste-handler.js +19 -34
  276. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  277. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  278. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  279. package/build-module/components/use-block-commands/index.js +28 -16
  280. package/build-module/components/use-block-commands/index.js.map +1 -1
  281. package/build-module/components/use-block-display-information/index.js +5 -2
  282. package/build-module/components/use-block-display-information/index.js.map +1 -1
  283. package/build-module/hooks/background.js +244 -0
  284. package/build-module/hooks/background.js.map +1 -0
  285. package/build-module/hooks/block-hooks.js +181 -0
  286. package/build-module/hooks/block-hooks.js.map +1 -0
  287. package/build-module/hooks/block-rename-ui.js +153 -0
  288. package/build-module/hooks/block-rename-ui.js.map +1 -0
  289. package/build-module/hooks/duotone.js +26 -39
  290. package/build-module/hooks/duotone.js.map +1 -1
  291. package/build-module/hooks/index.js +2 -2
  292. package/build-module/hooks/index.js.map +1 -1
  293. package/build-module/hooks/layout.js +33 -16
  294. package/build-module/hooks/layout.js.map +1 -1
  295. package/build-module/hooks/position.js +4 -2
  296. package/build-module/hooks/position.js.map +1 -1
  297. package/build-module/hooks/style.js +10 -3
  298. package/build-module/hooks/style.js.map +1 -1
  299. package/build-module/private-apis.js +2 -0
  300. package/build-module/private-apis.js.map +1 -1
  301. package/build-module/store/actions.js +33 -10
  302. package/build-module/store/actions.js.map +1 -1
  303. package/build-module/store/private-actions.js +39 -8
  304. package/build-module/store/private-actions.js.map +1 -1
  305. package/build-module/store/private-selectors.js +21 -0
  306. package/build-module/store/private-selectors.js.map +1 -1
  307. package/build-module/store/reducer.js +41 -1
  308. package/build-module/store/reducer.js.map +1 -1
  309. package/build-module/store/selectors.js +78 -22
  310. package/build-module/store/selectors.js.map +1 -1
  311. package/build-module/store/utils.js +0 -4
  312. package/build-module/store/utils.js.map +1 -1
  313. package/build-style/content-rtl.css +0 -1
  314. package/build-style/content.css +0 -1
  315. package/build-style/style-rtl.css +170 -127
  316. package/build-style/style.css +170 -127
  317. package/package.json +32 -32
  318. package/src/components/block-canvas/index.js +108 -0
  319. package/src/components/block-inspector/index.js +5 -1
  320. package/src/components/block-list/content.scss +0 -1
  321. package/src/components/block-patterns-list/index.js +32 -7
  322. package/src/components/block-patterns-list/style.scss +26 -9
  323. package/src/components/block-patterns-paging/index.js +92 -0
  324. package/src/components/block-patterns-paging/style.scss +42 -0
  325. package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
  326. package/src/components/block-settings-menu-controls/index.js +4 -9
  327. package/src/components/block-styles/index.js +1 -0
  328. package/src/components/block-styles/style.scss +3 -3
  329. package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
  330. package/src/components/block-tools/block-contextual-toolbar.js +16 -5
  331. package/src/components/block-tools/block-selection-button.js +9 -1
  332. package/src/components/block-tools/style.scss +0 -98
  333. package/src/components/border-radius-control/input-controls.js +1 -1
  334. package/src/components/border-radius-control/linked-button.js +8 -11
  335. package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
  336. package/src/components/colors/with-colors.js +3 -2
  337. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
  338. package/src/components/default-block-appender/index.native.js +26 -3
  339. package/src/components/duotone/utils.js +65 -0
  340. package/src/components/editor-styles/index.js +32 -23
  341. package/src/components/global-styles/hooks.js +4 -112
  342. package/src/components/global-styles/image-settings-panel.js +71 -0
  343. package/src/components/global-styles/index.js +4 -3
  344. package/src/components/global-styles/use-global-styles-output.js +25 -16
  345. package/src/components/global-styles/utils.js +1 -2
  346. package/src/components/iframe/index.js +72 -33
  347. package/src/components/image-editor/use-save-image.js +2 -9
  348. package/src/components/image-editor/use-transform-image.js +9 -9
  349. package/src/components/index.js +1 -1
  350. package/src/components/index.native.js +2 -2
  351. package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
  352. package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
  353. package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
  354. package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
  355. package/src/components/inserter/block-patterns-source-filter.js +40 -0
  356. package/src/components/inserter/block-patterns-sync-filter.js +35 -0
  357. package/src/components/inserter/block-patterns-tab.js +168 -57
  358. package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
  359. package/src/components/inserter/hooks/use-patterns-state.js +27 -16
  360. package/src/components/inserter/menu.js +15 -17
  361. package/src/components/inserter/search-results.js +6 -4
  362. package/src/components/inserter/style.scss +23 -2
  363. package/src/components/inserter/tabs.js +2 -12
  364. package/src/components/inserter/test/index.native.js +8 -12
  365. package/src/components/inspector-controls/block-support-slot-container.js +19 -3
  366. package/src/components/inspector-controls/fill.js +28 -14
  367. package/src/components/inspector-controls/groups.js +6 -2
  368. package/src/components/inspector-controls/slot.js +28 -3
  369. package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
  370. package/src/components/link-control/index.js +13 -0
  371. package/src/components/link-control/style.scss +23 -2
  372. package/src/components/link-control/test/index.js +88 -6
  373. package/src/components/list-view/block-select-button.js +1 -3
  374. package/src/components/list-view/block.js +19 -1
  375. package/src/components/list-view/style.scss +1 -2
  376. package/src/components/list-view/use-block-selection.js +38 -32
  377. package/src/components/media-placeholder/README.md +2 -2
  378. package/src/components/media-placeholder/index.js +2 -2
  379. package/src/components/media-placeholder/index.native.js +11 -12
  380. package/src/components/media-replace-flow/index.js +2 -2
  381. package/src/components/media-replace-flow/test/index.js +5 -23
  382. package/src/components/media-upload/README.md +3 -2
  383. package/src/components/media-upload/constants.js +15 -0
  384. package/src/components/media-upload/index.native.js +66 -40
  385. package/src/components/media-upload/style.native.scss +4 -0
  386. package/src/components/media-upload/test/index.native.js +2 -2
  387. package/src/components/preview-options/README.md +7 -0
  388. package/src/components/preview-options/index.js +1 -1
  389. package/src/components/rich-text/index.js +48 -44
  390. package/src/components/rich-text/index.native.js +14 -42
  391. package/src/components/rich-text/multiline.js +121 -0
  392. package/src/components/rich-text/split-value.js +10 -35
  393. package/src/components/rich-text/use-enter.js +32 -42
  394. package/src/components/rich-text/use-paste-handler.js +16 -40
  395. package/src/components/spacing-sizes-control/style.scss +5 -7
  396. package/src/components/spacing-sizes-control/utils.js +1 -2
  397. package/src/components/use-block-commands/index.js +28 -20
  398. package/src/components/use-block-display-information/index.js +3 -0
  399. package/src/hooks/background.js +288 -0
  400. package/src/hooks/background.scss +57 -0
  401. package/src/hooks/block-hooks.js +257 -0
  402. package/src/hooks/block-hooks.scss +16 -0
  403. package/src/hooks/block-rename-ui.js +230 -0
  404. package/src/hooks/block-rename-ui.scss +3 -0
  405. package/src/hooks/duotone.js +42 -43
  406. package/src/hooks/index.js +2 -2
  407. package/src/hooks/layout.js +31 -33
  408. package/src/hooks/position.js +4 -3
  409. package/src/hooks/style.js +11 -2
  410. package/src/hooks/test/align.native.js +4 -3
  411. package/src/private-apis.js +2 -0
  412. package/src/store/actions.js +52 -10
  413. package/src/store/private-actions.js +37 -6
  414. package/src/store/private-selectors.js +21 -0
  415. package/src/store/reducer.js +38 -0
  416. package/src/store/selectors.js +107 -26
  417. package/src/store/test/actions.js +19 -8
  418. package/src/store/test/private-actions.js +17 -0
  419. package/src/store/test/reducer.js +25 -0
  420. package/src/store/test/selectors.js +130 -123
  421. package/src/store/utils.js +3 -10
  422. package/src/style.scss +4 -0
  423. package/build/components/duotone/components.js +0 -135
  424. package/build/components/duotone/components.js.map +0 -1
  425. package/build/components/duotone/index.js +0 -38
  426. package/build/components/duotone/index.js.map +0 -1
  427. package/build/components/global-styles/behaviors-panel.js +0 -64
  428. package/build/components/global-styles/behaviors-panel.js.map +0 -1
  429. package/build/components/inserter/reusable-blocks-tab.js +0 -85
  430. package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
  431. package/build/hooks/auto-inserting-blocks.js +0 -174
  432. package/build/hooks/auto-inserting-blocks.js.map +0 -1
  433. package/build/hooks/behaviors.js +0 -173
  434. package/build/hooks/behaviors.js.map +0 -1
  435. package/build-module/components/duotone/components.js +0 -126
  436. package/build-module/components/duotone/components.js.map +0 -1
  437. package/build-module/components/duotone/index.js +0 -3
  438. package/build-module/components/duotone/index.js.map +0 -1
  439. package/build-module/components/global-styles/behaviors-panel.js +0 -57
  440. package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
  441. package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
  442. package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
  443. package/build-module/hooks/auto-inserting-blocks.js +0 -167
  444. package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
  445. package/build-module/hooks/behaviors.js +0 -166
  446. package/build-module/hooks/behaviors.js.map +0 -1
  447. package/src/components/duotone/components.js +0 -133
  448. package/src/components/duotone/index.js +0 -7
  449. package/src/components/global-styles/behaviors-panel.js +0 -71
  450. package/src/components/inserter/reusable-blocks-tab.js +0 -84
  451. package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
  452. package/src/hooks/auto-inserting-blocks.js +0 -232
  453. package/src/hooks/behaviors.js +0 -206
@@ -0,0 +1,288 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { isBlobURL } from '@wordpress/blob';
5
+ import { getBlockSupport } from '@wordpress/blocks';
6
+ import {
7
+ __experimentalToolsPanelItem as ToolsPanelItem,
8
+ Button,
9
+ DropZone,
10
+ FlexItem,
11
+ MenuItem,
12
+ __experimentalItemGroup as ItemGroup,
13
+ __experimentalHStack as HStack,
14
+ __experimentalTruncate as Truncate,
15
+ } from '@wordpress/components';
16
+ import { useDispatch, useSelect } from '@wordpress/data';
17
+ import { Platform, useCallback } from '@wordpress/element';
18
+ import { __ } from '@wordpress/i18n';
19
+ import { store as noticesStore } from '@wordpress/notices';
20
+ import { getFilename } from '@wordpress/url';
21
+
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+ import InspectorControls from '../components/inspector-controls';
26
+ import MediaReplaceFlow from '../components/media-replace-flow';
27
+ import MediaUpload from '../components/media-upload';
28
+ import MediaUploadCheck from '../components/media-upload/check';
29
+ import useSetting from '../components/use-setting';
30
+ import { cleanEmptyObject } from './utils';
31
+ import { store as blockEditorStore } from '../store';
32
+
33
+ export const BACKGROUND_SUPPORT_KEY = 'background';
34
+ export const IMAGE_BACKGROUND_TYPE = 'image';
35
+
36
+ /**
37
+ * Checks if there is a current value in the background image block support
38
+ * attributes.
39
+ *
40
+ * @param {Object} props Block props.
41
+ * @return {boolean} Whether or not the block has a background image value set.
42
+ */
43
+ export function hasBackgroundImageValue( props ) {
44
+ const hasValue =
45
+ !! props.attributes.style?.background?.backgroundImage?.id ||
46
+ !! props.attributes.style?.background?.backgroundImage?.url;
47
+
48
+ return hasValue;
49
+ }
50
+
51
+ /**
52
+ * Determine whether there is block support for background.
53
+ *
54
+ * @param {string} blockName Block name.
55
+ * @param {string} feature Background image feature to check for.
56
+ *
57
+ * @return {boolean} Whether there is support.
58
+ */
59
+ export function hasBackgroundSupport( blockName, feature = 'any' ) {
60
+ if ( Platform.OS !== 'web' ) {
61
+ return false;
62
+ }
63
+
64
+ const support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );
65
+
66
+ if ( support === true ) {
67
+ return true;
68
+ }
69
+
70
+ if ( feature === 'any' ) {
71
+ return !! support?.backgroundImage;
72
+ }
73
+
74
+ return !! support?.[ feature ];
75
+ }
76
+
77
+ /**
78
+ * Resets the background image block support attributes. This can be used when disabling
79
+ * the background image controls for a block via a `ToolsPanel`.
80
+ *
81
+ * @param {Object} props Block props.
82
+ * @param {Object} props.attributes Block's attributes.
83
+ * @param {Object} props.setAttributes Function to set block's attributes.
84
+ */
85
+ export function resetBackgroundImage( { attributes = {}, setAttributes } ) {
86
+ const { style = {} } = attributes;
87
+
88
+ setAttributes( {
89
+ style: cleanEmptyObject( {
90
+ ...style,
91
+ background: {
92
+ ...style?.background,
93
+ backgroundImage: undefined,
94
+ },
95
+ } ),
96
+ } );
97
+ }
98
+
99
+ function InspectorImagePreview( { label, url: imgUrl } ) {
100
+ const imgLabel = label || getFilename( imgUrl );
101
+ return (
102
+ <ItemGroup as="span">
103
+ <HStack justify="flex-start" as="span">
104
+ <img src={ imgUrl } alt="" />
105
+ <FlexItem as="span">
106
+ <Truncate
107
+ numberOfLines={ 1 }
108
+ className="block-editor-hooks__background__inspector-media-replace-title"
109
+ >
110
+ { imgLabel }
111
+ </Truncate>
112
+ </FlexItem>
113
+ </HStack>
114
+ </ItemGroup>
115
+ );
116
+ }
117
+
118
+ function BackgroundImagePanelItem( props ) {
119
+ const { attributes, clientId, setAttributes } = props;
120
+
121
+ const { id, title, url } =
122
+ attributes.style?.background?.backgroundImage || {};
123
+
124
+ const { mediaUpload } = useSelect( ( select ) => {
125
+ return {
126
+ mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
127
+ };
128
+ } );
129
+
130
+ const { createErrorNotice } = useDispatch( noticesStore );
131
+ const onUploadError = ( message ) => {
132
+ createErrorNotice( message, { type: 'snackbar' } );
133
+ };
134
+
135
+ const onSelectMedia = ( media ) => {
136
+ if ( ! media || ! media.url ) {
137
+ const newStyle = {
138
+ ...attributes.style,
139
+ background: {
140
+ ...attributes.style?.background,
141
+ backgroundImage: undefined,
142
+ },
143
+ };
144
+
145
+ const newAttributes = {
146
+ style: cleanEmptyObject( newStyle ),
147
+ };
148
+
149
+ setAttributes( newAttributes );
150
+ return;
151
+ }
152
+
153
+ if ( isBlobURL( media.url ) ) {
154
+ return;
155
+ }
156
+
157
+ // For media selections originated from a file upload.
158
+ if (
159
+ ( media.media_type &&
160
+ media.media_type !== IMAGE_BACKGROUND_TYPE ) ||
161
+ ( ! media.media_type &&
162
+ media.type &&
163
+ media.type !== IMAGE_BACKGROUND_TYPE )
164
+ ) {
165
+ onUploadError(
166
+ __( 'Only images can be used as a background image.' )
167
+ );
168
+ return;
169
+ }
170
+
171
+ const newStyle = {
172
+ ...attributes.style,
173
+ background: {
174
+ ...attributes.style?.background,
175
+ backgroundImage: {
176
+ url: media.url,
177
+ id: media.id,
178
+ source: 'file',
179
+ title: media.title || undefined,
180
+ },
181
+ },
182
+ };
183
+
184
+ const newAttributes = {
185
+ style: cleanEmptyObject( newStyle ),
186
+ };
187
+
188
+ setAttributes( newAttributes );
189
+ };
190
+
191
+ const onFilesDrop = ( filesList ) => {
192
+ mediaUpload( {
193
+ allowedTypes: [ 'image' ],
194
+ filesList,
195
+ onFileChange( [ image ] ) {
196
+ if ( isBlobURL( image?.url ) ) {
197
+ return;
198
+ }
199
+ onSelectMedia( image );
200
+ },
201
+ onError: onUploadError,
202
+ } );
203
+ };
204
+
205
+ const resetAllFilter = useCallback( ( previousValue ) => {
206
+ return {
207
+ ...previousValue,
208
+ style: {
209
+ ...previousValue.style,
210
+ background: undefined,
211
+ },
212
+ };
213
+ }, [] );
214
+
215
+ return (
216
+ <ToolsPanelItem
217
+ className="single-column"
218
+ hasValue={ () => hasBackgroundImageValue( props ) }
219
+ label={ __( 'Background image' ) }
220
+ onDeselect={ () => resetBackgroundImage( props ) }
221
+ isShownByDefault={ true }
222
+ resetAllFilter={ resetAllFilter }
223
+ panelId={ clientId }
224
+ >
225
+ <div className="block-editor-hooks__background__inspector-media-replace-container">
226
+ { !! url && (
227
+ <MediaReplaceFlow
228
+ mediaId={ id }
229
+ mediaURL={ url }
230
+ allowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }
231
+ accept="image/*"
232
+ onSelect={ onSelectMedia }
233
+ name={
234
+ <InspectorImagePreview
235
+ label={ title }
236
+ url={ url }
237
+ />
238
+ }
239
+ variant="secondary"
240
+ >
241
+ <MenuItem
242
+ onClick={ () => resetBackgroundImage( props ) }
243
+ >
244
+ { __( 'Reset ' ) }
245
+ </MenuItem>
246
+ </MediaReplaceFlow>
247
+ ) }
248
+ { ! url && (
249
+ <MediaUploadCheck>
250
+ <MediaUpload
251
+ onSelect={ onSelectMedia }
252
+ allowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }
253
+ render={ ( { open } ) => (
254
+ <div className="block-editor-hooks__background__inspector-upload-container">
255
+ <Button
256
+ onClick={ open }
257
+ variant="secondary"
258
+ >
259
+ { __( 'Add background image' ) }
260
+ </Button>
261
+ <DropZone onFilesDrop={ onFilesDrop } />
262
+ </div>
263
+ ) }
264
+ />
265
+ </MediaUploadCheck>
266
+ ) }
267
+ </div>
268
+ </ToolsPanelItem>
269
+ );
270
+ }
271
+
272
+ export function BackgroundImagePanel( props ) {
273
+ const isBackgroundImageSupported =
274
+ useSetting( 'background.backgroundImage' ) &&
275
+ hasBackgroundSupport( props.name, 'backgroundImage' );
276
+
277
+ if ( ! isBackgroundImageSupported ) {
278
+ return null;
279
+ }
280
+
281
+ return (
282
+ <InspectorControls group="background">
283
+ { isBackgroundImageSupported && (
284
+ <BackgroundImagePanelItem { ...props } />
285
+ ) }
286
+ </InspectorControls>
287
+ );
288
+ }
@@ -0,0 +1,57 @@
1
+ .block-editor-hooks__background__inspector-upload-container {
2
+ position: relative;
3
+ // Since there is no option to skip rendering the drag'n'drop icon in drop
4
+ // zone, we hide it for now.
5
+ .components-drop-zone__content-icon {
6
+ display: none;
7
+ }
8
+ }
9
+
10
+ .block-editor-hooks__background__inspector-upload-container,
11
+ .block-editor-hooks__background__inspector-media-replace-container {
12
+ button.components-button {
13
+ color: $gray-900;
14
+ box-shadow: inset 0 0 0 1px $gray-400;
15
+ width: 100%;
16
+ display: block;
17
+ height: $grid-unit-50;
18
+
19
+ &:hover {
20
+ color: var(--wp-admin-theme-color);
21
+ }
22
+
23
+ &:focus {
24
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
25
+ }
26
+ }
27
+
28
+ .block-editor-hooks__background__inspector-media-replace-title {
29
+ word-break: break-all;
30
+ // The Button component is white-space: nowrap, and that won't work with line-clamp.
31
+ white-space: normal;
32
+
33
+ // Without this, the ellipsis can sometimes be partially hidden by the Button padding.
34
+ text-align: start;
35
+ text-align-last: center;
36
+ }
37
+ }
38
+
39
+ .block-editor-hooks__background__inspector-media-replace-container {
40
+ .components-dropdown {
41
+ display: block;
42
+ }
43
+
44
+ img {
45
+ width: 20px;
46
+ min-width: 20px;
47
+ aspect-ratio: 1;
48
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
49
+ border-radius: 50% !important;
50
+ }
51
+
52
+ .block-editor-hooks__background__inspector-readonly-logo-preview {
53
+ padding: 6px 12px;
54
+ display: flex;
55
+ height: $grid-unit-50;
56
+ }
57
+ }
@@ -0,0 +1,257 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { addFilter } from '@wordpress/hooks';
6
+ import { Fragment, useMemo } from '@wordpress/element';
7
+ import {
8
+ __experimentalHStack as HStack,
9
+ PanelBody,
10
+ ToggleControl,
11
+ } from '@wordpress/components';
12
+ import { createHigherOrderComponent } from '@wordpress/compose';
13
+ import { createBlock, store as blocksStore } from '@wordpress/blocks';
14
+ import { useDispatch, useSelect } from '@wordpress/data';
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+ import { BlockIcon, InspectorControls } from '../components';
20
+ import { store as blockEditorStore } from '../store';
21
+
22
+ const EMPTY_OBJECT = {};
23
+
24
+ function BlockHooksControl( props ) {
25
+ const blockTypes = useSelect(
26
+ ( select ) => select( blocksStore ).getBlockTypes(),
27
+ []
28
+ );
29
+
30
+ const hookedBlocksForCurrentBlock = useMemo(
31
+ () =>
32
+ blockTypes?.filter(
33
+ ( { blockHooks } ) =>
34
+ blockHooks && props.blockName in blockHooks
35
+ ),
36
+ [ blockTypes, props.blockName ]
37
+ );
38
+
39
+ const { blockIndex, rootClientId, innerBlocksLength } = useSelect(
40
+ ( select ) => {
41
+ const { getBlock, getBlockIndex, getBlockRootClientId } =
42
+ select( blockEditorStore );
43
+
44
+ return {
45
+ blockIndex: getBlockIndex( props.clientId ),
46
+ innerBlocksLength: getBlock( props.clientId )?.innerBlocks
47
+ ?.length,
48
+ rootClientId: getBlockRootClientId( props.clientId ),
49
+ };
50
+ },
51
+ [ props.clientId ]
52
+ );
53
+
54
+ const hookedBlockClientIds = useSelect(
55
+ ( select ) => {
56
+ const { getBlock, getGlobalBlockCount } =
57
+ select( blockEditorStore );
58
+
59
+ const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce(
60
+ ( clientIds, block ) => {
61
+ // If the block doesn't exist anywhere in the block tree,
62
+ // we know that we have to display the toggle for it, and set
63
+ // it to disabled.
64
+ if ( getGlobalBlockCount( block.name ) === 0 ) {
65
+ return clientIds;
66
+ }
67
+
68
+ const relativePosition =
69
+ block?.blockHooks?.[ props.blockName ];
70
+ let candidates;
71
+
72
+ switch ( relativePosition ) {
73
+ case 'before':
74
+ case 'after':
75
+ // Any of the current block's siblings (with the right block type) qualifies
76
+ // as a hooked block (inserted `before` or `after` the current one), as the block
77
+ // might've been automatically inserted and then moved around a bit by the user.
78
+ candidates = getBlock( rootClientId )?.innerBlocks;
79
+ break;
80
+
81
+ case 'first_child':
82
+ case 'last_child':
83
+ // Any of the current block's child blocks (with the right block type) qualifies
84
+ // as a hooked first or last child block, as the block might've been automatically
85
+ // inserted and then moved around a bit by the user.
86
+ candidates = getBlock( props.clientId ).innerBlocks;
87
+ break;
88
+ }
89
+
90
+ const hookedBlock = candidates?.find(
91
+ ( { name } ) => name === block.name
92
+ );
93
+
94
+ // If the block exists in the designated location, we consider it hooked
95
+ // and show the toggle as enabled.
96
+ if ( hookedBlock ) {
97
+ return {
98
+ ...clientIds,
99
+ [ block.name ]: hookedBlock.clientId,
100
+ };
101
+ }
102
+
103
+ // If no hooked block was found in any of its designated locations,
104
+ // but it exists elsewhere in the block tree, we consider it manually inserted.
105
+ // In this case, we take note and will remove the corresponding toggle from the
106
+ // block inspector panel.
107
+ return {
108
+ ...clientIds,
109
+ [ block.name ]: false,
110
+ };
111
+ },
112
+ {}
113
+ );
114
+
115
+ if ( Object.values( _hookedBlockClientIds ).length > 0 ) {
116
+ return _hookedBlockClientIds;
117
+ }
118
+
119
+ return EMPTY_OBJECT;
120
+ },
121
+ [
122
+ hookedBlocksForCurrentBlock,
123
+ props.blockName,
124
+ props.clientId,
125
+ rootClientId,
126
+ ]
127
+ );
128
+
129
+ const { insertBlock, removeBlock } = useDispatch( blockEditorStore );
130
+
131
+ // Remove toggle if block isn't present in the designated location but elsewhere in the block tree.
132
+ const hookedBlocksForCurrentBlockIfNotPresentElsewhere =
133
+ hookedBlocksForCurrentBlock?.filter(
134
+ ( block ) => hookedBlockClientIds?.[ block.name ] !== false
135
+ );
136
+
137
+ if ( ! hookedBlocksForCurrentBlockIfNotPresentElsewhere.length ) {
138
+ return null;
139
+ }
140
+
141
+ // Group by block namespace (i.e. prefix before the slash).
142
+ const groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce(
143
+ ( groups, block ) => {
144
+ const [ namespace ] = block.name.split( '/' );
145
+ if ( ! groups[ namespace ] ) {
146
+ groups[ namespace ] = [];
147
+ }
148
+ groups[ namespace ].push( block );
149
+ return groups;
150
+ },
151
+ {}
152
+ );
153
+
154
+ const insertBlockIntoDesignatedLocation = ( block, relativePosition ) => {
155
+ switch ( relativePosition ) {
156
+ case 'before':
157
+ case 'after':
158
+ insertBlock(
159
+ block,
160
+ relativePosition === 'after' ? blockIndex + 1 : blockIndex,
161
+ rootClientId, // Insert as a child of the current block's parent
162
+ false
163
+ );
164
+ break;
165
+
166
+ case 'first_child':
167
+ case 'last_child':
168
+ insertBlock(
169
+ block,
170
+ // TODO: It'd be great if insertBlock() would accept negative indices for insertion.
171
+ relativePosition === 'first_child' ? 0 : innerBlocksLength,
172
+ props.clientId, // Insert as a child of the current block.
173
+ false
174
+ );
175
+ break;
176
+ }
177
+ };
178
+
179
+ return (
180
+ <InspectorControls>
181
+ <PanelBody
182
+ className="block-editor-hooks__block-hooks"
183
+ title={ __( 'Plugins' ) }
184
+ initialOpen={ true }
185
+ >
186
+ { Object.keys( groupedHookedBlocks ).map( ( vendor ) => {
187
+ return (
188
+ <Fragment key={ vendor }>
189
+ <h3>{ vendor }</h3>
190
+ { groupedHookedBlocks[ vendor ].map( ( block ) => {
191
+ const checked =
192
+ block.name in hookedBlockClientIds;
193
+
194
+ return (
195
+ <ToggleControl
196
+ checked={ checked }
197
+ key={ block.title }
198
+ label={
199
+ <HStack justify="flex-start">
200
+ <BlockIcon
201
+ icon={ block.icon }
202
+ />
203
+ <span>{ block.title }</span>
204
+ </HStack>
205
+ }
206
+ onChange={ () => {
207
+ if ( ! checked ) {
208
+ // Create and insert block.
209
+ const relativePosition =
210
+ block.blockHooks[
211
+ props.blockName
212
+ ];
213
+ insertBlockIntoDesignatedLocation(
214
+ createBlock( block.name ),
215
+ relativePosition
216
+ );
217
+ return;
218
+ }
219
+
220
+ // Remove block.
221
+ const clientId =
222
+ hookedBlockClientIds[
223
+ block.name
224
+ ];
225
+ removeBlock( clientId, false );
226
+ } }
227
+ />
228
+ );
229
+ } ) }
230
+ </Fragment>
231
+ );
232
+ } ) }
233
+ </PanelBody>
234
+ </InspectorControls>
235
+ );
236
+ }
237
+
238
+ export const withBlockHooks = createHigherOrderComponent( ( BlockEdit ) => {
239
+ return ( props ) => {
240
+ const blockEdit = <BlockEdit key="edit" { ...props } />;
241
+ return (
242
+ <>
243
+ { blockEdit }
244
+ <BlockHooksControl
245
+ blockName={ props.name }
246
+ clientId={ props.clientId }
247
+ />
248
+ </>
249
+ );
250
+ };
251
+ }, 'withBlockHooks' );
252
+
253
+ addFilter(
254
+ 'editor.BlockEdit',
255
+ 'core/block-hooks/with-inspector-control',
256
+ withBlockHooks
257
+ );
@@ -0,0 +1,16 @@
1
+ .block-editor-hooks__block-hooks {
2
+ /**
3
+ * Since we're displaying the block icon alongside the block name,
4
+ * we need to right-align the toggle.
5
+ */
6
+ .components-toggle-control .components-h-stack {
7
+ flex-direction: row-reverse;
8
+ }
9
+
10
+ /**
11
+ * Un-reverse the flex direction for the toggle's label.
12
+ */
13
+ .components-toggle-control .components-h-stack .components-h-stack {
14
+ flex-direction: row;
15
+ }
16
+ }