-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba1f023
commit 79499f2
Showing
4 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/block-editor/src/components/block-tools/exploded-mode-inserters.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect } from '@wordpress/data'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockPopoverInbetween from '../block-popover/inbetween'; | ||
import { store as blockEditorStore } from '../../store'; | ||
import Inserter from '../inserter'; | ||
|
||
function ExplodedModeInserters( { __unstableContentRef } ) { | ||
const blockOrder = useSelect( ( select ) => { | ||
return select( blockEditorStore ).getBlockOrder(); | ||
}, [] ); | ||
|
||
return blockOrder.map( ( clientId, index ) => { | ||
if ( index === blockOrder.length - 1 ) { | ||
return null; | ||
} | ||
return ( | ||
<BlockPopoverInbetween | ||
key={ clientId } | ||
previousClientId={ clientId } | ||
nextClientId={ blockOrder[ index + 1 ] } | ||
__unstableContentRef={ __unstableContentRef } | ||
> | ||
<div className="block-editor-block-list__insertion-point-inserter"> | ||
<Inserter | ||
position="bottom center" | ||
clientId={ blockOrder[ index + 1 ] } | ||
__experimentalIsQuick | ||
/> | ||
</div> | ||
</BlockPopoverInbetween> | ||
); | ||
} ); | ||
} | ||
|
||
export default ExplodedModeInserters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters