tipus/editor/Editor.jsx

34 lines
1.1 KiB
React
Raw Normal View History

2024-06-14 01:24:07 +00:00
import { useState } from '@wordpress/element';
import { BlockEditorProvider } from '@wordpress/block-editor';
import BlockEditor from './BlockEditor';
import './editor.scss';
import blockLibraryCommon from '@wordpress/block-library/build-style/common.css?inline';
import blockLibraryEditor from '@wordpress/block-library/build-style/editor.css?inline';
import blockLibraryStyle from '@wordpress/block-library/build-style/style.css?inline';
import componentsStyle from '@wordpress/components/build-style/style.css?inline';
import formatLibraryStyle from '@wordpress/format-library/build-style/style.css?inline';
export default function Editor() {
const [ blocks, updateBlocks ] = useState();
return <BlockEditorProvider
value={ blocks }
onInput={ updateBlocks }
onChange={ updateBlocks }
settings={ {
styles: [
{ css: componentsStyle },
{ css: blockLibraryCommon },
{ css: blockLibraryStyle },
{ css: blockLibraryEditor },
{ css: formatLibraryStyle },
],
} }
>
<BlockEditor/>
</BlockEditorProvider>;
}