@wordpress/block-editor 14.9.0 → 14.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +40 -0
  4. package/build/components/audio-player/index.native.js +1 -1
  5. package/build/components/audio-player/index.native.js.map +1 -1
  6. package/build/components/background-image-control/index.js +4 -0
  7. package/build/components/background-image-control/index.js.map +1 -1
  8. package/build/components/block-alignment-matrix-control/index.js +32 -0
  9. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  10. package/build/components/block-card/index.js +45 -8
  11. package/build/components/block-card/index.js.map +1 -1
  12. package/build/components/block-edit/edit.js +147 -10
  13. package/build/components/block-edit/edit.js.map +1 -1
  14. package/build/components/block-list/index.js +1 -2
  15. package/build/components/block-list/index.js.map +1 -1
  16. package/build/components/block-list/use-block-props/index.js +2 -2
  17. package/build/components/block-list/use-block-props/index.js.map +1 -1
  18. package/build/components/block-list/zoom-out-separator.js +20 -3
  19. package/build/components/block-list/zoom-out-separator.js.map +1 -1
  20. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -8
  21. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  22. package/build/components/block-styles/utils.js +3 -3
  23. package/build/components/block-styles/utils.js.map +1 -1
  24. package/build/components/block-tools/zoom-out-mode-inserters.js +19 -6
  25. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  26. package/build/components/button-block-appender/index.js +1 -5
  27. package/build/components/button-block-appender/index.js.map +1 -1
  28. package/build/components/child-layout-control/index.js +6 -0
  29. package/build/components/child-layout-control/index.js.map +1 -1
  30. package/build/components/colors-gradients/dropdown.js +51 -11
  31. package/build/components/colors-gradients/dropdown.js.map +1 -1
  32. package/build/components/contrast-checker/index.native.js +1 -1
  33. package/build/components/contrast-checker/index.native.js.map +1 -1
  34. package/build/components/date-format-picker/index.js +7 -16
  35. package/build/components/date-format-picker/index.js.map +1 -1
  36. package/build/components/font-appearance-control/index.js +9 -0
  37. package/build/components/font-appearance-control/index.js.map +1 -1
  38. package/build/components/font-family/index.js +10 -1
  39. package/build/components/font-family/index.js.map +1 -1
  40. package/build/components/global-styles/color-panel.js +3 -0
  41. package/build/components/global-styles/color-panel.js.map +1 -1
  42. package/build/components/global-styles/typography-utils.js +1 -1
  43. package/build/components/global-styles/typography-utils.js.map +1 -1
  44. package/build/components/global-styles/use-global-styles-output.js +2 -2
  45. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  46. package/build/components/grid/grid-visualizer.js +9 -0
  47. package/build/components/grid/grid-visualizer.js.map +1 -1
  48. package/build/components/grid/utils.js +12 -1
  49. package/build/components/grid/utils.js.map +1 -1
  50. package/build/components/iframe/index.js +1 -1
  51. package/build/components/iframe/index.js.map +1 -1
  52. package/build/components/inner-blocks/use-inner-block-template-sync.js +11 -11
  53. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  54. package/build/components/inserter/block-patterns-explorer/index.js +1 -1
  55. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  56. package/build/components/inserter/block-patterns-tab/index.js +1 -1
  57. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  58. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  59. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  60. package/build/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  61. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  62. package/build/components/inserter/category-tabs/index.js +1 -2
  63. package/build/components/inserter/category-tabs/index.js.map +1 -1
  64. package/build/components/inserter/index.js +6 -15
  65. package/build/components/inserter/index.js.map +1 -1
  66. package/build/components/inserter/quick-inserter.js +2 -13
  67. package/build/components/inserter/quick-inserter.js.map +1 -1
  68. package/build/components/keyboard-shortcuts/index.js +2 -2
  69. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  70. package/build/components/line-height-control/index.js +9 -0
  71. package/build/components/line-height-control/index.js.map +1 -1
  72. package/build/components/media-placeholder/index.js +2 -2
  73. package/build/components/media-placeholder/index.js.map +1 -1
  74. package/build/components/media-replace-flow/index.js +26 -26
  75. package/build/components/media-replace-flow/index.js.map +1 -1
  76. package/build/components/plain-text/index.js +34 -0
  77. package/build/components/plain-text/index.js.map +1 -1
  78. package/build/components/provider/index.js +61 -5
  79. package/build/components/provider/index.js.map +1 -1
  80. package/build/components/provider/use-media-upload-settings.js +28 -0
  81. package/build/components/provider/use-media-upload-settings.js.map +1 -0
  82. package/build/components/resolution-tool/index.js +3 -1
  83. package/build/components/resolution-tool/index.js.map +1 -1
  84. package/build/components/responsive-block-control/index.js +1 -1
  85. package/build/components/responsive-block-control/index.js.map +1 -1
  86. package/build/components/rich-text/event-listeners/delete.js +7 -1
  87. package/build/components/rich-text/event-listeners/delete.js.map +1 -1
  88. package/build/components/rich-text/index.js +2 -2
  89. package/build/components/rich-text/index.js.map +1 -1
  90. package/build/components/use-block-drop-zone/index.js +2 -1
  91. package/build/components/use-block-drop-zone/index.js.map +1 -1
  92. package/build/hooks/background.js +2 -0
  93. package/build/hooks/background.js.map +1 -1
  94. package/build/hooks/block-bindings.js +15 -14
  95. package/build/hooks/block-bindings.js.map +1 -1
  96. package/build/hooks/border.js +3 -3
  97. package/build/hooks/border.js.map +1 -1
  98. package/build/hooks/color.js +1 -1
  99. package/build/hooks/color.js.map +1 -1
  100. package/build/hooks/dimensions.js +2 -2
  101. package/build/hooks/dimensions.js.map +1 -1
  102. package/build/hooks/font-family.js +1 -1
  103. package/build/hooks/font-family.js.map +1 -1
  104. package/build/hooks/gap.js +2 -2
  105. package/build/hooks/gap.js.map +1 -1
  106. package/build/hooks/index.js +0 -1
  107. package/build/hooks/index.js.map +1 -1
  108. package/build/hooks/index.native.js +7 -0
  109. package/build/hooks/index.native.js.map +1 -1
  110. package/build/hooks/style.js +7 -7
  111. package/build/hooks/style.js.map +1 -1
  112. package/build/hooks/supports.js +7 -7
  113. package/build/hooks/supports.js.map +1 -1
  114. package/build/hooks/typography.js +6 -6
  115. package/build/hooks/typography.js.map +1 -1
  116. package/build/hooks/use-zoom-out.js +12 -1
  117. package/build/hooks/use-zoom-out.js.map +1 -1
  118. package/build/hooks/utils.js +1 -1
  119. package/build/hooks/utils.js.map +1 -1
  120. package/build/store/private-actions.js +1 -1
  121. package/build/store/private-actions.js.map +1 -1
  122. package/build/store/private-selectors.js +11 -1
  123. package/build/store/private-selectors.js.map +1 -1
  124. package/build/store/reducer.js +93 -12
  125. package/build/store/reducer.js.map +1 -1
  126. package/build/store/selectors.js +6 -8
  127. package/build/store/selectors.js.map +1 -1
  128. package/build/utils/block-bindings.js +95 -0
  129. package/build/utils/block-bindings.js.map +1 -1
  130. package/build-module/components/audio-player/index.native.js +2 -2
  131. package/build-module/components/audio-player/index.native.js.map +1 -1
  132. package/build-module/components/background-image-control/index.js +5 -1
  133. package/build-module/components/background-image-control/index.js.map +1 -1
  134. package/build-module/components/block-alignment-matrix-control/index.js +32 -0
  135. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  136. package/build-module/components/block-card/index.js +45 -8
  137. package/build-module/components/block-card/index.js.map +1 -1
  138. package/build-module/components/block-edit/edit.js +148 -11
  139. package/build-module/components/block-edit/edit.js.map +1 -1
  140. package/build-module/components/block-list/index.js +2 -3
  141. package/build-module/components/block-list/index.js.map +1 -1
  142. package/build-module/components/block-list/use-block-props/index.js +1 -1
  143. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  144. package/build-module/components/block-list/zoom-out-separator.js +20 -3
  145. package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
  146. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -8
  147. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  148. package/build-module/components/block-styles/utils.js +3 -3
  149. package/build-module/components/block-styles/utils.js.map +1 -1
  150. package/build-module/components/block-tools/zoom-out-mode-inserters.js +19 -6
  151. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  152. package/build-module/components/button-block-appender/index.js +2 -6
  153. package/build-module/components/button-block-appender/index.js.map +1 -1
  154. package/build-module/components/child-layout-control/index.js +7 -1
  155. package/build-module/components/child-layout-control/index.js.map +1 -1
  156. package/build-module/components/colors-gradients/dropdown.js +51 -11
  157. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  158. package/build-module/components/contrast-checker/index.native.js +2 -2
  159. package/build-module/components/contrast-checker/index.native.js.map +1 -1
  160. package/build-module/components/date-format-picker/index.js +7 -16
  161. package/build-module/components/date-format-picker/index.js.map +1 -1
  162. package/build-module/components/font-appearance-control/index.js +8 -0
  163. package/build-module/components/font-appearance-control/index.js.map +1 -1
  164. package/build-module/components/font-family/index.js +10 -1
  165. package/build-module/components/font-family/index.js.map +1 -1
  166. package/build-module/components/global-styles/color-panel.js +3 -0
  167. package/build-module/components/global-styles/color-panel.js.map +1 -1
  168. package/build-module/components/global-styles/typography-utils.js +1 -1
  169. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  170. package/build-module/components/global-styles/use-global-styles-output.js +2 -2
  171. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  172. package/build-module/components/grid/grid-visualizer.js +9 -0
  173. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  174. package/build-module/components/grid/utils.js +12 -1
  175. package/build-module/components/grid/utils.js.map +1 -1
  176. package/build-module/components/iframe/index.js +1 -1
  177. package/build-module/components/iframe/index.js.map +1 -1
  178. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +12 -12
  179. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  180. package/build-module/components/inserter/block-patterns-explorer/index.js +1 -1
  181. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  182. package/build-module/components/inserter/block-patterns-tab/index.js +1 -1
  183. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  184. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  185. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  186. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  187. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  188. package/build-module/components/inserter/category-tabs/index.js +1 -2
  189. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  190. package/build-module/components/inserter/index.js +6 -15
  191. package/build-module/components/inserter/index.js.map +1 -1
  192. package/build-module/components/inserter/quick-inserter.js +2 -13
  193. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  194. package/build-module/components/keyboard-shortcuts/index.js +2 -2
  195. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  196. package/build-module/components/line-height-control/index.js +8 -0
  197. package/build-module/components/line-height-control/index.js.map +1 -1
  198. package/build-module/components/media-placeholder/index.js +3 -3
  199. package/build-module/components/media-placeholder/index.js.map +1 -1
  200. package/build-module/components/media-replace-flow/index.js +28 -28
  201. package/build-module/components/media-replace-flow/index.js.map +1 -1
  202. package/build-module/components/plain-text/index.js +34 -0
  203. package/build-module/components/plain-text/index.js.map +1 -1
  204. package/build-module/components/provider/index.js +62 -5
  205. package/build-module/components/provider/index.js.map +1 -1
  206. package/build-module/components/provider/use-media-upload-settings.js +22 -0
  207. package/build-module/components/provider/use-media-upload-settings.js.map +1 -0
  208. package/build-module/components/resolution-tool/index.js +3 -1
  209. package/build-module/components/resolution-tool/index.js.map +1 -1
  210. package/build-module/components/responsive-block-control/index.js +1 -1
  211. package/build-module/components/responsive-block-control/index.js.map +1 -1
  212. package/build-module/components/rich-text/event-listeners/delete.js +7 -1
  213. package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
  214. package/build-module/components/rich-text/index.js +1 -1
  215. package/build-module/components/rich-text/index.js.map +1 -1
  216. package/build-module/components/use-block-drop-zone/index.js +2 -1
  217. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  218. package/build-module/hooks/background.js +2 -0
  219. package/build-module/hooks/background.js.map +1 -1
  220. package/build-module/hooks/block-bindings.js +13 -12
  221. package/build-module/hooks/block-bindings.js.map +1 -1
  222. package/build-module/hooks/border.js +3 -3
  223. package/build-module/hooks/border.js.map +1 -1
  224. package/build-module/hooks/color.js +1 -1
  225. package/build-module/hooks/color.js.map +1 -1
  226. package/build-module/hooks/dimensions.js +2 -2
  227. package/build-module/hooks/dimensions.js.map +1 -1
  228. package/build-module/hooks/font-family.js +1 -1
  229. package/build-module/hooks/font-family.js.map +1 -1
  230. package/build-module/hooks/gap.js +2 -2
  231. package/build-module/hooks/gap.js.map +1 -1
  232. package/build-module/hooks/index.js +0 -1
  233. package/build-module/hooks/index.js.map +1 -1
  234. package/build-module/hooks/index.native.js +1 -0
  235. package/build-module/hooks/index.native.js.map +1 -1
  236. package/build-module/hooks/style.js +7 -7
  237. package/build-module/hooks/style.js.map +1 -1
  238. package/build-module/hooks/supports.js +7 -7
  239. package/build-module/hooks/supports.js.map +1 -1
  240. package/build-module/hooks/typography.js +6 -6
  241. package/build-module/hooks/typography.js.map +1 -1
  242. package/build-module/hooks/use-zoom-out.js +12 -2
  243. package/build-module/hooks/use-zoom-out.js.map +1 -1
  244. package/build-module/hooks/utils.js +1 -1
  245. package/build-module/hooks/utils.js.map +1 -1
  246. package/build-module/store/private-actions.js +1 -1
  247. package/build-module/store/private-actions.js.map +1 -1
  248. package/build-module/store/private-selectors.js +11 -1
  249. package/build-module/store/private-selectors.js.map +1 -1
  250. package/build-module/store/reducer.js +93 -12
  251. package/build-module/store/reducer.js.map +1 -1
  252. package/build-module/store/selectors.js +6 -8
  253. package/build-module/store/selectors.js.map +1 -1
  254. package/build-module/utils/block-bindings.js +90 -0
  255. package/build-module/utils/block-bindings.js.map +1 -1
  256. package/build-style/style-rtl.css +27 -9
  257. package/build-style/style.css +27 -9
  258. package/package.json +33 -33
  259. package/src/components/audio-player/index.native.js +2 -2
  260. package/src/components/background-image-control/index.js +4 -0
  261. package/src/components/background-image-control/style.scss +4 -2
  262. package/src/components/block-alignment-matrix-control/README.md +29 -6
  263. package/src/components/block-alignment-matrix-control/index.js +31 -0
  264. package/src/components/block-alignment-matrix-control/stories/index.story.js +78 -0
  265. package/src/components/block-card/README.md +7 -0
  266. package/src/components/block-card/index.js +41 -12
  267. package/src/components/block-card/stories/index.story.js +79 -0
  268. package/src/components/block-card/style.scss +9 -1
  269. package/src/components/block-edit/edit.js +218 -11
  270. package/src/components/block-list/index.js +2 -7
  271. package/src/components/block-list/use-block-props/index.js +1 -1
  272. package/src/components/block-list/zoom-out-separator.js +30 -0
  273. package/src/components/block-settings-menu/block-settings-dropdown.js +17 -20
  274. package/src/components/block-styles/utils.js +3 -3
  275. package/src/components/block-title/stories/index.story.js +76 -0
  276. package/src/components/block-tools/style.scss +1 -0
  277. package/src/components/block-tools/zoom-out-mode-inserters.js +21 -3
  278. package/src/components/border-radius-control/README.md +59 -0
  279. package/src/components/border-radius-control/stories/index.story.js +58 -0
  280. package/src/components/button-block-appender/index.js +2 -7
  281. package/src/components/child-layout-control/index.js +14 -0
  282. package/src/components/colors-gradients/dropdown.js +57 -8
  283. package/src/components/colors-gradients/style.scss +5 -0
  284. package/src/components/contrast-checker/index.native.js +2 -2
  285. package/src/components/contrast-checker/stories/index.story.js +117 -0
  286. package/src/components/date-format-picker/README.md +6 -13
  287. package/src/components/date-format-picker/index.js +10 -17
  288. package/src/components/date-format-picker/stories/index.story.js +69 -0
  289. package/src/components/date-format-picker/style.scss +3 -1
  290. package/src/components/default-block-appender/content.scss +1 -0
  291. package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +2 -1
  292. package/src/components/dimensions-tool/stories/index.story.js +2 -1
  293. package/src/components/dimensions-tool/stories/scale-tool.story.js +2 -1
  294. package/src/components/dimensions-tool/stories/width-height-tool.story.js +2 -1
  295. package/src/components/font-appearance-control/index.js +15 -0
  296. package/src/components/font-family/README.md +1 -0
  297. package/src/components/font-family/index.js +17 -1
  298. package/src/components/font-family/stories/index.story.js +1 -0
  299. package/src/components/global-styles/color-panel.js +3 -0
  300. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  301. package/src/components/global-styles/typography-utils.js +1 -1
  302. package/src/components/global-styles/use-global-styles-output.js +2 -2
  303. package/src/components/grid/grid-visualizer.js +11 -0
  304. package/src/components/grid/utils.js +19 -1
  305. package/src/components/iframe/index.js +1 -1
  306. package/src/components/inner-blocks/use-inner-block-template-sync.js +17 -10
  307. package/src/components/inserter/block-patterns-explorer/index.js +2 -3
  308. package/src/components/inserter/block-patterns-tab/index.js +3 -1
  309. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  310. package/src/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  311. package/src/components/inserter/category-tabs/index.js +3 -2
  312. package/src/components/inserter/index.js +1 -13
  313. package/src/components/inserter/quick-inserter.js +2 -25
  314. package/src/components/keyboard-shortcuts/index.js +2 -2
  315. package/src/components/line-height-control/README.md +1 -0
  316. package/src/components/line-height-control/index.js +12 -0
  317. package/src/components/line-height-control/stories/index.story.js +1 -0
  318. package/src/components/line-height-control/test/index.js +7 -1
  319. package/src/components/list-view/style.scss +10 -5
  320. package/src/components/media-placeholder/index.js +3 -3
  321. package/src/components/media-replace-flow/README.md +7 -0
  322. package/src/components/media-replace-flow/index.js +28 -36
  323. package/src/components/media-replace-flow/style.scss +6 -6
  324. package/src/components/plain-text/README.md +2 -2
  325. package/src/components/plain-text/index.js +34 -0
  326. package/src/components/plain-text/stories/index.story.js +75 -0
  327. package/src/components/provider/index.js +81 -4
  328. package/src/components/provider/use-media-upload-settings.js +25 -0
  329. package/src/components/resolution-tool/index.js +2 -0
  330. package/src/components/resolution-tool/stories/index.story.js +36 -8
  331. package/src/components/responsive-block-control/index.js +1 -1
  332. package/src/components/rich-text/event-listeners/delete.js +6 -1
  333. package/src/components/rich-text/index.js +1 -1
  334. package/src/components/text-alignment-control/README.md +49 -0
  335. package/src/components/text-alignment-control/stories/index.story.js +56 -18
  336. package/src/components/text-decoration-control/README.md +0 -1
  337. package/src/components/text-decoration-control/stories/index.story.js +51 -16
  338. package/src/components/text-transform-control/README.md +3 -4
  339. package/src/components/text-transform-control/stories/index.story.js +53 -16
  340. package/src/components/use-block-drop-zone/index.js +8 -1
  341. package/src/components/warning/stories/index.story.js +86 -0
  342. package/src/hooks/background.js +6 -0
  343. package/src/hooks/block-bindings.js +17 -18
  344. package/src/hooks/border.js +9 -3
  345. package/src/hooks/color.js +1 -1
  346. package/src/hooks/dimensions.js +2 -2
  347. package/src/hooks/font-family.js +1 -1
  348. package/src/hooks/gap.js +2 -2
  349. package/src/hooks/index.js +0 -1
  350. package/src/hooks/index.native.js +1 -0
  351. package/src/hooks/style.js +13 -7
  352. package/src/hooks/supports.js +7 -7
  353. package/src/hooks/test/style.js +2 -1
  354. package/src/hooks/typography.js +6 -6
  355. package/src/hooks/use-zoom-out.js +10 -2
  356. package/src/hooks/utils.js +1 -1
  357. package/src/store/private-actions.js +1 -0
  358. package/src/store/private-selectors.js +15 -5
  359. package/src/store/reducer.js +112 -19
  360. package/src/store/selectors.js +6 -8
  361. package/src/store/test/private-selectors.js +53 -9
  362. package/src/store/test/reducer.js +172 -166
  363. package/src/store/test/selectors.js +23 -0
  364. package/src/utils/block-bindings.js +95 -0
  365. package/tsconfig.json +2 -5
  366. package/build/hooks/use-bindings-attributes.js +0 -262
  367. package/build/hooks/use-bindings-attributes.js.map +0 -1
  368. package/build-module/hooks/use-bindings-attributes.js +0 -253
  369. package/build-module/hooks/use-bindings-attributes.js.map +0 -1
  370. package/src/hooks/use-bindings-attributes.js +0 -322
@@ -9,10 +9,100 @@ import { useDispatch, useRegistry } from '@wordpress/data';
9
9
  */
10
10
  import { store as blockEditorStore } from '../store';
11
11
  import { useBlockEditContext } from '../components/block-edit';
12
+ const DEFAULT_ATTRIBUTE = '__default';
13
+ const PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides';
14
+ const BLOCK_BINDINGS_ALLOWED_BLOCKS = {
15
+ 'core/paragraph': ['content'],
16
+ 'core/heading': ['content'],
17
+ 'core/image': ['id', 'url', 'title', 'alt'],
18
+ 'core/button': ['url', 'text', 'linkTarget', 'rel']
19
+ };
20
+
21
+ /**
22
+ * Checks if the given object is empty.
23
+ *
24
+ * @param {?Object} object The object to check.
25
+ *
26
+ * @return {boolean} Whether the object is empty.
27
+ */
12
28
  function isObjectEmpty(object) {
13
29
  return !object || Object.keys(object).length === 0;
14
30
  }
15
31
 
32
+ /**
33
+ * Based on the given block name, checks if it is possible to bind the block.
34
+ *
35
+ * @param {string} blockName The name of the block.
36
+ *
37
+ * @return {boolean} Whether it is possible to bind the block to sources.
38
+ */
39
+ export function canBindBlock(blockName) {
40
+ return blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;
41
+ }
42
+
43
+ /**
44
+ * Based on the given block name and attribute name, checks if it is possible to bind the block attribute.
45
+ *
46
+ * @param {string} blockName The name of the block.
47
+ * @param {string} attributeName The name of attribute.
48
+ *
49
+ * @return {boolean} Whether it is possible to bind the block attribute.
50
+ */
51
+ export function canBindAttribute(blockName, attributeName) {
52
+ return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName);
53
+ }
54
+
55
+ /**
56
+ * Gets the bindable attributes for a given block.
57
+ *
58
+ * @param {string} blockName The name of the block.
59
+ *
60
+ * @return {string[]} The bindable attributes for the block.
61
+ */
62
+ export function getBindableAttributes(blockName) {
63
+ return BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName];
64
+ }
65
+
66
+ /**
67
+ * Checks if the block has the `__default` binding for pattern overrides.
68
+ *
69
+ * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.
70
+ *
71
+ * @return {boolean} Whether the block has the `__default` binding for pattern overrides.
72
+ */
73
+ export function hasPatternOverridesDefaultBinding(bindings) {
74
+ return bindings?.[DEFAULT_ATTRIBUTE]?.source === PATTERN_OVERRIDES_SOURCE;
75
+ }
76
+
77
+ /**
78
+ * Returns the bindings with the `__default` binding for pattern overrides
79
+ * replaced with the full-set of supported attributes. e.g.:
80
+ *
81
+ * - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`
82
+ * - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`
83
+ *
84
+ * @param {string} blockName The block name (e.g. 'core/paragraph').
85
+ * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.
86
+ *
87
+ * @return {Object} The bindings with default replaced for pattern overrides.
88
+ */
89
+ export function replacePatternOverridesDefaultBinding(blockName, bindings) {
90
+ // The `__default` binding currently only works for pattern overrides.
91
+ if (hasPatternOverridesDefaultBinding(bindings)) {
92
+ const supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName];
93
+ const bindingsWithDefaults = {};
94
+ for (const attributeName of supportedAttributes) {
95
+ // If the block has mixed binding sources, retain any non pattern override bindings.
96
+ const bindingSource = bindings[attributeName] ? bindings[attributeName] : {
97
+ source: PATTERN_OVERRIDES_SOURCE
98
+ };
99
+ bindingsWithDefaults[attributeName] = bindingSource;
100
+ }
101
+ return bindingsWithDefaults;
102
+ }
103
+ return bindings;
104
+ }
105
+
16
106
  /**
17
107
  * Contains utils to update the block `bindings` metadata.
18
108
  *
@@ -1 +1 @@
1
- {"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","isObjectEmpty","object","Object","keys","length","useBlockBindingsUtils","clientId","contextClientId","blockClientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","bindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Contains utils to update the block `bindings` metadata.\n *\n * @typedef {Object} WPBlockBindingsUtils\n *\n * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.\n * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.\n */\n\n/**\n * Retrieves the existing utils needed to update the block `bindings` metadata.\n * They can be used to create, modify, or remove connections from the existing block attributes.\n *\n * It contains the following utils:\n * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.\n * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @param {?string} clientId Optional block client ID. If not set, it will use the current block client ID from the context.\n *\n * @return {?WPBlockBindingsUtils} Object containing the block bindings utils.\n *\n * @example\n * ```js\n * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();\n *\n * // Update url and alt attributes.\n * updateBlockBindings( {\n * url: {\n * source: 'core/post-meta',\n * args: {\n * key: 'url_custom_field',\n * },\n * },\n * alt: {\n * source: 'core/post-meta',\n * args: {\n * key: 'text_custom_field',\n * },\n * },\n * } );\n *\n * // Remove binding from url attribute.\n * updateBlockBindings( { url: undefined } );\n *\n * // Remove bindings from all attributes.\n * removeAllBlockBindings();\n * ```\n */\nexport function useBlockBindingsUtils( clientId ) {\n\tconst { clientId: contextClientId } = useBlockEditContext();\n\tconst blockClientId = clientId || contextClientId;\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tconst newBindings = { ...currentBindings };\n\n\t\tObject.entries( bindings ).forEach( ( [ attribute, binding ] ) => {\n\t\t\tif ( ! binding && newBindings[ attribute ] ) {\n\t\t\t\tdelete newBindings[ attribute ];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewBindings[ attribute ] = binding;\n\t\t} );\n\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\tbindings: newBindings,\n\t\t};\n\n\t\tif ( isObjectEmpty( newMetadata.bindings ) ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( newMetadata ) ? undefined : newMetadata,\n\t\t} );\n\t};\n\n\t/**\n\t * Removes the bindings property of the `metadata` attribute.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { removeAllBlockBindings } = useBlockBindingsUtils();\n\t * removeAllBlockBindings();\n\t * ```\n\t */\n\tconst removeAllBlockBindings = () => {\n\t\tconst { metadata: { bindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( metadata ) ? undefined : metadata,\n\t\t} );\n\t};\n\n\treturn { updateBlockBindings, removeAllBlockBindings };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;;AAE1D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAEC,QAAQ,EAAG;EACjD,MAAM;IAAEA,QAAQ,EAAEC;EAAgB,CAAC,GAAGR,mBAAmB,CAAC,CAAC;EAC3D,MAAMS,aAAa,GAAGF,QAAQ,IAAIC,eAAe;EACjD,MAAM;IAAEE;EAAsB,CAAC,GAAGd,WAAW,CAAEG,gBAAiB,CAAC;EACjE,MAAM;IAAEY;EAAmB,CAAC,GAAGd,WAAW,CAAC,CAAC,CAACe,MAAM,CAAEb,gBAAiB,CAAC;;EAEvE;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMc,mBAAmB,GAAKC,QAAQ,IAAM;IAC3C,MAAM;MAAEC,QAAQ,EAAE;QAAED,QAAQ,EAAEE,eAAe;QAAE,GAAGD;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GAClEJ,kBAAkB,CAAEF,aAAc,CAAC;IACpC,MAAMQ,WAAW,GAAG;MAAE,GAAGD;IAAgB,CAAC;IAE1Cb,MAAM,CAACe,OAAO,CAAEJ,QAAS,CAAC,CAACK,OAAO,CAAE,CAAE,CAAEC,SAAS,EAAEC,OAAO,CAAE,KAAM;MACjE,IAAK,CAAEA,OAAO,IAAIJ,WAAW,CAAEG,SAAS,CAAE,EAAG;QAC5C,OAAOH,WAAW,CAAEG,SAAS,CAAE;QAC/B;MACD;MACAH,WAAW,CAAEG,SAAS,CAAE,GAAGC,OAAO;IACnC,CAAE,CAAC;IAEH,MAAMC,WAAW,GAAG;MACnB,GAAGP,QAAQ;MACXD,QAAQ,EAAEG;IACX,CAAC;IAED,IAAKhB,aAAa,CAAEqB,WAAW,CAACR,QAAS,CAAC,EAAG;MAC5C,OAAOQ,WAAW,CAACR,QAAQ;IAC5B;IAEAJ,qBAAqB,CAAED,aAAa,EAAE;MACrCM,QAAQ,EAAEd,aAAa,CAAEqB,WAAY,CAAC,GAAGC,SAAS,GAAGD;IACtD,CAAE,CAAC;EACJ,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAME,sBAAsB,GAAGA,CAAA,KAAM;IACpC,MAAM;MAAET,QAAQ,EAAE;QAAED,QAAQ;QAAE,GAAGC;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GACjDJ,kBAAkB,CAAEF,aAAc,CAAC;IACpCC,qBAAqB,CAAED,aAAa,EAAE;MACrCM,QAAQ,EAAEd,aAAa,CAAEc,QAAS,CAAC,GAAGQ,SAAS,GAAGR;IACnD,CAAE,CAAC;EACJ,CAAC;EAED,OAAO;IAAEF,mBAAmB;IAAEW;EAAuB,CAAC;AACvD","ignoreList":[]}
1
+ {"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","DEFAULT_ATTRIBUTE","PATTERN_OVERRIDES_SOURCE","BLOCK_BINDINGS_ALLOWED_BLOCKS","isObjectEmpty","object","Object","keys","length","canBindBlock","blockName","canBindAttribute","attributeName","includes","getBindableAttributes","hasPatternOverridesDefaultBinding","bindings","source","replacePatternOverridesDefaultBinding","supportedAttributes","bindingsWithDefaults","bindingSource","useBlockBindingsUtils","clientId","contextClientId","blockClientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nconst DEFAULT_ATTRIBUTE = '__default';\nconst PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides';\nconst BLOCK_BINDINGS_ALLOWED_BLOCKS = {\n\t'core/paragraph': [ 'content' ],\n\t'core/heading': [ 'content' ],\n\t'core/image': [ 'id', 'url', 'title', 'alt' ],\n\t'core/button': [ 'url', 'text', 'linkTarget', 'rel' ],\n};\n\n/**\n * Checks if the given object is empty.\n *\n * @param {?Object} object The object to check.\n *\n * @return {boolean} Whether the object is empty.\n */\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Based on the given block name, checks if it is possible to bind the block.\n *\n * @param {string} blockName The name of the block.\n *\n * @return {boolean} Whether it is possible to bind the block to sources.\n */\nexport function canBindBlock( blockName ) {\n\treturn blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;\n}\n\n/**\n * Based on the given block name and attribute name, checks if it is possible to bind the block attribute.\n *\n * @param {string} blockName The name of the block.\n * @param {string} attributeName The name of attribute.\n *\n * @return {boolean} Whether it is possible to bind the block attribute.\n */\nexport function canBindAttribute( blockName, attributeName ) {\n\treturn (\n\t\tcanBindBlock( blockName ) &&\n\t\tBLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ].includes( attributeName )\n\t);\n}\n\n/**\n * Gets the bindable attributes for a given block.\n *\n * @param {string} blockName The name of the block.\n *\n * @return {string[]} The bindable attributes for the block.\n */\nexport function getBindableAttributes( blockName ) {\n\treturn BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n}\n\n/**\n * Checks if the block has the `__default` binding for pattern overrides.\n *\n * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.\n *\n * @return {boolean} Whether the block has the `__default` binding for pattern overrides.\n */\nexport function hasPatternOverridesDefaultBinding( bindings ) {\n\treturn bindings?.[ DEFAULT_ATTRIBUTE ]?.source === PATTERN_OVERRIDES_SOURCE;\n}\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param {string} blockName The block name (e.g. 'core/paragraph').\n * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.\n *\n * @return {Object} The bindings with default replaced for pattern overrides.\n */\nexport function replacePatternOverridesDefaultBinding( blockName, bindings ) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif ( hasPatternOverridesDefaultBinding( bindings ) ) {\n\t\tconst supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n\t\tconst bindingsWithDefaults = {};\n\t\tfor ( const attributeName of supportedAttributes ) {\n\t\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t\t? bindings[ attributeName ]\n\t\t\t\t: { source: PATTERN_OVERRIDES_SOURCE };\n\t\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t\t}\n\n\t\treturn bindingsWithDefaults;\n\t}\n\n\treturn bindings;\n}\n\n/**\n * Contains utils to update the block `bindings` metadata.\n *\n * @typedef {Object} WPBlockBindingsUtils\n *\n * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.\n * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.\n */\n\n/**\n * Retrieves the existing utils needed to update the block `bindings` metadata.\n * They can be used to create, modify, or remove connections from the existing block attributes.\n *\n * It contains the following utils:\n * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.\n * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @param {?string} clientId Optional block client ID. If not set, it will use the current block client ID from the context.\n *\n * @return {?WPBlockBindingsUtils} Object containing the block bindings utils.\n *\n * @example\n * ```js\n * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();\n *\n * // Update url and alt attributes.\n * updateBlockBindings( {\n * url: {\n * source: 'core/post-meta',\n * args: {\n * key: 'url_custom_field',\n * },\n * },\n * alt: {\n * source: 'core/post-meta',\n * args: {\n * key: 'text_custom_field',\n * },\n * },\n * } );\n *\n * // Remove binding from url attribute.\n * updateBlockBindings( { url: undefined } );\n *\n * // Remove bindings from all attributes.\n * removeAllBlockBindings();\n * ```\n */\nexport function useBlockBindingsUtils( clientId ) {\n\tconst { clientId: contextClientId } = useBlockEditContext();\n\tconst blockClientId = clientId || contextClientId;\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tconst newBindings = { ...currentBindings };\n\n\t\tObject.entries( bindings ).forEach( ( [ attribute, binding ] ) => {\n\t\t\tif ( ! binding && newBindings[ attribute ] ) {\n\t\t\t\tdelete newBindings[ attribute ];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewBindings[ attribute ] = binding;\n\t\t} );\n\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\tbindings: newBindings,\n\t\t};\n\n\t\tif ( isObjectEmpty( newMetadata.bindings ) ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( newMetadata ) ? undefined : newMetadata,\n\t\t} );\n\t};\n\n\t/**\n\t * Removes the bindings property of the `metadata` attribute.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { removeAllBlockBindings } = useBlockBindingsUtils();\n\t * removeAllBlockBindings();\n\t * ```\n\t */\n\tconst removeAllBlockBindings = () => {\n\t\tconst { metadata: { bindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( metadata ) ? undefined : metadata,\n\t\t} );\n\t};\n\n\treturn { updateBlockBindings, removeAllBlockBindings };\n}\n"],"mappings":"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","ignoreList":[]}
@@ -153,7 +153,9 @@
153
153
  }
154
154
  .block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown {
155
155
  display: block;
156
- height: 36px;
156
+ }
157
+ .block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown .block-editor-global-styles-background-panel__dropdown-toggle {
158
+ height: 40px;
157
159
  }
158
160
 
159
161
  .block-editor-global-styles-background-panel__image-tools-panel-item {
@@ -166,7 +168,6 @@
166
168
  }
167
169
  .block-editor-global-styles-background-panel__image-tools-panel-item .components-dropdown {
168
170
  display: block;
169
- height: 36px;
170
171
  }
171
172
  .block-editor-global-styles-background-panel__image-tools-panel-item button.components-button {
172
173
  color: #1e1e1e;
@@ -644,11 +645,18 @@ iframe[name=editor-canvas] {
644
645
 
645
646
  .block-editor-block-card__title {
646
647
  font-weight: 500;
648
+ display: flex;
649
+ align-items: center;
650
+ flex-wrap: wrap;
651
+ gap: 4px 8px;
647
652
  }
648
653
  .block-editor-block-card__title.block-editor-block-card__title {
649
654
  font-size: 13px;
650
655
  line-height: 1.4;
651
656
  margin: 0;
657
+ }
658
+
659
+ .block-editor-block-card__name {
652
660
  padding: 3px 0;
653
661
  }
654
662
 
@@ -1655,9 +1663,16 @@ iframe[name=editor-canvas] {
1655
1663
  .block-editor-panel-color-gradient-settings__dropdown:hover + .block-editor-panel-color-gradient-settings__reset, .block-editor-panel-color-gradient-settings__reset:focus, .block-editor-panel-color-gradient-settings__reset:hover {
1656
1664
  opacity: 1;
1657
1665
  }
1666
+ @media (hover: none) {
1667
+ .block-editor-panel-color-gradient-settings__reset {
1668
+ opacity: 1;
1669
+ }
1670
+ }
1658
1671
 
1659
1672
  .block-editor-date-format-picker {
1660
- margin-bottom: 16px;
1673
+ margin: 0 0 16px;
1674
+ padding: 0;
1675
+ border: none;
1661
1676
  }
1662
1677
 
1663
1678
  .block-editor-date-format-picker__custom-format-select-control__custom-option {
@@ -2960,9 +2975,11 @@ iframe[name=editor-canvas] {
2960
2975
  color: #fff;
2961
2976
  margin: 8px 24px 0 0;
2962
2977
  height: 24px;
2963
- min-width: 24px;
2964
2978
  padding: 0;
2965
2979
  }
2980
+ .list-view-appender .block-editor-inserter__toggle.has-icon.is-next-40px-default-size {
2981
+ min-width: 24px;
2982
+ }
2966
2983
  .list-view-appender .block-editor-inserter__toggle:hover, .list-view-appender .block-editor-inserter__toggle:focus {
2967
2984
  background: var(--wp-admin-theme-color);
2968
2985
  color: #fff;
@@ -2980,16 +2997,17 @@ iframe[name=editor-canvas] {
2980
2997
  margin-right: 4px;
2981
2998
  }
2982
2999
 
3000
+ .block-editor-media-replace-flow__media-upload-menu:not(:empty) + .block-editor-media-flow__url-input {
3001
+ border-top: 1px solid #1e1e1e;
3002
+ margin-top: 8px;
3003
+ padding-bottom: 8px;
3004
+ }
3005
+
2983
3006
  .block-editor-media-flow__url-input {
2984
3007
  margin-left: -8px;
2985
3008
  margin-right: -8px;
2986
3009
  padding: 16px;
2987
3010
  }
2988
- .block-editor-media-flow__url-input.has-siblings {
2989
- border-top: 1px solid #1e1e1e;
2990
- margin-top: 8px;
2991
- padding-bottom: 8px;
2992
- }
2993
3011
  .block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label {
2994
3012
  display: block;
2995
3013
  top: 16px;
@@ -153,7 +153,9 @@
153
153
  }
154
154
  .block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown {
155
155
  display: block;
156
- height: 36px;
156
+ }
157
+ .block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown .block-editor-global-styles-background-panel__dropdown-toggle {
158
+ height: 40px;
157
159
  }
158
160
 
159
161
  .block-editor-global-styles-background-panel__image-tools-panel-item {
@@ -166,7 +168,6 @@
166
168
  }
167
169
  .block-editor-global-styles-background-panel__image-tools-panel-item .components-dropdown {
168
170
  display: block;
169
- height: 36px;
170
171
  }
171
172
  .block-editor-global-styles-background-panel__image-tools-panel-item button.components-button {
172
173
  color: #1e1e1e;
@@ -644,11 +645,18 @@ iframe[name=editor-canvas] {
644
645
 
645
646
  .block-editor-block-card__title {
646
647
  font-weight: 500;
648
+ display: flex;
649
+ align-items: center;
650
+ flex-wrap: wrap;
651
+ gap: 4px 8px;
647
652
  }
648
653
  .block-editor-block-card__title.block-editor-block-card__title {
649
654
  font-size: 13px;
650
655
  line-height: 1.4;
651
656
  margin: 0;
657
+ }
658
+
659
+ .block-editor-block-card__name {
652
660
  padding: 3px 0;
653
661
  }
654
662
 
@@ -1655,9 +1663,16 @@ iframe[name=editor-canvas] {
1655
1663
  .block-editor-panel-color-gradient-settings__dropdown:hover + .block-editor-panel-color-gradient-settings__reset, .block-editor-panel-color-gradient-settings__reset:focus, .block-editor-panel-color-gradient-settings__reset:hover {
1656
1664
  opacity: 1;
1657
1665
  }
1666
+ @media (hover: none) {
1667
+ .block-editor-panel-color-gradient-settings__reset {
1668
+ opacity: 1;
1669
+ }
1670
+ }
1658
1671
 
1659
1672
  .block-editor-date-format-picker {
1660
- margin-bottom: 16px;
1673
+ margin: 0 0 16px;
1674
+ padding: 0;
1675
+ border: none;
1661
1676
  }
1662
1677
 
1663
1678
  .block-editor-date-format-picker__custom-format-select-control__custom-option {
@@ -2961,9 +2976,11 @@ iframe[name=editor-canvas] {
2961
2976
  color: #fff;
2962
2977
  margin: 8px 0 0 24px;
2963
2978
  height: 24px;
2964
- min-width: 24px;
2965
2979
  padding: 0;
2966
2980
  }
2981
+ .list-view-appender .block-editor-inserter__toggle.has-icon.is-next-40px-default-size {
2982
+ min-width: 24px;
2983
+ }
2967
2984
  .list-view-appender .block-editor-inserter__toggle:hover, .list-view-appender .block-editor-inserter__toggle:focus {
2968
2985
  background: var(--wp-admin-theme-color);
2969
2986
  color: #fff;
@@ -2981,16 +2998,17 @@ iframe[name=editor-canvas] {
2981
2998
  margin-left: 4px;
2982
2999
  }
2983
3000
 
3001
+ .block-editor-media-replace-flow__media-upload-menu:not(:empty) + .block-editor-media-flow__url-input {
3002
+ border-top: 1px solid #1e1e1e;
3003
+ margin-top: 8px;
3004
+ padding-bottom: 8px;
3005
+ }
3006
+
2984
3007
  .block-editor-media-flow__url-input {
2985
3008
  margin-right: -8px;
2986
3009
  margin-left: -8px;
2987
3010
  padding: 16px;
2988
3011
  }
2989
- .block-editor-media-flow__url-input.has-siblings {
2990
- border-top: 1px solid #1e1e1e;
2991
- margin-top: 8px;
2992
- padding-bottom: 8px;
2993
- }
2994
3012
  .block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label {
2995
3013
  display: block;
2996
3014
  top: 16px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "14.9.0",
3
+ "version": "14.10.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,37 +37,37 @@
37
37
  "@emotion/react": "^11.7.1",
38
38
  "@emotion/styled": "^11.6.0",
39
39
  "@react-spring/web": "^9.4.5",
40
- "@wordpress/a11y": "*",
41
- "@wordpress/api-fetch": "*",
42
- "@wordpress/blob": "*",
43
- "@wordpress/block-serialization-default-parser": "*",
44
- "@wordpress/blocks": "*",
45
- "@wordpress/commands": "*",
46
- "@wordpress/components": "*",
47
- "@wordpress/compose": "*",
48
- "@wordpress/data": "*",
49
- "@wordpress/date": "*",
50
- "@wordpress/deprecated": "*",
51
- "@wordpress/dom": "*",
52
- "@wordpress/element": "*",
53
- "@wordpress/escape-html": "*",
54
- "@wordpress/hooks": "*",
55
- "@wordpress/html-entities": "*",
56
- "@wordpress/i18n": "*",
57
- "@wordpress/icons": "*",
58
- "@wordpress/is-shallow-equal": "*",
59
- "@wordpress/keyboard-shortcuts": "*",
60
- "@wordpress/keycodes": "*",
61
- "@wordpress/notices": "*",
62
- "@wordpress/preferences": "*",
63
- "@wordpress/priority-queue": "*",
64
- "@wordpress/private-apis": "*",
65
- "@wordpress/rich-text": "*",
66
- "@wordpress/style-engine": "*",
67
- "@wordpress/token-list": "*",
68
- "@wordpress/url": "*",
69
- "@wordpress/warning": "*",
70
- "@wordpress/wordcount": "*",
40
+ "@wordpress/a11y": "^4.15.0",
41
+ "@wordpress/api-fetch": "^7.15.0",
42
+ "@wordpress/blob": "^4.15.0",
43
+ "@wordpress/block-serialization-default-parser": "^5.15.0",
44
+ "@wordpress/blocks": "^14.4.0",
45
+ "@wordpress/commands": "^1.15.0",
46
+ "@wordpress/components": "^29.1.0",
47
+ "@wordpress/compose": "^7.15.0",
48
+ "@wordpress/data": "^10.15.0",
49
+ "@wordpress/date": "^5.15.0",
50
+ "@wordpress/deprecated": "^4.15.0",
51
+ "@wordpress/dom": "^4.15.0",
52
+ "@wordpress/element": "^6.15.0",
53
+ "@wordpress/escape-html": "^3.15.0",
54
+ "@wordpress/hooks": "^4.15.0",
55
+ "@wordpress/html-entities": "^4.15.0",
56
+ "@wordpress/i18n": "^5.15.0",
57
+ "@wordpress/icons": "^10.15.0",
58
+ "@wordpress/is-shallow-equal": "^5.15.0",
59
+ "@wordpress/keyboard-shortcuts": "^5.15.0",
60
+ "@wordpress/keycodes": "^4.15.0",
61
+ "@wordpress/notices": "^5.15.0",
62
+ "@wordpress/preferences": "^4.15.0",
63
+ "@wordpress/priority-queue": "^3.15.0",
64
+ "@wordpress/private-apis": "^1.15.0",
65
+ "@wordpress/rich-text": "^7.15.0",
66
+ "@wordpress/style-engine": "^2.15.0",
67
+ "@wordpress/token-list": "^3.15.0",
68
+ "@wordpress/url": "^4.15.0",
69
+ "@wordpress/warning": "^3.15.0",
70
+ "@wordpress/wordcount": "^4.15.0",
71
71
  "change-case": "^4.1.2",
72
72
  "clsx": "^2.1.1",
73
73
  "colord": "^2.7.0",
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "access": "public"
92
92
  },
93
- "gitHead": "b432c18934c9db866b6dba7d37517a4e97d642e3"
93
+ "gitHead": "75a65eb8ffc168a92042544052f46d080a71ea45"
94
94
  }
@@ -17,7 +17,7 @@ import { View } from '@wordpress/primitives';
17
17
  import { Icon } from '@wordpress/components';
18
18
  import { withPreferredColorScheme } from '@wordpress/compose';
19
19
  import { __ } from '@wordpress/i18n';
20
- import { audio, warning } from '@wordpress/icons';
20
+ import { audio, cautionFilled } from '@wordpress/icons';
21
21
  import {
22
22
  requestImageFailedRetryDialog,
23
23
  requestImageUploadCancelDialog,
@@ -167,7 +167,7 @@ function Player( {
167
167
  <View style={ styles.subtitleContainer }>
168
168
  { isUploadFailed && (
169
169
  <Icon
170
- icon={ warning }
170
+ icon={ cautionFilled }
171
171
  style={ {
172
172
  ...styles.errorIcon,
173
173
  ...uploadFailedStyle,
@@ -24,6 +24,7 @@ import {
24
24
  Placeholder,
25
25
  Spinner,
26
26
  __experimentalDropdownContentWrapper as DropdownContentWrapper,
27
+ Button,
27
28
  } from '@wordpress/components';
28
29
  import { __, _x, sprintf } from '@wordpress/i18n';
29
30
  import { store as noticesStore } from '@wordpress/notices';
@@ -378,6 +379,9 @@ function BackgroundImageControls( {
378
379
  />
379
380
  }
380
381
  variant="secondary"
382
+ renderToggle={ ( props ) => (
383
+ <Button { ...props } __next40pxDefaultSize />
384
+ ) }
381
385
  onError={ onUploadError }
382
386
  onReset={ () => {
383
387
  closeAndFocus();
@@ -23,7 +23,10 @@
23
23
 
24
24
  .components-dropdown {
25
25
  display: block;
26
- height: 36px;
26
+
27
+ .block-editor-global-styles-background-panel__dropdown-toggle {
28
+ height: 40px;
29
+ }
27
30
  }
28
31
  }
29
32
 
@@ -44,7 +47,6 @@
44
47
 
45
48
  .components-dropdown {
46
49
  display: block;
47
- height: 36px;
48
50
  }
49
51
 
50
52
  button.components-button {
@@ -41,13 +41,36 @@ const controls = (
41
41
  />
42
42
  </BlockControls>
43
43
  </>
44
- }
44
+ );
45
45
  ```
46
46
 
47
47
  ### Props
48
48
 
49
- | Name | Type | Default | Description |
50
- | ---------- | ---------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
51
- | `label` | `string` | `Change matrix alignment` | concise description of tool's functionality. |
52
- | `onChange` | `function` | `noop` | the function to execute upon a user's change of the matrix state |
53
- | `value` | `string` | `center` | describes the content alignment location and can be `top`, `right`, `bottom`, `left`, `topRight`, `bottomRight`, `bottomLeft`, `topLeft` |
49
+ ### `label`
50
+
51
+ - **Type:** `string`
52
+ - **Default:** `'Change matrix alignment'`
53
+
54
+ Label for the control.
55
+
56
+ ### `onChange`
57
+
58
+ - **Type:** `Function`
59
+ - **Default:** `noop`
60
+
61
+ Function to execute upon a user's change of the matrix state.
62
+
63
+ ### `value`
64
+
65
+ - **Type:** `string`
66
+ - **Default:** `'center'`
67
+ - **Options:** `'center'`, `'center center'`, `'center left'`, `'center right'`, `'top center'`, `'top left'`, `'top right'`, `'bottom center'`, `'bottom left'`, `'bottom right'`
68
+
69
+ Content alignment location.
70
+
71
+ ### `isDisabled`
72
+
73
+ - **Type:** `boolean`
74
+ - **Default:** `false`
75
+
76
+ Whether the control should be disabled.
@@ -11,6 +11,37 @@ import {
11
11
 
12
12
  const noop = () => {};
13
13
 
14
+ /**
15
+ * The alignment matrix control allows users to quickly adjust inner block alignment.
16
+ *
17
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-alignment-matrix-control/README.md
18
+ *
19
+ * @example
20
+ * ```jsx
21
+ * function Example() {
22
+ * return (
23
+ * <BlockControls>
24
+ * <BlockAlignmentMatrixControl
25
+ * label={ __( 'Change content position' ) }
26
+ * value="center"
27
+ * onChange={ ( nextPosition ) =>
28
+ * setAttributes( { contentPosition: nextPosition } )
29
+ * }
30
+ * />
31
+ * </BlockControls>
32
+ * );
33
+ * }
34
+ * ```
35
+ *
36
+ * @param {Object} props Component props.
37
+ * @param {string} props.label Label for the control. Defaults to 'Change matrix alignment'.
38
+ * @param {Function} props.onChange Function to execute upon change of matrix state.
39
+ * @param {string} props.value Content alignment location. One of: 'center', 'center center',
40
+ * 'center left', 'center right', 'top center', 'top left',
41
+ * 'top right', 'bottom center', 'bottom left', 'bottom right'.
42
+ * @param {boolean} props.isDisabled Whether the control should be disabled.
43
+ * @return {Element} The BlockAlignmentMatrixControl component.
44
+ */
14
45
  function BlockAlignmentMatrixControl( props ) {
15
46
  const {
16
47
  label = __( 'Change matrix alignment' ),
@@ -0,0 +1,78 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useState } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import BlockAlignmentMatrixControl from '../';
10
+
11
+ const meta = {
12
+ title: 'BlockEditor/BlockAlignmentMatrixControl',
13
+ component: BlockAlignmentMatrixControl,
14
+ parameters: {
15
+ docs: {
16
+ canvas: { sourceState: 'shown' },
17
+ description: {
18
+ component:
19
+ 'Renders a control for selecting block alignment using a matrix of alignment options.',
20
+ },
21
+ },
22
+ },
23
+ argTypes: {
24
+ label: {
25
+ control: 'text',
26
+ table: {
27
+ type: { summary: 'string' },
28
+ defaultValue: { summary: "'Change matrix alignment'" },
29
+ },
30
+ description: 'Label for the control.',
31
+ },
32
+ onChange: {
33
+ action: 'onChange',
34
+ control: { type: null },
35
+ table: {
36
+ type: { summary: 'function' },
37
+ defaultValue: { summary: '() => {}' },
38
+ },
39
+ description:
40
+ "Function to execute upon a user's change of the matrix state.",
41
+ },
42
+ isDisabled: {
43
+ control: 'boolean',
44
+ table: {
45
+ type: { summary: 'boolean' },
46
+ defaultValue: { summary: 'false' },
47
+ },
48
+ description: 'Whether the control should be disabled.',
49
+ },
50
+ value: {
51
+ control: { type: null },
52
+ table: {
53
+ type: { summary: 'string' },
54
+ defaultValue: { summary: "'center'" },
55
+ },
56
+ description: 'Content alignment location.',
57
+ },
58
+ },
59
+ };
60
+
61
+ export default meta;
62
+
63
+ export const Default = {
64
+ render: function Template( { onChange, ...args } ) {
65
+ const [ value, setValue ] = useState();
66
+
67
+ return (
68
+ <BlockAlignmentMatrixControl
69
+ { ...args }
70
+ value={ value }
71
+ onChange={ ( ...changeArgs ) => {
72
+ onChange( ...changeArgs );
73
+ setValue( ...changeArgs );
74
+ } }
75
+ />
76
+ );
77
+ },
78
+ };
@@ -21,6 +21,7 @@ const MyBlockCard = () => (
21
21
  icon={ paragraph }
22
22
  title="Paragraph"
23
23
  description="Start with the basic building block of all narrative."
24
+ name="Custom Block"
24
25
  />
25
26
  );
26
27
  ```
@@ -45,6 +46,12 @@ The title of the block.
45
46
 
46
47
  The description of the block.
47
48
 
49
+ #### name
50
+
51
+ - **Type:** `String`
52
+
53
+ The custom name of the block.
54
+
48
55
  ## Related components
49
56
 
50
57
  Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.