Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserter: show all blocks (alternative) #62169

Merged
merged 10 commits into from
May 31, 2024
Merged
Prev Previous commit
Next Next commit
Fix parents
  • Loading branch information
ellatrix committed May 31, 2024
commit aaa65324fbfd37e1c64b93c90b330edc3ca6f7ef
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ function useInsertionPoint( {
meta
);
} else {
const parents = registry
.select( blockEditorStore )
.getBlockParents( destinationRootClientId );
const parents = [
'',
...registry
.select( blockEditorStore )
.getBlockParents( destinationRootClientId ),
destinationRootClientId,
];
const index =
_rootClientId === destinationRootClientId
? destinationIndex
Expand Down Expand Up @@ -169,10 +173,14 @@ function useInsertionPoint( {

const onToggleInsertionPoint = useCallback(
( item ) => {
if ( item?.rootClientId ) {
const parents = registry
.select( blockEditorStore )
.getBlockParents( destinationRootClientId );
if ( item?.hasOwnProperty( 'rootClientId' ) ) {
const parents = [
'',
...registry
.select( blockEditorStore )
.getBlockParents( destinationRootClientId ),
destinationRootClientId,
];
const index =
item.rootClientId === destinationRootClientId
? destinationIndex
Expand Down
Loading