@@ -2050,23 +2050,25 @@ export const getInserterItems = createSelector(
20502050 *
20512051 * Items are returned ordered descendingly by their 'frecency'.
20522052 *
2053- * @param {Object } state Editor state.
2054- * @param {?string } rootClientId Optional root client ID of block list.
2053+ * @param {Object } state Editor state.
2054+ * @param {Object|Object[] } blocks Block object or array objects.
2055+ * @param {?string } rootClientId Optional root client ID of block list.
20552056 *
20562057 * @return {WPEditorTransformItem[] } Items that appear in inserter.
20572058 *
20582059 * @typedef {Object } WPEditorTransformItem
2059- * @property {string } id Unique identifier for the item.
2060- * @property {string } name The type of block to create.
2061- * @property {string } title Title of the item, as it appears in the inserter.
2062- * @property {string } icon Dashicon for the item, as it appears in the inserter.
2063- * @property {boolean } isDisabled Whether or not the user should be prevented from inserting
2064- * this item.
2065- * @property {number } frecency Heuristic that combines frequency and recency.
2060+ * @property {string } id Unique identifier for the item.
2061+ * @property {string } name The type of block to create.
2062+ * @property {string } title Title of the item, as it appears in the inserter.
2063+ * @property {string } icon Dashicon for the item, as it appears in the inserter.
2064+ * @property {boolean } isDisabled Whether or not the user should be prevented from inserting
2065+ * this item.
2066+ * @property {number } frecency Heuristic that combines frequency and recency.
20662067 */
20672068export const getBlockTransformItems = createSelector (
20682069 ( state , blocks , rootClientId = null ) => {
2069- const [ sourceBlock ] = blocks ;
2070+ const normalizedBlocks = castArray ( blocks ) ;
2071+ const [ sourceBlock ] = normalizedBlocks ;
20702072 const buildBlockTypeTransformItem = buildBlockTypeItem ( state , {
20712073 buildScope : 'transform' ,
20722074 } ) ;
@@ -2088,11 +2090,11 @@ export const getBlockTransformItems = createSelector(
20882090 isDisabled : false ,
20892091 name : '*' ,
20902092 title : __ ( 'Unwrap' ) ,
2091- icon : itemsByName [ sourceBlock . name ] ?. icon ,
2093+ icon : itemsByName [ sourceBlock ? .name ] ?. icon ,
20922094 } ;
20932095
20942096 const possibleTransforms = getPossibleBlockTransformations (
2095- blocks
2097+ normalizedBlocks
20962098 ) . reduce ( ( accumulator , block ) => {
20972099 if ( block === '*' ) {
20982100 accumulator . push ( itemsByName [ '*' ] ) ;
0 commit comments