diff --git a/packages/edit-site/src/components/navigate-to-link/index.js b/packages/edit-site/src/components/navigate-to-link/index.js index cae40a86af230..77f440abfc78f 100644 --- a/packages/edit-site/src/components/navigate-to-link/index.js +++ b/packages/edit-site/src/components/navigate-to-link/index.js @@ -7,6 +7,7 @@ import { useSelect } from '@wordpress/data'; import { Button } from '@wordpress/components'; import { edit } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; +import { store as coreStore } from '@wordpress/core-data'; export default function NavigateToLink( { type, @@ -19,7 +20,7 @@ export default function NavigateToLink( { type && id && type !== 'URL' && - select( 'core' ).getEntityRecord( 'postType', type, id ), + select( coreStore ).getEntityRecord( 'postType', type, id ), [ type, id ] ); diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js index 31a5249de4f54..91138170cf993 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js @@ -7,6 +7,7 @@ import { } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -27,7 +28,7 @@ export default function ContentCategoriesMenu() { const { categories, isResolved } = useSelect( ( select ) => { const { getEntityRecords, hasFinishedResolution } = select( - 'core' + coreStore ); const getEntityRecordsArgs = [ 'taxonomy', diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js index f91bfe23bacad..21a857d9b54cd 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js @@ -7,6 +7,7 @@ import { } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -27,7 +28,7 @@ export default function ContentPagesMenu() { const { pages, isResolved } = useSelect( ( select ) => { const { getEntityRecords, hasFinishedResolution } = select( - 'core' + coreStore ); const getEntityRecordsArgs = [ 'postType', diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js index bd9faf04df668..8b6a665635e12 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js @@ -8,6 +8,7 @@ import { import { __ } from '@wordpress/i18n'; import { useCallback } from '@wordpress/element'; import { useDispatch, useSelect } from '@wordpress/data'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -32,7 +33,7 @@ export default function ContentPostsMenu() { getEntityRecords, getEditedEntityRecord, hasFinishedResolution, - } = select( 'core' ); + } = select( coreStore ); const getEntityRecodsArgs = [ 'postType', 'post', diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js index eff5c13f4cfe9..aef8443edfe91 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js @@ -4,6 +4,7 @@ import { useDispatch, useSelect } from '@wordpress/data'; import { __experimentalNavigationItem as NavigationItem } from '@wordpress/components'; import { getPathAndQueryString } from '@wordpress/url'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -15,7 +16,7 @@ const getEntityTitle = ( kind, entity ) => export default function NavigationEntityItems( { kind, name, query = {} } ) { const entities = useSelect( - ( select ) => select( 'core' ).getEntityRecords( kind, name, query ), + ( select ) => select( coreStore ).getEntityRecords( kind, name, query ), [ kind, name, query ] ); diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js index a030b8bdd8a72..127238e481f9e 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js @@ -15,6 +15,8 @@ import { import { useDispatch, useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { Icon, plus } from '@wordpress/icons'; +import { store as editorStore } from '@wordpress/editor'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -27,8 +29,8 @@ export default function NewTemplateDropdown() { const { defaultTemplateTypes, templates } = useSelect( ( select ) => { const { __experimentalGetDefaultTemplateTypes: getDefaultTemplateTypes, - } = select( 'core/editor' ); - const templateEntities = select( 'core' ).getEntityRecords( + } = select( editorStore ); + const templateEntities = select( coreStore ).getEntityRecords( 'postType', 'wp_template' ); diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js index e18f1009430d5..5135b72313504 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js @@ -15,6 +15,7 @@ import { __ } from '@wordpress/i18n'; */ import { normalizedSearch } from './utils'; import { useSelect } from '@wordpress/data'; +import { store as editorStore } from '@wordpress/editor'; import TemplateNavigationItem from './template-navigation-item'; import ContentNavigationItem from './content-navigation-item'; @@ -37,7 +38,7 @@ export default function SearchResults( { items, search, disableFilter } ) { if ( itemType === 'wp_template' ) { const { __experimentalGetTemplateInfo: getTemplateInfo, - } = select( 'core/editor' ); + } = select( editorStore ); return items.map( ( item ) => ( { slug: item.slug, diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js index 26399e79bb48e..01218380a25f9 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js @@ -8,6 +8,7 @@ import { import { useDispatch, useSelect } from '@wordpress/data'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; +import { store as editorStore } from '@wordpress/editor'; /** * Internal dependencies @@ -20,7 +21,7 @@ export default function TemplateNavigationItem( { item } ) { const { title, description } = useSelect( ( select ) => 'wp_template' === item.type - ? select( 'core/editor' ).__experimentalGetTemplateInfo( item ) + ? select( editorStore ).__experimentalGetTemplateInfo( item ) : { title: item?.title?.rendered || item?.slug, description: '', diff --git a/packages/edit-site/src/components/template-details/index.js b/packages/edit-site/src/components/template-details/index.js index 9876606c38502..87dc3f7f67002 100644 --- a/packages/edit-site/src/components/template-details/index.js +++ b/packages/edit-site/src/components/template-details/index.js @@ -8,6 +8,7 @@ import { __experimentalText as Text, } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; +import { store as editorStore } from '@wordpress/editor'; /** * Internal dependencies @@ -19,7 +20,7 @@ import { store as editSiteStore } from '../../store'; export default function TemplateDetails( { template, onClose } ) { const { title, description } = useSelect( ( select ) => - select( 'core/editor' ).__experimentalGetTemplateInfo( template ), + select( editorStore ).__experimentalGetTemplateInfo( template ), [] ); const { openNavigationPanelToMenu, revertTemplate } = useDispatch( diff --git a/packages/edit-site/src/components/template-part-converter/index.js b/packages/edit-site/src/components/template-part-converter/index.js index ae018a555cccb..67bd61d56dc58 100644 --- a/packages/edit-site/src/components/template-part-converter/index.js +++ b/packages/edit-site/src/components/template-part-converter/index.js @@ -2,6 +2,7 @@ * WordPress dependencies */ import { useSelect } from '@wordpress/data'; +import { store as blockEditorStore } from '@wordpress/block-editor'; /** * Internal dependencies @@ -12,7 +13,7 @@ import ConvertToTemplatePart from './convert-to-template-part'; export default function TemplatePartConverter() { const { clientIds, blocks } = useSelect( ( select ) => { const { getSelectedBlockClientIds, getBlocksByClientId } = select( - 'core/block-editor' + blockEditorStore ); const selectedBlockClientIds = getSelectedBlockClientIds(); return { diff --git a/packages/edit-site/src/store/actions.js b/packages/edit-site/src/store/actions.js index 17a0965ee7a53..1cbdb9bd19e95 100644 --- a/packages/edit-site/src/store/actions.js +++ b/packages/edit-site/src/store/actions.js @@ -54,7 +54,7 @@ export function* setTemplate( templateId, templateSlug ) { const pageContext = { templateSlug }; if ( ! templateSlug ) { const template = yield controls.resolveSelect( - 'core', + coreStore.name, 'getEntityRecord', 'postType', 'wp_template', @@ -78,7 +78,7 @@ export function* setTemplate( templateId, templateSlug ) { */ export function* addTemplate( template ) { const newTemplate = yield controls.dispatch( - 'core', + coreStore.name, 'saveEntityRecord', 'postType', 'wp_template', @@ -87,7 +87,7 @@ export function* addTemplate( template ) { if ( template.content ) { yield controls.dispatch( - 'core', + coreStore.name, 'editEntityRecord', 'postType', 'wp_template', @@ -160,7 +160,7 @@ export function setHomeTemplateId( homeTemplateId ) { export function* setPage( page ) { if ( ! page.path && page.context?.postId ) { const entity = yield controls.resolveSelect( - 'core', + coreStore.name, 'getEntityRecord', 'postType', page.context.postType || 'post', @@ -170,7 +170,7 @@ export function* setPage( page ) { page.path = getPathAndQueryString( entity.link ); } const { id: templateId, slug: templateSlug } = yield controls.resolveSelect( - 'core', + coreStore.name, '__experimentalGetTemplateForLink', page.path ); @@ -198,7 +198,7 @@ export function* showHomepage() { show_on_front: showOnFront, page_on_front: frontpageId, } = yield controls.resolveSelect( - 'core', + coreStore.name, 'getEntityRecord', 'root', 'site'