@wordpress/block-editor 15.17.0 → 15.18.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 (276) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/autocomplete/index.cjs.map +3 -3
  3. package/build/components/background-image-control/index.cjs +2 -1
  4. package/build/components/background-image-control/index.cjs.map +2 -2
  5. package/build/components/block-allowed-blocks/modal.cjs.map +2 -2
  6. package/build/components/block-bindings/attribute-control.cjs.map +3 -3
  7. package/build/components/block-card/index.cjs +2 -2
  8. package/build/components/block-card/index.cjs.map +3 -3
  9. package/build/components/block-mover/button.cjs +9 -3
  10. package/build/components/block-mover/button.cjs.map +2 -2
  11. package/build/components/block-pattern-setup/index.cjs +3 -2
  12. package/build/components/block-pattern-setup/index.cjs.map +2 -2
  13. package/build/components/block-patterns-list/index.cjs +2 -1
  14. package/build/components/block-patterns-list/index.cjs.map +2 -2
  15. package/build/components/block-patterns-paging/index.cjs.map +3 -3
  16. package/build/components/block-settings-menu/block-settings-dropdown.cjs +2 -2
  17. package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +3 -3
  18. package/build/components/block-settings-menu/index.cjs +2 -2
  19. package/build/components/block-settings-menu/index.cjs.map +3 -3
  20. package/build/components/block-styles/menu-items.cjs.map +3 -3
  21. package/build/components/block-switcher/index.cjs.map +3 -3
  22. package/build/components/block-switcher/pattern-transformations-menu.cjs +2 -1
  23. package/build/components/block-switcher/pattern-transformations-menu.cjs.map +2 -2
  24. package/build/components/block-toolbar/pattern-overrides-dropdown.cjs.map +3 -3
  25. package/build/components/block-variation-transforms/index.cjs +2 -1
  26. package/build/components/block-variation-transforms/index.cjs.map +2 -2
  27. package/build/components/block-visibility/viewport-visibility-info.cjs +4 -4
  28. package/build/components/block-visibility/viewport-visibility-info.cjs.map +3 -3
  29. package/build/components/collab/{block-comment-icon-slot.cjs → note-icon-slot.cjs} +8 -8
  30. package/build/components/collab/note-icon-slot.cjs.map +7 -0
  31. package/build/components/collab/{block-comment-icon-toolbar-slot.cjs → note-icon-toolbar-slot.cjs} +9 -9
  32. package/build/components/collab/note-icon-toolbar-slot.cjs.map +7 -0
  33. package/build/components/date-format-picker/index.cjs +2 -1
  34. package/build/components/date-format-picker/index.cjs.map +2 -2
  35. package/build/components/global-styles/color-panel.cjs.map +2 -2
  36. package/build/components/global-styles/dimensions-panel.cjs +87 -62
  37. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  38. package/build/components/global-styles/filters-panel.cjs.map +2 -2
  39. package/build/components/global-styles/hooks.cjs +9 -7
  40. package/build/components/global-styles/hooks.cjs.map +2 -2
  41. package/build/components/grid/grid-item-movers.cjs +2 -1
  42. package/build/components/grid/grid-item-movers.cjs.map +2 -2
  43. package/build/components/inserter/block-patterns-tab/pattern-category-previews.cjs.map +2 -2
  44. package/build/components/inserter/menu.cjs +2 -1
  45. package/build/components/inserter/menu.cjs.map +2 -2
  46. package/build/components/inserter/search-results.cjs +3 -3
  47. package/build/components/inserter/search-results.cjs.map +2 -2
  48. package/build/components/inspector-popover-header/index.cjs.map +3 -3
  49. package/build/components/link-control/link-preview.cjs +2 -2
  50. package/build/components/link-control/link-preview.cjs.map +2 -2
  51. package/build/components/link-control/settings.cjs +2 -1
  52. package/build/components/link-control/settings.cjs.map +2 -2
  53. package/build/components/link-picker/link-picker.cjs +3 -2
  54. package/build/components/link-picker/link-picker.cjs.map +2 -2
  55. package/build/components/link-picker/link-preview.cjs +2 -2
  56. package/build/components/link-picker/link-preview.cjs.map +2 -2
  57. package/build/components/list-view/block-select-button.cjs +2 -2
  58. package/build/components/list-view/block-select-button.cjs.map +2 -2
  59. package/build/components/list-view/index.cjs +2 -1
  60. package/build/components/list-view/index.cjs.map +2 -2
  61. package/build/components/provider/index.cjs +80 -7
  62. package/build/components/provider/index.cjs.map +2 -2
  63. package/build/components/responsive-block-control/label.cjs +9 -2
  64. package/build/components/responsive-block-control/label.cjs.map +2 -2
  65. package/build/components/rich-text/event-listeners/paste-handler.cjs +12 -5
  66. package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
  67. package/build/components/url-popover/image-url-input-ui.cjs +1 -1
  68. package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
  69. package/build/components/writing-flow/use-arrow-nav.cjs +1 -1
  70. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  71. package/build/hooks/block-bindings.cjs.map +3 -3
  72. package/build/hooks/block-fields/link/index.cjs +1 -1
  73. package/build/hooks/block-fields/link/index.cjs.map +1 -1
  74. package/build/hooks/custom-css.cjs +21 -0
  75. package/build/hooks/custom-css.cjs.map +3 -3
  76. package/build/hooks/dimensions.cjs +5 -1
  77. package/build/hooks/dimensions.cjs.map +2 -2
  78. package/build/hooks/grid-visualizer.cjs +1 -1
  79. package/build/hooks/grid-visualizer.cjs.map +1 -1
  80. package/build/hooks/layout-child.cjs +1 -1
  81. package/build/hooks/layout-child.cjs.map +1 -1
  82. package/build/hooks/utils.cjs +4 -0
  83. package/build/hooks/utils.cjs.map +2 -2
  84. package/build/layouts/flex.cjs +5 -8
  85. package/build/layouts/flex.cjs.map +3 -3
  86. package/build/layouts/grid.cjs +5 -5
  87. package/build/layouts/grid.cjs.map +2 -2
  88. package/build/private-apis.cjs +5 -4
  89. package/build/private-apis.cjs.map +3 -3
  90. package/build/store/private-keys.cjs +3 -0
  91. package/build/store/private-keys.cjs.map +2 -2
  92. package/build/utils/dom.cjs +3 -1
  93. package/build/utils/dom.cjs.map +2 -2
  94. package/build-module/components/autocomplete/index.mjs +2 -2
  95. package/build-module/components/autocomplete/index.mjs.map +2 -2
  96. package/build-module/components/background-image-control/index.mjs +2 -2
  97. package/build-module/components/background-image-control/index.mjs.map +2 -2
  98. package/build-module/components/block-allowed-blocks/modal.mjs +2 -2
  99. package/build-module/components/block-allowed-blocks/modal.mjs.map +2 -2
  100. package/build-module/components/block-bindings/attribute-control.mjs +3 -3
  101. package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
  102. package/build-module/components/block-card/index.mjs +4 -4
  103. package/build-module/components/block-card/index.mjs.map +2 -2
  104. package/build-module/components/block-mover/button.mjs +11 -5
  105. package/build-module/components/block-mover/button.mjs.map +2 -2
  106. package/build-module/components/block-pattern-setup/index.mjs +2 -1
  107. package/build-module/components/block-pattern-setup/index.mjs.map +2 -2
  108. package/build-module/components/block-patterns-list/index.mjs +1 -1
  109. package/build-module/components/block-patterns-list/index.mjs.map +2 -2
  110. package/build-module/components/block-patterns-paging/index.mjs +3 -3
  111. package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
  112. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +2 -2
  113. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
  114. package/build-module/components/block-settings-menu/index.mjs +2 -2
  115. package/build-module/components/block-settings-menu/index.mjs.map +2 -2
  116. package/build-module/components/block-styles/menu-items.mjs +2 -2
  117. package/build-module/components/block-styles/menu-items.mjs.map +2 -2
  118. package/build-module/components/block-switcher/index.mjs +2 -2
  119. package/build-module/components/block-switcher/index.mjs.map +2 -2
  120. package/build-module/components/block-switcher/pattern-transformations-menu.mjs +2 -7
  121. package/build-module/components/block-switcher/pattern-transformations-menu.mjs.map +2 -2
  122. package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs +2 -2
  123. package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs.map +2 -2
  124. package/build-module/components/block-variation-transforms/index.mjs +2 -2
  125. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  126. package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -6
  127. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
  128. package/build-module/components/collab/note-icon-slot.mjs +8 -0
  129. package/build-module/components/collab/note-icon-slot.mjs.map +7 -0
  130. package/build-module/components/collab/note-icon-toolbar-slot.mjs +10 -0
  131. package/build-module/components/collab/note-icon-toolbar-slot.mjs.map +7 -0
  132. package/build-module/components/date-format-picker/index.mjs +2 -2
  133. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  134. package/build-module/components/global-styles/color-panel.mjs.map +2 -2
  135. package/build-module/components/global-styles/dimensions-panel.mjs +87 -62
  136. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  137. package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
  138. package/build-module/components/global-styles/hooks.mjs +9 -7
  139. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  140. package/build-module/components/grid/grid-item-movers.mjs +2 -5
  141. package/build-module/components/grid/grid-item-movers.mjs.map +2 -2
  142. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.mjs +3 -3
  143. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.mjs.map +1 -1
  144. package/build-module/components/inserter/menu.mjs +3 -2
  145. package/build-module/components/inserter/menu.mjs.map +2 -2
  146. package/build-module/components/inserter/search-results.mjs +1 -1
  147. package/build-module/components/inserter/search-results.mjs.map +1 -1
  148. package/build-module/components/inspector-popover-header/index.mjs +2 -2
  149. package/build-module/components/inspector-popover-header/index.mjs.map +2 -2
  150. package/build-module/components/link-control/link-preview.mjs +2 -2
  151. package/build-module/components/link-control/link-preview.mjs.map +2 -2
  152. package/build-module/components/link-control/settings.mjs +3 -2
  153. package/build-module/components/link-control/settings.mjs.map +2 -2
  154. package/build-module/components/link-picker/link-picker.mjs +1 -1
  155. package/build-module/components/link-picker/link-picker.mjs.map +2 -2
  156. package/build-module/components/link-picker/link-preview.mjs +2 -2
  157. package/build-module/components/link-picker/link-preview.mjs.map +2 -2
  158. package/build-module/components/list-view/block-select-button.mjs +2 -2
  159. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  160. package/build-module/components/list-view/index.mjs +2 -4
  161. package/build-module/components/list-view/index.mjs.map +2 -2
  162. package/build-module/components/provider/index.mjs +82 -8
  163. package/build-module/components/provider/index.mjs.map +2 -2
  164. package/build-module/components/responsive-block-control/label.mjs +9 -2
  165. package/build-module/components/responsive-block-control/label.mjs.map +2 -2
  166. package/build-module/components/rich-text/event-listeners/paste-handler.mjs +12 -5
  167. package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
  168. package/build-module/components/url-popover/image-url-input-ui.mjs +1 -1
  169. package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
  170. package/build-module/components/writing-flow/use-arrow-nav.mjs +1 -1
  171. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  172. package/build-module/hooks/block-bindings.mjs +2 -2
  173. package/build-module/hooks/block-bindings.mjs.map +2 -2
  174. package/build-module/hooks/block-fields/link/index.mjs +1 -1
  175. package/build-module/hooks/block-fields/link/index.mjs.map +1 -1
  176. package/build-module/hooks/custom-css.mjs +23 -2
  177. package/build-module/hooks/custom-css.mjs.map +2 -2
  178. package/build-module/hooks/dimensions.mjs +5 -1
  179. package/build-module/hooks/dimensions.mjs.map +2 -2
  180. package/build-module/hooks/grid-visualizer.mjs +1 -1
  181. package/build-module/hooks/grid-visualizer.mjs.map +1 -1
  182. package/build-module/hooks/layout-child.mjs +1 -1
  183. package/build-module/hooks/layout-child.mjs.map +1 -1
  184. package/build-module/hooks/utils.mjs +4 -0
  185. package/build-module/hooks/utils.mjs.map +2 -2
  186. package/build-module/layouts/flex.mjs +4 -7
  187. package/build-module/layouts/flex.mjs.map +2 -2
  188. package/build-module/layouts/grid.mjs +4 -4
  189. package/build-module/layouts/grid.mjs.map +2 -2
  190. package/build-module/private-apis.mjs +7 -5
  191. package/build-module/private-apis.mjs.map +2 -2
  192. package/build-module/store/private-keys.mjs +2 -0
  193. package/build-module/store/private-keys.mjs.map +2 -2
  194. package/build-module/utils/dom.mjs +2 -1
  195. package/build-module/utils/dom.mjs.map +2 -2
  196. package/build-style/content-rtl.css +1 -4
  197. package/build-style/content.css +1 -4
  198. package/build-style/style-rtl.css +12 -12
  199. package/build-style/style.css +12 -12
  200. package/build-types/utils/dom.d.ts +7 -0
  201. package/build-types/utils/dom.d.ts.map +1 -1
  202. package/package.json +39 -38
  203. package/src/components/autocomplete/index.js +4 -2
  204. package/src/components/background-image-control/index.js +2 -2
  205. package/src/components/background-image-control/style.scss +1 -1
  206. package/src/components/block-allowed-blocks/modal.js +3 -3
  207. package/src/components/block-bindings/attribute-control.js +4 -4
  208. package/src/components/block-card/index.js +5 -5
  209. package/src/components/block-list/content.scss +0 -4
  210. package/src/components/block-mover/button.js +17 -7
  211. package/src/components/block-pattern-setup/index.js +2 -1
  212. package/src/components/block-pattern-setup/style.scss +2 -2
  213. package/src/components/block-patterns-list/index.js +1 -1
  214. package/src/components/block-patterns-list/style.scss +1 -1
  215. package/src/components/block-patterns-paging/index.js +5 -6
  216. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
  217. package/src/components/block-settings-menu/index.js +2 -2
  218. package/src/components/block-styles/menu-items.js +3 -3
  219. package/src/components/block-switcher/index.js +3 -3
  220. package/src/components/block-switcher/pattern-transformations-menu.js +2 -7
  221. package/src/components/block-switcher/style.scss +2 -2
  222. package/src/components/block-toolbar/pattern-overrides-dropdown.js +2 -2
  223. package/src/components/block-variation-transforms/index.js +2 -2
  224. package/src/components/block-visibility/viewport-visibility-info.js +7 -7
  225. package/src/components/collab/note-icon-slot.js +8 -0
  226. package/src/components/collab/note-icon-toolbar-slot.js +10 -0
  227. package/src/components/date-format-picker/index.js +4 -2
  228. package/src/components/global-styles/color-panel.js +0 -2
  229. package/src/components/global-styles/dimensions-panel.js +100 -73
  230. package/src/components/global-styles/filters-panel.js +0 -2
  231. package/src/components/global-styles/hooks.js +9 -7
  232. package/src/components/global-styles/style.scss +1 -1
  233. package/src/components/grid/grid-item-movers.js +2 -5
  234. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -5
  235. package/src/components/inserter/menu.js +3 -2
  236. package/src/components/inserter/search-results.js +1 -1
  237. package/src/components/inserter/style.scss +2 -2
  238. package/src/components/inserter-list-item/style.scss +1 -1
  239. package/src/components/inspector-popover-header/index.js +2 -2
  240. package/src/components/link-control/link-preview.js +3 -3
  241. package/src/components/link-control/settings.js +3 -2
  242. package/src/components/link-picker/link-picker.js +1 -1
  243. package/src/components/link-picker/link-preview.js +3 -3
  244. package/src/components/list-view/block-select-button.js +3 -3
  245. package/src/components/list-view/index.js +2 -4
  246. package/src/components/list-view/style.scss +1 -1
  247. package/src/components/media-placeholder/content.scss +1 -1
  248. package/src/components/provider/index.js +149 -8
  249. package/src/components/responsive-block-control/label.js +5 -2
  250. package/src/components/rich-text/event-listeners/paste-handler.js +18 -4
  251. package/src/components/url-input/style.scss +1 -1
  252. package/src/components/url-popover/image-url-input-ui.js +1 -1
  253. package/src/components/writing-flow/use-arrow-nav.js +9 -2
  254. package/src/hooks/block-bindings.js +3 -3
  255. package/src/hooks/block-fields/link/index.js +1 -1
  256. package/src/hooks/custom-css.js +30 -9
  257. package/src/hooks/dimensions.js +6 -1
  258. package/src/hooks/grid-visualizer.js +1 -1
  259. package/src/hooks/layout-child.js +1 -1
  260. package/src/hooks/test/dimensions.js +16 -0
  261. package/src/hooks/test/style.js +2 -0
  262. package/src/hooks/utils.js +4 -0
  263. package/src/layouts/flex.js +7 -9
  264. package/src/layouts/grid.js +7 -4
  265. package/src/private-apis.js +6 -4
  266. package/src/store/private-keys.js +1 -0
  267. package/src/utils/dom.js +3 -3
  268. package/src/utils/test/dom.js +47 -4
  269. package/build/components/collab/block-comment-icon-slot.cjs.map +0 -7
  270. package/build/components/collab/block-comment-icon-toolbar-slot.cjs.map +0 -7
  271. package/build-module/components/collab/block-comment-icon-slot.mjs +0 -8
  272. package/build-module/components/collab/block-comment-icon-slot.mjs.map +0 -7
  273. package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs +0 -10
  274. package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs.map +0 -7
  275. package/src/components/collab/block-comment-icon-slot.js +0 -8
  276. package/src/components/collab/block-comment-icon-toolbar-slot.js +0 -10
@@ -102,6 +102,10 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
102
102
  '__experimentalDefaultControls',
103
103
  ] );
104
104
  const defaultControls = {
105
+ // In the block inspector, minHeight and minWidth should not
106
+ // be shown by default unless the block explicitly opts in.
107
+ minHeight: false,
108
+ minWidth: false,
105
109
  ...defaultDimensionsControls,
106
110
  ...defaultSpacingControls,
107
111
  };
@@ -161,7 +165,8 @@ export function hasDimensionsSupport( blockName, feature = 'any' ) {
161
165
  support?.aspectRatio ||
162
166
  !! support?.height ||
163
167
  !! support?.minHeight ||
164
- !! support?.width
168
+ !! support?.width ||
169
+ !! support?.minWidth
165
170
  );
166
171
  }
167
172
 
@@ -54,7 +54,7 @@ function GridTools( { clientId, layout } ) {
54
54
  const settings = getSettings();
55
55
  const currentDeviceType =
56
56
  settings?.[ deviceTypeKey ]?.toLowerCase() ||
57
- BLOCK_VISIBILITY_VIEWPORTS.desktop.value;
57
+ BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
58
58
 
59
59
  return {
60
60
  isVisible: true,
@@ -244,7 +244,7 @@ function GridTools( {
244
244
  blockAttributes?.metadata?.blockVisibility,
245
245
  deviceType:
246
246
  settings?.[ deviceTypeKey ]?.toLowerCase() ||
247
- BLOCK_VISIBILITY_VIEWPORTS.desktop.value,
247
+ BLOCK_VISIBILITY_VIEWPORTS.desktop.key,
248
248
  // Check if the selected child block is itself a grid.
249
249
  isChildBlockAGrid: blockAttributes?.layout?.type === 'grid',
250
250
  };
@@ -76,6 +76,22 @@ describe( 'getDimensionsClassesAndStyles', () => {
76
76
  } );
77
77
  } );
78
78
 
79
+ it( 'should return minWidth style', () => {
80
+ const attributes = {
81
+ style: {
82
+ dimensions: {
83
+ minWidth: '200px',
84
+ },
85
+ },
86
+ };
87
+ expect( getDimensionsClassesAndStyles( attributes ) ).toEqual( {
88
+ className: undefined,
89
+ style: {
90
+ minWidth: '200px',
91
+ },
92
+ } );
93
+ } );
94
+
79
95
  it( 'should return all dimension styles when multiple are provided', () => {
80
96
  const attributes = {
81
97
  style: {
@@ -25,6 +25,7 @@ describe( 'getInlineStyles', () => {
25
25
  },
26
26
  dimensions: {
27
27
  minHeight: '50vh',
28
+ minWidth: '200px',
28
29
  },
29
30
  spacing: {
30
31
  blockGap: '1em',
@@ -44,6 +45,7 @@ describe( 'getInlineStyles', () => {
44
45
  fontSize: 10,
45
46
  marginBottom: '15px',
46
47
  minHeight: '50vh',
48
+ minWidth: '200px',
47
49
  paddingTop: '10px',
48
50
  } );
49
51
  } );
@@ -269,6 +269,7 @@ export function useBlockSettings( name, parentLayout ) {
269
269
  aspectRatio,
270
270
  height,
271
271
  minHeight,
272
+ minWidth,
272
273
  width,
273
274
  dimensionSizes,
274
275
  layout,
@@ -332,6 +333,7 @@ export function useBlockSettings( name, parentLayout ) {
332
333
  'dimensions.aspectRatio',
333
334
  'dimensions.height',
334
335
  'dimensions.minHeight',
336
+ 'dimensions.minWidth',
335
337
  'dimensions.width',
336
338
  'dimensions.dimensionSizes',
337
339
  'layout',
@@ -446,6 +448,7 @@ export function useBlockSettings( name, parentLayout ) {
446
448
  aspectRatio,
447
449
  height,
448
450
  minHeight,
451
+ minWidth,
449
452
  width,
450
453
  dimensionSizes,
451
454
  },
@@ -487,6 +490,7 @@ export function useBlockSettings( name, parentLayout ) {
487
490
  aspectRatio,
488
491
  height,
489
492
  minHeight,
493
+ minWidth,
490
494
  width,
491
495
  dimensionSizes,
492
496
  layout,
@@ -23,7 +23,8 @@ import {
23
23
  * Internal dependencies
24
24
  */
25
25
  import { appendSelectors, getBlockGapCSS } from './utils';
26
- import { getGapCSSValue } from '../hooks/gap';
26
+ import { getGapCSSValue, getGapBoxControlValueFromStyle } from '../hooks/gap';
27
+ import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';
27
28
  import {
28
29
  BlockControls,
29
30
  JustifyContentControl,
@@ -147,15 +148,12 @@ export default {
147
148
  // falling back to '0.5em' for backwards compatibility.
148
149
  let fallbackGapValue = '0.5em';
149
150
  if ( globalBlockGapValue ) {
150
- // Process the global gap value to handle preset values
151
- const processedGlobalGap = getGapCSSValue(
152
- globalBlockGapValue,
153
- '0.5em'
154
- );
155
- // Use the column gap value (second value if two values exist)
156
- const gapParts = processedGlobalGap.split( ' ' );
151
+ const gapBox =
152
+ getGapBoxControlValueFromStyle( globalBlockGapValue );
157
153
  fallbackGapValue =
158
- gapParts.length > 1 ? gapParts[ 1 ] : gapParts[ 0 ];
154
+ getSpacingPresetCssVar( gapBox?.left ) ||
155
+ getSpacingPresetCssVar( gapBox?.top ) ||
156
+ '0.5em';
159
157
  }
160
158
 
161
159
  // If a block's block.json skips serialization for spacing or spacing.blockGap,
@@ -21,7 +21,8 @@ import { useState } from '@wordpress/element';
21
21
  * Internal dependencies
22
22
  */
23
23
  import { appendSelectors, getBlockGapCSS } from './utils';
24
- import { getGapCSSValue } from '../hooks/gap';
24
+ import { getGapCSSValue, getGapBoxControlValueFromStyle } from '../hooks/gap';
25
+ import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';
25
26
  import { shouldSkipSerialization } from '../hooks/utils';
26
27
  import { LAYOUT_DEFINITIONS } from './definitions';
27
28
 
@@ -143,10 +144,12 @@ export default {
143
144
  // If the gap value has both top and left (separated by space), use the left value for horizontal calculations.
144
145
  let fallbackGapValue = '1.2rem';
145
146
  if ( globalBlockGapValue ) {
146
- const processedGap = getGapCSSValue( globalBlockGapValue, '0.5em' );
147
- const gapParts = processedGap.split( ' ' );
147
+ const gapBox =
148
+ getGapBoxControlValueFromStyle( globalBlockGapValue );
148
149
  fallbackGapValue =
149
- gapParts.length > 1 ? gapParts[ 1 ] : gapParts[ 0 ];
150
+ getSpacingPresetCssVar( gapBox?.left ) ||
151
+ getSpacingPresetCssVar( gapBox?.top ) ||
152
+ '1.2rem';
150
153
  }
151
154
 
152
155
  // If a block's block.json skips serialization for spacing or spacing.blockGap,
@@ -50,6 +50,7 @@ import {
50
50
  isNavigationOverlayContextKey,
51
51
  isNavigationPostEditorKey,
52
52
  mediaUploadOnSuccessKey,
53
+ openMediaEditorModalKey,
53
54
  } from './store/private-keys';
54
55
  import { requiresWrapperOnCopy } from './components/writing-flow/utils';
55
56
  import { PrivateRichText } from './components/rich-text/';
@@ -59,8 +60,8 @@ import { PrivatePublishDateTimePicker } from './components/publish-date-time-pic
59
60
  import useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';
60
61
  import useBlockDisplayTitle from './components/block-title/use-block-display-title';
61
62
  import TabbedSidebar from './components/tabbed-sidebar';
62
- import CommentIconSlotFill from './components/collab/block-comment-icon-slot';
63
- import CommentIconToolbarSlotFill from './components/collab/block-comment-icon-toolbar-slot';
63
+ import NoteIconSlotFill from './components/collab/note-icon-slot';
64
+ import NoteIconToolbarSlotFill from './components/collab/note-icon-toolbar-slot';
64
65
  import HTMLElementControl from './components/html-element-control';
65
66
  import {
66
67
  useBlockElementRef,
@@ -124,8 +125,8 @@ lock( privateApis, {
124
125
  BlockStyleVariationOverridesWithConfig,
125
126
  setBackgroundStyleDefaults,
126
127
  sectionRootClientIdKey,
127
- CommentIconSlotFill,
128
- CommentIconToolbarSlotFill,
128
+ NoteIconSlotFill,
129
+ NoteIconToolbarSlotFill,
129
130
  mediaEditKey,
130
131
  getMediaSelectKey,
131
132
  deviceTypeKey,
@@ -133,6 +134,7 @@ lock( privateApis, {
133
134
  isNavigationOverlayContextKey,
134
135
  isNavigationPostEditorKey,
135
136
  mediaUploadOnSuccessKey,
137
+ openMediaEditorModalKey,
136
138
  useBlockElement,
137
139
  useBlockElementRef,
138
140
  LinkPicker,
@@ -12,3 +12,4 @@ export const isNavigationOverlayContextKey = Symbol(
12
12
  );
13
13
  export const isNavigationPostEditorKey = Symbol( 'isNavigationPostEditor' );
14
14
  export const mediaUploadOnSuccessKey = Symbol( 'mediaUploadOnSuccess' );
15
+ export const openMediaEditorModalKey = Symbol( 'openMediaEditorModal' );
package/src/utils/dom.js CHANGED
@@ -80,14 +80,14 @@ export function rectUnion( rect1, rect2 ) {
80
80
  * @param {Element} element Element.
81
81
  * @return {boolean} Whether the element is visible.
82
82
  */
83
- function isElementVisible( element ) {
83
+ export function isElementVisible( element ) {
84
84
  const viewport = element.ownerDocument.defaultView;
85
85
  if ( ! viewport ) {
86
86
  return false;
87
87
  }
88
88
 
89
- // Check for <VisuallyHidden> component.
90
- if ( element.classList.contains( 'components-visually-hidden' ) ) {
89
+ // Check for <VisuallyHidden> components.
90
+ if ( element.hasAttribute( 'data-visually-hidden' ) ) {
91
91
  return false;
92
92
  }
93
93
 
@@ -1,8 +1,51 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { getElementBounds, WITH_OVERFLOW_ELEMENT_BLOCKS } from '../dom';
1
+ import { render, screen } from '@testing-library/react';
2
+ // eslint-disable-next-line @wordpress/use-recommended-components -- Required for testing
3
+ import { VisuallyHidden as WCVisuallyHidden } from '@wordpress/components';
4
+ import { VisuallyHidden } from '@wordpress/ui';
5
+ import {
6
+ getElementBounds,
7
+ isElementVisible,
8
+ WITH_OVERFLOW_ELEMENT_BLOCKS,
9
+ } from '../dom';
10
+
11
+ function mockVisibleBoundingClientRect( element ) {
12
+ element.getBoundingClientRect = jest.fn().mockReturnValue( {
13
+ left: 0,
14
+ top: 0,
15
+ right: 100,
16
+ bottom: 20,
17
+ width: 100,
18
+ height: 20,
19
+ x: 0,
20
+ y: 0,
21
+ } );
22
+ }
23
+
5
24
  describe( 'dom', () => {
25
+ describe( 'isElementVisible', () => {
26
+ it( 'returns false for @wordpress/components VisuallyHidden', () => {
27
+ render(
28
+ <WCVisuallyHidden data-testid="wc-visually-hidden">
29
+ Hidden
30
+ </WCVisuallyHidden>
31
+ );
32
+ const element = screen.getByTestId( 'wc-visually-hidden' );
33
+ mockVisibleBoundingClientRect( element );
34
+ expect( isElementVisible( element ) ).toBe( false );
35
+ } );
36
+
37
+ it( 'returns false for @wordpress/ui VisuallyHidden', () => {
38
+ render(
39
+ <VisuallyHidden data-testid="ui-visually-hidden">
40
+ Hidden
41
+ </VisuallyHidden>
42
+ );
43
+ const element = screen.getByTestId( 'ui-visually-hidden' );
44
+ mockVisibleBoundingClientRect( element );
45
+ expect( isElementVisible( element ) ).toBe( false );
46
+ } );
47
+ } );
48
+
6
49
  describe( 'getElementBounds', () => {
7
50
  it( 'should return a DOMRectReadOnly object if the viewport is not available', () => {
8
51
  const element = {
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/collab/block-comment-icon-slot.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );\n\nexport default CommentIconSlotFill;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA+B;AAE/B,IAAM,0BAAsB,kCAAgB,uBAAQ,qBAAsB,CAAE;AAE5E,IAAO,kCAAQ;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/collab/block-comment-icon-toolbar-slot.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconToolbarSlotFill = createSlotFill(\n\tSymbol( 'CommentIconToolbarSlotFill' )\n);\n\nexport default CommentIconToolbarSlotFill;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA+B;AAE/B,IAAM,iCAA6B;AAAA,EAClC,uBAAQ,4BAA6B;AACtC;AAEA,IAAO,0CAAQ;",
6
- "names": []
7
- }
@@ -1,8 +0,0 @@
1
- // packages/block-editor/src/components/collab/block-comment-icon-slot.js
2
- import { createSlotFill } from "@wordpress/components";
3
- var CommentIconSlotFill = createSlotFill(/* @__PURE__ */ Symbol("CommentIconSlotFill"));
4
- var block_comment_icon_slot_default = CommentIconSlotFill;
5
- export {
6
- block_comment_icon_slot_default as default
7
- };
8
- //# sourceMappingURL=block-comment-icon-slot.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/collab/block-comment-icon-slot.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );\n\nexport default CommentIconSlotFill;\n"],
5
- "mappings": ";AAGA,SAAS,sBAAsB;AAE/B,IAAM,sBAAsB,eAAgB,uBAAQ,qBAAsB,CAAE;AAE5E,IAAO,kCAAQ;",
6
- "names": []
7
- }
@@ -1,10 +0,0 @@
1
- // packages/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js
2
- import { createSlotFill } from "@wordpress/components";
3
- var CommentIconToolbarSlotFill = createSlotFill(
4
- /* @__PURE__ */ Symbol("CommentIconToolbarSlotFill")
5
- );
6
- var block_comment_icon_toolbar_slot_default = CommentIconToolbarSlotFill;
7
- export {
8
- block_comment_icon_toolbar_slot_default as default
9
- };
10
- //# sourceMappingURL=block-comment-icon-toolbar-slot.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/collab/block-comment-icon-toolbar-slot.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconToolbarSlotFill = createSlotFill(\n\tSymbol( 'CommentIconToolbarSlotFill' )\n);\n\nexport default CommentIconToolbarSlotFill;\n"],
5
- "mappings": ";AAGA,SAAS,sBAAsB;AAE/B,IAAM,6BAA6B;AAAA,EAClC,uBAAQ,4BAA6B;AACtC;AAEA,IAAO,0CAAQ;",
6
- "names": []
7
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createSlotFill } from '@wordpress/components';
5
-
6
- const CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );
7
-
8
- export default CommentIconSlotFill;
@@ -1,10 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createSlotFill } from '@wordpress/components';
5
-
6
- const CommentIconToolbarSlotFill = createSlotFill(
7
- Symbol( 'CommentIconToolbarSlotFill' )
8
- );
9
-
10
- export default CommentIconToolbarSlotFill;