Always show the sidebar
This commit is contained in:
parent
9916afc768
commit
b6665b67ba
|
@ -6,24 +6,17 @@ import { BlockBreadcrumb, BlockCanvas, store as blockEditorStore } from '@wordpr
|
||||||
import Sidebar from './Sidebar';
|
import Sidebar from './Sidebar';
|
||||||
|
|
||||||
export default function BlockEditor() {
|
export default function BlockEditor() {
|
||||||
const { styles, sidebarIsOpen, hasBlockSelected } = useSelect(( select ) => {
|
const { styles } = useSelect(( select ) => {
|
||||||
const { getSettings, getBlockSelectionStart } = select( blockEditorStore );
|
const { getSettings, getBlockSelectionStart } = select( blockEditorStore );
|
||||||
const { getActiveComplementaryArea } = select( interfaceStore );
|
|
||||||
return {
|
return {
|
||||||
styles: getSettings().styles,
|
styles: getSettings().styles,
|
||||||
hasBlockSelected: !!getBlockSelectionStart(),
|
|
||||||
sidebarIsOpen: !!getActiveComplementaryArea( 'tipus/editor' )
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const { enableComplementaryArea, disableComplementaryArea } = useDispatch( interfaceStore );
|
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hasBlockSelected) {
|
|
||||||
enableComplementaryArea( 'tipus/editor', 'edit-post/block' );
|
enableComplementaryArea( 'tipus/editor', 'edit-post/block' );
|
||||||
} else {
|
}, []);
|
||||||
disableComplementaryArea( 'tipus/editor' );
|
|
||||||
}
|
|
||||||
}, [ hasBlockSelected ]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -31,7 +24,7 @@ export default function BlockEditor() {
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
<InterfaceSkeleton
|
<InterfaceSkeleton
|
||||||
content={ <BlockCanvas height="100%" styles={styles} /> }
|
content={ <BlockCanvas height="100%" styles={styles} /> }
|
||||||
sidebar={ sidebarIsOpen && <ComplementaryArea.Slot scope="tipus/editor" /> }
|
sidebar={ <ComplementaryArea.Slot scope="tipus/editor" /> }
|
||||||
footer={ <BlockBreadcrumb /> }
|
footer={ <BlockBreadcrumb /> }
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in New Issue