@wordpress/block-editor 15.8.1-next.dc3f6d3c1.0 → 15.9.1-next.6deb34194.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 (325) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +12 -0
  3. package/build/components/block-alignment-matrix-control/index.js +1 -8
  4. package/build/components/block-alignment-matrix-control/index.js.map +2 -2
  5. package/build/components/block-bindings/attribute-control.js +172 -0
  6. package/build/components/block-bindings/attribute-control.js.map +7 -0
  7. package/build/components/block-bindings/index.js +47 -0
  8. package/build/components/block-bindings/index.js.map +7 -0
  9. package/build/components/block-bindings/source-fields-list.js +135 -0
  10. package/build/components/block-bindings/source-fields-list.js.map +7 -0
  11. package/build/components/block-bindings/use-block-bindings-utils.js +66 -0
  12. package/build/components/block-bindings/use-block-bindings-utils.js.map +7 -0
  13. package/build/components/block-edit/edit.js +1 -3
  14. package/build/components/block-edit/edit.js.map +2 -2
  15. package/build/components/block-list/index.js +2 -1
  16. package/build/components/block-list/index.js.map +2 -2
  17. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +27 -5
  18. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +2 -2
  19. package/build/components/block-lock/modal.js +5 -5
  20. package/build/components/block-lock/modal.js.map +2 -2
  21. package/build/components/block-lock/use-block-lock.js +10 -13
  22. package/build/components/block-lock/use-block-lock.js.map +2 -2
  23. package/build/components/block-settings-menu-controls/index.js +1 -1
  24. package/build/components/block-settings-menu-controls/index.js.map +2 -2
  25. package/build/components/block-styles/preview-panel.js +3 -5
  26. package/build/components/block-styles/preview-panel.js.map +2 -2
  27. package/build/components/block-styles/use-styles-for-block.js +2 -2
  28. package/build/components/block-styles/use-styles-for-block.js.map +2 -2
  29. package/build/components/block-toolbar/index.js +1 -8
  30. package/build/components/block-toolbar/index.js.map +3 -3
  31. package/build/components/block-tools/index.js +56 -45
  32. package/build/components/block-tools/index.js.map +3 -3
  33. package/build/components/block-visibility/toolbar.js +1 -1
  34. package/build/components/block-visibility/toolbar.js.map +1 -1
  35. package/build/components/content-only-controls/fields-dropdown-menu.js +66 -0
  36. package/build/components/content-only-controls/fields-dropdown-menu.js.map +7 -0
  37. package/build/components/content-only-controls/index.js +202 -44
  38. package/build/components/content-only-controls/index.js.map +3 -3
  39. package/build/components/content-only-controls/link/index.js +92 -103
  40. package/build/components/content-only-controls/link/index.js.map +3 -3
  41. package/build/components/content-only-controls/media/index.js +134 -134
  42. package/build/components/content-only-controls/media/index.js.map +3 -3
  43. package/build/components/content-only-controls/rich-text/index.js +66 -74
  44. package/build/components/content-only-controls/rich-text/index.js.map +3 -3
  45. package/build/components/dimensions-tool/width-height-tool.js +4 -16
  46. package/build/components/dimensions-tool/width-height-tool.js.map +3 -3
  47. package/build/components/font-family/index.js +1 -15
  48. package/build/components/font-family/index.js.map +2 -2
  49. package/build/components/global-styles/dimensions-panel.js +35 -2
  50. package/build/components/global-styles/dimensions-panel.js.map +2 -2
  51. package/build/components/global-styles/hooks.js +1 -1
  52. package/build/components/global-styles/hooks.js.map +2 -2
  53. package/build/components/global-styles/typography-panel.js +1 -2
  54. package/build/components/global-styles/typography-panel.js.map +2 -2
  55. package/build/components/image-editor/cropper.js +3 -34
  56. package/build/components/image-editor/cropper.js.map +3 -3
  57. package/build/components/image-editor/index.js +9 -3
  58. package/build/components/image-editor/index.js.map +2 -2
  59. package/build/components/image-editor/use-transform-image.js +62 -32
  60. package/build/components/image-editor/use-transform-image.js.map +2 -2
  61. package/build/components/image-editor/zoom-dropdown.js +2 -2
  62. package/build/components/image-editor/zoom-dropdown.js.map +2 -2
  63. package/build/components/index.js +10 -3
  64. package/build/components/index.js.map +2 -2
  65. package/build/components/inserter-draggable-blocks/index.js +8 -4
  66. package/build/components/inserter-draggable-blocks/index.js.map +2 -2
  67. package/build/components/inspector-controls-tabs/content-tab.js +3 -2
  68. package/build/components/inspector-controls-tabs/content-tab.js.map +2 -2
  69. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
  70. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
  71. package/build/components/link-control/index.js +15 -7
  72. package/build/components/link-control/index.js.map +2 -2
  73. package/build/components/list-view/block-select-button.js +3 -11
  74. package/build/components/list-view/block-select-button.js.map +2 -2
  75. package/build/components/list-view/block.js +9 -7
  76. package/build/components/list-view/block.js.map +2 -2
  77. package/build/components/media-placeholder/index.js +17 -4
  78. package/build/components/media-placeholder/index.js.map +2 -2
  79. package/build/components/media-placeholder/utils.js +60 -0
  80. package/build/components/media-placeholder/utils.js.map +7 -0
  81. package/build/components/media-replace-flow/index.js +20 -3
  82. package/build/components/media-replace-flow/index.js.map +2 -2
  83. package/build/components/tool-selector/index.js +46 -0
  84. package/build/components/tool-selector/index.js.map +7 -0
  85. package/build/components/use-block-commands/index.js +1 -1
  86. package/build/components/use-block-commands/index.js.map +2 -2
  87. package/build/components/use-block-drop-zone/index.js +1 -5
  88. package/build/components/use-block-drop-zone/index.js.map +2 -2
  89. package/build/hooks/block-bindings.js +22 -260
  90. package/build/hooks/block-bindings.js.map +3 -3
  91. package/build/hooks/dimensions.js +3 -3
  92. package/build/hooks/dimensions.js.map +2 -2
  93. package/build/hooks/metadata.js +1 -1
  94. package/build/hooks/metadata.js.map +2 -2
  95. package/build/hooks/utils.js +5 -1
  96. package/build/hooks/utils.js.map +2 -2
  97. package/build/layouts/grid.js +23 -28
  98. package/build/layouts/grid.js.map +2 -2
  99. package/build/store/private-selectors.js +43 -3
  100. package/build/store/private-selectors.js.map +2 -2
  101. package/build/store/reducer.js +2 -1
  102. package/build/store/reducer.js.map +2 -2
  103. package/build/store/selectors.js +6 -4
  104. package/build/store/selectors.js.map +2 -2
  105. package/build/utils/block-bindings.js +2 -44
  106. package/build/utils/block-bindings.js.map +3 -3
  107. package/build/utils/index.js +2 -5
  108. package/build/utils/index.js.map +2 -2
  109. package/build-module/components/block-alignment-matrix-control/index.js +1 -8
  110. package/build-module/components/block-alignment-matrix-control/index.js.map +2 -2
  111. package/build-module/components/block-bindings/attribute-control.js +150 -0
  112. package/build-module/components/block-bindings/attribute-control.js.map +7 -0
  113. package/build-module/components/block-bindings/index.js +10 -0
  114. package/build-module/components/block-bindings/index.js.map +7 -0
  115. package/build-module/components/block-bindings/source-fields-list.js +104 -0
  116. package/build-module/components/block-bindings/source-fields-list.js.map +7 -0
  117. package/build-module/components/block-bindings/use-block-bindings-utils.js +45 -0
  118. package/build-module/components/block-bindings/use-block-bindings-utils.js.map +7 -0
  119. package/build-module/components/block-edit/edit.js +1 -3
  120. package/build-module/components/block-edit/edit.js.map +2 -2
  121. package/build-module/components/block-list/index.js +2 -1
  122. package/build-module/components/block-list/index.js.map +2 -2
  123. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +27 -5
  124. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +2 -2
  125. package/build-module/components/block-lock/modal.js +5 -5
  126. package/build-module/components/block-lock/modal.js.map +2 -2
  127. package/build-module/components/block-lock/use-block-lock.js +10 -13
  128. package/build-module/components/block-lock/use-block-lock.js.map +2 -2
  129. package/build-module/components/block-settings-menu-controls/index.js +1 -1
  130. package/build-module/components/block-settings-menu-controls/index.js.map +2 -2
  131. package/build-module/components/block-styles/preview-panel.js +3 -5
  132. package/build-module/components/block-styles/preview-panel.js.map +2 -2
  133. package/build-module/components/block-styles/use-styles-for-block.js +2 -2
  134. package/build-module/components/block-styles/use-styles-for-block.js.map +2 -2
  135. package/build-module/components/block-toolbar/index.js +1 -8
  136. package/build-module/components/block-toolbar/index.js.map +2 -2
  137. package/build-module/components/block-tools/index.js +56 -45
  138. package/build-module/components/block-tools/index.js.map +2 -2
  139. package/build-module/components/block-visibility/toolbar.js +1 -1
  140. package/build-module/components/block-visibility/toolbar.js.map +1 -1
  141. package/build-module/components/content-only-controls/fields-dropdown-menu.js +45 -0
  142. package/build-module/components/content-only-controls/fields-dropdown-menu.js.map +7 -0
  143. package/build-module/components/content-only-controls/index.js +206 -46
  144. package/build-module/components/content-only-controls/index.js.map +2 -2
  145. package/build-module/components/content-only-controls/link/index.js +92 -104
  146. package/build-module/components/content-only-controls/link/index.js.map +2 -2
  147. package/build-module/components/content-only-controls/media/index.js +134 -135
  148. package/build-module/components/content-only-controls/media/index.js.map +2 -2
  149. package/build-module/components/content-only-controls/rich-text/index.js +68 -81
  150. package/build-module/components/content-only-controls/rich-text/index.js.map +2 -2
  151. package/build-module/components/dimensions-tool/width-height-tool.js +4 -6
  152. package/build-module/components/dimensions-tool/width-height-tool.js.map +2 -2
  153. package/build-module/components/font-family/index.js +1 -15
  154. package/build-module/components/font-family/index.js.map +2 -2
  155. package/build-module/components/global-styles/dimensions-panel.js +35 -2
  156. package/build-module/components/global-styles/dimensions-panel.js.map +2 -2
  157. package/build-module/components/global-styles/hooks.js +1 -1
  158. package/build-module/components/global-styles/hooks.js.map +2 -2
  159. package/build-module/components/global-styles/typography-panel.js +1 -2
  160. package/build-module/components/global-styles/typography-panel.js.map +2 -2
  161. package/build-module/components/image-editor/cropper.js +3 -34
  162. package/build-module/components/image-editor/cropper.js.map +2 -2
  163. package/build-module/components/image-editor/index.js +9 -3
  164. package/build-module/components/image-editor/index.js.map +2 -2
  165. package/build-module/components/image-editor/use-transform-image.js +63 -33
  166. package/build-module/components/image-editor/use-transform-image.js.map +2 -2
  167. package/build-module/components/image-editor/zoom-dropdown.js +2 -2
  168. package/build-module/components/image-editor/zoom-dropdown.js.map +2 -2
  169. package/build-module/components/index.js +74 -66
  170. package/build-module/components/index.js.map +2 -2
  171. package/build-module/components/inserter-draggable-blocks/index.js +8 -4
  172. package/build-module/components/inserter-draggable-blocks/index.js.map +2 -2
  173. package/build-module/components/inspector-controls-tabs/content-tab.js +3 -2
  174. package/build-module/components/inspector-controls-tabs/content-tab.js.map +2 -2
  175. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
  176. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
  177. package/build-module/components/link-control/index.js +16 -8
  178. package/build-module/components/link-control/index.js.map +2 -2
  179. package/build-module/components/list-view/block-select-button.js +3 -11
  180. package/build-module/components/list-view/block-select-button.js.map +2 -2
  181. package/build-module/components/list-view/block.js +9 -7
  182. package/build-module/components/list-view/block.js.map +2 -2
  183. package/build-module/components/media-placeholder/index.js +18 -5
  184. package/build-module/components/media-placeholder/index.js.map +2 -2
  185. package/build-module/components/media-placeholder/utils.js +35 -0
  186. package/build-module/components/media-placeholder/utils.js.map +7 -0
  187. package/build-module/components/media-replace-flow/index.js +20 -3
  188. package/build-module/components/media-replace-flow/index.js.map +2 -2
  189. package/build-module/components/tool-selector/index.js +15 -0
  190. package/build-module/components/tool-selector/index.js.map +7 -0
  191. package/build-module/components/use-block-commands/index.js +1 -1
  192. package/build-module/components/use-block-commands/index.js.map +2 -2
  193. package/build-module/components/use-block-drop-zone/index.js +1 -5
  194. package/build-module/components/use-block-drop-zone/index.js.map +2 -2
  195. package/build-module/hooks/block-bindings.js +27 -270
  196. package/build-module/hooks/block-bindings.js.map +2 -2
  197. package/build-module/hooks/dimensions.js +3 -3
  198. package/build-module/hooks/dimensions.js.map +2 -2
  199. package/build-module/hooks/metadata.js +1 -1
  200. package/build-module/hooks/metadata.js.map +2 -2
  201. package/build-module/hooks/utils.js +5 -1
  202. package/build-module/hooks/utils.js.map +2 -2
  203. package/build-module/layouts/grid.js +23 -28
  204. package/build-module/layouts/grid.js.map +2 -2
  205. package/build-module/store/private-selectors.js +39 -3
  206. package/build-module/store/private-selectors.js.map +2 -2
  207. package/build-module/store/reducer.js +2 -1
  208. package/build-module/store/reducer.js.map +2 -2
  209. package/build-module/store/selectors.js +6 -4
  210. package/build-module/store/selectors.js.map +2 -2
  211. package/build-module/utils/block-bindings.js +1 -42
  212. package/build-module/utils/block-bindings.js.map +2 -2
  213. package/build-module/utils/index.js +1 -3
  214. package/build-module/utils/index.js.map +2 -2
  215. package/build-style/content-rtl.css +3 -0
  216. package/build-style/content.css +3 -0
  217. package/build-style/style-rtl.css +20 -11
  218. package/build-style/style.css +20 -11
  219. package/package.json +39 -39
  220. package/src/components/block-alignment-matrix-control/index.js +1 -5
  221. package/src/components/block-bindings/attribute-control.js +174 -0
  222. package/src/components/block-bindings/index.js +6 -0
  223. package/src/components/block-bindings/source-fields-list.js +130 -0
  224. package/src/components/block-bindings/use-block-bindings-utils.js +156 -0
  225. package/src/components/block-edit/edit.js +1 -3
  226. package/src/components/block-list/content.scss +5 -0
  227. package/src/components/block-list/index.js +3 -1
  228. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +34 -3
  229. package/src/components/block-lock/modal.js +6 -5
  230. package/src/components/block-lock/use-block-lock.js +10 -14
  231. package/src/components/block-patterns-list/stories/{index.story.js → index.story.jsx} +3 -1
  232. package/src/components/block-settings-menu-controls/index.js +1 -1
  233. package/src/components/block-styles/preview-panel.js +3 -5
  234. package/src/components/block-styles/use-styles-for-block.js +2 -2
  235. package/src/components/block-toolbar/index.js +1 -6
  236. package/src/components/block-toolbar/style.scss +6 -6
  237. package/src/components/block-tools/index.js +15 -2
  238. package/src/components/block-tools/style.scss +4 -0
  239. package/src/components/block-visibility/toolbar.js +1 -1
  240. package/src/components/content-only-controls/fields-dropdown-menu.js +53 -0
  241. package/src/components/content-only-controls/index.js +289 -50
  242. package/src/components/content-only-controls/link/index.js +62 -57
  243. package/src/components/content-only-controls/media/index.js +177 -156
  244. package/src/components/content-only-controls/rich-text/index.js +31 -44
  245. package/src/components/content-only-controls/styles.scss +10 -1
  246. package/src/components/dimensions-tool/width-height-tool.js +6 -13
  247. package/src/components/font-family/README.md +0 -9
  248. package/src/components/font-family/index.js +1 -16
  249. package/src/components/font-family/stories/{index.story.js → index.story.jsx} +0 -1
  250. package/src/components/global-styles/dimensions-panel.js +36 -0
  251. package/src/components/global-styles/hooks.js +1 -1
  252. package/src/components/global-styles/typography-panel.js +0 -1
  253. package/src/components/image-editor/cropper.js +3 -32
  254. package/src/components/image-editor/index.js +34 -29
  255. package/src/components/image-editor/use-transform-image.js +80 -34
  256. package/src/components/image-editor/zoom-dropdown.js +2 -2
  257. package/src/components/index.js +9 -1
  258. package/src/components/inserter/style.scss +1 -1
  259. package/src/components/inserter-draggable-blocks/index.js +19 -8
  260. package/src/components/inspector-controls-tabs/content-tab.js +6 -2
  261. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -5
  262. package/src/components/link-control/index.js +36 -12
  263. package/src/components/list-view/block-select-button.js +22 -30
  264. package/src/components/list-view/block.js +9 -7
  265. package/src/components/media-placeholder/index.js +20 -5
  266. package/src/components/media-placeholder/test/get-computed-accept-attribute.js +164 -0
  267. package/src/components/media-placeholder/utils.js +65 -0
  268. package/src/components/media-replace-flow/index.js +22 -3
  269. package/src/components/tool-selector/index.js +19 -0
  270. package/src/components/use-block-commands/index.js +1 -1
  271. package/src/components/use-block-drop-zone/index.js +1 -5
  272. package/src/hooks/block-bindings.js +27 -347
  273. package/src/hooks/dimensions.js +8 -3
  274. package/src/hooks/metadata.js +1 -1
  275. package/src/hooks/test/metadata.js +1 -1
  276. package/src/hooks/utils.js +4 -0
  277. package/src/layouts/grid.js +40 -72
  278. package/src/layouts/test/grid.js +14 -0
  279. package/src/store/private-selectors.js +123 -6
  280. package/src/store/reducer.js +3 -0
  281. package/src/store/selectors.js +6 -4
  282. package/src/store/test/private-selectors.js +242 -0
  283. package/src/store/test/reducer.js +17 -7
  284. package/src/style.scss +0 -1
  285. package/src/utils/block-bindings.js +0 -157
  286. package/src/utils/index.js +0 -1
  287. package/tsconfig.json +2 -0
  288. package/build/components/block-toolbar/block-name-context.js +0 -30
  289. package/build/components/block-toolbar/block-name-context.js.map +0 -7
  290. package/build/components/content-only-controls/plain-text/index.js +0 -68
  291. package/build/components/content-only-controls/plain-text/index.js.map +0 -7
  292. package/build-module/components/block-toolbar/block-name-context.js +0 -9
  293. package/build-module/components/block-toolbar/block-name-context.js.map +0 -7
  294. package/build-module/components/content-only-controls/plain-text/index.js +0 -50
  295. package/build-module/components/content-only-controls/plain-text/index.js.map +0 -7
  296. package/src/components/block-toolbar/block-name-context.js +0 -9
  297. package/src/components/content-only-controls/plain-text/index.js +0 -49
  298. package/src/components/font-family/style.scss +0 -7
  299. /package/src/components/alignment-control/stories/{aliginment-toolbar.story.js → aliginment-toolbar.story.jsx} +0 -0
  300. /package/src/components/alignment-control/stories/{index.story.js → index.story.jsx} +0 -0
  301. /package/src/components/block-alignment-matrix-control/stories/{index.story.js → index.story.jsx} +0 -0
  302. /package/src/{utils → components/block-bindings}/test/use-block-bindings-utils.js +0 -0
  303. /package/src/components/block-draggable/stories/{index.story.js → index.story.jsx} +0 -0
  304. /package/src/components/block-heading-level-dropdown/stories/{index.story.js → index.story.jsx} +0 -0
  305. /package/src/components/block-mover/stories/{index.story.js → index.story.jsx} +0 -0
  306. /package/src/components/block-title/stories/{index.story.js → index.story.jsx} +0 -0
  307. /package/src/components/border-radius-control/stories/{index.story.js → index.story.jsx} +0 -0
  308. /package/src/components/date-format-picker/stories/{index.story.js → index.story.jsx} +0 -0
  309. /package/src/components/dimensions-tool/stories/{aspect-ratio-tool.story.js → aspect-ratio-tool.story.jsx} +0 -0
  310. /package/src/components/dimensions-tool/stories/{index.story.js → index.story.jsx} +0 -0
  311. /package/src/components/dimensions-tool/stories/{scale-tool.story.js → scale-tool.story.jsx} +0 -0
  312. /package/src/components/dimensions-tool/stories/{width-height-tool.story.js → width-height-tool.story.jsx} +0 -0
  313. /package/src/components/height-control/stories/{index.story.js → index.story.jsx} +0 -0
  314. /package/src/components/inserter/stories/{index.story.js → index.story.jsx} +0 -0
  315. /package/src/components/line-height-control/stories/{index.story.js → index.story.jsx} +0 -0
  316. /package/src/components/plain-text/stories/{index.story.js → index.story.jsx} +0 -0
  317. /package/src/components/resolution-tool/stories/{index.story.js → index.story.jsx} +0 -0
  318. /package/src/components/tabbed-sidebar/stories/{index.story.js → index.story.jsx} +0 -0
  319. /package/src/components/text-alignment-control/stories/{index.story.js → index.story.jsx} +0 -0
  320. /package/src/components/text-decoration-control/stories/{index.story.js → index.story.jsx} +0 -0
  321. /package/src/components/text-transform-control/stories/{index.story.js → index.story.jsx} +0 -0
  322. /package/src/components/unit-control/stories/{index.story.js → index.story.jsx} +0 -0
  323. /package/src/components/url-popover/stories/{index.story.js → index.story.jsx} +0 -0
  324. /package/src/components/warning/stories/{index.story.js → index.story.jsx} +0 -0
  325. /package/src/components/writing-mode-control/stories/{index.story.js → index.story.jsx} +0 -0
@@ -18,8 +18,6 @@ import { useSettings } from '../use-settings';
18
18
  export default function FontFamilyControl( {
19
19
  /** Start opting into the larger default height that will become the default size in a future version. */
20
20
  __next40pxDefaultSize = false,
21
- /** Start opting into the new margin-free styles that will become the default in a future version. */
22
- __nextHasNoMarginBottom = false,
23
21
  value = '',
24
22
  onChange,
25
23
  fontFamilies,
@@ -47,17 +45,6 @@ export default function FontFamilyControl( {
47
45
  } ) ),
48
46
  ];
49
47
 
50
- if ( ! __nextHasNoMarginBottom ) {
51
- deprecated(
52
- 'Bottom margin styles for wp.blockEditor.FontFamilyControl',
53
- {
54
- since: '6.7',
55
- version: '7.0',
56
- hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',
57
- }
58
- );
59
- }
60
-
61
48
  if (
62
49
  ! __next40pxDefaultSize &&
63
50
  ( props.size === undefined || props.size === 'default' )
@@ -82,9 +69,7 @@ export default function FontFamilyControl( {
82
69
  value={ selectedValue }
83
70
  onChange={ ( { selectedItem } ) => onChange( selectedItem.key ) }
84
71
  options={ options }
85
- className={ clsx( 'block-editor-font-family-control', className, {
86
- 'is-next-has-no-margin-bottom': __nextHasNoMarginBottom,
87
- } ) }
72
+ className={ clsx( 'block-editor-font-family-control', className ) }
88
73
  { ...props }
89
74
  />
90
75
  );
@@ -49,7 +49,6 @@ export const Default = {
49
49
  slug: 'system-font',
50
50
  },
51
51
  ],
52
- __nextHasNoMarginBottom: true,
53
52
  __next40pxDefaultSize: true,
54
53
  },
55
54
  };
@@ -39,6 +39,7 @@ export function useHasDimensionsPanel( settings ) {
39
39
  const hasMargin = useHasMargin( settings );
40
40
  const hasGap = useHasGap( settings );
41
41
  const hasMinHeight = useHasMinHeight( settings );
42
+ const hasWidth = useHasWidth( settings );
42
43
  const hasAspectRatio = useHasAspectRatio( settings );
43
44
  const hasChildLayout = useHasChildLayout( settings );
44
45
 
@@ -50,6 +51,7 @@ export function useHasDimensionsPanel( settings ) {
50
51
  hasMargin ||
51
52
  hasGap ||
52
53
  hasMinHeight ||
54
+ hasWidth ||
53
55
  hasAspectRatio ||
54
56
  hasChildLayout )
55
57
  );
@@ -79,6 +81,10 @@ function useHasMinHeight( settings ) {
79
81
  return settings?.dimensions?.minHeight;
80
82
  }
81
83
 
84
+ function useHasWidth( settings ) {
85
+ return settings?.dimensions?.width;
86
+ }
87
+
82
88
  function useHasAspectRatio( settings ) {
83
89
  return settings?.dimensions?.aspectRatio;
84
90
  }
@@ -206,6 +212,7 @@ const DEFAULT_CONTROLS = {
206
212
  margin: true,
207
213
  blockGap: true,
208
214
  minHeight: true,
215
+ width: true,
209
216
  aspectRatio: true,
210
217
  childLayout: true,
211
218
  };
@@ -384,6 +391,17 @@ export default function DimensionsPanel( {
384
391
  };
385
392
  const hasMinHeightValue = () => !! value?.dimensions?.minHeight;
386
393
 
394
+ // Width
395
+ const showWidthControl = useHasWidth( settings );
396
+ const widthValue = decodeValue( inheritedValue?.dimensions?.width );
397
+ const setWidthValue = ( newValue ) => {
398
+ onChange( setImmutably( value, [ 'dimensions', 'width' ], newValue ) );
399
+ };
400
+ const resetWidthValue = () => {
401
+ setWidthValue( undefined );
402
+ };
403
+ const hasWidthValue = () => !! value?.dimensions?.width;
404
+
387
405
  // Aspect Ratio
388
406
  const showAspectRatioControl = useHasAspectRatio( settings );
389
407
  const aspectRatioValue = decodeValue(
@@ -439,6 +457,7 @@ export default function DimensionsPanel( {
439
457
  ...previousValue?.dimensions,
440
458
  minHeight: undefined,
441
459
  aspectRatio: undefined,
460
+ width: undefined,
442
461
  },
443
462
  };
444
463
  }, [] );
@@ -688,6 +707,23 @@ export default function DimensionsPanel( {
688
707
  />
689
708
  </ToolsPanelItem>
690
709
  ) }
710
+ { showWidthControl && (
711
+ <ToolsPanelItem
712
+ hasValue={ hasWidthValue }
713
+ label={ __( 'Width' ) }
714
+ onDeselect={ resetWidthValue }
715
+ isShownByDefault={
716
+ defaultControls.width ?? DEFAULT_CONTROLS.width
717
+ }
718
+ panelId={ panelId }
719
+ >
720
+ <HeightControl
721
+ label={ __( 'Width' ) }
722
+ value={ widthValue }
723
+ onChange={ setWidthValue }
724
+ />
725
+ </ToolsPanelItem>
726
+ ) }
691
727
  { showAspectRatioControl && (
692
728
  <AspectRatioTool
693
729
  hasValue={ hasAspectRatioValue }
@@ -152,7 +152,7 @@ export function useSettingsForBlockElement(
152
152
  }
153
153
  } );
154
154
 
155
- [ 'aspectRatio', 'minHeight' ].forEach( ( key ) => {
155
+ [ 'aspectRatio', 'minHeight', 'width' ].forEach( ( key ) => {
156
156
  if ( ! supportedStyles.includes( key ) ) {
157
157
  updatedSettings.dimensions = {
158
158
  ...updatedSettings.dimensions,
@@ -446,7 +446,6 @@ export default function TypographyPanel( {
446
446
  value={ fontFamily }
447
447
  onChange={ setFontFamily }
448
448
  size="__unstable-large"
449
- __nextHasNoMarginBottom
450
449
  />
451
450
  </ToolsPanelItem>
452
451
  ) }
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import Cropper from 'react-easy-crop';
5
4
  import clsx from 'clsx';
6
5
 
7
6
  /**
@@ -9,12 +8,11 @@ import clsx from 'clsx';
9
8
  */
10
9
  import { Spinner } from '@wordpress/components';
11
10
  import { useResizeObserver } from '@wordpress/compose';
11
+ import { ImageCropper as ImageCropperComponent } from '@wordpress/image-cropper';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
- import { MIN_ZOOM, MAX_ZOOM } from './constants';
17
-
18
16
  import { useImageEditingContext } from './context';
19
17
 
20
18
  export default function ImageCropper( {
@@ -25,17 +23,7 @@ export default function ImageCropper( {
25
23
  naturalWidth,
26
24
  borderProps,
27
25
  } ) {
28
- const {
29
- isInProgress,
30
- editedUrl,
31
- position,
32
- zoom,
33
- aspect,
34
- setPosition,
35
- setCrop,
36
- setZoom,
37
- rotation,
38
- } = useImageEditingContext();
26
+ const { isInProgress, editedUrl, rotation } = useImageEditingContext();
39
27
  const [ contentResizeListener, { width: clientWidth } ] =
40
28
  useResizeObserver();
41
29
 
@@ -60,24 +48,7 @@ export default function ImageCropper( {
60
48
  height: editedHeight,
61
49
  } }
62
50
  >
63
- <Cropper
64
- image={ editedUrl || url }
65
- disabled={ isInProgress }
66
- minZoom={ MIN_ZOOM / 100 }
67
- maxZoom={ MAX_ZOOM / 100 }
68
- crop={ position }
69
- zoom={ zoom / 100 }
70
- aspect={ aspect }
71
- onCropChange={ ( pos ) => {
72
- setPosition( pos );
73
- } }
74
- onCropComplete={ ( newCropPercent ) => {
75
- setCrop( newCropPercent );
76
- } }
77
- onZoomChange={ ( newZoom ) => {
78
- setZoom( newZoom * 100 );
79
- } }
80
- />
51
+ <ImageCropperComponent src={ editedUrl || url } />
81
52
  { isInProgress && <Spinner /> }
82
53
  </div>
83
54
  );
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { ToolbarGroup, ToolbarItem } from '@wordpress/components';
5
+ import { ImageCropperProvider } from '@wordpress/image-cropper';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -26,36 +27,40 @@ export default function ImageEditor( {
26
27
  borderProps,
27
28
  } ) {
28
29
  return (
29
- <ImageEditingProvider
30
- id={ id }
31
- url={ url }
32
- naturalWidth={ naturalWidth }
33
- naturalHeight={ naturalHeight }
34
- onSaveImage={ onSaveImage }
35
- onFinishEditing={ onFinishEditing }
36
- >
37
- <Cropper
38
- borderProps={ borderProps }
30
+ <ImageCropperProvider>
31
+ <ImageEditingProvider
32
+ id={ id }
39
33
  url={ url }
40
- width={ width }
41
- height={ height }
42
- naturalHeight={ naturalHeight }
43
34
  naturalWidth={ naturalWidth }
44
- />
45
- <BlockControls>
46
- <ToolbarGroup>
47
- <ZoomDropdown />
48
- <ToolbarItem>
49
- { ( toggleProps ) => (
50
- <AspectRatioDropdown toggleProps={ toggleProps } />
51
- ) }
52
- </ToolbarItem>
53
- <RotationButton />
54
- </ToolbarGroup>
55
- <ToolbarGroup>
56
- <FormControls />
57
- </ToolbarGroup>
58
- </BlockControls>
59
- </ImageEditingProvider>
35
+ naturalHeight={ naturalHeight }
36
+ onSaveImage={ onSaveImage }
37
+ onFinishEditing={ onFinishEditing }
38
+ >
39
+ <Cropper
40
+ borderProps={ borderProps }
41
+ url={ url }
42
+ width={ width }
43
+ height={ height }
44
+ naturalHeight={ naturalHeight }
45
+ naturalWidth={ naturalWidth }
46
+ />
47
+ <BlockControls>
48
+ <ToolbarGroup>
49
+ <ZoomDropdown />
50
+ <ToolbarItem>
51
+ { ( toggleProps ) => (
52
+ <AspectRatioDropdown
53
+ toggleProps={ toggleProps }
54
+ />
55
+ ) }
56
+ </ToolbarItem>
57
+ <RotationButton />
58
+ </ToolbarGroup>
59
+ <ToolbarGroup>
60
+ <FormControls />
61
+ </ToolbarGroup>
62
+ </BlockControls>
63
+ </ImageEditingProvider>
64
+ </ImageCropperProvider>
60
65
  );
61
66
  }
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useCallback, useMemo, useState } from '@wordpress/element';
4
+ import { useCallback, useEffect, useMemo, useState } from '@wordpress/element';
5
5
  import { applyFilters } from '@wordpress/hooks';
6
+ import { useImageCropper } from '@wordpress/image-cropper';
6
7
 
7
8
  export default function useTransformImage( {
8
9
  url,
@@ -10,30 +11,63 @@ export default function useTransformImage( {
10
11
  naturalHeight,
11
12
  } ) {
12
13
  const [ editedUrl, setEditedUrl ] = useState();
13
- const [ crop, setCrop ] = useState();
14
- const [ position, setPosition ] = useState( { x: 0, y: 0 } );
15
- const [ zoom, setZoom ] = useState( 100 );
16
- const [ rotation, setRotation ] = useState( 0 );
17
- const defaultAspect = naturalWidth / naturalHeight;
18
- const [ aspect, setAspect ] = useState( defaultAspect );
14
+ const { cropperState, setCropperState } = useImageCropper();
15
+ const { zoom, aspectRatio, crop, croppedArea } = cropperState;
16
+
17
+ const setZoom = useCallback(
18
+ ( newZoom ) => {
19
+ setCropperState( { zoom: newZoom } );
20
+ },
21
+ [ setCropperState ]
22
+ );
23
+
24
+ const setAspectRatio = useCallback(
25
+ ( newAspect ) => {
26
+ setCropperState( { aspectRatio: newAspect } );
27
+ },
28
+ [ setCropperState ]
29
+ );
19
30
 
31
+ const defaultAspect = naturalWidth / naturalHeight;
32
+ const rotatedAspect = naturalHeight / naturalWidth;
33
+
34
+ // Initialize aspect ratio on mount or when defaultAspect changes
35
+ useEffect( () => {
36
+ setAspectRatio( defaultAspect );
37
+ }, [] ); // eslint-disable-line react-hooks/exhaustive-deps
38
+
39
+ /**
40
+ * rotateClockwise rotates the image by 90° clockwise by drawing the original image onto a canvas with rotation applied,
41
+ * then saves it as a new blob URL (editedUrl).
42
+ * This creates a new rotated image file, bypassing the image-cropper’s CSS transform rotation.
43
+ * It's a bespoke solution to ensure that the rotated image fills the content width.
44
+ */
45
+ const [ internalRotation, setInternalRotation ] = useState( 0 );
20
46
  const rotateClockwise = useCallback( () => {
21
- const angle = ( rotation + 90 ) % 360;
47
+ const angle = ( internalRotation + 90 ) % 360;
22
48
 
23
49
  let naturalAspectRatio = defaultAspect;
50
+ const isDefaultAspect =
51
+ defaultAspect === aspectRatio || rotatedAspect === aspectRatio;
52
+ const shouldResetAspect = zoom !== 1 || ! isDefaultAspect;
24
53
 
25
- if ( rotation % 180 === 90 ) {
54
+ if ( internalRotation % 180 === 90 ) {
26
55
  naturalAspectRatio = 1 / defaultAspect;
27
56
  }
28
57
 
29
58
  if ( angle === 0 ) {
30
59
  setEditedUrl();
31
- setRotation( angle );
32
- setAspect( defaultAspect );
33
- setPosition( ( prevPosition ) => ( {
34
- x: -( prevPosition.y * naturalAspectRatio ),
35
- y: prevPosition.x * naturalAspectRatio,
36
- } ) );
60
+ setInternalRotation( angle );
61
+ const newAspectRatio = shouldResetAspect
62
+ ? aspectRatio
63
+ : defaultAspect;
64
+ setCropperState( {
65
+ aspectRatio: newAspectRatio,
66
+ crop: {
67
+ x: -( crop.y * naturalAspectRatio ),
68
+ y: crop.x * naturalAspectRatio,
69
+ },
70
+ } );
37
71
  return;
38
72
  }
39
73
 
@@ -67,12 +101,17 @@ export default function useTransformImage( {
67
101
 
68
102
  canvas.toBlob( ( blob ) => {
69
103
  setEditedUrl( URL.createObjectURL( blob ) );
70
- setRotation( angle );
71
- setAspect( canvas.width / canvas.height );
72
- setPosition( ( prevPosition ) => ( {
73
- x: -( prevPosition.y * naturalAspectRatio ),
74
- y: prevPosition.x * naturalAspectRatio,
75
- } ) );
104
+ setInternalRotation( angle );
105
+ const newAspectRatio = shouldResetAspect
106
+ ? aspectRatio
107
+ : canvas.width / canvas.height;
108
+ setCropperState( {
109
+ aspectRatio: newAspectRatio,
110
+ crop: {
111
+ x: -( crop.y * naturalAspectRatio ),
112
+ y: crop.x * naturalAspectRatio,
113
+ },
114
+ } );
76
115
  } );
77
116
  }
78
117
 
@@ -88,33 +127,40 @@ export default function useTransformImage( {
88
127
  if ( typeof imgCrossOrigin === 'string' ) {
89
128
  el.crossOrigin = imgCrossOrigin;
90
129
  }
91
- }, [ rotation, defaultAspect, url ] );
130
+ }, [
131
+ internalRotation,
132
+ defaultAspect,
133
+ url,
134
+ setCropperState,
135
+ crop,
136
+ zoom,
137
+ aspectRatio,
138
+ rotatedAspect,
139
+ setInternalRotation,
140
+ ] );
92
141
 
93
142
  return useMemo(
94
143
  () => ( {
95
144
  editedUrl,
96
145
  setEditedUrl,
97
- crop,
98
- setCrop,
99
- position,
100
- setPosition,
146
+ crop: croppedArea,
101
147
  zoom,
102
148
  setZoom,
103
- rotation,
104
- setRotation,
149
+ rotation: internalRotation,
105
150
  rotateClockwise,
106
- aspect,
107
- setAspect,
151
+ aspect: aspectRatio,
152
+ setAspect: setAspectRatio,
108
153
  defaultAspect,
109
154
  } ),
110
155
  [
111
156
  editedUrl,
112
- crop,
113
- position,
157
+ croppedArea,
114
158
  zoom,
115
- rotation,
159
+ setZoom,
160
+ internalRotation,
116
161
  rotateClockwise,
117
- aspect,
162
+ aspectRatio,
163
+ setAspectRatio,
118
164
  defaultAspect,
119
165
  ]
120
166
  );
@@ -39,8 +39,8 @@ export default function ZoomDropdown() {
39
39
  label={ __( 'Zoom' ) }
40
40
  min={ MIN_ZOOM }
41
41
  max={ MAX_ZOOM }
42
- value={ Math.round( zoom ) }
43
- onChange={ setZoom }
42
+ value={ Math.round( zoom * 100 ) }
43
+ onChange={ ( newZoom ) => setZoom( newZoom / 100 ) }
44
44
  />
45
45
  </DropdownContentWrapper>
46
46
  ) }
@@ -11,6 +11,11 @@ export {
11
11
  BlockAlignmentControl,
12
12
  BlockAlignmentToolbar,
13
13
  } from './block-alignment-control';
14
+ export {
15
+ BlockBindingsAttributeControl,
16
+ BlockBindingsSourceFieldsList,
17
+ useBlockBindingsUtils,
18
+ } from './block-bindings';
14
19
  export { default as __experimentalBlockFullHeightAligmentControl } from './block-full-height-alignment-control';
15
20
  export { default as __experimentalBlockAlignmentMatrixControl } from './block-alignment-matrix-control';
16
21
  export { default as BlockBreadcrumb } from './block-breadcrumb';
@@ -107,7 +112,6 @@ export {
107
112
 
108
113
  export { default as __unstableBlockSettingsMenuFirstItem } from './block-settings-menu/block-settings-menu-first-item';
109
114
  export { default as __unstableBlockToolbarLastItem } from './block-toolbar/block-toolbar-last-item';
110
- export { default as __unstableBlockNameContext } from './block-toolbar/block-name-context';
111
115
  export { default as __unstableInserterMenuExtension } from './inserter-menu-extension';
112
116
  export { default as __experimentalPreviewOptions } from './preview-options';
113
117
  export { default as __experimentalUseResizeCanvas } from './use-resize-canvas';
@@ -172,3 +176,7 @@ export { useBlockEditingMode } from './block-editing-mode';
172
176
  export { default as BlockEditorProvider } from './provider';
173
177
  export { useSettings, useSetting } from './use-settings';
174
178
  export { useBlockCommands } from './use-block-commands';
179
+
180
+ // This component is no longer used in Gutenberg,
181
+ // but kept for backwards compatibility.
182
+ export { default as ToolSelector } from './tool-selector';
@@ -383,7 +383,7 @@ $block-inserter-tabs-height: 44px;
383
383
  left: 0;
384
384
  bottom: 0;
385
385
  width: $sidebar-width;
386
- padding: $grid-unit-30 $grid-unit-40 $grid-unit-40;
386
+ padding: $grid-unit-30 $grid-unit-30 $grid-unit-30;
387
387
  overflow-x: visible;
388
388
  overflow-y: auto;
389
389
 
@@ -21,14 +21,15 @@ const InserterDraggableBlocks = ( {
21
21
  children,
22
22
  pattern,
23
23
  } ) => {
24
+ const blockName = blocks.length === 1 ? blocks[ 0 ].name : undefined;
24
25
  const blockTypeIcon = useSelect(
25
26
  ( select ) => {
26
- const { getBlockType } = select( blocksStore );
27
27
  return (
28
- blocks.length === 1 && getBlockType( blocks[ 0 ].name )?.icon
28
+ blockName &&
29
+ select( blocksStore ).getBlockType( blockName )?.icon
29
30
  );
30
31
  },
31
- [ blocks ]
32
+ [ blockName ]
32
33
  );
33
34
 
34
35
  const { startDragging, stopDragging } = unlock(
@@ -57,13 +58,23 @@ const InserterDraggableBlocks = ( {
57
58
  transferData={ { type: 'inserter', blocks: draggableBlocks } }
58
59
  onDragStart={ ( event ) => {
59
60
  startDragging();
61
+ const addedTypes = new Set();
60
62
  for ( const block of draggableBlocks ) {
61
63
  const type = `wp-block:${ block.name }`;
62
- // This will fill in the dataTransfer.types array so that
63
- // the drop zone can check if the draggable is eligible.
64
- // Unfortuantely, on drag start, we don't have access to the
65
- // actual data, only the data keys/types.
66
- event.dataTransfer.items.add( '', type );
64
+ /*
65
+ * Only add each block type once to avoid DataTransferItemList::add `NotSupportedError`
66
+ * when patterns contain multiple blocks of the same type.
67
+ */
68
+ if ( ! addedTypes.has( type ) ) {
69
+ /*
70
+ * This will fill in the dataTransfer.types array so that
71
+ * the drop zone can check if the draggable is eligible.
72
+ * Unfortuantely, on drag start, we don't have access to the
73
+ * actual data, only the data keys/types.
74
+ */
75
+ event.dataTransfer.items.add( '', type );
76
+ addedTypes.add( type );
77
+ }
67
78
  }
68
79
  } }
69
80
  onDragEnd={ () => {
@@ -15,14 +15,18 @@ const ContentTab = ( { rootClientId, contentClientIds } ) => {
15
15
  return null;
16
16
  }
17
17
 
18
+ const shouldShowContentOnlyControls =
19
+ window?.__experimentalContentOnlyPatternInsertion &&
20
+ window?.__experimentalContentOnlyInspectorFields;
21
+
18
22
  return (
19
23
  <>
20
- { ! window?.__experimentalContentOnlyPatternInsertion && (
24
+ { ! shouldShowContentOnlyControls && (
21
25
  <PanelBody title={ __( 'Content' ) }>
22
26
  <BlockQuickNavigation clientIds={ contentClientIds } />
23
27
  </PanelBody>
24
28
  ) }
25
- { window?.__experimentalContentOnlyPatternInsertion && (
29
+ { shouldShowContentOnlyControls && (
26
30
  <ContentOnlyControls rootClientId={ rootClientId } />
27
31
  ) }
28
32
  </>
@@ -99,11 +99,7 @@ export default function useInspectorControlsTabs(
99
99
  tabs.push( TAB_SETTINGS );
100
100
  }
101
101
 
102
- if (
103
- hasBlockStyles ||
104
- hasStyleFills ||
105
- window?.__experimentalContentOnlyPatternInsertion
106
- ) {
102
+ if ( hasBlockStyles || hasStyleFills ) {
107
103
  tabs.push( TAB_STYLES );
108
104
  }
109
105