@@ -15,7 +15,6 @@ import {
1515 getBlockOrder ,
1616 getBlockParents ,
1717 getBlockEditingMode ,
18- getBlockRootClientId ,
1918 getSettings ,
2019 canInsertBlockType ,
2120} from './selectors' ;
@@ -24,6 +23,8 @@ import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-ta
2423import { store } from './' ;
2524import { unlock } from '../lock-unlock' ;
2625
26+ export { getSelectedBlockClientIdsUnmemoized } from './utils' ;
27+
2728/**
2829 * Returns true if the block interface is hidden, or false otherwise.
2930 *
@@ -49,39 +50,6 @@ export function getBlockWithoutAttributes( state, clientId ) {
4950 return state . blocks . byClientId . get ( clientId ) ;
5051}
5152
52- const EMPTY_ARRAY = [ ] ;
53-
54- export function getSelectedBlockClientIdsUnmemoized ( state ) {
55- const { selectionStart, selectionEnd } = state . selection ;
56-
57- if ( ! selectionStart . clientId || ! selectionEnd . clientId ) {
58- return EMPTY_ARRAY ;
59- }
60-
61- if ( selectionStart . clientId === selectionEnd . clientId ) {
62- return [ selectionStart . clientId ] ;
63- }
64-
65- // Retrieve root client ID to aid in retrieving relevant nested block
66- // order, being careful to allow the falsey empty string top-level root
67- // by explicitly testing against null.
68- const rootClientId = getBlockRootClientId ( state , selectionStart . clientId ) ;
69-
70- if ( rootClientId === null ) {
71- return EMPTY_ARRAY ;
72- }
73-
74- const blockOrder = getBlockOrder ( state , rootClientId ) ;
75- const startIndex = blockOrder . indexOf ( selectionStart . clientId ) ;
76- const endIndex = blockOrder . indexOf ( selectionEnd . clientId ) ;
77-
78- if ( startIndex > endIndex ) {
79- return blockOrder . slice ( endIndex , startIndex + 1 ) ;
80- }
81-
82- return blockOrder . slice ( startIndex , endIndex + 1 ) ;
83- }
84-
8553/**
8654 * Returns true if all of the descendants of a block with the given client ID
8755 * have an editing mode of 'disabled', or false otherwise.
0 commit comments