@wordpress/block-editor 14.6.0 → 14.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 (187) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-list/block.js +14 -28
  3. package/build/components/block-list/block.js.map +1 -1
  4. package/build/components/block-patterns-list/index.js +23 -26
  5. package/build/components/block-patterns-list/index.js.map +1 -1
  6. package/build/components/block-popover/index.js +1 -1
  7. package/build/components/block-popover/index.js.map +1 -1
  8. package/build/components/block-preview/async.js +51 -0
  9. package/build/components/block-preview/async.js.map +1 -0
  10. package/build/components/block-preview/index.js +4 -1
  11. package/build/components/block-preview/index.js.map +1 -1
  12. package/build/components/block-toolbar/change-design.js +1 -4
  13. package/build/components/block-toolbar/change-design.js.map +1 -1
  14. package/build/components/block-tools/index.js +12 -9
  15. package/build/components/block-tools/index.js.map +1 -1
  16. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  17. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  18. package/build/components/block-tools/use-show-block-tools.js +4 -1
  19. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  20. package/build/components/global-styles/dimensions-panel.js +26 -14
  21. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  22. package/build/components/iframe/get-compatibility-styles.js +4 -4
  23. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  24. package/build/components/iframe/index.js +16 -0
  25. package/build/components/iframe/index.js.map +1 -1
  26. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  27. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  28. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  29. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  30. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +3 -1
  31. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  32. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
  33. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  34. package/build/components/inserter/block-patterns-tab/utils.js +5 -1
  35. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  36. package/build/components/inserter/hooks/use-block-types-state.js +1 -1
  37. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  38. package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
  39. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  40. package/build/components/inserter/search-results.js +0 -2
  41. package/build/components/inserter/search-results.js.map +1 -1
  42. package/build/components/media-placeholder/index.js +4 -4
  43. package/build/components/media-placeholder/index.js.map +1 -1
  44. package/build/components/rich-text/index.js +1 -1
  45. package/build/components/rich-text/index.js.map +1 -1
  46. package/build/components/tabbed-sidebar/index.js +1 -1
  47. package/build/components/tabbed-sidebar/index.js.map +1 -1
  48. package/build/components/url-input/index.js +3 -1
  49. package/build/components/url-input/index.js.map +1 -1
  50. package/build/components/use-block-commands/index.js +5 -6
  51. package/build/components/use-block-commands/index.js.map +1 -1
  52. package/build/hooks/font-family.js +1 -1
  53. package/build/hooks/font-family.js.map +1 -1
  54. package/build/hooks/supports.js +6 -6
  55. package/build/hooks/supports.js.map +1 -1
  56. package/build/hooks/typography.js +5 -5
  57. package/build/hooks/typography.js.map +1 -1
  58. package/build/hooks/utils.js +2 -2
  59. package/build/hooks/utils.js.map +1 -1
  60. package/build/lock-unlock.js.map +1 -1
  61. package/build/store/private-selectors.js +2 -2
  62. package/build/store/private-selectors.js.map +1 -1
  63. package/build/store/selectors.js +9 -8
  64. package/build/store/selectors.js.map +1 -1
  65. package/build/store/utils.js +5 -4
  66. package/build/store/utils.js.map +1 -1
  67. package/build/utils/dom.js +27 -22
  68. package/build/utils/dom.js.map +1 -1
  69. package/build-module/components/block-list/block.js +15 -27
  70. package/build-module/components/block-list/block.js.map +1 -1
  71. package/build-module/components/block-patterns-list/index.js +23 -26
  72. package/build-module/components/block-patterns-list/index.js.map +1 -1
  73. package/build-module/components/block-popover/index.js +2 -2
  74. package/build-module/components/block-popover/index.js.map +1 -1
  75. package/build-module/components/block-preview/async.js +44 -0
  76. package/build-module/components/block-preview/async.js.map +1 -0
  77. package/build-module/components/block-preview/index.js +4 -1
  78. package/build-module/components/block-preview/index.js.map +1 -1
  79. package/build-module/components/block-toolbar/change-design.js +1 -4
  80. package/build-module/components/block-toolbar/change-design.js.map +1 -1
  81. package/build-module/components/block-tools/index.js +13 -10
  82. package/build-module/components/block-tools/index.js.map +1 -1
  83. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  84. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  85. package/build-module/components/block-tools/use-show-block-tools.js +4 -1
  86. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  87. package/build-module/components/global-styles/dimensions-panel.js +26 -14
  88. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  89. package/build-module/components/iframe/get-compatibility-styles.js +4 -4
  90. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  91. package/build-module/components/iframe/index.js +16 -0
  92. package/build-module/components/iframe/index.js.map +1 -1
  93. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  94. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  95. package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
  96. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  97. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -2
  98. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  99. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
  100. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  101. package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
  102. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  103. package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
  104. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  105. package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
  106. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  107. package/build-module/components/inserter/search-results.js +0 -2
  108. package/build-module/components/inserter/search-results.js.map +1 -1
  109. package/build-module/components/media-placeholder/index.js +4 -4
  110. package/build-module/components/media-placeholder/index.js.map +1 -1
  111. package/build-module/components/rich-text/index.js +1 -1
  112. package/build-module/components/rich-text/index.js.map +1 -1
  113. package/build-module/components/tabbed-sidebar/index.js +1 -1
  114. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  115. package/build-module/components/url-input/index.js +3 -1
  116. package/build-module/components/url-input/index.js.map +1 -1
  117. package/build-module/components/use-block-commands/index.js +4 -4
  118. package/build-module/components/use-block-commands/index.js.map +1 -1
  119. package/build-module/hooks/font-family.js +1 -1
  120. package/build-module/hooks/font-family.js.map +1 -1
  121. package/build-module/hooks/supports.js +6 -6
  122. package/build-module/hooks/supports.js.map +1 -1
  123. package/build-module/hooks/typography.js +5 -5
  124. package/build-module/hooks/typography.js.map +1 -1
  125. package/build-module/hooks/utils.js +2 -2
  126. package/build-module/hooks/utils.js.map +1 -1
  127. package/build-module/lock-unlock.js.map +1 -1
  128. package/build-module/store/private-selectors.js +2 -2
  129. package/build-module/store/private-selectors.js.map +1 -1
  130. package/build-module/store/selectors.js +9 -8
  131. package/build-module/store/selectors.js.map +1 -1
  132. package/build-module/store/utils.js +3 -3
  133. package/build-module/store/utils.js.map +1 -1
  134. package/build-module/utils/dom.js +25 -21
  135. package/build-module/utils/dom.js.map +1 -1
  136. package/build-style/content-rtl.css +7 -6
  137. package/build-style/content.css +7 -6
  138. package/build-style/style-rtl.css +14 -3
  139. package/build-style/style.css +14 -3
  140. package/build-types/utils/dom.d.ts +7 -9
  141. package/build-types/utils/dom.d.ts.map +1 -1
  142. package/package.json +4 -3
  143. package/src/components/block-canvas/style.scss +1 -1
  144. package/src/components/block-inspector/style.scss +2 -1
  145. package/src/components/block-list/block.js +28 -48
  146. package/src/components/block-patterns-list/README.md +8 -8
  147. package/src/components/block-patterns-list/index.js +35 -51
  148. package/src/components/block-patterns-list/stories/index.story.js +2 -19
  149. package/src/components/block-popover/index.js +4 -4
  150. package/src/components/block-preview/async.js +43 -0
  151. package/src/components/block-preview/index.js +6 -1
  152. package/src/components/block-toolbar/change-design.js +1 -7
  153. package/src/components/block-tools/index.js +26 -10
  154. package/src/components/block-tools/style.scss +12 -0
  155. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  156. package/src/components/block-tools/use-show-block-tools.js +3 -1
  157. package/src/components/default-block-appender/content.scss +13 -19
  158. package/src/components/global-styles/dimensions-panel.js +22 -16
  159. package/src/components/iframe/get-compatibility-styles.js +4 -9
  160. package/src/components/iframe/index.js +17 -0
  161. package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
  162. package/src/components/inserter/block-patterns-tab/index.js +0 -1
  163. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +8 -1
  164. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
  165. package/src/components/inserter/block-patterns-tab/utils.js +5 -0
  166. package/src/components/inserter/hooks/use-block-types-state.js +6 -1
  167. package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
  168. package/src/components/inserter/search-results.js +0 -6
  169. package/src/components/media-placeholder/index.js +4 -4
  170. package/src/components/rich-text/index.js +8 -1
  171. package/src/components/tabbed-sidebar/index.js +1 -1
  172. package/src/components/tabbed-sidebar/style.scss +1 -1
  173. package/src/components/url-input/index.js +3 -4
  174. package/src/components/use-block-commands/index.js +245 -234
  175. package/src/hooks/font-family.js +1 -1
  176. package/src/hooks/supports.js +6 -6
  177. package/src/hooks/typography.js +5 -5
  178. package/src/hooks/utils.js +7 -2
  179. package/src/store/private-selectors.js +5 -6
  180. package/src/store/selectors.js +57 -45
  181. package/src/store/test/private-selectors.js +5 -0
  182. package/src/store/utils.js +12 -11
  183. package/src/utils/dom.js +26 -21
  184. package/src/utils/test/dom.js +224 -0
  185. package/tsconfig.json +1 -0
  186. package/tsconfig.tsbuildinfo +1 -1
  187. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -24,275 +24,286 @@ import {
24
24
  import BlockIcon from '../block-icon';
25
25
  import { store as blockEditorStore } from '../../store';
26
26
 
27
- export const useTransformCommands = () => {
28
- const { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );
29
- const {
30
- blocks,
31
- clientIds,
32
- canRemove,
33
- possibleBlockTransformations,
34
- invalidSelection,
35
- } = useSelect( ( select ) => {
27
+ const getTransformCommands = () =>
28
+ function useTransformCommands() {
29
+ const { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );
36
30
  const {
37
- getBlockRootClientId,
38
- getBlockTransformItems,
39
- getSelectedBlockClientIds,
40
- getBlocksByClientId,
41
- canRemoveBlocks,
42
- } = select( blockEditorStore );
31
+ blocks,
32
+ clientIds,
33
+ canRemove,
34
+ possibleBlockTransformations,
35
+ invalidSelection,
36
+ } = useSelect( ( select ) => {
37
+ const {
38
+ getBlockRootClientId,
39
+ getBlockTransformItems,
40
+ getSelectedBlockClientIds,
41
+ getBlocksByClientId,
42
+ canRemoveBlocks,
43
+ } = select( blockEditorStore );
44
+
45
+ const selectedBlockClientIds = getSelectedBlockClientIds();
46
+ const selectedBlocks = getBlocksByClientId(
47
+ selectedBlockClientIds
48
+ );
49
+
50
+ // selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.
51
+ // These nulls will cause fatal errors down the line.
52
+ // In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.
53
+ // @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536
54
+ if ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {
55
+ return {
56
+ invalidSelection: true,
57
+ };
58
+ }
43
59
 
44
- const selectedBlockClientIds = getSelectedBlockClientIds();
45
- const selectedBlocks = getBlocksByClientId( selectedBlockClientIds );
60
+ const rootClientId = getBlockRootClientId(
61
+ selectedBlockClientIds[ 0 ]
62
+ );
63
+ return {
64
+ blocks: selectedBlocks,
65
+ clientIds: selectedBlockClientIds,
66
+ possibleBlockTransformations: getBlockTransformItems(
67
+ selectedBlocks,
68
+ rootClientId
69
+ ),
70
+ canRemove: canRemoveBlocks( selectedBlockClientIds ),
71
+ invalidSelection: false,
72
+ };
73
+ }, [] );
46
74
 
47
- // selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.
48
- // These nulls will cause fatal errors down the line.
49
- // In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.
50
- // @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536
51
- if ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {
75
+ if ( invalidSelection ) {
52
76
  return {
53
- invalidSelection: true,
77
+ isLoading: false,
78
+ commands: [],
54
79
  };
55
80
  }
81
+ const isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );
82
+
83
+ function selectForMultipleBlocks( insertedBlocks ) {
84
+ if ( insertedBlocks.length > 1 ) {
85
+ multiSelect(
86
+ insertedBlocks[ 0 ].clientId,
87
+ insertedBlocks[ insertedBlocks.length - 1 ].clientId
88
+ );
89
+ }
90
+ }
56
91
 
57
- const rootClientId = getBlockRootClientId(
58
- selectedBlockClientIds[ 0 ]
59
- );
60
- return {
61
- blocks: selectedBlocks,
62
- clientIds: selectedBlockClientIds,
63
- possibleBlockTransformations: getBlockTransformItems(
64
- selectedBlocks,
65
- rootClientId
66
- ),
67
- canRemove: canRemoveBlocks( selectedBlockClientIds ),
68
- invalidSelection: false,
69
- };
70
- }, [] );
92
+ // Simple block tranformation based on the `Block Transforms` API.
93
+ function onBlockTransform( name ) {
94
+ const newBlocks = switchToBlockType( blocks, name );
95
+ replaceBlocks( clientIds, newBlocks );
96
+ selectForMultipleBlocks( newBlocks );
97
+ }
71
98
 
72
- if ( invalidSelection ) {
73
- return {
74
- isLoading: false,
75
- commands: [],
76
- };
77
- }
78
- const isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );
79
-
80
- function selectForMultipleBlocks( insertedBlocks ) {
81
- if ( insertedBlocks.length > 1 ) {
82
- multiSelect(
83
- insertedBlocks[ 0 ].clientId,
84
- insertedBlocks[ insertedBlocks.length - 1 ].clientId
85
- );
99
+ /**
100
+ * The `isTemplate` check is a stopgap solution here.
101
+ * Ideally, the Transforms API should handle this
102
+ * by allowing to exclude blocks from wildcard transformations.
103
+ */
104
+ const hasPossibleBlockTransformations =
105
+ !! possibleBlockTransformations.length && canRemove && ! isTemplate;
106
+
107
+ if (
108
+ ! clientIds ||
109
+ clientIds.length < 1 ||
110
+ ! hasPossibleBlockTransformations
111
+ ) {
112
+ return { isLoading: false, commands: [] };
86
113
  }
87
- }
88
-
89
- // Simple block tranformation based on the `Block Transforms` API.
90
- function onBlockTransform( name ) {
91
- const newBlocks = switchToBlockType( blocks, name );
92
- replaceBlocks( clientIds, newBlocks );
93
- selectForMultipleBlocks( newBlocks );
94
- }
95
-
96
- /**
97
- * The `isTemplate` check is a stopgap solution here.
98
- * Ideally, the Transforms API should handle this
99
- * by allowing to exclude blocks from wildcard transformations.
100
- */
101
- const hasPossibleBlockTransformations =
102
- !! possibleBlockTransformations.length && canRemove && ! isTemplate;
103
-
104
- if (
105
- ! clientIds ||
106
- clientIds.length < 1 ||
107
- ! hasPossibleBlockTransformations
108
- ) {
109
- return { isLoading: false, commands: [] };
110
- }
111
-
112
- const commands = possibleBlockTransformations.map( ( transformation ) => {
113
- const { name, title, icon } = transformation;
114
- return {
115
- name: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),
116
- /* translators: %s: Block or block variation name. */
117
- label: sprintf( __( 'Transform to %s' ), title ),
118
- icon: <BlockIcon icon={ icon } />,
119
- callback: ( { close } ) => {
120
- onBlockTransform( name );
121
- close();
114
+
115
+ const commands = possibleBlockTransformations.map(
116
+ ( transformation ) => {
117
+ const { name, title, icon } = transformation;
118
+ return {
119
+ name:
120
+ 'core/block-editor/transform-to-' +
121
+ name.replace( '/', '-' ),
122
+ /* translators: %s: Block or block variation name. */
123
+ label: sprintf( __( 'Transform to %s' ), title ),
124
+ icon: <BlockIcon icon={ icon } />,
125
+ callback: ( { close } ) => {
126
+ onBlockTransform( name );
127
+ close();
128
+ },
129
+ };
130
+ }
131
+ );
132
+
133
+ return { isLoading: false, commands };
134
+ };
135
+
136
+ const getQuickActionsCommands = () =>
137
+ function useQuickActionsCommands() {
138
+ const { clientIds, isUngroupable, isGroupable } = useSelect(
139
+ ( select ) => {
140
+ const {
141
+ getSelectedBlockClientIds,
142
+ isUngroupable: _isUngroupable,
143
+ isGroupable: _isGroupable,
144
+ } = select( blockEditorStore );
145
+ const selectedBlockClientIds = getSelectedBlockClientIds();
146
+
147
+ return {
148
+ clientIds: selectedBlockClientIds,
149
+ isUngroupable: _isUngroupable(),
150
+ isGroupable: _isGroupable(),
151
+ };
122
152
  },
123
- };
124
- } );
153
+ []
154
+ );
155
+ const {
156
+ canInsertBlockType,
157
+ getBlockRootClientId,
158
+ getBlocksByClientId,
159
+ canRemoveBlocks,
160
+ } = useSelect( blockEditorStore );
161
+ const { getDefaultBlockName, getGroupingBlockName } =
162
+ useSelect( blocksStore );
125
163
 
126
- return { isLoading: false, commands };
127
- };
164
+ const blocks = getBlocksByClientId( clientIds );
128
165
 
129
- const useQuickActionsCommands = () => {
130
- const { clientIds, isUngroupable, isGroupable } = useSelect( ( select ) => {
131
166
  const {
132
- getSelectedBlockClientIds,
133
- isUngroupable: _isUngroupable,
134
- isGroupable: _isGroupable,
135
- } = select( blockEditorStore );
136
- const selectedBlockClientIds = getSelectedBlockClientIds();
167
+ removeBlocks,
168
+ replaceBlocks,
169
+ duplicateBlocks,
170
+ insertAfterBlock,
171
+ insertBeforeBlock,
172
+ } = useDispatch( blockEditorStore );
173
+
174
+ const onGroup = () => {
175
+ if ( ! blocks.length ) {
176
+ return;
177
+ }
137
178
 
138
- return {
139
- clientIds: selectedBlockClientIds,
140
- isUngroupable: _isUngroupable(),
141
- isGroupable: _isGroupable(),
179
+ const groupingBlockName = getGroupingBlockName();
180
+
181
+ // Activate the `transform` on `core/group` which does the conversion.
182
+ const newBlocks = switchToBlockType( blocks, groupingBlockName );
183
+
184
+ if ( ! newBlocks ) {
185
+ return;
186
+ }
187
+ replaceBlocks( clientIds, newBlocks );
142
188
  };
143
- }, [] );
144
- const {
145
- canInsertBlockType,
146
- getBlockRootClientId,
147
- getBlocksByClientId,
148
- canRemoveBlocks,
149
- } = useSelect( blockEditorStore );
150
- const { getDefaultBlockName, getGroupingBlockName } =
151
- useSelect( blocksStore );
152
-
153
- const blocks = getBlocksByClientId( clientIds );
154
-
155
- const {
156
- removeBlocks,
157
- replaceBlocks,
158
- duplicateBlocks,
159
- insertAfterBlock,
160
- insertBeforeBlock,
161
- } = useDispatch( blockEditorStore );
162
-
163
- const onGroup = () => {
164
- if ( ! blocks.length ) {
165
- return;
166
- }
189
+ const onUngroup = () => {
190
+ if ( ! blocks.length ) {
191
+ return;
192
+ }
167
193
 
168
- const groupingBlockName = getGroupingBlockName();
194
+ const innerBlocks = blocks[ 0 ].innerBlocks;
169
195
 
170
- // Activate the `transform` on `core/group` which does the conversion.
171
- const newBlocks = switchToBlockType( blocks, groupingBlockName );
196
+ if ( ! innerBlocks.length ) {
197
+ return;
198
+ }
172
199
 
173
- if ( ! newBlocks ) {
174
- return;
175
- }
176
- replaceBlocks( clientIds, newBlocks );
177
- };
178
- const onUngroup = () => {
179
- if ( ! blocks.length ) {
180
- return;
200
+ replaceBlocks( clientIds, innerBlocks );
201
+ };
202
+
203
+ if ( ! clientIds || clientIds.length < 1 ) {
204
+ return { isLoading: false, commands: [] };
181
205
  }
182
206
 
183
- const innerBlocks = blocks[ 0 ].innerBlocks;
207
+ const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
208
+ const canInsertDefaultBlock = canInsertBlockType(
209
+ getDefaultBlockName(),
210
+ rootClientId
211
+ );
212
+ const canDuplicate = blocks.every( ( block ) => {
213
+ return (
214
+ !! block &&
215
+ hasBlockSupport( block.name, 'multiple', true ) &&
216
+ canInsertBlockType( block.name, rootClientId )
217
+ );
218
+ } );
219
+ const canRemove = canRemoveBlocks( clientIds );
184
220
 
185
- if ( ! innerBlocks.length ) {
186
- return;
221
+ const commands = [];
222
+
223
+ if ( canDuplicate ) {
224
+ commands.push( {
225
+ name: 'duplicate',
226
+ label: __( 'Duplicate' ),
227
+ callback: () => duplicateBlocks( clientIds, true ),
228
+ icon: copy,
229
+ } );
187
230
  }
188
231
 
189
- replaceBlocks( clientIds, innerBlocks );
190
- };
232
+ if ( canInsertDefaultBlock ) {
233
+ commands.push(
234
+ {
235
+ name: 'add-before',
236
+ label: __( 'Add before' ),
237
+ callback: () => {
238
+ const clientId = Array.isArray( clientIds )
239
+ ? clientIds[ 0 ]
240
+ : clientId;
241
+ insertBeforeBlock( clientId );
242
+ },
243
+ icon: add,
244
+ },
245
+ {
246
+ name: 'add-after',
247
+ label: __( 'Add after' ),
248
+ callback: () => {
249
+ const clientId = Array.isArray( clientIds )
250
+ ? clientIds[ clientIds.length - 1 ]
251
+ : clientId;
252
+ insertAfterBlock( clientId );
253
+ },
254
+ icon: add,
255
+ }
256
+ );
257
+ }
191
258
 
192
- if ( ! clientIds || clientIds.length < 1 ) {
193
- return { isLoading: false, commands: [] };
194
- }
195
-
196
- const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
197
- const canInsertDefaultBlock = canInsertBlockType(
198
- getDefaultBlockName(),
199
- rootClientId
200
- );
201
- const canDuplicate = blocks.every( ( block ) => {
202
- return (
203
- !! block &&
204
- hasBlockSupport( block.name, 'multiple', true ) &&
205
- canInsertBlockType( block.name, rootClientId )
206
- );
207
- } );
208
- const canRemove = canRemoveBlocks( clientIds );
259
+ if ( isGroupable ) {
260
+ commands.push( {
261
+ name: 'Group',
262
+ label: __( 'Group' ),
263
+ callback: onGroup,
264
+ icon: group,
265
+ } );
266
+ }
209
267
 
210
- const commands = [];
268
+ if ( isUngroupable ) {
269
+ commands.push( {
270
+ name: 'ungroup',
271
+ label: __( 'Ungroup' ),
272
+ callback: onUngroup,
273
+ icon: ungroup,
274
+ } );
275
+ }
211
276
 
212
- if ( canDuplicate ) {
213
- commands.push( {
214
- name: 'duplicate',
215
- label: __( 'Duplicate' ),
216
- callback: () => duplicateBlocks( clientIds, true ),
217
- icon: copy,
218
- } );
219
- }
220
-
221
- if ( canInsertDefaultBlock ) {
222
- commands.push(
223
- {
224
- name: 'add-before',
225
- label: __( 'Add before' ),
226
- callback: () => {
227
- const clientId = Array.isArray( clientIds )
228
- ? clientIds[ 0 ]
229
- : clientId;
230
- insertBeforeBlock( clientId );
231
- },
232
- icon: add,
233
- },
234
- {
235
- name: 'add-after',
236
- label: __( 'Add after' ),
237
- callback: () => {
238
- const clientId = Array.isArray( clientIds )
239
- ? clientIds[ clientIds.length - 1 ]
240
- : clientId;
241
- insertAfterBlock( clientId );
277
+ if ( canRemove ) {
278
+ commands.push( {
279
+ name: 'remove',
280
+ label: __( 'Delete' ),
281
+ callback: () => removeBlocks( clientIds, true ),
282
+ icon: remove,
283
+ } );
284
+ }
285
+
286
+ return {
287
+ isLoading: false,
288
+ commands: commands.map( ( command ) => ( {
289
+ ...command,
290
+ name: 'core/block-editor/action-' + command.name,
291
+ callback: ( { close } ) => {
292
+ command.callback();
293
+ close();
242
294
  },
243
- icon: add,
244
- }
245
- );
246
- }
247
-
248
- if ( isGroupable ) {
249
- commands.push( {
250
- name: 'Group',
251
- label: __( 'Group' ),
252
- callback: onGroup,
253
- icon: group,
254
- } );
255
- }
256
-
257
- if ( isUngroupable ) {
258
- commands.push( {
259
- name: 'ungroup',
260
- label: __( 'Ungroup' ),
261
- callback: onUngroup,
262
- icon: ungroup,
263
- } );
264
- }
265
-
266
- if ( canRemove ) {
267
- commands.push( {
268
- name: 'remove',
269
- label: __( 'Delete' ),
270
- callback: () => removeBlocks( clientIds, true ),
271
- icon: remove,
272
- } );
273
- }
274
-
275
- return {
276
- isLoading: false,
277
- commands: commands.map( ( command ) => ( {
278
- ...command,
279
- name: 'core/block-editor/action-' + command.name,
280
- callback: ( { close } ) => {
281
- command.callback();
282
- close();
283
- },
284
- } ) ),
295
+ } ) ),
296
+ };
285
297
  };
286
- };
287
298
 
288
299
  export const useBlockCommands = () => {
289
300
  useCommandLoader( {
290
301
  name: 'core/block-editor/blockTransforms',
291
- hook: useTransformCommands,
302
+ hook: getTransformCommands(),
292
303
  } );
293
304
  useCommandLoader( {
294
305
  name: 'core/block-editor/blockQuickActions',
295
- hook: useQuickActionsCommands,
306
+ hook: getQuickActionsCommands(),
296
307
  context: 'block-selection-edit',
297
308
  } );
298
309
  };
@@ -13,7 +13,7 @@ import { shouldSkipSerialization } from './utils';
13
13
  import { TYPOGRAPHY_SUPPORT_KEY } from './typography';
14
14
  import { unlock } from '../lock-unlock';
15
15
 
16
- export const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
16
+ export const FONT_FAMILY_SUPPORT_KEY = 'typography.fontFamily';
17
17
  const { kebabCase } = unlock( componentsPrivateApis );
18
18
 
19
19
  /**
@@ -9,17 +9,17 @@ const ALIGN_WIDE_SUPPORT_KEY = 'alignWide';
9
9
  const BORDER_SUPPORT_KEY = '__experimentalBorder';
10
10
  const COLOR_SUPPORT_KEY = 'color';
11
11
  const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';
12
- const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
12
+ const FONT_FAMILY_SUPPORT_KEY = 'typography.fontFamily';
13
13
  const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
14
14
  const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
15
15
  /**
16
16
  * Key within block settings' support array indicating support for font style.
17
17
  */
18
- const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
18
+ const FONT_STYLE_SUPPORT_KEY = 'typography.fontStyle';
19
19
  /**
20
20
  * Key within block settings' support array indicating support for font weight.
21
21
  */
22
- const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
22
+ const FONT_WEIGHT_SUPPORT_KEY = 'typography.fontWeight';
23
23
  /**
24
24
  * Key within block settings' supports array indicating support for text
25
25
  * align e.g. settings found in `block.json`.
@@ -34,7 +34,7 @@ const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
34
34
  * Key within block settings' supports array indicating support for text
35
35
  * decorations e.g. settings found in `block.json`.
36
36
  */
37
- const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
37
+ const TEXT_DECORATION_SUPPORT_KEY = 'typography.textDecoration';
38
38
  /**
39
39
  * Key within block settings' supports array indicating support for writing mode
40
40
  * e.g. settings found in `block.json`.
@@ -44,13 +44,13 @@ const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
44
44
  * Key within block settings' supports array indicating support for text
45
45
  * transforms e.g. settings found in `block.json`.
46
46
  */
47
- const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
47
+ const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.textTransform';
48
48
 
49
49
  /**
50
50
  * Key within block settings' supports array indicating support for letter-spacing
51
51
  * e.g. settings found in `block.json`.
52
52
  */
53
- const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
53
+ const LETTER_SPACING_SUPPORT_KEY = 'typography.letterSpacing';
54
54
  const LAYOUT_SUPPORT_KEY = 'layout';
55
55
  const TYPOGRAPHY_SUPPORT_KEYS = [
56
56
  LINE_HEIGHT_SUPPORT_KEY,
@@ -27,12 +27,12 @@ function omit( object, keys ) {
27
27
  );
28
28
  }
29
29
 
30
- const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
31
- const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
32
- const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
30
+ const LETTER_SPACING_SUPPORT_KEY = 'typography.letterSpacing';
31
+ const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.textTransform';
32
+ const TEXT_DECORATION_SUPPORT_KEY = 'typography.textDecoration';
33
33
  const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
34
- const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
35
- const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
34
+ const FONT_STYLE_SUPPORT_KEY = 'typography.fontStyle';
35
+ const FONT_WEIGHT_SUPPORT_KEY = 'typography.fontWeight';
36
36
  const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
37
37
  export const TYPOGRAPHY_SUPPORT_KEY = 'typography';
38
38
  export const TYPOGRAPHY_SUPPORT_KEYS = [
@@ -562,8 +562,13 @@ export function createBlockEditFilter( features ) {
562
562
  addFilter( 'editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks );
563
563
  }
564
564
 
565
- function BlockProps( { index, useBlockProps, setAllWrapperProps, ...props } ) {
566
- const wrapperProps = useBlockProps( props );
565
+ function BlockProps( {
566
+ index,
567
+ useBlockProps: hook,
568
+ setAllWrapperProps,
569
+ ...props
570
+ } ) {
571
+ const wrapperProps = hook( props );
567
572
  const setWrapperProps = ( next ) =>
568
573
  setAllWrapperProps( ( prev ) => {
569
574
  const nextAll = [ ...prev ];
@@ -109,17 +109,16 @@ function getEnabledClientIdsTreeUnmemoized( state, rootClientId ) {
109
109
  *
110
110
  * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.
111
111
  */
112
- export const getEnabledClientIdsTree = createSelector(
113
- getEnabledClientIdsTreeUnmemoized,
114
- ( state ) => [
112
+ export const getEnabledClientIdsTree = createRegistrySelector( ( select ) =>
113
+ createSelector( getEnabledClientIdsTreeUnmemoized, ( state ) => [
115
114
  state.blocks.order,
116
115
  state.blockEditingModes,
117
116
  state.settings.templateLock,
118
117
  state.blockListSettings,
119
- state.editorMode,
118
+ select( STORE_NAME ).__unstableGetEditorMode( state ),
120
119
  state.zoomLevel,
121
120
  getSectionRootClientId( state ),
122
- ]
121
+ ] )
123
122
  );
124
123
 
125
124
  /**
@@ -317,7 +316,7 @@ export const hasAllowedPatterns = createRegistrySelector( ( select ) =>
317
316
  },
318
317
  ( state, rootClientId ) => [
319
318
  ...getAllPatternsDependants( select )( state ),
320
- ...getInsertBlockTypeDependants( state, rootClientId ),
319
+ ...getInsertBlockTypeDependants( select )( state, rootClientId ),
321
320
  ]
322
321
  )
323
322
  );