@wordpress/block-editor 15.6.1-next.36001005c.0 → 15.7.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 (147) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-list/block.js +3 -3
  3. package/build/components/block-list/block.js.map +2 -2
  4. package/build/components/block-list/index.js +2 -2
  5. package/build/components/block-list/index.js.map +1 -1
  6. package/build/components/block-toolbar/switch-section-style.js +2 -5
  7. package/build/components/block-toolbar/switch-section-style.js.map +2 -2
  8. package/build/components/global-styles/hooks.js +0 -107
  9. package/build/components/global-styles/hooks.js.map +3 -3
  10. package/build/components/global-styles/index.js +0 -15
  11. package/build/components/global-styles/index.js.map +2 -2
  12. package/build/components/global-styles/typography-panel.js +18 -1
  13. package/build/components/global-styles/typography-panel.js.map +2 -2
  14. package/build/components/global-styles/utils.js +0 -19
  15. package/build/components/global-styles/utils.js.map +3 -3
  16. package/build/components/inserter/media-tab/media-tab.js +33 -1
  17. package/build/components/inserter/media-tab/media-tab.js.map +3 -3
  18. package/build/components/inserter/tips.js +0 -2
  19. package/build/components/inserter/tips.js.map +2 -2
  20. package/build/components/media-placeholder/index.js +31 -1
  21. package/build/components/media-placeholder/index.js.map +3 -3
  22. package/build/components/media-replace-flow/index.js +29 -1
  23. package/build/components/media-replace-flow/index.js.map +3 -3
  24. package/build/components/{global-styles/context.js → media-upload-modal/index.js} +8 -23
  25. package/build/components/media-upload-modal/index.js.map +7 -0
  26. package/build/components/rich-text/index.js +8 -7
  27. package/build/components/rich-text/index.js.map +2 -2
  28. package/build/hooks/allowed-blocks.js +3 -8
  29. package/build/hooks/allowed-blocks.js.map +3 -3
  30. package/build/hooks/block-bindings.js +111 -170
  31. package/build/hooks/block-bindings.js.map +2 -2
  32. package/build/hooks/block-style-variation.js +4 -13
  33. package/build/hooks/block-style-variation.js.map +2 -2
  34. package/build/hooks/custom-class-name.js +1 -1
  35. package/build/hooks/custom-class-name.js.map +1 -1
  36. package/build/hooks/fit-text.js +33 -20
  37. package/build/hooks/fit-text.js.map +2 -2
  38. package/build/hooks/font-size.js +4 -3
  39. package/build/hooks/font-size.js.map +2 -2
  40. package/build/hooks/metadata.js +48 -2
  41. package/build/hooks/metadata.js.map +2 -2
  42. package/build/hooks/typography.js +11 -4
  43. package/build/hooks/typography.js.map +3 -3
  44. package/build/private-apis.js +3 -1
  45. package/build/private-apis.js.map +3 -3
  46. package/build/store/private-selectors.js +3 -3
  47. package/build/store/private-selectors.js.map +2 -2
  48. package/build/store/selectors.js +38 -13
  49. package/build/store/selectors.js.map +2 -2
  50. package/build/store/utils.js +2 -1
  51. package/build/store/utils.js.map +2 -2
  52. package/build/utils/fit-text-utils.js +4 -4
  53. package/build/utils/fit-text-utils.js.map +2 -2
  54. package/build-module/components/block-list/block.js +3 -3
  55. package/build-module/components/block-list/block.js.map +2 -2
  56. package/build-module/components/block-list/index.js +2 -2
  57. package/build-module/components/block-list/index.js.map +1 -1
  58. package/build-module/components/block-toolbar/switch-section-style.js +2 -5
  59. package/build-module/components/block-toolbar/switch-section-style.js.map +2 -2
  60. package/build-module/components/global-styles/hooks.js +1 -99
  61. package/build-module/components/global-styles/hooks.js.map +2 -2
  62. package/build-module/components/global-styles/index.js +1 -15
  63. package/build-module/components/global-styles/index.js.map +2 -2
  64. package/build-module/components/global-styles/typography-panel.js +18 -1
  65. package/build-module/components/global-styles/typography-panel.js.map +2 -2
  66. package/build-module/components/global-styles/utils.js +0 -8
  67. package/build-module/components/global-styles/utils.js.map +2 -2
  68. package/build-module/components/inserter/media-tab/media-tab.js +34 -2
  69. package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
  70. package/build-module/components/inserter/tips.js +0 -2
  71. package/build-module/components/inserter/tips.js.map +2 -2
  72. package/build-module/components/media-placeholder/index.js +31 -1
  73. package/build-module/components/media-placeholder/index.js.map +2 -2
  74. package/build-module/components/media-replace-flow/index.js +29 -1
  75. package/build-module/components/media-replace-flow/index.js.map +2 -2
  76. package/build-module/components/media-upload-modal/index.js +7 -0
  77. package/build-module/components/media-upload-modal/index.js.map +7 -0
  78. package/build-module/components/rich-text/index.js +8 -7
  79. package/build-module/components/rich-text/index.js.map +2 -2
  80. package/build-module/hooks/allowed-blocks.js +3 -8
  81. package/build-module/hooks/allowed-blocks.js.map +2 -2
  82. package/build-module/hooks/block-bindings.js +112 -172
  83. package/build-module/hooks/block-bindings.js.map +2 -2
  84. package/build-module/hooks/block-style-variation.js +5 -14
  85. package/build-module/hooks/block-style-variation.js.map +2 -2
  86. package/build-module/hooks/custom-class-name.js +1 -1
  87. package/build-module/hooks/custom-class-name.js.map +1 -1
  88. package/build-module/hooks/fit-text.js +34 -21
  89. package/build-module/hooks/fit-text.js.map +2 -2
  90. package/build-module/hooks/font-size.js +4 -3
  91. package/build-module/hooks/font-size.js.map +2 -2
  92. package/build-module/hooks/metadata.js +46 -1
  93. package/build-module/hooks/metadata.js.map +2 -2
  94. package/build-module/hooks/typography.js +11 -4
  95. package/build-module/hooks/typography.js.map +3 -3
  96. package/build-module/private-apis.js +3 -1
  97. package/build-module/private-apis.js.map +2 -2
  98. package/build-module/store/private-selectors.js +2 -2
  99. package/build-module/store/private-selectors.js.map +2 -2
  100. package/build-module/store/selectors.js +39 -14
  101. package/build-module/store/selectors.js.map +2 -2
  102. package/build-module/store/utils.js +3 -2
  103. package/build-module/store/utils.js.map +2 -2
  104. package/build-module/utils/fit-text-utils.js +4 -4
  105. package/build-module/utils/fit-text-utils.js.map +2 -2
  106. package/package.json +36 -36
  107. package/src/components/block-list/block.js +1 -1
  108. package/src/components/block-list/index.js +2 -2
  109. package/src/components/block-toolbar/switch-section-style.js +2 -5
  110. package/src/components/global-styles/hooks.js +1 -121
  111. package/src/components/global-styles/index.js +1 -9
  112. package/src/components/global-styles/typography-panel.js +26 -1
  113. package/src/components/global-styles/utils.js +0 -31
  114. package/src/components/inserter/media-tab/media-tab.js +44 -2
  115. package/src/components/inserter/tips.js +0 -2
  116. package/src/components/media-placeholder/index.js +41 -1
  117. package/src/components/media-replace-flow/index.js +39 -1
  118. package/src/components/media-upload-modal/index.js +18 -0
  119. package/src/components/rich-text/index.js +8 -14
  120. package/src/hooks/allowed-blocks.js +3 -11
  121. package/src/hooks/block-bindings.js +79 -153
  122. package/src/hooks/block-style-variation.js +5 -17
  123. package/src/hooks/custom-class-name.js +1 -1
  124. package/src/hooks/fit-text.js +39 -30
  125. package/src/hooks/font-size.js +7 -3
  126. package/src/hooks/metadata.js +89 -0
  127. package/src/hooks/test/metadata.js +316 -0
  128. package/src/hooks/typography.js +15 -4
  129. package/src/private-apis.js +2 -0
  130. package/src/store/private-selectors.js +2 -2
  131. package/src/store/selectors.js +59 -21
  132. package/src/store/test/selectors.js +1 -1
  133. package/src/store/utils.js +2 -1
  134. package/src/utils/fit-text-utils.js +4 -16
  135. package/tsconfig.json +1 -0
  136. package/build/components/global-styles/context.js.map +0 -7
  137. package/build/components/global-styles/get-global-styles-changes.js +0 -216
  138. package/build/components/global-styles/get-global-styles-changes.js.map +0 -7
  139. package/build-module/components/global-styles/context.js +0 -17
  140. package/build-module/components/global-styles/context.js.map +0 -7
  141. package/build-module/components/global-styles/get-global-styles-changes.js +0 -182
  142. package/build-module/components/global-styles/get-global-styles-changes.js.map +0 -7
  143. package/src/components/global-styles/README.md +0 -190
  144. package/src/components/global-styles/context.js +0 -16
  145. package/src/components/global-styles/get-global-styles-changes.js +0 -252
  146. package/src/components/global-styles/test/get-global-styles-changes.js +0 -290
  147. package/src/components/global-styles/test/utils.js +0 -58
@@ -12,6 +12,7 @@ import {
12
12
  ToolbarButton,
13
13
  } from '@wordpress/components';
14
14
  import { useSelect, withDispatch } from '@wordpress/data';
15
+ import { useState } from '@wordpress/element';
15
16
  import { DOWN } from '@wordpress/keycodes';
16
17
  import {
17
18
  postFeaturedImage,
@@ -26,6 +27,7 @@ import { store as noticesStore } from '@wordpress/notices';
26
27
  * Internal dependencies
27
28
  */
28
29
  import MediaUpload from '../media-upload';
30
+ import MediaUploadModal from '../media-upload-modal';
29
31
  import MediaUploadCheck from '../media-upload/check';
30
32
  import LinkControl from '../link-control';
31
33
  import { store as blockEditorStore } from '../../store';
@@ -33,6 +35,42 @@ import { store as blockEditorStore } from '../../store';
33
35
  const noop = () => {};
34
36
  let uniqueId = 0;
35
37
 
38
+ /**
39
+ * Conditional Media component that uses MediaUploadModal when experiment is enabled,
40
+ * otherwise falls back to MediaUpload.
41
+ *
42
+ * @param {Object} root0 Component props.
43
+ * @param {Function} root0.render Render prop function that receives { open } object.
44
+ * @return {JSX.Element} The component.
45
+ */
46
+ function ConditionalMediaUpload( { render, ...props } ) {
47
+ const [ isModalOpen, setIsModalOpen ] = useState( false );
48
+ const { getSettings } = useSelect( blockEditorStore );
49
+
50
+ if ( window.__experimentalDataViewsMediaModal ) {
51
+ return (
52
+ <>
53
+ { render && render( { open: () => setIsModalOpen( true ) } ) }
54
+ <MediaUploadModal
55
+ { ...props }
56
+ isOpen={ isModalOpen }
57
+ onClose={ () => {
58
+ setIsModalOpen( false );
59
+ props.onClose?.();
60
+ } }
61
+ onSelect={ ( media ) => {
62
+ setIsModalOpen( false );
63
+ props.onSelect?.( media );
64
+ } }
65
+ onUpload={ getSettings().mediaUpload }
66
+ />
67
+ </>
68
+ );
69
+ }
70
+
71
+ return <MediaUpload { ...props } render={ render } />;
72
+ }
73
+
36
74
  const MediaReplaceFlow = ( {
37
75
  mediaURL,
38
76
  mediaId,
@@ -157,7 +195,7 @@ const MediaReplaceFlow = ( {
157
195
  <>
158
196
  <NavigableMenu className="block-editor-media-replace-flow__media-upload-menu">
159
197
  <MediaUploadCheck>
160
- <MediaUpload
198
+ <ConditionalMediaUpload
161
199
  gallery={ gallery }
162
200
  addToGallery={ addToGallery }
163
201
  multiple={ multiple }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { withFilters } from '@wordpress/components';
5
+
6
+ /**
7
+ * This is a placeholder for the media upload modal component necessary to make it possible to provide
8
+ * an integration with the core blocks that handle media files. By default it renders nothing but
9
+ * it provides a way to have it overridden with the `editor.MediaUploadModal` filter.
10
+ *
11
+ * @return {Component} The component to be rendered.
12
+ */
13
+ const MediaUploadModal = () => null;
14
+
15
+ /**
16
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload-modal/README.md
17
+ */
18
+ export default withFilters( 'editor.MediaUploadModal' )( MediaUploadModal );
@@ -41,6 +41,7 @@ import { getAllowedFormats } from './utils';
41
41
  import { Content, valueToHTMLString } from './content';
42
42
  import { withDeprecations } from './with-deprecations';
43
43
  import BlockContext from '../block-context';
44
+ import { PrivateBlockContext } from '../block-list/private-block-context';
44
45
 
45
46
  export const keyboardShortcutContext = createContext();
46
47
  keyboardShortcutContext.displayName = 'keyboardShortcutContext';
@@ -124,9 +125,10 @@ export function RichTextWrapper(
124
125
  const instanceId = useInstanceId( RichTextWrapper );
125
126
  const anchorRef = useRef();
126
127
  const context = useBlockEditContext();
127
- const { clientId, isSelected: isBlockSelected, name: blockName } = context;
128
+ const { clientId, isSelected: isBlockSelected } = context;
128
129
  const blockBindings = context[ blockBindingsKey ];
129
130
  const blockContext = useContext( BlockContext );
131
+ const { bindableAttributes } = useContext( PrivateBlockContext );
130
132
  const registry = useRegistry();
131
133
  const selector = ( select ) => {
132
134
  // Avoid subscribing to the block editor store if the block is not
@@ -171,15 +173,7 @@ export function RichTextWrapper(
171
173
 
172
174
  const { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = useSelect(
173
175
  ( select ) => {
174
- const { __experimentalBlockBindingsSupportedAttributes } =
175
- select( blockEditorStore ).getSettings();
176
-
177
- if (
178
- ! blockBindings?.[ identifier ] ||
179
- ! (
180
- blockName in __experimentalBlockBindingsSupportedAttributes
181
- )
182
- ) {
176
+ if ( ! blockBindings?.[ identifier ] || ! bindableAttributes ) {
183
177
  return {};
184
178
  }
185
179
 
@@ -214,12 +208,12 @@ export function RichTextWrapper(
214
208
  const { getBlockAttributes } = select( blockEditorStore );
215
209
  const blockAttributes = getBlockAttributes( clientId );
216
210
  let clientSideFieldLabel = null;
217
- if ( blockBindingsSource?.editorUI ) {
218
- const editorUIResult = blockBindingsSource.editorUI( {
211
+ if ( blockBindingsSource?.getFieldsList ) {
212
+ const fieldsItems = blockBindingsSource.getFieldsList( {
219
213
  select,
220
214
  context: blockBindingsContext,
221
215
  } );
222
- clientSideFieldLabel = editorUIResult.data?.find( ( item ) =>
216
+ clientSideFieldLabel = fieldsItems?.find( ( item ) =>
223
217
  fastDeepEqual( item.args, relatedBinding?.args )
224
218
  )?.label;
225
219
  }
@@ -252,7 +246,7 @@ export function RichTextWrapper(
252
246
  [
253
247
  blockBindings,
254
248
  identifier,
255
- blockName,
249
+ bindableAttributes,
256
250
  adjustedValue,
257
251
  clientId,
258
252
  blockContext,
@@ -3,25 +3,17 @@
3
3
  */
4
4
  import { addFilter } from '@wordpress/hooks';
5
5
  import { hasBlockSupport } from '@wordpress/blocks';
6
- import { useSelect } from '@wordpress/data';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
10
9
  */
11
- import { store as blockEditorStore } from '../store';
12
10
  import { PrivateInspectorControlsAllowedBlocks } from '../components/inspector-controls/groups';
13
11
  import BlockAllowedBlocksControl from '../components/block-allowed-blocks/allowed-blocks-control';
12
+ import { useBlockEditingMode } from '../components/block-editing-mode';
14
13
 
15
14
  function BlockEditAllowedBlocksControlPure( { clientId } ) {
16
- const isContentOnly = useSelect(
17
- ( select ) => {
18
- return (
19
- select( blockEditorStore ).getBlockEditingMode( clientId ) ===
20
- 'contentOnly'
21
- );
22
- },
23
- [ clientId ]
24
- );
15
+ const blockEditingMode = useBlockEditingMode();
16
+ const isContentOnly = blockEditingMode === 'contentOnly';
25
17
 
26
18
  if ( isContentOnly ) {
27
19
  return null;
@@ -15,11 +15,10 @@ import {
15
15
  __experimentalToolsPanel as ToolsPanel,
16
16
  __experimentalToolsPanelItem as ToolsPanelItem,
17
17
  __experimentalVStack as VStack,
18
- Modal,
19
18
  privateApis as componentsPrivateApis,
20
19
  } from '@wordpress/components';
21
20
  import { useSelect } from '@wordpress/data';
22
- import { useContext, useState } from '@wordpress/element';
21
+ import { useContext } from '@wordpress/element';
23
22
  import { useViewportMatch } from '@wordpress/compose';
24
23
 
25
24
  /**
@@ -63,12 +62,7 @@ const useToolsPanelDropdownMenuProps = () => {
63
62
  : {};
64
63
  };
65
64
 
66
- function BlockBindingsPanelMenuContent( {
67
- attribute,
68
- binding,
69
- sources,
70
- onOpenModal,
71
- } ) {
65
+ function BlockBindingsPanelMenuContent( { attribute, binding, sources } ) {
72
66
  const { clientId } = useBlockEditContext();
73
67
  const { updateBlockBindings } = useBlockBindingsUtils();
74
68
  const isMobile = useViewportMatch( 'medium', '<' );
@@ -99,105 +93,85 @@ function BlockBindingsPanelMenuContent( {
99
93
  return null;
100
94
  }
101
95
 
102
- if ( source.mode === 'dropdown' ) {
103
- return (
104
- <Menu
105
- key={ sourceKey }
106
- placement={
107
- isMobile ? 'bottom-start' : 'left-start'
108
- }
109
- >
110
- <Menu.SubmenuTriggerItem>
111
- <Menu.ItemLabel>
112
- { source.label }
113
- </Menu.ItemLabel>
114
- </Menu.SubmenuTriggerItem>
115
- <Menu.Popover gutter={ 8 }>
116
- <Menu.Group>
117
- { sourceDataItems.map( ( item ) => {
118
- const itemBindings = {
119
- source: sourceKey,
120
- args: item?.args || {
121
- key: item.key,
122
- },
123
- };
124
- const values = source.getValues( {
125
- select,
126
- context: blockContext,
127
- bindings: {
128
- [ attribute ]: itemBindings,
129
- },
130
- } );
131
- return (
132
- <Menu.CheckboxItem
133
- key={
134
- sourceKey +
135
- JSON.stringify(
136
- item.args
137
- ) || item.key
138
- }
139
- onChange={ () => {
140
- const isCurrentlySelected =
141
- fastDeepEqual(
142
- binding?.args,
143
- item.args
144
- ) ??
145
- // Deprecate key dependency in 7.0.
146
- item.key ===
147
- binding?.args?.key;
148
-
149
- if ( isCurrentlySelected ) {
150
- // Unset if the same item is selected again.
151
- updateBlockBindings( {
152
- [ attribute ]:
153
- undefined,
154
- } );
155
- } else {
156
- updateBlockBindings( {
157
- [ attribute ]:
158
- itemBindings,
159
- } );
160
- }
161
- } }
162
- name={ attribute + '-binding' }
163
- value={ values[ attribute ] }
164
- checked={
96
+ return (
97
+ <Menu
98
+ key={ sourceKey }
99
+ placement={ isMobile ? 'bottom-start' : 'left-start' }
100
+ >
101
+ <Menu.SubmenuTriggerItem>
102
+ <Menu.ItemLabel>{ source.label }</Menu.ItemLabel>
103
+ </Menu.SubmenuTriggerItem>
104
+ <Menu.Popover gutter={ 8 }>
105
+ <Menu.Group>
106
+ { sourceDataItems.map( ( item ) => {
107
+ const itemBindings = {
108
+ source: sourceKey,
109
+ args: item?.args || {
110
+ key: item.key,
111
+ },
112
+ };
113
+ const values = source.getValues( {
114
+ select,
115
+ context: blockContext,
116
+ bindings: {
117
+ [ attribute ]: itemBindings,
118
+ },
119
+ } );
120
+ return (
121
+ <Menu.CheckboxItem
122
+ key={
123
+ sourceKey +
124
+ JSON.stringify(
125
+ item.args
126
+ ) || item.key
127
+ }
128
+ onChange={ () => {
129
+ const isCurrentlySelected =
165
130
  fastDeepEqual(
166
131
  binding?.args,
167
132
  item.args
168
133
  ) ??
169
134
  // Deprecate key dependency in 7.0.
170
135
  item.key ===
171
- binding?.args?.key
136
+ binding?.args?.key;
137
+
138
+ if ( isCurrentlySelected ) {
139
+ // Unset if the same item is selected again.
140
+ updateBlockBindings( {
141
+ [ attribute ]:
142
+ undefined,
143
+ } );
144
+ } else {
145
+ updateBlockBindings( {
146
+ [ attribute ]:
147
+ itemBindings,
148
+ } );
172
149
  }
173
- >
174
- <Menu.ItemLabel>
175
- { item?.label }
176
- </Menu.ItemLabel>
177
- <Menu.ItemHelpText>
178
- { values[ attribute ] }
179
- </Menu.ItemHelpText>
180
- </Menu.CheckboxItem>
181
- );
182
- } ) }
183
- </Menu.Group>
184
- </Menu.Popover>
185
- </Menu>
186
- );
187
- }
188
-
189
- if ( source.mode === 'modal' ) {
190
- return (
191
- <Menu.Item
192
- key={ sourceKey }
193
- onClick={ () => onOpenModal( { sourceKey } ) }
194
- >
195
- <Menu.ItemLabel>{ source.label }</Menu.ItemLabel>
196
- </Menu.Item>
197
- );
198
- }
199
-
200
- return null;
150
+ } }
151
+ name={ attribute + '-binding' }
152
+ value={ values[ attribute ] }
153
+ checked={
154
+ fastDeepEqual(
155
+ binding?.args,
156
+ item.args
157
+ ) ??
158
+ // Deprecate key dependency in 7.0.
159
+ item.key === binding?.args?.key
160
+ }
161
+ >
162
+ <Menu.ItemLabel>
163
+ { item?.label }
164
+ </Menu.ItemLabel>
165
+ <Menu.ItemHelpText>
166
+ { values[ attribute ] }
167
+ </Menu.ItemHelpText>
168
+ </Menu.CheckboxItem>
169
+ );
170
+ } ) }
171
+ </Menu.Group>
172
+ </Menu.Popover>
173
+ </Menu>
174
+ );
201
175
  } ) }
202
176
  </Menu>
203
177
  );
@@ -282,16 +256,11 @@ function EditableBlockBindingsPanelItem( {
282
256
  attribute,
283
257
  binding,
284
258
  sources,
285
- setModalState,
286
259
  blockName,
287
260
  } ) {
288
261
  const { updateBlockBindings } = useBlockBindingsUtils();
289
262
  const isMobile = useViewportMatch( 'medium', '<' );
290
263
 
291
- const handleOpenModal = ( { sourceKey } ) => {
292
- setModalState( { attribute, sourceKey } );
293
- };
294
-
295
264
  return (
296
265
  <ToolsPanelItem
297
266
  hasValue={ () => !! binding }
@@ -316,7 +285,6 @@ function EditableBlockBindingsPanelItem( {
316
285
  attribute={ attribute }
317
286
  binding={ binding }
318
287
  sources={ sources }
319
- onOpenModal={ handleOpenModal }
320
288
  />
321
289
  </Menu.Popover>
322
290
  </Menu>
@@ -328,11 +296,6 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
328
296
  const blockContext = useContext( BlockContext );
329
297
  const { removeAllBlockBindings } = useBlockBindingsUtils();
330
298
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
331
- const [ modalState, setModalState ] = useState( null );
332
-
333
- const handleCloseModal = () => {
334
- setModalState( null );
335
- };
336
299
 
337
300
  // Use useSelect to ensure sources are updated whenever there are updates in block context
338
301
  // or when underlying data changes.
@@ -352,7 +315,7 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
352
315
  Object.entries( registeredSources ).forEach(
353
316
  ( [
354
317
  sourceName,
355
- { editorUI, getFieldsList, usesContext, label, getValues },
318
+ { getFieldsList, usesContext, label, getValues },
356
319
  ] ) => {
357
320
  // Populate context.
358
321
  const context = {};
@@ -361,44 +324,19 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
361
324
  context[ key ] = blockContext[ key ];
362
325
  }
363
326
  }
364
-
365
- if ( editorUI ) {
366
- const editorUIResult = editorUI( {
327
+ if ( getFieldsList ) {
328
+ const fieldsListResult = getFieldsList( {
367
329
  select,
368
330
  context,
369
331
  } );
370
-
371
332
  _sources[ sourceName ] = {
372
- ...editorUIResult,
333
+ data: fieldsListResult || [],
373
334
  label,
374
335
  getValues,
375
336
  };
376
- } else if ( getFieldsList ) {
377
- // Backward compatibility: Convert getFieldsList to editorUI format.
378
- const fieldsListResult = getFieldsList( {
379
- select,
380
- context,
381
- } );
382
-
383
- if ( fieldsListResult ) {
384
- const data = Object.entries( fieldsListResult ).map(
385
- ( [ key, field ] ) => ( {
386
- label: field.label || key,
387
- type: field.type || 'string',
388
- args: { key },
389
- } )
390
- );
391
-
392
- _sources[ sourceName ] = {
393
- mode: 'dropdown', // Default mode for backward compatibility.
394
- data,
395
- label,
396
- getValues,
397
- };
398
- }
399
337
  } else {
400
338
  /*
401
- * Include sources without editorUI if they are already used in a binding.
339
+ * Include sources without getFieldsList if they are already used in a binding.
402
340
  * This allows them to be displayed in read-only mode.
403
341
  */
404
342
  _sources[ sourceName ] = {
@@ -438,9 +376,6 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
438
376
  // Lock the UI when the user can't update bindings or there are no fields to connect to.
439
377
  const readOnly = ! canUpdateBlockBindings || ! hasCompatibleData;
440
378
 
441
- const RenderModalContent =
442
- sources[ modalState?.sourceKey ]?.renderModalContent;
443
-
444
379
  if ( bindings === undefined && ! hasCompatibleData ) {
445
380
  return null;
446
381
  }
@@ -490,7 +425,6 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
490
425
  attribute={ attribute }
491
426
  binding={ binding }
492
427
  sources={ sources }
493
- setModalState={ setModalState }
494
428
  blockName={ blockName }
495
429
  />
496
430
  );
@@ -508,14 +442,6 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
508
442
  </p>
509
443
  </Text>
510
444
  </ToolsPanel>
511
- { RenderModalContent && (
512
- <Modal onRequestClose={ handleCloseModal }>
513
- <RenderModalContent
514
- attribute={ modalState.attribute }
515
- closeModal={ handleCloseModal }
516
- />
517
- </Modal>
518
- ) }
519
445
  </InspectorControls>
520
446
  );
521
447
  };
@@ -3,13 +3,12 @@
3
3
  */
4
4
  import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
5
5
  import { useSelect } from '@wordpress/data';
6
- import { useContext, useMemo } from '@wordpress/element';
6
+ import { useMemo } from '@wordpress/element';
7
7
  import { toStyles, getBlockSelectors } from '@wordpress/global-styles-engine';
8
8
 
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
- import { GlobalStylesContext } from '../components/global-styles';
13
12
  import { usePrivateStyleOverride } from './utils';
14
13
  import { getValueFromObjectPath } from '../utils/object';
15
14
  import { store as blockEditorStore } from '../store';
@@ -249,10 +248,6 @@ export function getVariationStylesWithRefValues(
249
248
  }
250
249
 
251
250
  function useBlockStyleVariation( name, variation, clientId ) {
252
- // Prefer global styles data in GlobalStylesContext, which are available
253
- // if in the site editor. Otherwise fall back to whatever is in the
254
- // editor settings and available in the post editor.
255
- const { merged: mergedConfig } = useContext( GlobalStylesContext );
256
251
  const { globalSettings, globalStyles } = useSelect( ( select ) => {
257
252
  const settings = select( blockEditorStore ).getSettings();
258
253
  return {
@@ -264,15 +259,15 @@ function useBlockStyleVariation( name, variation, clientId ) {
264
259
  return useMemo( () => {
265
260
  const variationStyles = getVariationStylesWithRefValues(
266
261
  {
267
- settings: mergedConfig?.settings ?? globalSettings,
268
- styles: mergedConfig?.styles ?? globalStyles,
262
+ settings: globalSettings,
263
+ styles: globalStyles,
269
264
  },
270
265
  name,
271
266
  variation
272
267
  );
273
268
 
274
269
  return {
275
- settings: mergedConfig?.settings ?? globalSettings,
270
+ settings: globalSettings,
276
271
  // The variation style data is all that is needed to generate
277
272
  // the styles for the current application to a block. The variation
278
273
  // name is updated to match the instance specific class name.
@@ -286,14 +281,7 @@ function useBlockStyleVariation( name, variation, clientId ) {
286
281
  },
287
282
  },
288
283
  };
289
- }, [
290
- mergedConfig,
291
- globalSettings,
292
- globalStyles,
293
- variation,
294
- clientId,
295
- name,
296
- ] );
284
+ }, [ globalSettings, globalStyles, variation, clientId, name ] );
297
285
  }
298
286
 
299
287
  // Rather than leveraging `useInstanceId` here, the `clientId` is used.
@@ -145,6 +145,6 @@ addFilter(
145
145
 
146
146
  addFilter(
147
147
  'blocks.switchToBlockType.transformedBlock',
148
- 'core/color/addTransforms',
148
+ 'core/customClassName/addTransforms',
149
149
  addTransforms
150
150
  );