Skip to content

Commit

Permalink
migrate actions to @wordpress/fields package
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Sep 12, 2024
1 parent ae0efeb commit 4356a42
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 42 deletions.
26 changes: 0 additions & 26 deletions packages/editor/src/dataviews/fields/index.ts

This file was deleted.

11 changes: 6 additions & 5 deletions packages/editor/src/dataviews/store/private-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import { doAction } from '@wordpress/hooks';
/**
* Internal dependencies
*/
import duplicateTemplatePart from '../actions/duplicate-template-part';
import resetPost from '../actions/reset-post';
import trashPost from '../actions/trash-post';
import renamePost from '../actions/rename-post';
import restorePost from '../actions/restore-post';

import type { PostType } from '../types';
import { store as editorStore } from '../../store';
import { unlock } from '../../lock-unlock';
Expand All @@ -24,8 +20,13 @@ import {
reorderPage,
exportPattern,
permanentlyDeletePost,
restorePost,
trashPost,
renamePost,
} from '@wordpress/fields';
import duplicateTemplatePart from '../actions/duplicate-template-part';
import deletePost from '../actions/delete-post';
import resetPost from '../actions/reset-post';

export function registerEntityAction< Item >(
kind: string,
Expand Down
12 changes: 12 additions & 0 deletions packages/fields/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Undocumented declaration.

Undocumented declaration.

### renamePost

Undocumented declaration.

### reorderPage

Undocumented declaration.
Expand All @@ -50,10 +54,18 @@ Undocumented declaration.

Undocumented declaration.

### restorePost

Undocumented declaration.

### titleField

Undocumented declaration.

### trashPost

Undocumented declaration.

### viewPost

Undocumented declaration.
Expand Down
1 change: 1 addition & 0 deletions packages/fields/src/actions/base-post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { default as reorderPage } from './reorder-page';
export { default as reorderPageNative } from './reorder-page.native';
export { default as duplicatePost } from './duplicate-post';
export { default as duplicatePostNative } from './duplicate-post.native';
export { default as renamePost } from './rename-post';
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ import { store as noticesStore } from '@wordpress/notices';
/**
* Internal dependencies
*/
import {
TEMPLATE_ORIGINS,
TEMPLATE_PART_POST_TYPE,
TEMPLATE_POST_TYPE,
} from '../../store/constants';

import { unlock } from '../../lock-unlock';
import {
getItemTitle,
isTemplateRemovable,
isTemplate,
isTemplatePart,
} from './utils';
import type { CoreDataError, PostWithPermissions } from '../types';
TEMPLATE_ORIGINS,
TEMPLATE_PART_POST_TYPE,
TEMPLATE_POST_TYPE,
} from '../utils';
import type { CoreDataError, PostWithPermissions } from '../../types';

// Patterns.
const { PATTERN_TYPES } = unlock( patternsPrivateApis );
Expand Down
2 changes: 2 additions & 0 deletions packages/fields/src/actions/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { default as viewPostRevisions } from './view-post-revisions';
export { default as permanentlyDeletePost } from './permanently-delete-post';
export { default as restorePost } from './restore-post';
export { default as trashPost } from './trash-post';
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import { getItemTitle, isTemplateOrTemplatePart } from './utils';
import type { CoreDataError, PostWithPermissions } from '../types';
import { getItemTitle, isTemplateOrTemplatePart } from '../utils';
import type { CoreDataError, PostWithPermissions } from '../../types';

const restorePost: Action< PostWithPermissions > = {
id: 'restore',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import { getItemTitle, isTemplateOrTemplatePart } from './utils';
import type { CoreDataError, PostWithPermissions } from '../types';
import { getItemTitle, isTemplateOrTemplatePart } from '../utils';
import type { CoreDataError, PostWithPermissions } from '../../types';

const trashPost: Action< PostWithPermissions > = {
id: 'move-to-trash',
Expand Down

0 comments on commit 4356a42

Please sign in to comment.