Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework: Move store files into state directory #3030

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
578 changes: 0 additions & 578 deletions editor/actions.js

This file was deleted.

4 changes: 2 additions & 2 deletions editor/components/autosave-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { Component } from '@wordpress/element';
/**
* Internal dependencies
*/
import { autosave } from '../../actions';
import { autosave } from '../../state/actions';
import {
isEditedPostDirty,
isEditedPostSaveable,
} from '../../selectors';
} from '../../state/selectors';

export class AutosaveMonitor extends Component {
componentDidUpdate( prevProps ) {
Expand Down
2 changes: 1 addition & 1 deletion editor/components/block-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Slot } from '@wordpress/components';
* Internal Dependencies
*/
import './style.scss';
import { getSelectedBlock, getSelectedBlockCount } from '../../selectors';
import { getSelectedBlock, getSelectedBlockCount } from '../../state/selectors';

const BlockInspector = ( { selectedBlock, count } ) => {
if ( count > 1 ) {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { getBlockType } from '@wordpress/blocks';
*/
import './style.scss';
import { getBlockMoverLabel } from './mover-label';
import { isFirstBlock, isLastBlock, getBlockIndex, getBlock } from '../../selectors';
import { selectBlock } from '../../actions';
import { isFirstBlock, isLastBlock, getBlockIndex, getBlock } from '../../state/selectors';
import { selectBlock } from '../../state/actions';

export function BlockMover( { onMoveUp, onMoveDown, isFirst, isLast, uids, blockType, firstIndex } ) {
// We emulate a disabled state because forcefully applying the `disabled`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IconButton } from '@wordpress/components';
/**
* Internal dependencies
*/
import { removeBlocks } from '../../actions';
import { removeBlocks } from '../../state/actions';

export function BlockDeleteButton( { onDelete, onClick = noop, small = false } ) {
const label = __( 'Delete' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { IconButton } from '@wordpress/components';
/**
* Internal dependencies
*/
import { isEditorSidebarOpened } from '../../selectors';
import { toggleSidebar, setActivePanel } from '../../actions';
import { isEditorSidebarOpened } from '../../state/selectors';
import { toggleSidebar, setActivePanel } from '../../state/actions';

export function BlockInspectorButton( {
isSidebarOpened,
Expand Down
4 changes: 2 additions & 2 deletions editor/components/block-settings-menu/block-mode-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { getBlockType } from '@wordpress/blocks';
/**
* Internal dependencies
*/
import { getBlockMode, getBlock } from '../../selectors';
import { toggleBlockMode } from '../../actions';
import { getBlockMode, getBlock } from '../../state/selectors';
import { toggleBlockMode } from '../../state/actions';

export function BlockModeToggle( { blockType, mode, onToggleMode, small = false } ) {
if ( ! blockType || blockType.supportHTML === false ) {
Expand Down
2 changes: 1 addition & 1 deletion editor/components/block-settings-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import BlockInspectorButton from './block-inspector-button';
import BlockModeToggle from './block-mode-toggle';
import BlockDeleteButton from './block-delete-button';
import UnknownConverter from './unknown-converter';
import { selectBlock } from '../../actions';
import { selectBlock } from '../../state/actions';

function BlockSettingsMenu( { uids, onSelect, focus } ) {
const count = uids.length;
Expand Down
4 changes: 2 additions & 2 deletions editor/components/block-settings-menu/unknown-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { getUnknownTypeHandlerName, rawHandler, serialize } from '@wordpress/blo
/**
* Internal dependencies
*/
import { getBlock } from '../../selectors';
import { replaceBlocks } from '../../actions';
import { getBlock } from '../../state/selectors';
import { replaceBlocks } from '../../state/actions';

export function UnknownConverter( { block, convertToBlocks, small } ) {
if ( ! block || getUnknownTypeHandlerName() !== block.name ) {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { keycodes } from '@wordpress/utils';
* Internal dependencies
*/
import './style.scss';
import { replaceBlocks } from '../../actions';
import { getBlock } from '../../selectors';
import { replaceBlocks } from '../../state/actions';
import { getBlock } from '../../state/selectors';

/**
* Module Constants
Expand Down
2 changes: 1 addition & 1 deletion editor/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import BlockInspectorButton from '../block-settings-menu/block-inspector-button'
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
import BlockDeleteButton from '../block-settings-menu/block-delete-button';
import UnknownConverter from '../block-settings-menu/unknown-converter';
import { getBlockMode, getSelectedBlock } from '../../selectors';
import { getBlockMode, getSelectedBlock } from '../../state/selectors';

class BlockToolbar extends Component {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/document-outline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { __ } from '@wordpress/i18n';
*/
import './style.scss';
import DocumentOutlineItem from './item';
import { getBlocks } from '../../selectors';
import { selectBlock } from '../../actions';
import { getBlocks } from '../../state/selectors';
import { selectBlock } from '../../state/actions';

/**
* Module constants
Expand Down
2 changes: 1 addition & 1 deletion editor/components/error-boundary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Button, ClipboardButton } from '@wordpress/components';
* Internal dependencies
*/
import { Warning } from '../';
import { getEditedPostContent } from '../../selectors';
import { getEditedPostContent } from '../../state/selectors';

class ErrorBoundary extends Component {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/inserter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import { Component } from '@wordpress/element';
* Internal dependencies
*/
import InserterMenu from './menu';
import { getBlockInsertionPoint, getEditorMode } from '../../selectors';
import { getBlockInsertionPoint, getEditorMode } from '../../state/selectors';
import {
insertBlock,
setBlockInsertionPoint,
clearBlockInsertionPoint,
hideInsertionPoint,
} from '../../actions';
} from '../../state/actions';

class Inserter extends Component {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import { keycodes } from '@wordpress/utils';
*/
import './style.scss';

import { getBlocks, getRecentlyUsedBlocks } from '../../selectors';
import { showInsertionPoint, hideInsertionPoint } from '../../actions';
import { getBlocks, getRecentlyUsedBlocks } from '../../state/selectors';
import { showInsertionPoint, hideInsertionPoint } from '../../state/actions';
import { default as InserterGroup } from './group';

export const searchBlocks = ( blocks, searchTerm ) => {
Expand Down
2 changes: 1 addition & 1 deletion editor/components/meta-boxes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { connect } from 'react-redux';
*/
import MetaBoxesArea from './meta-boxes-area';
import MetaBoxesPanel from './meta-boxes-panel';
import { getMetaBox } from '../../selectors';
import { getMetaBox } from '../../state/selectors';

function MetaBoxes( { location, isActive, usePanel = false } ) {
if ( ! isActive ) {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/meta-boxes/meta-boxes-area/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { Spinner } from '@wordpress/components';
* Internal dependencies
*/
import './style.scss';
import { handleMetaBoxReload, metaBoxStateChanged, metaBoxLoaded } from '../../../actions';
import { getMetaBox, isSavingPost } from '../../../selectors';
import { handleMetaBoxReload, metaBoxStateChanged, metaBoxLoaded } from '../../../state/actions';
import { getMetaBox, isSavingPost } from '../../../state/selectors';

class MetaBoxesArea extends Component {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion editor/components/page-attributes/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { withAPIData } from '@wordpress/components';
/**
* Internal dependencies
*/
import { getCurrentPostType } from '../../selectors';
import { getCurrentPostType } from '../../state/selectors';

export function PageAttributesCheck( { postType, children } ) {
const supportsPageAttributes = get( postType.data, [
Expand Down
4 changes: 2 additions & 2 deletions editor/components/page-attributes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { withInstanceId } from '@wordpress/components';
* Internal dependencies
*/
import PageAttributesCheck from './check';
import { editPost } from '../../actions';
import { getEditedPostAttribute } from '../../selectors';
import { editPost } from '../../state/actions';
import { getEditedPostAttribute } from '../../state/selectors';

export function PageAttributes( { onUpdateOrder, instanceId, order } ) {
const setUpdatedOrder = ( event ) => {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-author/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { Component } from '@wordpress/element';
* Internal dependencies
*/
import PostAuthorCheck from './check';
import { getEditedPostAttribute } from '../../selectors';
import { editPost } from '../../actions';
import { getEditedPostAttribute } from '../../state/selectors';
import { editPost } from '../../state/actions';

export class PostAuthor extends Component {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-comments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { FormToggle, withInstanceId } from '@wordpress/components';
/**
* Internal Dependencies
*/
import { getEditedPostAttribute } from '../../selectors';
import { editPost } from '../../actions';
import { getEditedPostAttribute } from '../../state/selectors';
import { editPost } from '../../state/actions';

function PostComments( { commentStatus = 'open', instanceId, ...props } ) {
const onToggleComments = () => props.editPost( { comment_status: commentStatus === 'open' ? 'closed' : 'open' } );
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-excerpt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { ExternalLink } from '@wordpress/components';
* Internal Dependencies
*/
import './style.scss';
import { getEditedPostExcerpt } from '../../selectors';
import { editPost } from '../../actions';
import { getEditedPostExcerpt } from '../../state/selectors';
import { editPost } from '../../state/actions';

function PostExcerpt( { excerpt, onUpdateExcerpt } ) {
const onChange = ( event ) => onUpdateExcerpt( event.target.value );
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-featured-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { MediaUploadButton } from '@wordpress/blocks';
* Internal dependencies
*/
import './style.scss';
import { getEditedPostAttribute } from '../../selectors';
import { editPost } from '../../actions';
import { getEditedPostAttribute } from '../../state/selectors';
import { editPost } from '../../state/actions';

function PostFeaturedImage( { featuredImageId, onUpdateImage, onRemoveImage, media } ) {
return (
Expand Down
2 changes: 1 addition & 1 deletion editor/components/post-format/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { withAPIData } from '@wordpress/components';
/**
* Internal dependencies
*/
import { getCurrentPostType } from '../../selectors';
import { getCurrentPostType } from '../../state/selectors';

function PostFormatCheck( { postType, children } ) {
if ( ! get( postType.data, [ 'supports', 'post-formats' ] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-format/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { withInstanceId } from '@wordpress/components';
*/
import './style.scss';
import PostFormatCheck from './check';
import { getEditedPostAttribute, getSuggestedPostFormat } from '../../selectors';
import { editPost } from '../../actions';
import { getEditedPostAttribute, getSuggestedPostFormat } from '../../state/selectors';
import { editPost } from '../../state/actions';

const POST_FORMATS = [
{ id: 'aside', caption: __( 'Aside' ) },
Expand Down
2 changes: 1 addition & 1 deletion editor/components/post-last-revision/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { connect } from 'react-redux';
/**
* Internal dependencies
*/
import { getCurrentPostLastRevisionId } from '../../selectors';
import { getCurrentPostLastRevisionId } from '../../state/selectors';

function PostLastRevisionCheck( { lastRevisionId, children } ) {
if ( ! lastRevisionId ) {
Expand Down
2 changes: 1 addition & 1 deletion editor/components/post-last-revision/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import PostLastRevisionCheck from './check';
import {
getCurrentPostLastRevisionId,
getCurrentPostRevisionsCount,
} from '../../selectors';
} from '../../state/selectors';
import { getWPAdminURL } from '../../utils/url';

function LastRevision( { lastRevisionId, revisionsCount } ) {
Expand Down
2 changes: 1 addition & 1 deletion editor/components/post-pending-status/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { withAPIData } from '@wordpress/components';
/**
* Internal dependencies
*/
import { isCurrentPostPublished } from '../../selectors';
import { isCurrentPostPublished } from '../../state/selectors';

export function PostPendingStatusCheck( { isPublished, children, user } ) {
if ( isPublished || ! user.data || ! user.data.capabilities.publish_posts ) {
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-pending-status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { FormToggle, withInstanceId } from '@wordpress/components';
* Internal dependencies
*/
import PostPendingStatusCheck from './check';
import { getEditedPostAttribute } from '../../selectors';
import { editPost } from '../../actions';
import { getEditedPostAttribute } from '../../state/selectors';
import { editPost } from '../../state/actions';

export function PostPendingStatus( { instanceId, status, onUpdateStatus } ) {
const pendingId = 'pending-toggle-' + instanceId;
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-permalink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Dashicon, ClipboardButton, Button } from '@wordpress/components';
* Internal Dependencies
*/
import './style.scss';
import { isEditedPostNew, getEditedPostAttribute } from '../../selectors';
import { isCurrentPostNew, getEditedPostAttribute } from '../../state/selectors';

class PostPermalink extends Component {
constructor() {
Expand Down Expand Up @@ -66,7 +66,7 @@ class PostPermalink extends Component {
export default connect(
( state ) => {
return {
isNew: isEditedPostNew( state ),
isNew: isCurrentPostNew( state ),
link: getEditedPostAttribute( state, 'link' ),
};
}
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-pingbacks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { FormToggle, withInstanceId } from '@wordpress/components';
/**
* Internal Dependencies
*/
import { getEditedPostAttribute } from '../../selectors';
import { editPost } from '../../actions';
import { getEditedPostAttribute } from '../../state/selectors';
import { editPost } from '../../state/actions';

function PostPingbacks( { pingStatus = 'open', instanceId, ...props } ) {
const onTogglePingback = () => props.editPost( { ping_status: pingStatus === 'open' ? 'closed' : 'open' } );
Expand Down
12 changes: 6 additions & 6 deletions editor/components/post-preview-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { _x } from '@wordpress/i18n';
* Internal dependencies
*/
import {
getEditedPostPreviewLink,
getCurrentPostPreviewLink,
getEditedPostAttribute,
isEditedPostDirty,
isEditedPostNew,
isCurrentPostNew,
isEditedPostSaveable,
} from '../../selectors';
import { autosave } from '../../actions';
} from '../../state/selectors';
import { autosave } from '../../state/actions';

export class PostPreviewButton extends Component {
constructor() {
Expand Down Expand Up @@ -117,9 +117,9 @@ export class PostPreviewButton extends Component {
export default connect(
( state ) => ( {
postId: state.currentPost.id,
link: getEditedPostPreviewLink( state ),
link: getCurrentPostPreviewLink( state ),
isDirty: isEditedPostDirty( state ),
isNew: isEditedPostNew( state ),
isNew: isCurrentPostNew( state ),
isSaveable: isEditedPostSaveable( state ),
modified: getEditedPostAttribute( state, 'modified' ),
} ),
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-publish-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import { Button, withAPIData } from '@wordpress/components';
*/
import './style.scss';
import PublishButtonLabel from './label';
import { editPost, savePost } from '../../actions';
import { editPost, savePost } from '../../state/actions';
import {
isSavingPost,
isEditedPostBeingScheduled,
getEditedPostVisibility,
isEditedPostSaveable,
isEditedPostPublishable,
} from '../../selectors';
} from '../../state/selectors';

export function PostPublishButton( {
isSaving,
Expand Down
2 changes: 1 addition & 1 deletion editor/components/post-publish-button/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import './style.scss';
import {
isCurrentPostPublished,
isEditedPostBeingScheduled,
} from '../../selectors';
} from '../../state/selectors';

export function PublishButtonLabel( {
isPublished,
Expand Down
Loading