@wordpress/block-editor 15.16.0 → 15.16.1-next.v.202604091042.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 (124) hide show
  1. package/build/components/autocomplete/index.cjs +1 -2
  2. package/build/components/autocomplete/index.cjs.map +3 -3
  3. package/build/components/block-list/block-crash-warning.cjs +4 -2
  4. package/build/components/block-list/block-crash-warning.cjs.map +2 -2
  5. package/build/components/block-list/block-html.cjs +6 -2
  6. package/build/components/block-list/block-html.cjs.map +2 -2
  7. package/build/components/block-mover/button.cjs +4 -3
  8. package/build/components/block-mover/button.cjs.map +2 -2
  9. package/build/components/block-mover/index.cjs +1 -8
  10. package/build/components/block-mover/index.cjs.map +2 -2
  11. package/build/components/iframe/get-compatibility-styles.cjs +1 -1
  12. package/build/components/iframe/get-compatibility-styles.cjs.map +2 -2
  13. package/build/components/inserter/media-tab/hooks.cjs +1 -1
  14. package/build/components/inserter/media-tab/hooks.cjs.map +2 -2
  15. package/build/components/link-control/search-input.cjs +1 -1
  16. package/build/components/link-control/search-input.cjs.map +2 -2
  17. package/build/components/link-picker/link-preview.cjs +2 -1
  18. package/build/components/link-picker/link-preview.cjs.map +3 -3
  19. package/build/components/rich-text/index.cjs +1 -1
  20. package/build/components/rich-text/index.cjs.map +2 -2
  21. package/build/components/rich-text/input-event.cjs +3 -3
  22. package/build/components/rich-text/input-event.cjs.map +2 -2
  23. package/build/components/use-on-block-drop/index.cjs +1 -1
  24. package/build/components/use-on-block-drop/index.cjs.map +2 -2
  25. package/build/components/use-paste-styles/index.cjs +2 -2
  26. package/build/components/use-paste-styles/index.cjs.map +2 -2
  27. package/build/hooks/block-style-variation.cjs +5 -6
  28. package/build/hooks/block-style-variation.cjs.map +3 -3
  29. package/build/hooks/index.cjs +2 -2
  30. package/build/hooks/index.cjs.map +2 -2
  31. package/build/private-apis.cjs +1 -1
  32. package/build/private-apis.cjs.map +1 -1
  33. package/build/store/actions.cjs +0 -8
  34. package/build/store/actions.cjs.map +2 -2
  35. package/build/store/reducer.cjs +52 -53
  36. package/build/store/reducer.cjs.map +2 -2
  37. package/build/store/selectors.cjs +12 -13
  38. package/build/store/selectors.cjs.map +2 -2
  39. package/build/store/utils.cjs +1 -1
  40. package/build/store/utils.cjs.map +2 -2
  41. package/build/utils/pasting.cjs +1 -1
  42. package/build/utils/pasting.cjs.map +2 -2
  43. package/build-module/components/autocomplete/index.mjs +1 -2
  44. package/build-module/components/autocomplete/index.mjs.map +2 -2
  45. package/build-module/components/block-list/block-crash-warning.mjs +4 -2
  46. package/build-module/components/block-list/block-crash-warning.mjs.map +2 -2
  47. package/build-module/components/block-list/block-html.mjs +7 -3
  48. package/build-module/components/block-list/block-html.mjs.map +2 -2
  49. package/build-module/components/block-mover/button.mjs +4 -3
  50. package/build-module/components/block-mover/button.mjs.map +2 -2
  51. package/build-module/components/block-mover/index.mjs +1 -8
  52. package/build-module/components/block-mover/index.mjs.map +2 -2
  53. package/build-module/components/iframe/get-compatibility-styles.mjs +1 -1
  54. package/build-module/components/iframe/get-compatibility-styles.mjs.map +2 -2
  55. package/build-module/components/inserter/media-tab/hooks.mjs +1 -1
  56. package/build-module/components/inserter/media-tab/hooks.mjs.map +2 -2
  57. package/build-module/components/link-control/search-input.mjs +1 -1
  58. package/build-module/components/link-control/search-input.mjs.map +2 -2
  59. package/build-module/components/link-picker/link-preview.mjs +2 -1
  60. package/build-module/components/link-picker/link-preview.mjs.map +2 -2
  61. package/build-module/components/rich-text/index.mjs +2 -2
  62. package/build-module/components/rich-text/index.mjs.map +2 -2
  63. package/build-module/components/rich-text/input-event.mjs +2 -2
  64. package/build-module/components/rich-text/input-event.mjs.map +2 -2
  65. package/build-module/components/use-on-block-drop/index.mjs +1 -1
  66. package/build-module/components/use-on-block-drop/index.mjs.map +2 -2
  67. package/build-module/components/use-paste-styles/index.mjs +2 -2
  68. package/build-module/components/use-paste-styles/index.mjs.map +2 -2
  69. package/build-module/hooks/block-style-variation.mjs +4 -5
  70. package/build-module/hooks/block-style-variation.mjs.map +2 -2
  71. package/build-module/hooks/index.mjs +2 -2
  72. package/build-module/hooks/index.mjs.map +2 -2
  73. package/build-module/private-apis.mjs +2 -2
  74. package/build-module/private-apis.mjs.map +1 -1
  75. package/build-module/store/actions.mjs +0 -8
  76. package/build-module/store/actions.mjs.map +2 -2
  77. package/build-module/store/reducer.mjs +52 -53
  78. package/build-module/store/reducer.mjs.map +2 -2
  79. package/build-module/store/selectors.mjs +12 -13
  80. package/build-module/store/selectors.mjs.map +2 -2
  81. package/build-module/store/utils.mjs +1 -1
  82. package/build-module/store/utils.mjs.map +2 -2
  83. package/build-module/utils/pasting.mjs +1 -1
  84. package/build-module/utils/pasting.mjs.map +2 -2
  85. package/build-style/style-rtl.css +0 -7
  86. package/build-style/style.css +0 -7
  87. package/package.json +38 -39
  88. package/src/autocompleters/style.scss +0 -8
  89. package/src/components/autocomplete/index.js +1 -2
  90. package/src/components/block-draggable/test/helpers.native.js +1 -1
  91. package/src/components/block-list/block-crash-warning.js +3 -1
  92. package/src/components/block-list/block-crash-warning.native.js +3 -1
  93. package/src/components/block-list/block-html.js +13 -3
  94. package/src/components/block-mover/button.js +7 -4
  95. package/src/components/block-mover/index.js +1 -8
  96. package/src/components/iframe/get-compatibility-styles.js +1 -1
  97. package/src/components/inserter/media-tab/hooks.js +1 -1
  98. package/src/components/link-control/README.md +2 -2
  99. package/src/components/link-control/search-input.js +1 -1
  100. package/src/components/link-picker/link-preview.js +2 -1
  101. package/src/components/rich-text/index.js +1 -1
  102. package/src/components/rich-text/index.native.js +1 -1
  103. package/src/components/rich-text/input-event.js +1 -1
  104. package/src/components/rich-text/input-event.native.js +1 -1
  105. package/src/components/rich-text/native/index.native.js +18 -17
  106. package/src/components/use-on-block-drop/index.js +1 -1
  107. package/src/components/use-paste-styles/index.js +2 -2
  108. package/src/hooks/block-style-variation.js +3 -4
  109. package/src/hooks/index.js +1 -1
  110. package/src/private-apis.js +2 -2
  111. package/src/store/actions.js +0 -8
  112. package/src/store/reducer.js +62 -67
  113. package/src/store/selectors.js +31 -21
  114. package/src/store/test/private-selectors.js +44 -41
  115. package/src/store/test/reducer.js +159 -88
  116. package/src/store/test/registry-selectors.js +1 -1
  117. package/src/store/test/selectors.js +265 -200
  118. package/src/store/utils.js +1 -1
  119. package/src/utils/pasting.js +1 -1
  120. package/build/autocompleters/link.cjs +0 -81
  121. package/build/autocompleters/link.cjs.map +0 -7
  122. package/build-module/autocompleters/link.mjs +0 -50
  123. package/build-module/autocompleters/link.mjs.map +0 -7
  124. package/src/autocompleters/link.js +0 -63
@@ -1768,10 +1768,6 @@ export const insertBeforeBlock =
1768
1768
  return;
1769
1769
  }
1770
1770
  const rootClientId = select.getBlockRootClientId( clientId );
1771
- const isLocked = select.getTemplateLock( rootClientId );
1772
- if ( isLocked ) {
1773
- return;
1774
- }
1775
1771
 
1776
1772
  const blockIndex = select.getBlockIndex( clientId );
1777
1773
  const directInsertBlock = rootClientId
@@ -1811,10 +1807,6 @@ export const insertAfterBlock =
1811
1807
  return;
1812
1808
  }
1813
1809
  const rootClientId = select.getBlockRootClientId( clientId );
1814
- const isLocked = select.getTemplateLock( rootClientId );
1815
- if ( isLocked ) {
1816
- return;
1817
- }
1818
1810
 
1819
1811
  const blockIndex = select.getBlockIndex( clientId );
1820
1812
  const directInsertBlock = rootClientId
@@ -213,7 +213,7 @@ function updateParentInnerBlocksInTree(
213
213
  ? clientId
214
214
  : state.parents.get( clientId );
215
215
  do {
216
- if ( state.controlledInnerBlocks[ current ] ) {
216
+ if ( state.controlledInnerBlocks.has( current ) ) {
217
217
  // Should stop on controlled blocks.
218
218
  // If we reach a controlled parent, break out of the loop.
219
219
  controlledParents.add( current );
@@ -591,7 +591,7 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
591
591
  } );
592
592
 
593
593
  const preservedControlledInnerBlocks =
594
- state?.controlledInnerBlocks ?? {};
594
+ state?.controlledInnerBlocks ?? new Set();
595
595
 
596
596
  // Preserve controlled inner blocks data from the old state.
597
597
  // The maps above are rebuilt solely from action.blocks, but
@@ -599,17 +599,12 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
599
599
  // present in action.blocks. Re-inject them so the state
600
600
  // remains consistent with the preserved flags.
601
601
  if ( state?.order ) {
602
- for ( const clientId of Object.keys(
603
- preservedControlledInnerBlocks
604
- ) ) {
605
- if ( ! preservedControlledInnerBlocks[ clientId ] ) {
606
- continue;
607
- }
602
+ for ( const clientId of preservedControlledInnerBlocks ) {
608
603
  // Only preserve if the parent block still exists.
609
604
  if ( ! newState.byClientId.has( clientId ) ) {
610
605
  continue;
611
606
  }
612
- newState.controlledInnerBlocks[ clientId ] = true;
607
+ newState.controlledInnerBlocks.add( clientId );
613
608
  const oldOrder = state.order.get( clientId );
614
609
  if ( ! oldOrder?.length ) {
615
610
  continue;
@@ -641,9 +636,7 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
641
636
  // (entity-level IDs), but we need them to reference the preserved
642
637
  // cloned inner blocks instead. Mutating the existing object
643
638
  // preserves references held by ancestor tree entries.
644
- for ( const clientId of Object.keys(
645
- newState.controlledInnerBlocks
646
- ) ) {
639
+ for ( const clientId of newState.controlledInnerBlocks ) {
647
640
  const controlledOrder = newState.order.get( clientId );
648
641
  if ( ! controlledOrder?.length ) {
649
642
  continue;
@@ -707,12 +700,12 @@ const withReplaceInnerBlocks = ( reducer ) => ( state, action ) => {
707
700
  // inner blocks from the block state because its inner blocks will not be
708
701
  // attached to the block in the action.
709
702
  const nestedControllers = {};
710
- if ( Object.keys( state.controlledInnerBlocks ).length ) {
703
+ if ( state.controlledInnerBlocks.size ) {
711
704
  const stack = [ ...action.blocks ];
712
705
  while ( stack.length ) {
713
706
  const { innerBlocks, ...block } = stack.shift();
714
707
  stack.push( ...innerBlocks );
715
- if ( !! state.controlledInnerBlocks[ block.clientId ] ) {
708
+ if ( state.controlledInnerBlocks.has( block.clientId ) ) {
716
709
  nestedControllers[ block.clientId ] = true;
717
710
  }
718
711
  }
@@ -1222,14 +1215,22 @@ export const blocks = pipe(
1222
1215
  },
1223
1216
 
1224
1217
  controlledInnerBlocks(
1225
- state = {},
1218
+ state = new Set(),
1226
1219
  { type, clientId, hasControlledInnerBlocks }
1227
1220
  ) {
1228
1221
  if ( type === 'SET_HAS_CONTROLLED_INNER_BLOCKS' ) {
1229
- return {
1230
- ...state,
1231
- [ clientId ]: hasControlledInnerBlocks,
1232
- };
1222
+ if ( hasControlledInnerBlocks ) {
1223
+ if ( state.has( clientId ) ) {
1224
+ return state;
1225
+ }
1226
+ return new Set( state ).add( clientId );
1227
+ }
1228
+ if ( ! state.has( clientId ) ) {
1229
+ return state;
1230
+ }
1231
+ const newState = new Set( state );
1232
+ newState.delete( clientId );
1233
+ return newState;
1233
1234
  }
1234
1235
  return state;
1235
1236
  },
@@ -1828,12 +1829,12 @@ export function preferences( state = PREFERENCES_DEFAULTS, action ) {
1828
1829
  * Reducer returning an object where each key is a block client ID, its value
1829
1830
  * representing the settings for its nested blocks.
1830
1831
  *
1831
- * @param {Object} state Current state.
1832
+ * @param {Map} state Current state.
1832
1833
  * @param {Object} action Dispatched action.
1833
1834
  *
1834
1835
  * @return {Object} Updated state.
1835
1836
  */
1836
- export const blockListSettings = ( state = {}, action ) => {
1837
+ export const blockListSettings = ( state = new Map(), action ) => {
1837
1838
  switch ( action.type ) {
1838
1839
  case 'REPLACE_BLOCKS': {
1839
1840
  // Collect all clientIds from replacement blocks. If a clientId
@@ -1848,53 +1849,48 @@ export const blockListSettings = ( state = {}, action ) => {
1848
1849
  replacementIds.add( block.clientId );
1849
1850
  stack.push( ...block.innerBlocks );
1850
1851
  }
1851
- return Object.fromEntries(
1852
- Object.entries( state ).filter(
1853
- ( [ id ] ) =>
1854
- ! action.clientIds.includes( id ) ||
1855
- replacementIds.has( id )
1856
- )
1857
- );
1852
+ const newState = new Map( state );
1853
+ for ( const clientId of action.clientIds ) {
1854
+ if ( ! replacementIds.has( clientId ) ) {
1855
+ newState.delete( clientId );
1856
+ }
1857
+ }
1858
+ return newState;
1858
1859
  }
1859
1860
  case 'REMOVE_BLOCKS': {
1860
- return Object.fromEntries(
1861
- Object.entries( state ).filter(
1862
- ( [ id ] ) => ! action.clientIds.includes( id )
1863
- )
1864
- );
1861
+ const newState = new Map( state );
1862
+ for ( const clientId of action.clientIds ) {
1863
+ newState.delete( clientId );
1864
+ }
1865
+ return newState;
1865
1866
  }
1866
1867
  case 'UPDATE_BLOCK_LIST_SETTINGS': {
1867
1868
  const updates =
1868
1869
  typeof action.clientId === 'string'
1869
- ? { [ action.clientId ]: action.settings }
1870
- : action.clientId;
1871
-
1872
- // Remove settings that are the same as the current state.
1873
- for ( const clientId in updates ) {
1874
- if ( ! updates[ clientId ] ) {
1875
- if ( ! state[ clientId ] ) {
1876
- delete updates[ clientId ];
1877
- }
1878
- } else if (
1879
- fastDeepEqual( state[ clientId ], updates[ clientId ] )
1880
- ) {
1881
- delete updates[ clientId ];
1882
- }
1883
- }
1870
+ ? [ [ action.clientId, action.settings ] ]
1871
+ : Object.entries( action.clientId );
1872
+
1873
+ const relevantUpdates = updates.filter(
1874
+ ( [ clientId, nextSettings ] ) =>
1875
+ ! nextSettings
1876
+ ? state.has( clientId )
1877
+ : ! fastDeepEqual( state.get( clientId ), nextSettings )
1878
+ );
1884
1879
 
1885
- if ( Object.keys( updates ).length === 0 ) {
1880
+ if ( ! relevantUpdates.length ) {
1886
1881
  return state;
1887
1882
  }
1888
1883
 
1889
- const merged = { ...state, ...updates };
1890
-
1891
- for ( const clientId in updates ) {
1892
- if ( ! updates[ clientId ] ) {
1893
- delete merged[ clientId ];
1884
+ const newState = new Map( state );
1885
+ for ( const [ clientId, nextSettings ] of relevantUpdates ) {
1886
+ if ( ! nextSettings ) {
1887
+ newState.delete( clientId );
1888
+ } else {
1889
+ newState.set( clientId, nextSettings );
1894
1890
  }
1895
1891
  }
1896
1892
 
1897
- return merged;
1893
+ return newState;
1898
1894
  }
1899
1895
  }
1900
1896
  return state;
@@ -2369,7 +2365,7 @@ function getBlockTreeBlock( state, clientId ) {
2369
2365
  };
2370
2366
  }
2371
2367
 
2372
- if ( ! state.blocks.controlledInnerBlocks[ clientId ] ) {
2368
+ if ( ! state.blocks.controlledInnerBlocks.has( clientId ) ) {
2373
2369
  return state.blocks.tree.get( clientId );
2374
2370
  }
2375
2371
 
@@ -2468,7 +2464,7 @@ function getDerivedBlockEditingModesForTree( state, treeClientId = '' ) {
2468
2464
  const templatePartClientIds = [];
2469
2465
  const syncedPatternClientIds = [];
2470
2466
 
2471
- Object.keys( state.blocks.controlledInnerBlocks ).forEach( ( clientId ) => {
2467
+ state.blocks.controlledInnerBlocks.forEach( ( clientId ) => {
2472
2468
  const block = state.blocks.byClientId?.get( clientId );
2473
2469
 
2474
2470
  if ( block?.name === 'core/template-part' ) {
@@ -2479,11 +2475,10 @@ function getDerivedBlockEditingModesForTree( state, treeClientId = '' ) {
2479
2475
  syncedPatternClientIds.push( clientId );
2480
2476
  }
2481
2477
  } );
2482
- const contentOnlyTemplateLockedClientIds = Object.keys(
2478
+ const contentOnlyTemplateLockedClientIds = Array.from(
2483
2479
  state.blockListSettings
2484
- ).filter(
2485
- ( clientId ) =>
2486
- state.blockListSettings[ clientId ]?.templateLock === 'contentOnly'
2480
+ ).flatMap( ( [ clientId, listSettings ] ) =>
2481
+ listSettings?.templateLock === 'contentOnly' ? [ clientId ] : []
2487
2482
  );
2488
2483
 
2489
2484
  // When in an isolated editing context (e.g., editing a template part or pattern directly),
@@ -2889,15 +2884,15 @@ export function withDerivedBlockEditingModes( reducer ) {
2889
2884
 
2890
2885
  for ( const clientId in updates ) {
2891
2886
  const isNewContentOnlyBlock =
2892
- state.blockListSettings[ clientId ]?.templateLock !==
2893
- 'contentOnly' &&
2894
- nextState.blockListSettings[ clientId ]
2887
+ state.blockListSettings.get( clientId )
2888
+ ?.templateLock !== 'contentOnly' &&
2889
+ nextState.blockListSettings.get( clientId )
2895
2890
  ?.templateLock === 'contentOnly';
2896
2891
 
2897
2892
  const wasContentOnlyBlock =
2898
- state.blockListSettings[ clientId ]?.templateLock ===
2899
- 'contentOnly' &&
2900
- nextState.blockListSettings[ clientId ]
2893
+ state.blockListSettings.get( clientId )
2894
+ ?.templateLock === 'contentOnly' &&
2895
+ nextState.blockListSettings.get( clientId )
2901
2896
  ?.templateLock !== 'contentOnly';
2902
2897
 
2903
2898
  if ( isNewContentOnlyBlock ) {
@@ -1747,14 +1747,23 @@ const canInsertBlockTypeUnmemoized = (
1747
1747
  return false;
1748
1748
  }
1749
1749
 
1750
- // In content only mode, check if this container allows insertion.
1751
- // We need the `isParentSectionBlock` check because section blocks
1752
- // (synced patterns, contentOnly groups) have a `getBlockEditingMode`
1753
- // of 'default', not 'contentOnly' the 'contentOnly' mode is only
1754
- // set on their *children*.
1750
+ /*
1751
+ * In content only mode, check if this container allows insertion.
1752
+ * We need the `isParentSectionBlock` check because section blocks
1753
+ * (synced patterns, contentOnly groups) have a `getBlockEditingMode`
1754
+ * of 'default', not 'contentOnly' — the 'contentOnly' mode is only
1755
+ * set on their *children*.
1756
+ *
1757
+ * Also include `disabled` alongside `contentOnly`: structural inner blocks
1758
+ * (e.g. Column) inside a content-only section use `disabled` mode, and they
1759
+ * need the same default-block sibling rules so insertion stays aligned with
1760
+ * `canRemoveBlock`.
1761
+ */
1755
1762
  if (
1756
1763
  isWithinSection &&
1757
- ( isParentSectionBlock || blockEditingMode === 'contentOnly' ) &&
1764
+ ( isParentSectionBlock ||
1765
+ blockEditingMode === 'contentOnly' ||
1766
+ blockEditingMode === 'disabled' ) &&
1758
1767
  ! isContainerInsertableToInContentOnlyMode(
1759
1768
  state,
1760
1769
  blockName,
@@ -1762,8 +1771,11 @@ const canInsertBlockTypeUnmemoized = (
1762
1771
  )
1763
1772
  ) {
1764
1773
  const defaultBlockName = getDefaultBlockName();
1765
- // Allow inserting the default block anywhere that another default block already exists
1766
- // when in contentOnly mode.
1774
+ /*
1775
+ * Allow inserting the default block anywhere that another default block already exists
1776
+ * when in contentOnly mode. The same sibling rule applies when the parent is `disabled`
1777
+ * within a content-only section (see the condition above).
1778
+ */
1767
1779
  if ( blockName === defaultBlockName ) {
1768
1780
  const existingBlocks = getBlockOrder( state, rootClientId );
1769
1781
  const hasDefaultBlock = existingBlocks.some(
@@ -1980,9 +1992,9 @@ export function canRemoveBlock( state, clientId ) {
1980
1992
  if ( defaultBlocks.length > 1 ) {
1981
1993
  return true;
1982
1994
  }
1983
- } else {
1984
1995
  return false;
1985
1996
  }
1997
+ return false;
1986
1998
  }
1987
1999
 
1988
2000
  return rootBlockEditingMode !== 'disabled';
@@ -2624,7 +2636,7 @@ export function getDirectInsertBlock( state, rootClientId = null ) {
2624
2636
  return;
2625
2637
  }
2626
2638
  const { defaultBlock, directInsert } =
2627
- state.blockListSettings[ rootClientId ] ?? {};
2639
+ state.blockListSettings.get( rootClientId ) ?? {};
2628
2640
  if ( ! defaultBlock || ! directInsert ) {
2629
2641
  return;
2630
2642
  }
@@ -2857,7 +2869,7 @@ export const __experimentalGetPatternTransformItems = createRegistrySelector(
2857
2869
  * @return {?Object} Block settings of the block if set.
2858
2870
  */
2859
2871
  export function getBlockListSettings( state, clientId ) {
2860
- return state.blockListSettings[ clientId ];
2872
+ return state.blockListSettings.get( clientId );
2861
2873
  }
2862
2874
 
2863
2875
  /**
@@ -2895,16 +2907,14 @@ export function isLastBlockChangePersistent( state ) {
2895
2907
  */
2896
2908
  export const __experimentalGetBlockListSettingsForBlocks = createSelector(
2897
2909
  ( state, clientIds = [] ) => {
2898
- return clientIds.reduce( ( blockListSettingsForBlocks, clientId ) => {
2899
- if ( ! state.blockListSettings[ clientId ] ) {
2900
- return blockListSettingsForBlocks;
2910
+ const blockListSettingsForBlocks = {};
2911
+ for ( const clientId of clientIds ) {
2912
+ const settings = getBlockListSettings( state, clientId );
2913
+ if ( settings ) {
2914
+ blockListSettingsForBlocks[ clientId ] = settings;
2901
2915
  }
2902
-
2903
- return {
2904
- ...blockListSettingsForBlocks,
2905
- [ clientId ]: state.blockListSettings[ clientId ],
2906
- };
2907
- }, {} );
2916
+ }
2917
+ return blockListSettingsForBlocks;
2908
2918
  },
2909
2919
  ( state ) => [ state.blockListSettings ]
2910
2920
  );
@@ -3021,7 +3031,7 @@ export function isBlockHighlighted( state, clientId ) {
3021
3031
  * @return {boolean} True if the block has controlled inner blocks.
3022
3032
  */
3023
3033
  export function areInnerBlocksControlled( state, clientId ) {
3024
- return !! state.blocks.controlledInnerBlocks[ clientId ];
3034
+ return state.blocks.controlledInnerBlocks.has( clientId );
3025
3035
  }
3026
3036
 
3027
3037
  /**
@@ -131,13 +131,13 @@ describe( 'private selectors', () => {
131
131
  '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f',
132
132
  ],
133
133
  ] ),
134
- blockEditingModes: new Map( [] ),
134
+ blockEditingModes: new Map(),
135
135
  },
136
- blockListSettings: {
137
- 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337': {},
138
- '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f': {},
139
- },
140
- derivedBlockEditingModes: new Map( [] ),
136
+ blockListSettings: new Map( [
137
+ [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', {} ],
138
+ [ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', {} ],
139
+ ] ),
140
+ derivedBlockEditingModes: new Map(),
141
141
  };
142
142
 
143
143
  const hasContentRoleAttribute = jest.fn( () => false );
@@ -154,9 +154,9 @@ describe( 'private selectors', () => {
154
154
  ...baseState,
155
155
  blocks: {
156
156
  ...baseState.blocks,
157
- blockEditingModes: new Map( [] ),
157
+ blockEditingModes: new Map(),
158
158
  },
159
- derivedBlockEditingModes: new Map( [] ),
159
+ derivedBlockEditingModes: new Map(),
160
160
  };
161
161
  expect(
162
162
  isBlockSubtreeDisabled(
@@ -349,10 +349,10 @@ describe( 'private selectors', () => {
349
349
  ],
350
350
  ] ),
351
351
  },
352
- blockListSettings: {
353
- 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337': {},
354
- '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f': {},
355
- },
352
+ blockListSettings: new Map( [
353
+ [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', {} ],
354
+ [ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', {} ],
355
+ ] ),
356
356
  };
357
357
  getEnabledClientIdsTree.registry = {
358
358
  select: jest.fn( () => ( {} ) ),
@@ -363,9 +363,9 @@ describe( 'private selectors', () => {
363
363
  ...baseState,
364
364
  blocks: {
365
365
  ...baseState.blocks,
366
- blockEditingModes: new Map( [] ),
366
+ blockEditingModes: new Map(),
367
367
  },
368
- derivedBlockEditingModes: new Map( [] ),
368
+ derivedBlockEditingModes: new Map(),
369
369
  };
370
370
  expect( getEnabledClientIdsTree( state ) ).toEqual( [
371
371
  {
@@ -404,9 +404,9 @@ describe( 'private selectors', () => {
404
404
  ...baseState,
405
405
  blocks: {
406
406
  ...baseState.blocks,
407
- blockEditingModes: new Map( [] ),
407
+ blockEditingModes: new Map(),
408
408
  },
409
- derivedBlockEditingModes: new Map( [] ),
409
+ derivedBlockEditingModes: new Map(),
410
410
  };
411
411
  expect(
412
412
  getEnabledClientIdsTree(
@@ -545,7 +545,7 @@ describe( 'private selectors', () => {
545
545
  [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
546
546
  [ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'disabled' ],
547
547
  ] ),
548
- blockListSettings: {},
548
+ blockListSettings: new Map(),
549
549
  };
550
550
  expect(
551
551
  getEnabledBlockParents(
@@ -597,7 +597,7 @@ describe( 'private selectors', () => {
597
597
  derivedBlockEditingModes: new Map( [
598
598
  [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
599
599
  ] ),
600
- blockListSettings: {},
600
+ blockListSettings: new Map(),
601
601
  };
602
602
  expect(
603
603
  getEnabledBlockParents(
@@ -799,9 +799,9 @@ describe( 'private selectors', () => {
799
799
  ] ),
800
800
  },
801
801
  settings: {},
802
- blockListSettings: {
803
- 'parent-block': templateLock ? { templateLock } : {},
804
- },
802
+ blockListSettings: new Map( [
803
+ [ 'parent-block', templateLock ? { templateLock } : {} ],
804
+ ] ),
805
805
  } );
806
806
 
807
807
  it( 'returns false when block has no lock and no templateLock', () => {
@@ -852,9 +852,9 @@ describe( 'private selectors', () => {
852
852
  ] ),
853
853
  },
854
854
  settings: {},
855
- blockListSettings: {
856
- 'parent-block': templateLock ? { templateLock } : {},
857
- },
855
+ blockListSettings: new Map( [
856
+ [ 'parent-block', templateLock ? { templateLock } : {} ],
857
+ ] ),
858
858
  } );
859
859
 
860
860
  it( 'returns false when block has no lock and no templateLock', () => {
@@ -910,9 +910,9 @@ describe( 'private selectors', () => {
910
910
  ] ),
911
911
  },
912
912
  settings: {},
913
- blockListSettings: {
914
- 'parent-block': templateLock ? { templateLock } : {},
915
- },
913
+ blockListSettings: new Map( [
914
+ [ 'parent-block', templateLock ? { templateLock } : {} ],
915
+ ] ),
916
916
  } );
917
917
 
918
918
  it( 'returns false when block is not locked in any way', () => {
@@ -1395,12 +1395,15 @@ describe( 'private selectors', () => {
1395
1395
  attributes: new Map( [ [ clientId, attributes ] ] ),
1396
1396
  parents: new Map( [ [ clientId, rootClientId ] ] ),
1397
1397
  },
1398
- blockListSettings: {
1399
- [ clientId ]: templateLock ? { templateLock } : {},
1400
- '': rootTemplateLock
1401
- ? { templateLock: rootTemplateLock }
1402
- : {},
1403
- },
1398
+ blockListSettings: new Map( [
1399
+ [ clientId, templateLock ? { templateLock } : {} ],
1400
+ [
1401
+ '',
1402
+ rootTemplateLock
1403
+ ? { templateLock: rootTemplateLock }
1404
+ : {},
1405
+ ],
1406
+ ] ),
1404
1407
  settings:
1405
1408
  disableContentOnlyForUnsyncedPatterns !== undefined
1406
1409
  ? { disableContentOnlyForUnsyncedPatterns }
@@ -1470,7 +1473,7 @@ describe( 'private selectors', () => {
1470
1473
  [ 'inner-pattern', 'outer-pattern' ],
1471
1474
  ] ),
1472
1475
  },
1473
- blockListSettings: {},
1476
+ blockListSettings: new Map(),
1474
1477
  settings: {},
1475
1478
  editedContentOnlySection: undefined,
1476
1479
  };
@@ -1509,7 +1512,7 @@ describe( 'private selectors', () => {
1509
1512
  [ 'block-1', 'outer-pattern' ],
1510
1513
  ] ),
1511
1514
  },
1512
- blockListSettings: {},
1515
+ blockListSettings: new Map(),
1513
1516
  settings: {},
1514
1517
  editedContentOnlySection: 'outer-pattern',
1515
1518
  };
@@ -1535,7 +1538,7 @@ describe( 'private selectors', () => {
1535
1538
  [ 'pattern-b', '' ],
1536
1539
  ] ),
1537
1540
  },
1538
- blockListSettings: {},
1541
+ blockListSettings: new Map(),
1539
1542
  settings: {},
1540
1543
  editedContentOnlySection: 'pattern-a',
1541
1544
  };
@@ -1554,7 +1557,7 @@ describe( 'private selectors', () => {
1554
1557
  attributes: new Map( [ [ 'block-1', {} ] ] ),
1555
1558
  parents: new Map( [ [ 'block-1', '' ] ] ),
1556
1559
  },
1557
- blockListSettings: {},
1560
+ blockListSettings: new Map(),
1558
1561
  settings: {},
1559
1562
  editedContentOnlySection: undefined,
1560
1563
  };
@@ -1580,7 +1583,7 @@ describe( 'private selectors', () => {
1580
1583
  [ 'inner-block', 'pattern-block' ],
1581
1584
  ] ),
1582
1585
  },
1583
- blockListSettings: {},
1586
+ blockListSettings: new Map(),
1584
1587
  settings: {},
1585
1588
  editedContentOnlySection: undefined,
1586
1589
  };
@@ -1608,7 +1611,7 @@ describe( 'private selectors', () => {
1608
1611
  [ 'inner-block', 'pattern-block' ],
1609
1612
  ] ),
1610
1613
  },
1611
- blockListSettings: {},
1614
+ blockListSettings: new Map(),
1612
1615
  settings: {},
1613
1616
  editedContentOnlySection: 'pattern-block',
1614
1617
  };
@@ -1645,7 +1648,7 @@ describe( 'private selectors', () => {
1645
1648
  [ 'deep-block', 'nested-pattern' ],
1646
1649
  ] ),
1647
1650
  },
1648
- blockListSettings: {},
1651
+ blockListSettings: new Map(),
1649
1652
  settings: {},
1650
1653
  editedContentOnlySection: 'outer-pattern',
1651
1654
  };
@@ -1676,7 +1679,7 @@ describe( 'private selectors', () => {
1676
1679
  [ 'pattern-b', '' ],
1677
1680
  ] ),
1678
1681
  },
1679
- blockListSettings: {},
1682
+ blockListSettings: new Map(),
1680
1683
  settings: {},
1681
1684
  editedContentOnlySection: 'pattern-b',
1682
1685
  };