UNPKG

@wordpress/core-data

Version:
40 lines (36 loc) 1.04 kB
/** * External dependencies */ import createSelector from 'rememo'; /** * WordPress dependencies */ import { createRegistrySelector } from '@wordpress/data'; /** * Internal dependencies */ import { STORE_NAME } from './name'; /** * Returns the previous edit from the current undo offset * for the entity records edits history, if any. * * @param state State tree. * * @return The undo manager. */ export function getUndoManager(state) { return state.undoManager; } /** * Retrieve the fallback Navigation. * * @param state Data state. * @return The ID for the fallback Navigation post. */ export function getNavigationFallbackId(state) { return state.navigationFallbackId; } export const getBlockPatternsForPostType = createRegistrySelector(select => createSelector((state, postType) => select(STORE_NAME).getBlockPatterns().filter(({ postTypes }) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType)), () => [select(STORE_NAME).getBlockPatterns()])); //# sourceMappingURL=private-selectors.js.map