我想在我的WordPress插件中使用此Gutenberg软件包:
https://github.com/WordPress/gutenberg/tree/master/packages/block-editor
使用情况部分说:
import {
BlockEditorProvider,
BlockList,
WritingFlow,
ObserveTyping
} from '@wordpress/block-editor';
import { Popover } from '@wordpress/components';
import { useState } from '@wordpress/element';
function MyEditorComponent () {
const [ blocks, updateBlocks ] = useState( [] );
return (
<BlockEditorProvider
value={ blocks }
onInput={ updateBlocks }
onChange={ updateBlocks }
>
<WritingFlow>
<ObserveTyping>
<BlockList />
</ObserveTyping>
</WritingFlow>
<Popover.Slot />
</BlockEditorProvider>
);
}
// Make sure to load the block editor stylesheets too
// import '@wordpress/components/build-style/style.css';
// import '@wordpress/block-editor/build-style/style.css';
我应该在哪里包含此代码?