diff --git a/packages/editor/src/dataviews/fields/index.ts b/packages/editor/src/dataviews/fields/index.ts deleted file mode 100644 index b215172eaf7f0..0000000000000 --- a/packages/editor/src/dataviews/fields/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * WordPress dependencies - */ -import { __ } from '@wordpress/i18n'; -import type { Field } from '@wordpress/dataviews'; - -/** - * Internal dependencies - */ -import type { BasePost } from '../types'; -import { getItemTitle } from '../actions/utils'; - -export const titleField: Field< BasePost > = { - type: 'text', - id: 'title', - label: __( 'Title' ), - placeholder: __( 'No title' ), - getValue: ( { item } ) => getItemTitle( item ), -}; - -export const orderField: Field< BasePost > = { - type: 'integer', - id: 'menu_order', - label: __( 'Order' ), - description: __( 'Determines the order of pages.' ), -}; diff --git a/packages/editor/src/dataviews/store/private-actions.ts b/packages/editor/src/dataviews/store/private-actions.ts index e685493641f3b..76a561200901e 100644 --- a/packages/editor/src/dataviews/store/private-actions.ts +++ b/packages/editor/src/dataviews/store/private-actions.ts @@ -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'; @@ -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, diff --git a/packages/fields/README.md b/packages/fields/README.md index 842fab02606af..422d25f3d68bd 100644 --- a/packages/fields/README.md +++ b/packages/fields/README.md @@ -42,6 +42,10 @@ Undocumented declaration. Undocumented declaration. +### renamePost + +Undocumented declaration. + ### reorderPage Undocumented declaration. @@ -50,10 +54,18 @@ Undocumented declaration. Undocumented declaration. +### restorePost + +Undocumented declaration. + ### titleField Undocumented declaration. +### trashPost + +Undocumented declaration. + ### viewPost Undocumented declaration. diff --git a/packages/fields/src/actions/base-post/index.ts b/packages/fields/src/actions/base-post/index.ts index 7541be86c48b1..ca2f95d69ad53 100644 --- a/packages/fields/src/actions/base-post/index.ts +++ b/packages/fields/src/actions/base-post/index.ts @@ -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'; diff --git a/packages/editor/src/dataviews/actions/rename-post.tsx b/packages/fields/src/actions/base-post/rename-post.tsx similarity index 96% rename from packages/editor/src/dataviews/actions/rename-post.tsx rename to packages/fields/src/actions/base-post/rename-post.tsx index ef9da271111ea..5db6bd50e5c4f 100644 --- a/packages/editor/src/dataviews/actions/rename-post.tsx +++ b/packages/fields/src/actions/base-post/rename-post.tsx @@ -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 ); diff --git a/packages/fields/src/actions/common/index.ts b/packages/fields/src/actions/common/index.ts index 3590b2e270892..3d49129c8a47d 100644 --- a/packages/fields/src/actions/common/index.ts +++ b/packages/fields/src/actions/common/index.ts @@ -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'; diff --git a/packages/editor/src/dataviews/actions/restore-post.tsx b/packages/fields/src/actions/common/restore-post.tsx similarity index 96% rename from packages/editor/src/dataviews/actions/restore-post.tsx rename to packages/fields/src/actions/common/restore-post.tsx index 874eca91fee11..af664744fd543 100644 --- a/packages/editor/src/dataviews/actions/restore-post.tsx +++ b/packages/fields/src/actions/common/restore-post.tsx @@ -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', diff --git a/packages/editor/src/dataviews/actions/trash-post.tsx b/packages/fields/src/actions/common/trash-post.tsx similarity index 97% rename from packages/editor/src/dataviews/actions/trash-post.tsx rename to packages/fields/src/actions/common/trash-post.tsx index 1e2b3639dddc8..ae6f1bee8f7f0 100644 --- a/packages/editor/src/dataviews/actions/trash-post.tsx +++ b/packages/fields/src/actions/common/trash-post.tsx @@ -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',