Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add for site editor
  • Loading branch information
ellatrix committed Apr 23, 2021
commit db53bcd8c48afa32fce3f6fdfee59f9560184de5
7 changes: 6 additions & 1 deletion packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ function Editor( { initialSettings } ) {

const secondarySidebar = () => {
if ( isInserterOpen ) {
return <InserterSidebar />;
return (
<InserterSidebar
rootClientId={ isInserterOpen?.rootClientId }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems weird that isInserterOpen is not a boolean. Can we rename the selectors? Are these stable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setting (action) is exposed as experimental (__experimentalSetIsInserterOpened), but the selector was not. I created a separate experimental selector to get the insertion point and make sure that the isInserterOpen selector remains boolean.

index={ isInserterOpen?.blockIndex }
/>
);
}
if ( isListViewOpen ) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
*/
import { store as editSiteStore } from '../../store';

export default function InserterSidebar() {
export default function InserterSidebar( { rootClientId, index } ) {
const { setIsInserterOpened } = useDispatch( editSiteStore );

const isMobile = useViewportMatch( 'medium', '<' );
Expand All @@ -36,7 +36,12 @@ export default function InserterSidebar() {
/>
</div>
<div className="edit-site-editor__inserter-panel-content">
<Library showInserterHelpPanel shouldFocusBlock={ isMobile } />
<Library
showInserterHelpPanel
shouldFocusBlock={ isMobile }
rootClientId={ rootClientId }
index={ index }
/>
</div>
</div>
);
Expand Down