Skip to content

Commit

Permalink
Use new method of getting store data. (See #27088.)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZebulanStanphill committed Feb 9, 2021
1 parent ac1a250 commit 00b18cd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/block-library/src/table-of-contents/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
BlockControls,
BlockIcon,
InspectorControls,
store as blockEditorStore,
useBlockProps,
} from '@wordpress/block-editor';
import { createBlock } from '@wordpress/blocks';
Expand All @@ -21,6 +22,7 @@ import {
ToolbarGroup,
} from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
import { renderToString, useEffect, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

Expand Down Expand Up @@ -55,7 +57,7 @@ export default function TableOfContentsEdit( {
const [ headingTree, setHeadingTree ] = useState( [] );

const postContent = useSelect(
( select ) => select( 'core/editor' ).getEditedPostContent(),
( select ) => select( editorStore ).getEditedPostContent(),
[]
);

Expand All @@ -72,7 +74,7 @@ export default function TableOfContentsEdit( {
getBlockIndex,
getBlockName,
getBlockOrder,
} = select( 'core/block-editor' );
} = select( blockEditorStore );

const blockIndex = getBlockIndex( clientId );
const blockOrder = getBlockOrder();
Expand Down Expand Up @@ -126,7 +128,7 @@ export default function TableOfContentsEdit( {
}
}, [ pageIndex, postContent, onlyIncludeCurrentPage ] );

const { replaceBlocks } = useDispatch( 'core/block-editor' );
const { replaceBlocks } = useDispatch( blockEditorStore );

const toolbarControls = (
<BlockControls>
Expand Down

0 comments on commit 00b18cd

Please sign in to comment.