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

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 (399) 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/index.js +9 -0
  39. package/build/components/block-tools/index.js.map +1 -1
  40. package/build/components/block-tools/insertion-point.js +1 -11
  41. package/build/components/block-tools/insertion-point.js.map +1 -1
  42. package/build/components/button-block-appender/index.js +1 -2
  43. package/build/components/button-block-appender/index.js.map +1 -1
  44. package/build/components/colors-gradients/panel-color-gradient-settings.js +10 -51
  45. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  46. package/build/components/default-block-appender/index.js +19 -16
  47. package/build/components/default-block-appender/index.js.map +1 -1
  48. package/build/components/default-style-picker/index.js +3 -18
  49. package/build/components/default-style-picker/index.js.map +1 -1
  50. package/build/components/font-appearance-control/index.js +11 -11
  51. package/build/components/font-appearance-control/index.js.map +1 -1
  52. package/build/components/gradients/use-gradient.js +4 -4
  53. package/build/components/gradients/use-gradient.js.map +1 -1
  54. package/build/components/iframe/index.js +6 -7
  55. package/build/components/iframe/index.js.map +1 -1
  56. package/build/components/index.js +9 -9
  57. package/build/components/index.js.map +1 -1
  58. package/build/components/inner-blocks/default-block-appender.js +4 -2
  59. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  60. package/build/components/inserter/hooks/use-insertion-point.js +2 -2
  61. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  62. package/build/components/inserter/index.js +2 -2
  63. package/build/components/inserter/index.js.map +1 -1
  64. package/build/components/inserter/index.native.js +3 -3
  65. package/build/components/inserter/index.native.js.map +1 -1
  66. package/build/components/inserter/quick-inserter.js +1 -1
  67. package/build/components/inserter/quick-inserter.js.map +1 -1
  68. package/build/components/inserter/tabs.native.js +4 -7
  69. package/build/components/inserter/tabs.native.js.map +1 -1
  70. package/build/components/inspector-controls/block-support-slot-container.js +1 -2
  71. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  72. package/build/components/inspector-controls/block-support-tools-panel.js +50 -22
  73. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  74. package/build/components/inspector-controls/fill.native.js +5 -3
  75. package/build/components/inspector-controls/fill.native.js.map +1 -1
  76. package/build/components/inspector-controls/groups.js +0 -2
  77. package/build/components/inspector-controls/groups.js.map +1 -1
  78. package/build/components/inspector-controls/slot.js +3 -1
  79. package/build/components/inspector-controls/slot.js.map +1 -1
  80. package/build/components/letter-spacing-control/index.js +6 -6
  81. package/build/components/letter-spacing-control/index.js.map +1 -1
  82. package/build/components/list-view/block-select-button.js +3 -23
  83. package/build/components/list-view/block-select-button.js.map +1 -1
  84. package/build/components/list-view/use-list-view-drop-zone.js +1 -1
  85. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  86. package/build/components/media-placeholder/index.js +0 -2
  87. package/build/components/media-placeholder/index.js.map +1 -1
  88. package/build/components/media-replace-flow/index.js +0 -2
  89. package/build/components/media-replace-flow/index.js.map +1 -1
  90. package/build/components/provider/use-block-sync.js +37 -10
  91. package/build/components/provider/use-block-sync.js.map +1 -1
  92. package/build/components/rich-text/file-paste-handler.js +1 -1
  93. package/build/components/rich-text/file-paste-handler.js.map +1 -1
  94. package/build/components/rich-text/use-input-rules.js +1 -3
  95. package/build/components/rich-text/use-input-rules.js.map +1 -1
  96. package/build/components/selection-scroll-into-view/index.js +1 -2
  97. package/build/components/selection-scroll-into-view/index.js.map +1 -1
  98. package/build/components/use-canvas-click-redirect/index.js +66 -0
  99. package/build/components/use-canvas-click-redirect/index.js.map +1 -0
  100. package/build/components/use-on-block-drop/index.js +4 -8
  101. package/build/components/use-on-block-drop/index.js.map +1 -1
  102. package/build/components/use-setting/index.js +7 -0
  103. package/build/components/use-setting/index.js.map +1 -1
  104. package/build/components/writing-flow/use-multi-selection.js +1 -3
  105. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  106. package/build/hooks/border-color.js +5 -63
  107. package/build/hooks/border-color.js.map +1 -1
  108. package/build/hooks/border-radius.js +0 -47
  109. package/build/hooks/border-radius.js.map +1 -1
  110. package/build/hooks/border-style.js +0 -41
  111. package/build/hooks/border-style.js.map +1 -1
  112. package/build/hooks/border-width.js +31 -70
  113. package/build/hooks/border-width.js.map +1 -1
  114. package/build/hooks/border.js +11 -81
  115. package/build/hooks/border.js.map +1 -1
  116. package/build/hooks/color.js +6 -5
  117. package/build/hooks/color.js.map +1 -1
  118. package/build/hooks/layout.js +2 -1
  119. package/build/hooks/layout.js.map +1 -1
  120. package/build/hooks/letter-spacing.js +1 -1
  121. package/build/hooks/letter-spacing.js.map +1 -1
  122. package/build/hooks/style.js +2 -1
  123. package/build/hooks/style.js.map +1 -1
  124. package/build/hooks/typography.js +1 -1
  125. package/build/hooks/typography.js.map +1 -1
  126. package/build/layouts/flex.js +9 -29
  127. package/build/layouts/flex.js.map +1 -1
  128. package/build/layouts/flow.js +10 -6
  129. package/build/layouts/flow.js.map +1 -1
  130. package/build/store/actions.js +5 -4
  131. package/build/store/actions.js.map +1 -1
  132. package/build/store/defaults.js +1 -5
  133. package/build/store/defaults.js.map +1 -1
  134. package/build/store/reducer.js +24 -1
  135. package/build/store/reducer.js.map +1 -1
  136. package/build/store/selectors.js +2 -2
  137. package/build/store/selectors.js.map +1 -1
  138. package/build/utils/get-paste-event-data.js +1 -1
  139. package/build/utils/get-paste-event-data.js.map +1 -1
  140. package/build/utils/parse-css-unit-to-px.js +1 -1
  141. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  142. package/build-module/components/block-caption/index.native.js +3 -13
  143. package/build-module/components/block-caption/index.native.js.map +1 -1
  144. package/build-module/components/block-inspector/index.js +33 -12
  145. package/build-module/components/block-inspector/index.js.map +1 -1
  146. package/build-module/components/block-list/block.js +1 -1
  147. package/build-module/components/block-list/block.js.map +1 -1
  148. package/build-module/components/block-list/block.native.js +2 -3
  149. package/build-module/components/block-list/block.native.js.map +1 -1
  150. package/build-module/components/block-list/use-block-props/index.js +1 -3
  151. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  152. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  153. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  154. package/build-module/components/block-list-appender/index.js +10 -3
  155. package/build-module/components/block-list-appender/index.js.map +1 -1
  156. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
  157. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  158. package/build-module/components/block-mover/button.js +2 -2
  159. package/build-module/components/block-mover/button.js.map +1 -1
  160. package/build-module/components/block-mover/index.js +2 -2
  161. package/build-module/components/block-mover/index.js.map +1 -1
  162. package/build-module/components/block-mover/index.native.js +2 -2
  163. package/build-module/components/block-mover/index.native.js.map +1 -1
  164. package/build-module/components/block-preview/auto.js +2 -10
  165. package/build-module/components/block-preview/auto.js.map +1 -1
  166. package/build-module/components/block-settings/container.native.js +1 -2
  167. package/build-module/components/block-settings/container.native.js.map +1 -1
  168. package/build-module/components/block-styles/index.js +133 -112
  169. package/build-module/components/block-styles/index.js.map +1 -1
  170. package/build-module/components/block-styles/utils.js +0 -34
  171. package/build-module/components/block-styles/utils.js.map +1 -1
  172. package/build-module/components/block-switcher/block-styles-menu.js +21 -3
  173. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  174. package/build-module/components/block-tools/back-compat.js +1 -2
  175. package/build-module/components/block-tools/back-compat.js.map +1 -1
  176. package/build-module/components/block-tools/block-selection-button.js +3 -3
  177. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  178. package/build-module/components/block-tools/index.js +9 -0
  179. package/build-module/components/block-tools/index.js.map +1 -1
  180. package/build-module/components/block-tools/insertion-point.js +1 -11
  181. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  182. package/build-module/components/button-block-appender/index.js +1 -2
  183. package/build-module/components/button-block-appender/index.js.map +1 -1
  184. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +13 -54
  185. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  186. package/build-module/components/default-block-appender/index.js +18 -15
  187. package/build-module/components/default-block-appender/index.js.map +1 -1
  188. package/build-module/components/default-style-picker/index.js +3 -17
  189. package/build-module/components/default-style-picker/index.js.map +1 -1
  190. package/build-module/components/font-appearance-control/index.js +12 -12
  191. package/build-module/components/font-appearance-control/index.js.map +1 -1
  192. package/build-module/components/gradients/use-gradient.js +4 -3
  193. package/build-module/components/gradients/use-gradient.js.map +1 -1
  194. package/build-module/components/iframe/index.js +6 -7
  195. package/build-module/components/iframe/index.js.map +1 -1
  196. package/build-module/components/index.js +1 -1
  197. package/build-module/components/index.js.map +1 -1
  198. package/build-module/components/inner-blocks/default-block-appender.js +4 -2
  199. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  200. package/build-module/components/inserter/hooks/use-insertion-point.js +2 -2
  201. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  202. package/build-module/components/inserter/index.js +2 -2
  203. package/build-module/components/inserter/index.js.map +1 -1
  204. package/build-module/components/inserter/index.native.js +4 -4
  205. package/build-module/components/inserter/index.native.js.map +1 -1
  206. package/build-module/components/inserter/quick-inserter.js +1 -1
  207. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  208. package/build-module/components/inserter/tabs.native.js +4 -7
  209. package/build-module/components/inserter/tabs.native.js.map +1 -1
  210. package/build-module/components/inspector-controls/block-support-slot-container.js +1 -2
  211. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  212. package/build-module/components/inspector-controls/block-support-tools-panel.js +50 -22
  213. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  214. package/build-module/components/inspector-controls/fill.native.js +5 -3
  215. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  216. package/build-module/components/inspector-controls/groups.js +0 -2
  217. package/build-module/components/inspector-controls/groups.js.map +1 -1
  218. package/build-module/components/inspector-controls/slot.js +3 -1
  219. package/build-module/components/inspector-controls/slot.js.map +1 -1
  220. package/build-module/components/letter-spacing-control/index.js +6 -6
  221. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  222. package/build-module/components/list-view/block-select-button.js +3 -22
  223. package/build-module/components/list-view/block-select-button.js.map +1 -1
  224. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
  225. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  226. package/build-module/components/media-placeholder/index.js +0 -2
  227. package/build-module/components/media-placeholder/index.js.map +1 -1
  228. package/build-module/components/media-replace-flow/index.js +0 -2
  229. package/build-module/components/media-replace-flow/index.js.map +1 -1
  230. package/build-module/components/provider/use-block-sync.js +41 -14
  231. package/build-module/components/provider/use-block-sync.js.map +1 -1
  232. package/build-module/components/rich-text/file-paste-handler.js +1 -1
  233. package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
  234. package/build-module/components/rich-text/use-input-rules.js +1 -2
  235. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  236. package/build-module/components/selection-scroll-into-view/index.js +1 -2
  237. package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
  238. package/build-module/components/use-canvas-click-redirect/index.js +54 -0
  239. package/build-module/components/use-canvas-click-redirect/index.js.map +1 -0
  240. package/build-module/components/use-on-block-drop/index.js +4 -8
  241. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  242. package/build-module/components/use-setting/index.js +7 -0
  243. package/build-module/components/use-setting/index.js.map +1 -1
  244. package/build-module/components/writing-flow/use-multi-selection.js +4 -3
  245. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  246. package/build-module/hooks/border-color.js +7 -61
  247. package/build-module/hooks/border-color.js.map +1 -1
  248. package/build-module/hooks/border-radius.js +0 -42
  249. package/build-module/hooks/border-radius.js.map +1 -1
  250. package/build-module/hooks/border-style.js +0 -36
  251. package/build-module/hooks/border-style.js.map +1 -1
  252. package/build-module/hooks/border-width.js +32 -66
  253. package/build-module/hooks/border-width.js.map +1 -1
  254. package/build-module/hooks/border.js +12 -80
  255. package/build-module/hooks/border.js.map +1 -1
  256. package/build-module/hooks/color.js +6 -5
  257. package/build-module/hooks/color.js.map +1 -1
  258. package/build-module/hooks/layout.js +2 -1
  259. package/build-module/hooks/layout.js.map +1 -1
  260. package/build-module/hooks/letter-spacing.js +1 -1
  261. package/build-module/hooks/letter-spacing.js.map +1 -1
  262. package/build-module/hooks/style.js +2 -1
  263. package/build-module/hooks/style.js.map +1 -1
  264. package/build-module/hooks/typography.js +1 -1
  265. package/build-module/hooks/typography.js.map +1 -1
  266. package/build-module/layouts/flex.js +9 -29
  267. package/build-module/layouts/flex.js.map +1 -1
  268. package/build-module/layouts/flow.js +10 -6
  269. package/build-module/layouts/flow.js.map +1 -1
  270. package/build-module/store/actions.js +5 -4
  271. package/build-module/store/actions.js.map +1 -1
  272. package/build-module/store/defaults.js +1 -5
  273. package/build-module/store/defaults.js.map +1 -1
  274. package/build-module/store/reducer.js +24 -1
  275. package/build-module/store/reducer.js.map +1 -1
  276. package/build-module/store/selectors.js +2 -2
  277. package/build-module/store/selectors.js.map +1 -1
  278. package/build-module/utils/get-paste-event-data.js +1 -1
  279. package/build-module/utils/get-paste-event-data.js.map +1 -1
  280. package/build-module/utils/parse-css-unit-to-px.js +1 -1
  281. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  282. package/build-style/style-rtl.css +180 -212
  283. package/build-style/style.css +180 -212
  284. package/package.json +27 -27
  285. package/src/components/block-caption/index.native.js +4 -22
  286. package/src/components/block-inspector/index.js +32 -13
  287. package/src/components/block-list/block.js +1 -1
  288. package/src/components/block-list/block.native.js +2 -2
  289. package/src/components/block-list/use-block-props/index.js +1 -3
  290. package/src/components/block-list/use-in-between-inserter.js +1 -1
  291. package/src/components/block-list-appender/index.js +21 -5
  292. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +2 -5
  293. package/src/components/block-mover/button.js +2 -6
  294. package/src/components/block-mover/index.js +2 -5
  295. package/src/components/block-mover/index.native.js +2 -5
  296. package/src/components/block-preview/auto.js +2 -7
  297. package/src/components/block-settings/container.native.js +0 -1
  298. package/src/components/block-styles/index.js +145 -125
  299. package/src/components/block-styles/style.scss +51 -59
  300. package/src/components/block-styles/test/{utils.js → index.js} +1 -60
  301. package/src/components/block-styles/utils.js +0 -39
  302. package/src/components/block-switcher/block-styles-menu.js +38 -3
  303. package/src/components/block-tools/back-compat.js +0 -1
  304. package/src/components/block-tools/block-selection-button.js +3 -9
  305. package/src/components/block-tools/index.js +11 -0
  306. package/src/components/block-tools/insertion-point.js +1 -10
  307. package/src/components/border-style-control/style.scss +1 -0
  308. package/src/components/button-block-appender/index.js +0 -1
  309. package/src/components/colors-gradients/panel-color-gradient-settings.js +19 -75
  310. package/src/components/colors-gradients/style.scss +5 -42
  311. package/src/components/default-block-appender/index.js +24 -17
  312. package/src/components/default-block-appender/style.scss +0 -4
  313. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +24 -12
  314. package/src/components/default-block-appender/test/index.js +14 -4
  315. package/src/components/default-style-picker/index.js +6 -18
  316. package/src/components/font-appearance-control/index.js +12 -12
  317. package/src/components/gradients/use-gradient.js +7 -7
  318. package/src/components/iframe/index.js +6 -13
  319. package/src/components/index.js +1 -1
  320. package/src/components/inner-blocks/README.md +0 -2
  321. package/src/components/inner-blocks/default-block-appender.js +7 -2
  322. package/src/components/inserter/hooks/use-insertion-point.js +2 -9
  323. package/src/components/inserter/index.js +2 -2
  324. package/src/components/inserter/index.native.js +4 -7
  325. package/src/components/inserter/quick-inserter.js +1 -1
  326. package/src/components/inserter/tabs.native.js +4 -5
  327. package/src/components/inspector-controls/block-support-slot-container.js +1 -3
  328. package/src/components/inspector-controls/block-support-tools-panel.js +57 -21
  329. package/src/components/inspector-controls/fill.native.js +3 -4
  330. package/src/components/inspector-controls/groups.js +0 -2
  331. package/src/components/inspector-controls/slot.js +7 -2
  332. package/src/components/letter-spacing-control/index.js +6 -6
  333. package/src/components/link-control/README.md +1 -1
  334. package/src/components/link-control/test/index.js +0 -2
  335. package/src/components/list-view/block-select-button.js +1 -20
  336. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  337. package/src/components/media-placeholder/index.js +0 -2
  338. package/src/components/media-replace-flow/index.js +0 -2
  339. package/src/components/provider/use-block-sync.js +45 -11
  340. package/src/components/rich-text/file-paste-handler.js +1 -3
  341. package/src/components/rich-text/use-input-rules.js +1 -2
  342. package/src/components/selection-scroll-into-view/index.js +0 -1
  343. package/src/components/url-input/README.md +0 -5
  344. package/src/components/use-canvas-click-redirect/index.js +57 -0
  345. package/src/components/use-on-block-drop/index.js +4 -11
  346. package/src/components/use-setting/index.js +9 -0
  347. package/src/components/writing-flow/use-multi-selection.js +9 -12
  348. package/src/hooks/border-color.js +3 -55
  349. package/src/hooks/border-radius.js +0 -32
  350. package/src/hooks/border-style.js +0 -26
  351. package/src/hooks/border-width.js +32 -56
  352. package/src/hooks/border.js +20 -115
  353. package/src/hooks/border.scss +17 -3
  354. package/src/hooks/color.js +13 -14
  355. package/src/hooks/layout.js +1 -0
  356. package/src/hooks/letter-spacing.js +1 -1
  357. package/src/hooks/style.js +2 -1
  358. package/src/hooks/test/style.js +0 -2
  359. package/src/hooks/typography.js +1 -1
  360. package/src/layouts/flex.js +8 -31
  361. package/src/layouts/flow.js +8 -6
  362. package/src/store/actions.js +5 -5
  363. package/src/store/defaults.js +0 -2
  364. package/src/store/reducer.js +23 -1
  365. package/src/store/selectors.js +2 -2
  366. package/src/store/test/reducer.js +35 -0
  367. package/src/store/test/selectors.js +1 -1
  368. package/src/style.scss +3 -4
  369. package/src/utils/get-paste-event-data.js +1 -1
  370. package/src/utils/parse-css-unit-to-px.js +1 -1
  371. package/src/utils/test/parse-css-unit-to-px.js +0 -1
  372. package/tsconfig.tsbuildinfo +1 -1
  373. package/build/components/block-styles/menu-items.js +0 -63
  374. package/build/components/block-styles/menu-items.js.map +0 -1
  375. package/build/components/block-styles/preview-panel.js +0 -45
  376. package/build/components/block-styles/preview-panel.js.map +0 -1
  377. package/build/components/block-styles/use-styles-for-block.js +0 -119
  378. package/build/components/block-styles/use-styles-for-block.js.map +0 -1
  379. package/build/components/rich-text/prevent-event-discovery.js +0 -33
  380. package/build/components/rich-text/prevent-event-discovery.js.map +0 -1
  381. package/build/components/use-display-block-controls/index.native.js +0 -45
  382. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  383. package/build-module/components/block-styles/menu-items.js +0 -50
  384. package/build-module/components/block-styles/menu-items.js.map +0 -1
  385. package/build-module/components/block-styles/preview-panel.js +0 -35
  386. package/build-module/components/block-styles/preview-panel.js.map +0 -1
  387. package/build-module/components/block-styles/use-styles-for-block.js +0 -107
  388. package/build-module/components/block-styles/use-styles-for-block.js.map +0 -1
  389. package/build-module/components/rich-text/prevent-event-discovery.js +0 -25
  390. package/build-module/components/rich-text/prevent-event-discovery.js.map +0 -1
  391. package/build-module/components/use-display-block-controls/index.native.js +0 -34
  392. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  393. package/src/components/block-styles/menu-items.js +0 -49
  394. package/src/components/block-styles/preview-panel.js +0 -36
  395. package/src/components/block-styles/use-styles-for-block.js +0 -99
  396. package/src/components/rich-text/prevent-event-discovery.js +0 -23
  397. package/src/components/use-display-block-controls/index.native.js +0 -38
  398. package/src/components/writing-flow/test/use-multi-selection.js +0 -36
  399. package/src/hooks/dimensions.scss +0 -5
@@ -75,7 +75,6 @@ export function MediaPlaceholder( {
75
75
  onDoubleClick,
76
76
  onFilesPreUpload = noop,
77
77
  onHTMLDrop = noop,
78
- onClose = noop,
79
78
  children,
80
79
  mediaLibraryButton,
81
80
  placeholder,
@@ -329,7 +328,6 @@ export function MediaPlaceholder( {
329
328
  gallery={ multiple && onlyAllowsImages() }
330
329
  multiple={ multiple }
331
330
  onSelect={ onSelect }
332
- onClose={ onClose }
333
331
  allowedTypes={ allowedTypes }
334
332
  value={
335
333
  Array.isArray( value )
@@ -39,7 +39,6 @@ const MediaReplaceFlow = ( {
39
39
  onSelect,
40
40
  onSelectURL,
41
41
  onFilesUpload = noop,
42
- onCloseModal = noop,
43
42
  name = __( 'Replace' ),
44
43
  createNotice,
45
44
  removeNotice,
@@ -137,7 +136,6 @@ const MediaReplaceFlow = ( {
137
136
  value={ mediaId }
138
137
  onSelect={ ( media ) => selectMedia( media ) }
139
138
  allowedTypes={ allowedTypes }
140
- onClose={ onCloseModal }
141
139
  render={ ( { open } ) => (
142
140
  <MenuItem icon={ mediaIcon } onClick={ open }>
143
141
  { __( 'Open Media Library' ) }
@@ -7,7 +7,7 @@ import { last, noop } from 'lodash';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useEffect, useRef } from '@wordpress/element';
10
- import { useRegistry } from '@wordpress/data';
10
+ import { useRegistry, useSelect } from '@wordpress/data';
11
11
  import { cloneBlock } from '@wordpress/blocks';
12
12
 
13
13
  /**
@@ -83,6 +83,15 @@ export default function useBlockSync( {
83
83
  __unstableMarkNextChangeAsNotPersistent,
84
84
  } = registry.dispatch( blockEditorStore );
85
85
  const { getBlockName, getBlocks } = registry.select( blockEditorStore );
86
+ const isControlled = useSelect(
87
+ ( select ) => {
88
+ return (
89
+ ! clientId ||
90
+ select( blockEditorStore ).areInnerBlocksControlled( clientId )
91
+ );
92
+ },
93
+ [ clientId ]
94
+ );
86
95
 
87
96
  const pendingChanges = useRef( { incoming: null, outgoing: [] } );
88
97
  const subscribed = useRef( false );
@@ -97,15 +106,21 @@ export default function useBlockSync( {
97
106
  // and so it would already be persisted.
98
107
  __unstableMarkNextChangeAsNotPersistent();
99
108
  if ( clientId ) {
100
- setHasControlledInnerBlocks( clientId, true );
101
- __unstableMarkNextChangeAsNotPersistent();
102
- const storeBlocks = controlledBlocks.map( ( block ) =>
103
- cloneBlock( block )
104
- );
105
- if ( subscribed.current ) {
106
- pendingChanges.current.incoming = storeBlocks;
107
- }
108
- replaceInnerBlocks( clientId, storeBlocks );
109
+ // It is important to batch here because otherwise,
110
+ // as soon as `setHasControlledInnerBlocks` is called
111
+ // the effect to restore might be triggered
112
+ // before the actual blocks get set properly in state.
113
+ registry.batch( () => {
114
+ setHasControlledInnerBlocks( clientId, true );
115
+ const storeBlocks = controlledBlocks.map( ( block ) =>
116
+ cloneBlock( block )
117
+ );
118
+ if ( subscribed.current ) {
119
+ pendingChanges.current.incoming = storeBlocks;
120
+ }
121
+ __unstableMarkNextChangeAsNotPersistent();
122
+ replaceInnerBlocks( clientId, storeBlocks );
123
+ } );
109
124
  } else {
110
125
  if ( subscribed.current ) {
111
126
  pendingChanges.current.incoming = controlledBlocks;
@@ -157,6 +172,15 @@ export default function useBlockSync( {
157
172
  }
158
173
  }, [ controlledBlocks, clientId ] );
159
174
 
175
+ useEffect( () => {
176
+ // When the block becomes uncontrolled, it means its inner state has been reset
177
+ // we need to take the blocks again from the external value property.
178
+ if ( ! isControlled ) {
179
+ pendingChanges.current.outgoing = [];
180
+ setControlledBlocks();
181
+ }
182
+ }, [ isControlled ] );
183
+
160
184
  useEffect( () => {
161
185
  const {
162
186
  getSelectionStart,
@@ -164,6 +188,7 @@ export default function useBlockSync( {
164
188
  getSelectedBlocksInitialCaretPosition,
165
189
  isLastBlockChangePersistent,
166
190
  __unstableIsLastBlockChangeIgnored,
191
+ areInnerBlocksControlled,
167
192
  } = registry.select( blockEditorStore );
168
193
 
169
194
  let blocks = getBlocks( clientId );
@@ -182,8 +207,17 @@ export default function useBlockSync( {
182
207
  if ( clientId !== null && getBlockName( clientId ) === null )
183
208
  return;
184
209
 
185
- const newIsPersistent = isLastBlockChangePersistent();
210
+ // When RESET_BLOCKS on parent blocks get called, the controlled blocks
211
+ // can reset to uncontrolled, in these situations, it means we need to populate
212
+ // the blocks again from the external blocks (the value property here)
213
+ // and we should stop triggering onChange
214
+ const isStillControlled =
215
+ ! clientId || areInnerBlocksControlled( clientId );
216
+ if ( ! isStillControlled ) {
217
+ return;
218
+ }
186
219
 
220
+ const newIsPersistent = isLastBlockChangePersistent();
187
221
  const newBlocks = getBlocks( clientId );
188
222
  const areBlocksDifferent = newBlocks !== blocks;
189
223
  blocks = newBlocks;
@@ -5,9 +5,7 @@ import { createBlobURL } from '@wordpress/blob';
5
5
 
6
6
  export function filePasteHandler( files ) {
7
7
  return files
8
- .filter( ( { type } ) =>
9
- /^image\/(?:jpe?g|png|gif|webp)$/.test( type )
10
- )
8
+ .filter( ( { type } ) => /^image\/(?:jpe?g|png|gif)$/.test( type ) )
11
9
  .map( ( file ) => `<img src="${ createBlobURL( file ) }">` )
12
10
  .join( '' );
13
11
  }
@@ -11,7 +11,6 @@ import { useDispatch } from '@wordpress/data';
11
11
  * Internal dependencies
12
12
  */
13
13
  import { store as blockEditorStore } from '../../store';
14
- import { preventEventDiscovery } from './prevent-event-discovery';
15
14
 
16
15
  export function useInputRules( props ) {
17
16
  const {
@@ -86,7 +85,7 @@ export function useInputRules( props ) {
86
85
 
87
86
  return accumlator;
88
87
  },
89
- preventEventDiscovery( value )
88
+ value
90
89
  );
91
90
 
92
91
  if ( transformed !== value ) {
@@ -12,7 +12,6 @@ import deprecated from '@wordpress/deprecated';
12
12
  export function MultiSelectScrollIntoView() {
13
13
  deprecated( 'wp.blockEditor.MultiSelectScrollIntoView', {
14
14
  hint: 'This behaviour is now built-in.',
15
- since: '5.8',
16
15
  } );
17
16
  return null;
18
17
  }
@@ -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
- }