Always show the sidebar

This commit is contained in:
jordi fita mas 2024-06-15 01:48:12 +02:00
parent 9916afc768
commit b6665b67ba
1 changed files with 5 additions and 12 deletions

View File

@ -6,24 +6,17 @@ import { BlockBreadcrumb, BlockCanvas, store as blockEditorStore } from '@wordpr
import Sidebar from './Sidebar';
export default function BlockEditor() {
const { styles, sidebarIsOpen, hasBlockSelected } = useSelect(( select ) => {
const { styles } = useSelect(( select ) => {
const { getSettings, getBlockSelectionStart } = select( blockEditorStore );
const { getActiveComplementaryArea } = select( interfaceStore );
return {
styles: getSettings().styles,
hasBlockSelected: !!getBlockSelectionStart(),
sidebarIsOpen: !!getActiveComplementaryArea( 'tipus/editor' )
};
}, []);
const { enableComplementaryArea, disableComplementaryArea } = useDispatch( interfaceStore );
const { enableComplementaryArea } = useDispatch( interfaceStore );
useEffect(() => {
if (hasBlockSelected) {
enableComplementaryArea( 'tipus/editor', 'edit-post/block' );
} else {
disableComplementaryArea( 'tipus/editor' );
}
}, [ hasBlockSelected ]);
enableComplementaryArea( 'tipus/editor', 'edit-post/block' );
}, []);
return (
<>
@ -31,7 +24,7 @@ export default function BlockEditor() {
<Sidebar />
<InterfaceSkeleton
content={ <BlockCanvas height="100%" styles={styles} /> }
sidebar={ sidebarIsOpen && <ComplementaryArea.Slot scope="tipus/editor" /> }
sidebar={ <ComplementaryArea.Slot scope="tipus/editor" /> }
footer={ <BlockBreadcrumb /> }
/>
</>