tipus/editor/BlockEditor.jsx

33 lines
1.0 KiB
JavaScript

import { useSelect, useDispatch } from '@wordpress/data';
import { useEffect } from '@wordpress/element';
import { InterfaceSkeleton, FullscreenMode, ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
import { BlockBreadcrumb, BlockCanvas, store as blockEditorStore } from '@wordpress/block-editor';
import Sidebar from './Sidebar';
export default function BlockEditor() {
const { styles } = useSelect(( select ) => {
const { getSettings, getBlockSelectionStart } = select( blockEditorStore );
return {
styles: getSettings().styles,
};
}, []);
const { enableComplementaryArea } = useDispatch( interfaceStore );
useEffect(() => {
enableComplementaryArea( 'tipus/editor', 'edit-post/block' );
}, []);
return (
<>
<FullscreenMode isActive={ true } />
<Sidebar />
<InterfaceSkeleton
content={ <BlockCanvas height="100%" styles={styles} /> }
sidebar={ <ComplementaryArea.Slot scope="tipus/editor" /> }
footer={ <BlockBreadcrumb /> }
/>
</>
);
}