UNPKG

@wordpress/editor

Version:
102 lines (94 loc) 2.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.registerEntityAction = registerEntityAction; exports.registerEntityField = registerEntityField; exports.unregisterEntityAction = unregisterEntityAction; exports.unregisterEntityField = unregisterEntityField; var _data = require("@wordpress/data"); var _lockUnlock = require("../lock-unlock"); var _store = require("../store"); /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {import('@wordpress/dataviews').Action} Action * @typedef {import('@wordpress/dataviews').Field} Field */ /** * Registers a new DataViews action. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {Action} config Action configuration. */ function registerEntityAction(kind, name, config) { const { registerEntityAction: _registerEntityAction } = (0, _lockUnlock.unlock)((0, _data.dispatch)(_store.store)); if (globalThis.IS_GUTENBERG_PLUGIN) { _registerEntityAction(kind, name, config); } } /** * Unregisters a DataViews action. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {string} actionId Action ID. */ function unregisterEntityAction(kind, name, actionId) { const { unregisterEntityAction: _unregisterEntityAction } = (0, _lockUnlock.unlock)((0, _data.dispatch)(_store.store)); if (globalThis.IS_GUTENBERG_PLUGIN) { _unregisterEntityAction(kind, name, actionId); } } /** * Registers a new DataViews field. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {Field} config Field configuration. */ function registerEntityField(kind, name, config) { const { registerEntityField: _registerEntityField } = (0, _lockUnlock.unlock)((0, _data.dispatch)(_store.store)); if (globalThis.IS_GUTENBERG_PLUGIN) { _registerEntityField(kind, name, config); } } /** * Unregisters a DataViews field. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {string} fieldId Field ID. */ function unregisterEntityField(kind, name, fieldId) { const { unregisterEntityField: _unregisterEntityField } = (0, _lockUnlock.unlock)((0, _data.dispatch)(_store.store)); if (globalThis.IS_GUTENBERG_PLUGIN) { _unregisterEntityField(kind, name, fieldId); } } //# sourceMappingURL=api.js.map