@wordpress/block-editor 8.0.12-next.33ec3857e2.0 → 8.0.12

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 (363) hide show
  1. package/README.md +0 -4
  2. package/build/components/block-caption/index.native.js +3 -14
  3. package/build/components/block-caption/index.native.js.map +1 -1
  4. package/build/components/block-inspector/index.js +33 -12
  5. package/build/components/block-inspector/index.js.map +1 -1
  6. package/build/components/block-list/block.js +1 -1
  7. package/build/components/block-list/block.js.map +1 -1
  8. package/build/components/block-list/block.native.js +2 -3
  9. package/build/components/block-list/block.native.js.map +1 -1
  10. package/build/components/block-list/use-block-props/index.js +1 -3
  11. package/build/components/block-list/use-block-props/index.js.map +1 -1
  12. package/build/components/block-list/use-in-between-inserter.js +1 -1
  13. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  14. package/build/components/block-list-appender/index.js +11 -3
  15. package/build/components/block-list-appender/index.js.map +1 -1
  16. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
  17. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  18. package/build/components/block-mover/button.js +2 -2
  19. package/build/components/block-mover/button.js.map +1 -1
  20. package/build/components/block-mover/index.js +2 -2
  21. package/build/components/block-mover/index.js.map +1 -1
  22. package/build/components/block-mover/index.native.js +2 -2
  23. package/build/components/block-mover/index.native.js.map +1 -1
  24. package/build/components/block-preview/auto.js +2 -10
  25. package/build/components/block-preview/auto.js.map +1 -1
  26. package/build/components/block-settings/container.native.js +1 -2
  27. package/build/components/block-settings/container.native.js.map +1 -1
  28. package/build/components/block-styles/index.js +134 -110
  29. package/build/components/block-styles/index.js.map +1 -1
  30. package/build/components/block-styles/utils.js +0 -39
  31. package/build/components/block-styles/utils.js.map +1 -1
  32. package/build/components/block-switcher/block-styles-menu.js +23 -3
  33. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  34. package/build/components/block-tools/back-compat.js +1 -2
  35. package/build/components/block-tools/back-compat.js.map +1 -1
  36. package/build/components/block-tools/block-selection-button.js +3 -3
  37. package/build/components/block-tools/block-selection-button.js.map +1 -1
  38. package/build/components/block-tools/insertion-point.js +1 -11
  39. package/build/components/block-tools/insertion-point.js.map +1 -1
  40. package/build/components/button-block-appender/index.js +1 -2
  41. package/build/components/button-block-appender/index.js.map +1 -1
  42. package/build/components/colors-gradients/panel-color-gradient-settings.js +10 -51
  43. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  44. package/build/components/default-block-appender/index.js +19 -16
  45. package/build/components/default-block-appender/index.js.map +1 -1
  46. package/build/components/default-style-picker/index.js +3 -18
  47. package/build/components/default-style-picker/index.js.map +1 -1
  48. package/build/components/iframe/index.js +4 -3
  49. package/build/components/iframe/index.js.map +1 -1
  50. package/build/components/index.js +9 -9
  51. package/build/components/index.js.map +1 -1
  52. package/build/components/inner-blocks/default-block-appender.js +4 -2
  53. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  54. package/build/components/inserter/hooks/use-insertion-point.js +2 -2
  55. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  56. package/build/components/inserter/index.js +2 -2
  57. package/build/components/inserter/index.js.map +1 -1
  58. package/build/components/inserter/index.native.js +3 -3
  59. package/build/components/inserter/index.native.js.map +1 -1
  60. package/build/components/inserter/quick-inserter.js +1 -1
  61. package/build/components/inserter/quick-inserter.js.map +1 -1
  62. package/build/components/inserter/tabs.native.js +4 -7
  63. package/build/components/inserter/tabs.native.js.map +1 -1
  64. package/build/components/inspector-controls/block-support-slot-container.js +1 -2
  65. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  66. package/build/components/inspector-controls/block-support-tools-panel.js +50 -22
  67. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  68. package/build/components/inspector-controls/fill.native.js +5 -3
  69. package/build/components/inspector-controls/fill.native.js.map +1 -1
  70. package/build/components/inspector-controls/groups.js +0 -2
  71. package/build/components/inspector-controls/groups.js.map +1 -1
  72. package/build/components/inspector-controls/slot.js +3 -1
  73. package/build/components/inspector-controls/slot.js.map +1 -1
  74. package/build/components/letter-spacing-control/index.js +6 -6
  75. package/build/components/letter-spacing-control/index.js.map +1 -1
  76. package/build/components/list-view/block-select-button.js +3 -23
  77. package/build/components/list-view/block-select-button.js.map +1 -1
  78. package/build/components/list-view/use-list-view-drop-zone.js +1 -1
  79. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  80. package/build/components/media-placeholder/index.js +0 -2
  81. package/build/components/media-placeholder/index.js.map +1 -1
  82. package/build/components/media-replace-flow/index.js +0 -2
  83. package/build/components/media-replace-flow/index.js.map +1 -1
  84. package/build/components/provider/use-block-sync.js +37 -10
  85. package/build/components/provider/use-block-sync.js.map +1 -1
  86. package/build/components/rich-text/file-paste-handler.js +1 -1
  87. package/build/components/rich-text/file-paste-handler.js.map +1 -1
  88. package/build/components/rich-text/use-input-rules.js +1 -3
  89. package/build/components/rich-text/use-input-rules.js.map +1 -1
  90. package/build/components/selection-scroll-into-view/index.js +1 -2
  91. package/build/components/selection-scroll-into-view/index.js.map +1 -1
  92. package/build/components/use-canvas-click-redirect/index.js +66 -0
  93. package/build/components/use-canvas-click-redirect/index.js.map +1 -0
  94. package/build/components/use-on-block-drop/index.js +4 -8
  95. package/build/components/use-on-block-drop/index.js.map +1 -1
  96. package/build/components/use-setting/index.js +7 -0
  97. package/build/components/use-setting/index.js.map +1 -1
  98. package/build/components/writing-flow/use-multi-selection.js +1 -3
  99. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  100. package/build/hooks/border-color.js +5 -63
  101. package/build/hooks/border-color.js.map +1 -1
  102. package/build/hooks/border-radius.js +0 -47
  103. package/build/hooks/border-radius.js.map +1 -1
  104. package/build/hooks/border-style.js +0 -41
  105. package/build/hooks/border-style.js.map +1 -1
  106. package/build/hooks/border-width.js +31 -70
  107. package/build/hooks/border-width.js.map +1 -1
  108. package/build/hooks/border.js +11 -81
  109. package/build/hooks/border.js.map +1 -1
  110. package/build/hooks/letter-spacing.js +1 -1
  111. package/build/hooks/letter-spacing.js.map +1 -1
  112. package/build/hooks/typography.js +1 -1
  113. package/build/hooks/typography.js.map +1 -1
  114. package/build/layouts/flex.js +3 -27
  115. package/build/layouts/flex.js.map +1 -1
  116. package/build/store/actions.js +5 -4
  117. package/build/store/actions.js.map +1 -1
  118. package/build/store/defaults.js +1 -5
  119. package/build/store/defaults.js.map +1 -1
  120. package/build/store/reducer.js +24 -1
  121. package/build/store/reducer.js.map +1 -1
  122. package/build/store/selectors.js +9 -27
  123. package/build/store/selectors.js.map +1 -1
  124. package/build/utils/get-paste-event-data.js +1 -1
  125. package/build/utils/get-paste-event-data.js.map +1 -1
  126. package/build/utils/parse-css-unit-to-px.js +1 -1
  127. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  128. package/build-module/components/block-caption/index.native.js +3 -13
  129. package/build-module/components/block-caption/index.native.js.map +1 -1
  130. package/build-module/components/block-inspector/index.js +33 -12
  131. package/build-module/components/block-inspector/index.js.map +1 -1
  132. package/build-module/components/block-list/block.js +1 -1
  133. package/build-module/components/block-list/block.js.map +1 -1
  134. package/build-module/components/block-list/block.native.js +2 -3
  135. package/build-module/components/block-list/block.native.js.map +1 -1
  136. package/build-module/components/block-list/use-block-props/index.js +1 -3
  137. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  138. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  139. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  140. package/build-module/components/block-list-appender/index.js +10 -3
  141. package/build-module/components/block-list-appender/index.js.map +1 -1
  142. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
  143. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  144. package/build-module/components/block-mover/button.js +2 -2
  145. package/build-module/components/block-mover/button.js.map +1 -1
  146. package/build-module/components/block-mover/index.js +2 -2
  147. package/build-module/components/block-mover/index.js.map +1 -1
  148. package/build-module/components/block-mover/index.native.js +2 -2
  149. package/build-module/components/block-mover/index.native.js.map +1 -1
  150. package/build-module/components/block-preview/auto.js +2 -10
  151. package/build-module/components/block-preview/auto.js.map +1 -1
  152. package/build-module/components/block-settings/container.native.js +1 -2
  153. package/build-module/components/block-settings/container.native.js.map +1 -1
  154. package/build-module/components/block-styles/index.js +133 -112
  155. package/build-module/components/block-styles/index.js.map +1 -1
  156. package/build-module/components/block-styles/utils.js +0 -34
  157. package/build-module/components/block-styles/utils.js.map +1 -1
  158. package/build-module/components/block-switcher/block-styles-menu.js +21 -3
  159. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  160. package/build-module/components/block-tools/back-compat.js +1 -2
  161. package/build-module/components/block-tools/back-compat.js.map +1 -1
  162. package/build-module/components/block-tools/block-selection-button.js +3 -3
  163. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  164. package/build-module/components/block-tools/insertion-point.js +1 -11
  165. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  166. package/build-module/components/button-block-appender/index.js +1 -2
  167. package/build-module/components/button-block-appender/index.js.map +1 -1
  168. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +13 -54
  169. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  170. package/build-module/components/default-block-appender/index.js +18 -15
  171. package/build-module/components/default-block-appender/index.js.map +1 -1
  172. package/build-module/components/default-style-picker/index.js +3 -17
  173. package/build-module/components/default-style-picker/index.js.map +1 -1
  174. package/build-module/components/iframe/index.js +4 -3
  175. package/build-module/components/iframe/index.js.map +1 -1
  176. package/build-module/components/index.js +1 -1
  177. package/build-module/components/index.js.map +1 -1
  178. package/build-module/components/inner-blocks/default-block-appender.js +4 -2
  179. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  180. package/build-module/components/inserter/hooks/use-insertion-point.js +2 -2
  181. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  182. package/build-module/components/inserter/index.js +2 -2
  183. package/build-module/components/inserter/index.js.map +1 -1
  184. package/build-module/components/inserter/index.native.js +4 -4
  185. package/build-module/components/inserter/index.native.js.map +1 -1
  186. package/build-module/components/inserter/quick-inserter.js +1 -1
  187. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  188. package/build-module/components/inserter/tabs.native.js +4 -7
  189. package/build-module/components/inserter/tabs.native.js.map +1 -1
  190. package/build-module/components/inspector-controls/block-support-slot-container.js +1 -2
  191. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  192. package/build-module/components/inspector-controls/block-support-tools-panel.js +50 -22
  193. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  194. package/build-module/components/inspector-controls/fill.native.js +5 -3
  195. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  196. package/build-module/components/inspector-controls/groups.js +0 -2
  197. package/build-module/components/inspector-controls/groups.js.map +1 -1
  198. package/build-module/components/inspector-controls/slot.js +3 -1
  199. package/build-module/components/inspector-controls/slot.js.map +1 -1
  200. package/build-module/components/letter-spacing-control/index.js +6 -6
  201. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  202. package/build-module/components/list-view/block-select-button.js +3 -22
  203. package/build-module/components/list-view/block-select-button.js.map +1 -1
  204. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
  205. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  206. package/build-module/components/media-placeholder/index.js +0 -2
  207. package/build-module/components/media-placeholder/index.js.map +1 -1
  208. package/build-module/components/media-replace-flow/index.js +0 -2
  209. package/build-module/components/media-replace-flow/index.js.map +1 -1
  210. package/build-module/components/provider/use-block-sync.js +41 -14
  211. package/build-module/components/provider/use-block-sync.js.map +1 -1
  212. package/build-module/components/rich-text/file-paste-handler.js +1 -1
  213. package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
  214. package/build-module/components/rich-text/use-input-rules.js +1 -2
  215. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  216. package/build-module/components/selection-scroll-into-view/index.js +1 -2
  217. package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
  218. package/build-module/components/use-canvas-click-redirect/index.js +54 -0
  219. package/build-module/components/use-canvas-click-redirect/index.js.map +1 -0
  220. package/build-module/components/use-on-block-drop/index.js +4 -8
  221. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  222. package/build-module/components/use-setting/index.js +7 -0
  223. package/build-module/components/use-setting/index.js.map +1 -1
  224. package/build-module/components/writing-flow/use-multi-selection.js +4 -3
  225. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  226. package/build-module/hooks/border-color.js +7 -61
  227. package/build-module/hooks/border-color.js.map +1 -1
  228. package/build-module/hooks/border-radius.js +0 -42
  229. package/build-module/hooks/border-radius.js.map +1 -1
  230. package/build-module/hooks/border-style.js +0 -36
  231. package/build-module/hooks/border-style.js.map +1 -1
  232. package/build-module/hooks/border-width.js +32 -66
  233. package/build-module/hooks/border-width.js.map +1 -1
  234. package/build-module/hooks/border.js +12 -80
  235. package/build-module/hooks/border.js.map +1 -1
  236. package/build-module/hooks/letter-spacing.js +1 -1
  237. package/build-module/hooks/letter-spacing.js.map +1 -1
  238. package/build-module/hooks/typography.js +1 -1
  239. package/build-module/hooks/typography.js.map +1 -1
  240. package/build-module/layouts/flex.js +3 -27
  241. package/build-module/layouts/flex.js.map +1 -1
  242. package/build-module/store/actions.js +5 -4
  243. package/build-module/store/actions.js.map +1 -1
  244. package/build-module/store/defaults.js +1 -5
  245. package/build-module/store/defaults.js.map +1 -1
  246. package/build-module/store/reducer.js +24 -1
  247. package/build-module/store/reducer.js.map +1 -1
  248. package/build-module/store/selectors.js +9 -26
  249. package/build-module/store/selectors.js.map +1 -1
  250. package/build-module/utils/get-paste-event-data.js +1 -1
  251. package/build-module/utils/get-paste-event-data.js.map +1 -1
  252. package/build-module/utils/parse-css-unit-to-px.js +1 -1
  253. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  254. package/build-style/style-rtl.css +180 -212
  255. package/build-style/style.css +180 -212
  256. package/package.json +27 -27
  257. package/src/components/block-caption/index.native.js +4 -22
  258. package/src/components/block-inspector/index.js +32 -13
  259. package/src/components/block-list/block.js +1 -1
  260. package/src/components/block-list/block.native.js +2 -2
  261. package/src/components/block-list/use-block-props/index.js +1 -3
  262. package/src/components/block-list/use-in-between-inserter.js +1 -1
  263. package/src/components/block-list-appender/index.js +21 -5
  264. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +2 -5
  265. package/src/components/block-mover/button.js +2 -6
  266. package/src/components/block-mover/index.js +2 -5
  267. package/src/components/block-mover/index.native.js +2 -5
  268. package/src/components/block-preview/auto.js +2 -7
  269. package/src/components/block-settings/container.native.js +0 -1
  270. package/src/components/block-styles/index.js +145 -125
  271. package/src/components/block-styles/style.scss +51 -59
  272. package/src/components/block-styles/test/{utils.js → index.js} +1 -60
  273. package/src/components/block-styles/utils.js +0 -39
  274. package/src/components/block-switcher/block-styles-menu.js +38 -3
  275. package/src/components/block-tools/back-compat.js +0 -1
  276. package/src/components/block-tools/block-selection-button.js +3 -9
  277. package/src/components/block-tools/insertion-point.js +1 -10
  278. package/src/components/border-style-control/style.scss +1 -0
  279. package/src/components/button-block-appender/index.js +0 -1
  280. package/src/components/colors-gradients/panel-color-gradient-settings.js +19 -75
  281. package/src/components/colors-gradients/style.scss +5 -42
  282. package/src/components/default-block-appender/index.js +24 -17
  283. package/src/components/default-block-appender/style.scss +0 -4
  284. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +24 -12
  285. package/src/components/default-block-appender/test/index.js +14 -4
  286. package/src/components/default-style-picker/index.js +6 -18
  287. package/src/components/iframe/index.js +3 -6
  288. package/src/components/index.js +1 -1
  289. package/src/components/inner-blocks/README.md +0 -2
  290. package/src/components/inner-blocks/default-block-appender.js +7 -2
  291. package/src/components/inserter/hooks/use-insertion-point.js +2 -9
  292. package/src/components/inserter/index.js +2 -2
  293. package/src/components/inserter/index.native.js +4 -7
  294. package/src/components/inserter/quick-inserter.js +1 -1
  295. package/src/components/inserter/tabs.native.js +4 -5
  296. package/src/components/inspector-controls/block-support-slot-container.js +1 -3
  297. package/src/components/inspector-controls/block-support-tools-panel.js +57 -21
  298. package/src/components/inspector-controls/fill.native.js +3 -4
  299. package/src/components/inspector-controls/groups.js +0 -2
  300. package/src/components/inspector-controls/slot.js +7 -2
  301. package/src/components/letter-spacing-control/index.js +6 -6
  302. package/src/components/link-control/README.md +1 -1
  303. package/src/components/link-control/test/index.js +0 -2
  304. package/src/components/list-view/block-select-button.js +1 -20
  305. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  306. package/src/components/media-placeholder/index.js +0 -2
  307. package/src/components/media-replace-flow/index.js +0 -2
  308. package/src/components/provider/use-block-sync.js +45 -11
  309. package/src/components/rich-text/file-paste-handler.js +1 -3
  310. package/src/components/rich-text/use-input-rules.js +1 -2
  311. package/src/components/selection-scroll-into-view/index.js +0 -1
  312. package/src/components/url-input/README.md +0 -5
  313. package/src/components/use-canvas-click-redirect/index.js +57 -0
  314. package/src/components/use-on-block-drop/index.js +4 -11
  315. package/src/components/use-setting/index.js +9 -0
  316. package/src/components/writing-flow/use-multi-selection.js +9 -12
  317. package/src/hooks/border-color.js +3 -55
  318. package/src/hooks/border-radius.js +0 -32
  319. package/src/hooks/border-style.js +0 -26
  320. package/src/hooks/border-width.js +32 -56
  321. package/src/hooks/border.js +20 -115
  322. package/src/hooks/border.scss +17 -3
  323. package/src/hooks/letter-spacing.js +1 -1
  324. package/src/hooks/typography.js +1 -1
  325. package/src/layouts/flex.js +4 -25
  326. package/src/store/actions.js +5 -5
  327. package/src/store/defaults.js +0 -2
  328. package/src/store/reducer.js +23 -1
  329. package/src/store/selectors.js +9 -39
  330. package/src/store/test/reducer.js +35 -0
  331. package/src/store/test/selectors.js +1 -1
  332. package/src/style.scss +3 -4
  333. package/src/utils/get-paste-event-data.js +1 -1
  334. package/src/utils/parse-css-unit-to-px.js +1 -1
  335. package/src/utils/test/parse-css-unit-to-px.js +0 -1
  336. package/tsconfig.tsbuildinfo +1 -1
  337. package/build/components/block-styles/menu-items.js +0 -63
  338. package/build/components/block-styles/menu-items.js.map +0 -1
  339. package/build/components/block-styles/preview-panel.js +0 -45
  340. package/build/components/block-styles/preview-panel.js.map +0 -1
  341. package/build/components/block-styles/use-styles-for-block.js +0 -119
  342. package/build/components/block-styles/use-styles-for-block.js.map +0 -1
  343. package/build/components/rich-text/prevent-event-discovery.js +0 -33
  344. package/build/components/rich-text/prevent-event-discovery.js.map +0 -1
  345. package/build/components/use-display-block-controls/index.native.js +0 -45
  346. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  347. package/build-module/components/block-styles/menu-items.js +0 -50
  348. package/build-module/components/block-styles/menu-items.js.map +0 -1
  349. package/build-module/components/block-styles/preview-panel.js +0 -35
  350. package/build-module/components/block-styles/preview-panel.js.map +0 -1
  351. package/build-module/components/block-styles/use-styles-for-block.js +0 -107
  352. package/build-module/components/block-styles/use-styles-for-block.js.map +0 -1
  353. package/build-module/components/rich-text/prevent-event-discovery.js +0 -25
  354. package/build-module/components/rich-text/prevent-event-discovery.js.map +0 -1
  355. package/build-module/components/use-display-block-controls/index.native.js +0 -34
  356. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  357. package/src/components/block-styles/menu-items.js +0 -49
  358. package/src/components/block-styles/preview-panel.js +0 -36
  359. package/src/components/block-styles/use-styles-for-block.js +0 -99
  360. package/src/components/rich-text/prevent-event-discovery.js +0 -23
  361. package/src/components/use-display-block-controls/index.native.js +0 -38
  362. package/src/components/writing-flow/test/use-multi-selection.js +0 -36
  363. package/src/hooks/dimensions.scss +0 -5
@@ -147,11 +147,6 @@ _Optional._ If this property is added, a label will be generated using label pro
147
147
 
148
148
  _Optional._ Adds and optional class to the parent `div` that wraps the URLInput field and popover
149
149
 
150
- ### `placeholder: String`
151
-
152
- _Optional._ Placeholder text to show when the field is empty, similar to the
153
- [`input` and `textarea` attribute of the same name](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/HTML5_updates#The_placeholder_attribute).
154
-
155
150
  ### `disableSuggestions: Boolean`
156
151
 
157
152
  _Optional._ Provides additional control over whether suggestions are disabled.
@@ -0,0 +1,57 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { overEvery, findLast } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useRefEffect } from '@wordpress/compose';
10
+ import { focus, isTextField, placeCaretAtHorizontalEdge } from '@wordpress/dom';
11
+
12
+ /**
13
+ * Given an element, returns true if the element is a tabbable text field, or
14
+ * false otherwise.
15
+ *
16
+ * @param {Element} element Element to test.
17
+ *
18
+ * @return {boolean} Whether element is a tabbable text field.
19
+ */
20
+ const isTabbableTextField = overEvery( [
21
+ isTextField,
22
+ focus.tabbable.isTabbableIndex,
23
+ ] );
24
+
25
+ export function useCanvasClickRedirect() {
26
+ return useRefEffect( ( node ) => {
27
+ function onMouseDown( event ) {
28
+ // Only handle clicks on the canvas, not the content.
29
+ if ( event.target !== node ) {
30
+ return;
31
+ }
32
+
33
+ const focusableNodes = focus.focusable.find( node );
34
+ const target = findLast( focusableNodes, isTabbableTextField );
35
+
36
+ if ( ! target ) {
37
+ return;
38
+ }
39
+
40
+ const { bottom } = target.getBoundingClientRect();
41
+
42
+ // Ensure the click is below the last block.
43
+ if ( event.clientY < bottom ) {
44
+ return;
45
+ }
46
+
47
+ placeCaretAtHorizontalEdge( target, true );
48
+ event.preventDefault();
49
+ }
50
+
51
+ node.addEventListener( 'mousedown', onMouseDown );
52
+
53
+ return () => {
54
+ node.addEventListener( 'mousedown', onMouseDown );
55
+ };
56
+ }, [] );
57
+ }
@@ -95,10 +95,7 @@ export function onBlockDrop(
95
95
 
96
96
  // If the user is moving a block
97
97
  if ( dropType === 'block' ) {
98
- const sourceBlockIndex = getBlockIndex(
99
- sourceClientIds[ 0 ],
100
- sourceRootClientId
101
- );
98
+ const sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );
102
99
 
103
100
  // If the user is dropping to the same position, return early.
104
101
  if (
@@ -259,14 +256,10 @@ export default function useOnBlockDrop( targetRootClientId, targetBlockIndex ) {
259
256
  const files = getFilesFromDataTransfer( event.dataTransfer );
260
257
  const html = event.dataTransfer.getData( 'text/html' );
261
258
 
262
- /**
263
- * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
264
- * The order of the checks is important to recognise the HTML drop.
265
- */
266
- if ( html ) {
267
- _onHTMLDrop( html );
268
- } else if ( files.length ) {
259
+ if ( files.length ) {
269
260
  _onFilesDrop( files );
261
+ } else if ( html ) {
262
+ _onHTMLDrop( html );
270
263
  } else {
271
264
  _onDrop( event );
272
265
  }
@@ -15,6 +15,8 @@ import { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE } from '@wordpress/
15
15
  import { useBlockEditContext } from '../block-edit';
16
16
  import { store as blockEditorStore } from '../../store';
17
17
 
18
+ const blockedPaths = [ 'color', 'border', 'typography', 'spacing' ];
19
+
18
20
  const deprecatedFlags = {
19
21
  'color.palette': ( settings ) =>
20
22
  settings.colors === undefined ? undefined : settings.colors,
@@ -104,6 +106,13 @@ export default function useSetting( path ) {
104
106
 
105
107
  const setting = useSelect(
106
108
  ( select ) => {
109
+ if ( blockedPaths.includes( path ) ) {
110
+ // eslint-disable-next-line no-console
111
+ console.warn(
112
+ 'Top level useSetting paths are disabled. Please use a subpath to query the information needed.'
113
+ );
114
+ return undefined;
115
+ }
107
116
  const settings = select( blockEditorStore ).getSettings();
108
117
 
109
118
  // 1 - Use __experimental features, if available.
@@ -15,19 +15,16 @@ import { useSelect } from '@wordpress/data';
15
15
  import { store as blockEditorStore } from '../../store';
16
16
  import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';
17
17
 
18
- export function toggleRichText( container, toggle ) {
19
- Array.from(
20
- container.querySelectorAll(
21
- // Exclude the Post Title from multi-select disable.
22
- '.rich-text:not( .editor-post-title__input )'
23
- )
24
- ).forEach( ( node ) => {
25
- if ( toggle ) {
26
- node.setAttribute( 'contenteditable', true );
27
- } else {
28
- node.removeAttribute( 'contenteditable' );
18
+ function toggleRichText( container, toggle ) {
19
+ Array.from( container.querySelectorAll( '.rich-text' ) ).forEach(
20
+ ( node ) => {
21
+ if ( toggle ) {
22
+ node.setAttribute( 'contenteditable', true );
23
+ } else {
24
+ node.removeAttribute( 'contenteditable' );
25
+ }
29
26
  }
30
- } );
27
+ );
31
28
  }
32
29
 
33
30
  /**
@@ -9,7 +9,7 @@ import classnames from 'classnames';
9
9
  import { addFilter } from '@wordpress/hooks';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { createHigherOrderComponent } from '@wordpress/compose';
12
- import { useEffect, useState } from '@wordpress/element';
12
+ import { useState } from '@wordpress/element';
13
13
 
14
14
  /**
15
15
  * Internal dependencies
@@ -22,11 +22,7 @@ import {
22
22
  getColorObjectByAttributeValues,
23
23
  } from '../components/colors';
24
24
  import useSetting from '../components/use-setting';
25
- import {
26
- hasBorderSupport,
27
- removeBorderAttribute,
28
- shouldSkipSerialization,
29
- } from './border';
25
+ import { hasBorderSupport, shouldSkipSerialization } from './border';
30
26
  import { cleanEmptyObject } from './utils';
31
27
 
32
28
  // Defining empty array here instead of inline avoids unnecessary re-renders of
@@ -56,30 +52,15 @@ export function BorderColorEdit( props ) {
56
52
  ( colors, origin ) => colors.concat( origin.colors ),
57
53
  []
58
54
  );
59
- const { color: customBorderColor } = style?.border || {};
60
55
  const [ colorValue, setColorValue ] = useState(
61
56
  () =>
62
57
  getColorObjectByAttributeValues(
63
58
  availableColors,
64
59
  borderColor,
65
- customBorderColor
60
+ style?.border?.color
66
61
  )?.color
67
62
  );
68
63
 
69
- // Detect changes in the color attributes and update the colorValue to keep the
70
- // UI in sync. This is necessary for situations when border controls interact with
71
- // eachother: eg, setting the border width to zero causes the color and style
72
- // selections to be cleared.
73
- useEffect( () => {
74
- setColorValue(
75
- getColorObjectByAttributeValues(
76
- availableColors,
77
- borderColor,
78
- customBorderColor
79
- )?.color
80
- );
81
- }, [ borderColor, customBorderColor, availableColors ] );
82
-
83
64
  const onChangeColor = ( value ) => {
84
65
  setColorValue( value );
85
66
 
@@ -117,39 +98,6 @@ export function BorderColorEdit( props ) {
117
98
  );
118
99
  }
119
100
 
120
- /**
121
- * Checks if there is a current value in the border color block support
122
- * attributes.
123
- *
124
- * @param {Object} props Block props.
125
- * @return {boolean} Whether or not the block has a border color value set.
126
- */
127
- export function hasBorderColorValue( props ) {
128
- const {
129
- attributes: { borderColor, style },
130
- } = props;
131
-
132
- return !! borderColor || !! style?.border?.color;
133
- }
134
-
135
- /**
136
- * Resets the border color block support attributes. This can be used when
137
- * disabling the border color support controls for a block via a progressive
138
- * discovery panel.
139
- *
140
- * @param {Object} props Block props.
141
- * @param {Object} props.attributes Block's attributes.
142
- * @param {Object} props.setAttributes Function to set block's attributes.
143
- */
144
- export function resetBorderColor( { attributes = {}, setAttributes } ) {
145
- const { style } = attributes;
146
-
147
- setAttributes( {
148
- borderColor: undefined,
149
- style: removeBorderAttribute( style, 'color' ),
150
- } );
151
- }
152
-
153
101
  /**
154
102
  * Filters registered block settings, extending attributes to include
155
103
  * `borderColor` if needed.
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import BorderRadiusControl from '../components/border-radius-control';
5
5
  import { cleanEmptyObject } from './utils';
6
- import { removeBorderAttribute } from './border';
7
6
 
8
7
  /**
9
8
  * Inspector control panel containing the border radius related configuration.
@@ -41,34 +40,3 @@ export function BorderRadiusEdit( props ) {
41
40
  />
42
41
  );
43
42
  }
44
-
45
- /**
46
- * Checks if there is a current value in the border radius block support
47
- * attributes.
48
- *
49
- * @param {Object} props Block props.
50
- * @return {boolean} Whether or not the block has a border radius value set.
51
- */
52
- export function hasBorderRadiusValue( props ) {
53
- const borderRadius = props.attributes.style?.border?.radius;
54
-
55
- if ( typeof borderRadius === 'object' ) {
56
- return Object.entries( borderRadius ).some( Boolean );
57
- }
58
-
59
- return !! borderRadius;
60
- }
61
-
62
- /**
63
- * Resets the border radius block support attributes. This can be used when
64
- * disabling the border radius support controls for a block via a progressive
65
- * discovery panel.
66
- *
67
- * @param {Object} props Block props.
68
- * @param {Object} props.attributes Block's attributes.
69
- * @param {Object} props.setAttributes Function to set block's attributes.
70
- */
71
- export function resetBorderRadius( { attributes = {}, setAttributes } ) {
72
- const { style } = attributes;
73
- setAttributes( { style: removeBorderAttribute( style, 'radius' ) } );
74
- }
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import BorderStyleControl from '../components/border-style-control';
5
5
  import { cleanEmptyObject } from './utils';
6
- import { removeBorderAttribute } from './border';
7
6
 
8
7
  /**
9
8
  * Inspector control for configuring border style property.
@@ -37,28 +36,3 @@ export const BorderStyleEdit = ( props ) => {
37
36
  />
38
37
  );
39
38
  };
40
-
41
- /**
42
- * Checks if there is a current value in the border style block support
43
- * attributes.
44
- *
45
- * @param {Object} props Block props.
46
- * @return {boolean} Whether or not the block has a border style value set.
47
- */
48
- export function hasBorderStyleValue( props ) {
49
- return !! props.attributes.style?.border?.style;
50
- }
51
-
52
- /**
53
- * Resets the border style block support attribute. This can be used when
54
- * disabling the border style support control for a block via a progressive
55
- * discovery panel.
56
- *
57
- * @param {Object} props Block props.
58
- * @param {Object} props.attributes Block's attributes.
59
- * @param {Object} props.setAttributes Function to set block's attributes.
60
- */
61
- export function resetBorderStyle( { attributes = {}, setAttributes } ) {
62
- const { style } = attributes;
63
- setAttributes( { style: removeBorderAttribute( style, 'style' ) } );
64
- }
@@ -5,14 +5,13 @@ import {
5
5
  __experimentalUnitControl as UnitControl,
6
6
  __experimentalUseCustomUnits as useCustomUnits,
7
7
  } from '@wordpress/components';
8
- import { useState } from '@wordpress/element';
8
+ import { useEffect, useState } from '@wordpress/element';
9
9
  import { __ } from '@wordpress/i18n';
10
10
 
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
14
  import { cleanEmptyObject } from './utils';
15
- import { removeBorderAttribute } from './border';
16
15
  import useSetting from '../components/use-setting';
17
16
 
18
17
  const MIN_BORDER_WIDTH = 0;
@@ -32,12 +31,25 @@ export const BorderWidthEdit = ( props ) => {
32
31
 
33
32
  const { width, color: customBorderColor, style: borderStyle } =
34
33
  style?.border || {};
35
-
36
- // Used to temporarily track previous border color & style selections to be
37
- // able to restore them when border width changes from zero value.
38
34
  const [ styleSelection, setStyleSelection ] = useState();
39
35
  const [ colorSelection, setColorSelection ] = useState();
40
- const [ customColorSelection, setCustomColorSelection ] = useState();
36
+
37
+ // Temporarily track previous border color & style selections to be able to
38
+ // restore them when border width changes from zero value.
39
+ useEffect( () => {
40
+ if ( borderStyle !== 'none' ) {
41
+ setStyleSelection( borderStyle );
42
+ }
43
+ }, [ borderStyle ] );
44
+
45
+ useEffect( () => {
46
+ if ( borderColor || customBorderColor ) {
47
+ setColorSelection( {
48
+ name: !! borderColor ? borderColor : undefined,
49
+ color: !! customBorderColor ? customBorderColor : undefined,
50
+ } );
51
+ }
52
+ }, [ borderColor, customBorderColor ] );
41
53
 
42
54
  const onChange = ( newWidth ) => {
43
55
  let newStyle = {
@@ -52,39 +64,28 @@ export const BorderWidthEdit = ( props ) => {
52
64
  let borderPaletteColor = borderColor;
53
65
 
54
66
  const hasZeroWidth = parseFloat( newWidth ) === 0;
55
- const hadPreviousZeroWidth = parseFloat( width ) === 0;
56
67
 
57
68
  // Setting the border width explicitly to zero will also set the
58
69
  // border style to `none` and clear border color attributes.
59
- if ( hasZeroWidth && ! hadPreviousZeroWidth ) {
60
- // Before clearing color and style selections, keep track of
61
- // the current selections so they can be restored when the width
62
- // changes to a non-zero value.
63
- setColorSelection( borderColor );
64
- setCustomColorSelection( customBorderColor );
65
- setStyleSelection( borderStyle );
66
-
67
- // Clear style and color attributes.
70
+ if ( hasZeroWidth ) {
68
71
  borderPaletteColor = undefined;
69
72
  newStyle.border.color = undefined;
70
73
  newStyle.border.style = 'none';
71
74
  }
72
75
 
73
- if ( ! hasZeroWidth && hadPreviousZeroWidth ) {
74
- // Restore previous border style selection if width is now not zero and
75
- // border style was 'none'. This is to support changes to the UI which
76
- // change the border style UI to a segmented control without a "none"
77
- // option.
78
- if ( borderStyle === 'none' ) {
79
- newStyle.border.style = styleSelection;
80
- }
81
-
82
- // Restore previous border color selection if width is no longer zero
83
- // and current border color is undefined.
84
- if ( borderColor === undefined ) {
85
- borderPaletteColor = colorSelection;
86
- newStyle.border.color = customColorSelection;
87
- }
76
+ // Restore previous border style selection if width is now not zero and
77
+ // border style was 'none'. This is to support changes to the UI which
78
+ // change the border style UI to a segmented control without a "none"
79
+ // option.
80
+ if ( ! hasZeroWidth && borderStyle === 'none' ) {
81
+ newStyle.border.style = styleSelection;
82
+ }
83
+
84
+ // Restore previous border color selection if width is no longer zero
85
+ // and current border color is undefined.
86
+ if ( ! hasZeroWidth && borderColor === undefined ) {
87
+ borderPaletteColor = colorSelection?.name;
88
+ newStyle.border.color = colorSelection?.color;
88
89
  }
89
90
 
90
91
  // If width was reset, clean out undefined styles.
@@ -112,28 +113,3 @@ export const BorderWidthEdit = ( props ) => {
112
113
  />
113
114
  );
114
115
  };
115
-
116
- /**
117
- * Checks if there is a current value in the border width block support
118
- * attributes.
119
- *
120
- * @param {Object} props Block props.
121
- * @return {boolean} Whether or not the block has a border width value set.
122
- */
123
- export function hasBorderWidthValue( props ) {
124
- return !! props.attributes.style?.border?.width;
125
- }
126
-
127
- /**
128
- * Resets the border width block support attribute. This can be used when
129
- * disabling the border width support control for a block via a progressive
130
- * discovery panel.
131
- *
132
- * @param {Object} props Block props.
133
- * @param {Object} props.attributes Block's attributes.
134
- * @param {Object} props.setAttributes Function to set block's attributes.
135
- */
136
- export function resetBorderWidth( { attributes = {}, setAttributes } ) {
137
- const { style } = attributes;
138
- setAttributes( { style: removeBorderAttribute( style, 'width' ) } );
139
- }
@@ -2,41 +2,23 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { getBlockSupport } from '@wordpress/blocks';
5
- import { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
5
+ import { PanelBody } from '@wordpress/components';
6
6
  import { Platform } from '@wordpress/element';
7
7
  import { __ } from '@wordpress/i18n';
8
8
 
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
- import {
13
- BorderColorEdit,
14
- hasBorderColorValue,
15
- resetBorderColor,
16
- } from './border-color';
17
- import {
18
- BorderRadiusEdit,
19
- hasBorderRadiusValue,
20
- resetBorderRadius,
21
- } from './border-radius';
22
- import {
23
- BorderStyleEdit,
24
- hasBorderStyleValue,
25
- resetBorderStyle,
26
- } from './border-style';
27
- import {
28
- BorderWidthEdit,
29
- hasBorderWidthValue,
30
- resetBorderWidth,
31
- } from './border-width';
32
12
  import InspectorControls from '../components/inspector-controls';
33
13
  import useSetting from '../components/use-setting';
34
- import { cleanEmptyObject } from './utils';
14
+ import { BorderColorEdit } from './border-color';
15
+ import { BorderRadiusEdit } from './border-radius';
16
+ import { BorderStyleEdit } from './border-style';
17
+ import { BorderWidthEdit } from './border-width';
35
18
 
36
19
  export const BORDER_SUPPORT_KEY = '__experimentalBorder';
37
20
 
38
21
  export function BorderPanel( props ) {
39
- const { clientId } = props;
40
22
  const isDisabled = useIsBorderDisabled( props );
41
23
  const isSupported = hasBorderSupport( props.name );
42
24
 
@@ -57,80 +39,22 @@ export function BorderPanel( props ) {
57
39
  return null;
58
40
  }
59
41
 
60
- const defaultBorderControls = getBlockSupport( props.name, [
61
- BORDER_SUPPORT_KEY,
62
- '__experimentalDefaultControls',
63
- ] );
64
-
65
- const createResetAllFilter = (
66
- borderAttribute,
67
- topLevelAttributes = {}
68
- ) => ( newAttributes ) => ( {
69
- ...newAttributes,
70
- ...topLevelAttributes,
71
- style: {
72
- ...newAttributes.style,
73
- border: {
74
- ...newAttributes.style?.border,
75
- [ borderAttribute ]: undefined,
76
- },
77
- },
78
- } );
79
-
80
42
  return (
81
- <InspectorControls __experimentalGroup="border">
82
- { isWidthSupported && (
83
- <ToolsPanelItem
84
- className="single-column"
85
- hasValue={ () => hasBorderWidthValue( props ) }
86
- label={ __( 'Width' ) }
87
- onDeselect={ () => resetBorderWidth( props ) }
88
- isShownByDefault={ defaultBorderControls?.width }
89
- resetAllFilter={ createResetAllFilter( 'width' ) }
90
- panelId={ clientId }
91
- >
92
- <BorderWidthEdit { ...props } />
93
- </ToolsPanelItem>
94
- ) }
95
- { isStyleSupported && (
96
- <ToolsPanelItem
97
- className="single-column"
98
- hasValue={ () => hasBorderStyleValue( props ) }
99
- label={ __( 'Style' ) }
100
- onDeselect={ () => resetBorderStyle( props ) }
101
- isShownByDefault={ defaultBorderControls?.style }
102
- resetAllFilter={ createResetAllFilter( 'style' ) }
103
- panelId={ clientId }
104
- >
105
- <BorderStyleEdit { ...props } />
106
- </ToolsPanelItem>
107
- ) }
108
- { isColorSupported && (
109
- <ToolsPanelItem
110
- hasValue={ () => hasBorderColorValue( props ) }
111
- label={ __( 'Color' ) }
112
- onDeselect={ () => resetBorderColor( props ) }
113
- isShownByDefault={ defaultBorderControls?.color }
114
- resetAllFilter={ createResetAllFilter( 'color', {
115
- borderColor: undefined,
116
- } ) }
117
- panelId={ clientId }
118
- >
119
- <BorderColorEdit { ...props } />
120
- </ToolsPanelItem>
121
- ) }
122
- { isRadiusSupported && (
123
- <ToolsPanelItem
124
- hasValue={ () => hasBorderRadiusValue( props ) }
125
- label={ __( 'Radius' ) }
126
- onDeselect={ () => resetBorderRadius( props ) }
127
- isShownByDefault={ defaultBorderControls?.radius }
128
- resetAllFilter={ createResetAllFilter( 'radius' ) }
129
- panelId={ clientId }
130
- >
131
- <BorderRadiusEdit { ...props } />
132
- </ToolsPanelItem>
133
- ) }
43
+ <InspectorControls>
44
+ <PanelBody
45
+ className="block-editor-hooks__border-controls"
46
+ title={ __( 'Border' ) }
47
+ initialOpen={ false }
48
+ >
49
+ { ( isWidthSupported || isStyleSupported ) && (
50
+ <div className="block-editor-hooks__border-controls-row">
51
+ { isWidthSupported && <BorderWidthEdit { ...props } /> }
52
+ { isStyleSupported && <BorderStyleEdit { ...props } /> }
53
+ </div>
54
+ ) }
55
+ { isColorSupported && <BorderColorEdit { ...props } /> }
56
+ { isRadiusSupported && <BorderRadiusEdit { ...props } /> }
57
+ </PanelBody>
134
58
  </InspectorControls>
135
59
  );
136
60
  }
@@ -194,22 +118,3 @@ const useIsBorderDisabled = () => {
194
118
 
195
119
  return configs.every( Boolean );
196
120
  };
197
-
198
- /**
199
- * Returns a new style object where the specified border attribute has been
200
- * removed.
201
- *
202
- * @param {Object} style Styles from block attributes.
203
- * @param {string} attribute The border style attribute to clear.
204
- *
205
- * @return {Object} Style object with the specified attribute removed.
206
- */
207
- export function removeBorderAttribute( style, attribute ) {
208
- return cleanEmptyObject( {
209
- ...style,
210
- border: {
211
- ...style?.border,
212
- [ attribute ]: undefined,
213
- },
214
- } );
215
- }
@@ -1,5 +1,19 @@
1
- .border-block-support-panel {
2
- .single-column {
3
- grid-column: span 1;
1
+ .block-editor-hooks__border-controls {
2
+ .block-editor-hooks__border-controls-row {
3
+ display: flex;
4
+ justify-content: space-between;
5
+
6
+ > * {
7
+ width: calc(50% - #{ $grid-unit-10 });
8
+ }
9
+ }
10
+
11
+ .components-unit-control-wrapper {
12
+ margin-bottom: $grid-unit-30;
13
+
14
+ &:last-child {
15
+ margin-bottom: $grid-unit-10;
16
+ }
4
17
  }
5
18
  }
19
+
@@ -45,7 +45,7 @@ export function LetterSpacingEdit( props ) {
45
45
  <LetterSpacingControl
46
46
  value={ style?.typography?.letterSpacing }
47
47
  onChange={ onChange }
48
- __unstableInputWidth={ '100%' }
48
+ __unstableInputWidth={ false }
49
49
  />
50
50
  );
51
51
  }
@@ -218,7 +218,7 @@ export function TypographyPanel( props ) {
218
218
  <ToolsPanelItem
219
219
  className="single-column"
220
220
  hasValue={ () => hasLetterSpacingValue( props ) }
221
- label={ __( 'Letter spacing' ) }
221
+ label={ __( 'Letter-spacing' ) }
222
222
  onDeselect={ () => resetLetterSpacing( props ) }
223
223
  isShownByDefault={ defaultControls?.letterSpacing }
224
224
  resetAllFilter={ createResetAllFilter( 'letterSpacing' ) }