@wordpress/core-data
Version:
Access to and manipulation of core WordPress entities.
45 lines (41 loc) • 1.36 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBlockPatternsForPostType = void 0;
exports.getNavigationFallbackId = getNavigationFallbackId;
exports.getUndoManager = getUndoManager;
var _rememo = _interopRequireDefault(require("rememo"));
var _data = require("@wordpress/data");
var _name = require("./name");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* 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.
*/
function getUndoManager(state) {
return state.undoManager;
}
/**
* Retrieve the fallback Navigation.
*
* @param state Data state.
* @return The ID for the fallback Navigation post.
*/
function getNavigationFallbackId(state) {
return state.navigationFallbackId;
}
const getBlockPatternsForPostType = exports.getBlockPatternsForPostType = (0, _data.createRegistrySelector)(select => (0, _rememo.default)((state, postType) => select(_name.STORE_NAME).getBlockPatterns().filter(({
postTypes
}) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType)), () => [select(_name.STORE_NAME).getBlockPatterns()]));
//# sourceMappingURL=private-selectors.js.map