UNPKG

@wordpress/edit-post

Version:
275 lines (238 loc) 5.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.openGeneralSidebar = openGeneralSidebar; exports.closeGeneralSidebar = closeGeneralSidebar; exports.openModal = openModal; exports.closeModal = closeModal; exports.openPublishSidebar = openPublishSidebar; exports.closePublishSidebar = closePublishSidebar; exports.togglePublishSidebar = togglePublishSidebar; exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled; exports.toggleEditorPanelOpened = toggleEditorPanelOpened; exports.removeEditorPanel = removeEditorPanel; exports.toggleFeature = toggleFeature; exports.switchEditorMode = switchEditorMode; exports.togglePinnedPluginItem = togglePinnedPluginItem; exports.hideBlockTypes = hideBlockTypes; exports.showBlockTypes = showBlockTypes; exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation; exports.requestMetaBoxUpdates = requestMetaBoxUpdates; exports.metaBoxUpdatesSuccess = metaBoxUpdatesSuccess; var _lodash = require("lodash"); /** * External dependencies */ /** * Returns an action object used in signalling that the user opened an editor sidebar. * * @param {string} name Sidebar name to be opened. * * @return {Object} Action object. */ function openGeneralSidebar(name) { return { type: 'OPEN_GENERAL_SIDEBAR', name: name }; } /** * Returns an action object signalling that the user closed the sidebar. * * @return {Object} Action object. */ function closeGeneralSidebar() { return { type: 'CLOSE_GENERAL_SIDEBAR' }; } /** * Returns an action object used in signalling that the user opened a modal. * * @param {string} name A string that uniquely identifies the modal. * * @return {Object} Action object. */ function openModal(name) { return { type: 'OPEN_MODAL', name: name }; } /** * Returns an action object signalling that the user closed a modal. * * @return {Object} Action object. */ function closeModal() { return { type: 'CLOSE_MODAL' }; } /** * Returns an action object used in signalling that the user opened the publish * sidebar. * * @return {Object} Action object */ function openPublishSidebar() { return { type: 'OPEN_PUBLISH_SIDEBAR' }; } /** * Returns an action object used in signalling that the user closed the * publish sidebar. * * @return {Object} Action object. */ function closePublishSidebar() { return { type: 'CLOSE_PUBLISH_SIDEBAR' }; } /** * Returns an action object used in signalling that the user toggles the publish sidebar. * * @return {Object} Action object */ function togglePublishSidebar() { return { type: 'TOGGLE_PUBLISH_SIDEBAR' }; } /** * Returns an action object used to enable or disable a panel in the editor. * * @param {string} panelName A string that identifies the panel to enable or disable. * * @return {Object} Action object. */ function toggleEditorPanelEnabled(panelName) { return { type: 'TOGGLE_PANEL_ENABLED', panelName: panelName }; } /** * Returns an action object used to open or close a panel in the editor. * * @param {string} panelName A string that identifies the panel to open or close. * * @return {Object} Action object. */ function toggleEditorPanelOpened(panelName) { return { type: 'TOGGLE_PANEL_OPENED', panelName: panelName }; } /** * Returns an action object used to remove a panel from the editor. * * @param {string} panelName A string that identifies the panel to remove. * * @return {Object} Action object. */ function removeEditorPanel(panelName) { return { type: 'REMOVE_PANEL', panelName: panelName }; } /** * Returns an action object used to toggle a feature flag. * * @param {string} feature Feature name. * * @return {Object} Action object. */ function toggleFeature(feature) { return { type: 'TOGGLE_FEATURE', feature: feature }; } function switchEditorMode(mode) { return { type: 'SWITCH_MODE', mode: mode }; } /** * Returns an action object used to toggle a plugin name flag. * * @param {string} pluginName Plugin name. * * @return {Object} Action object. */ function togglePinnedPluginItem(pluginName) { return { type: 'TOGGLE_PINNED_PLUGIN_ITEM', pluginName: pluginName }; } /** * Returns an action object used in signalling that block types by the given * name(s) should be hidden. * * @param {string[]} blockNames Names of block types to hide. * * @return {Object} Action object. */ function hideBlockTypes(blockNames) { return { type: 'HIDE_BLOCK_TYPES', blockNames: (0, _lodash.castArray)(blockNames) }; } /** * Returns an action object used in signalling that block types by the given * name(s) should be shown. * * @param {string[]} blockNames Names of block types to show. * * @return {Object} Action object. */ function showBlockTypes(blockNames) { return { type: 'SHOW_BLOCK_TYPES', blockNames: (0, _lodash.castArray)(blockNames) }; } /** * Returns an action object used in signaling * what Meta boxes are available in which location. * * @param {Object} metaBoxesPerLocation Meta boxes per location. * * @return {Object} Action object. */ function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) { return { type: 'SET_META_BOXES_PER_LOCATIONS', metaBoxesPerLocation: metaBoxesPerLocation }; } /** * Returns an action object used to request meta box update. * * @return {Object} Action object. */ function requestMetaBoxUpdates() { return { type: 'REQUEST_META_BOX_UPDATES' }; } /** * Returns an action object used signal a successful meta box update. * * @return {Object} Action object. */ function metaBoxUpdatesSuccess() { return { type: 'META_BOX_UPDATES_SUCCESS' }; } //# sourceMappingURL=actions.js.map