@wordpress/blocks
Version:
Block API for WordPress.
47 lines (46 loc) • 1.2 kB
JavaScript
// packages/blocks/src/store/private-actions.js
import { processBlockType } from "./process-block-type";
function addBootstrappedBlockType(name, blockType) {
return {
type: "ADD_BOOTSTRAPPED_BLOCK_TYPE",
name,
blockType
};
}
function addUnprocessedBlockType(name, blockType) {
return ({ dispatch }) => {
dispatch({ type: "ADD_UNPROCESSED_BLOCK_TYPE", name, blockType });
const processedBlockType = dispatch(
processBlockType(name, blockType)
);
if (!processedBlockType) {
return;
}
dispatch.addBlockTypes(processedBlockType);
};
}
function addBlockBindingsSource(source) {
return {
type: "ADD_BLOCK_BINDINGS_SOURCE",
name: source.name,
label: source.label,
usesContext: source.usesContext,
getValues: source.getValues,
setValues: source.setValues,
canUserEditValue: source.canUserEditValue,
getFieldsList: source.getFieldsList
};
}
function removeBlockBindingsSource(name) {
return {
type: "REMOVE_BLOCK_BINDINGS_SOURCE",
name
};
}
export {
addBlockBindingsSource,
addBootstrappedBlockType,
addUnprocessedBlockType,
removeBlockBindingsSource
};
//# sourceMappingURL=private-actions.js.map