@wordpress/edit-site 5.21.0 → 5.21.1-next.f8d8eceb.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/actions/index.js +121 -0
- package/build/components/actions/index.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +12 -4
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/dataviews/context.js +15 -0
- package/build/components/dataviews/context.js.map +1 -0
- package/build/components/dataviews/dataviews.js +10 -2
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filters.js +30 -17
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/in-filter.js +5 -7
- package/build/components/dataviews/in-filter.js.map +1 -1
- package/build/components/dataviews/item-actions.js +62 -0
- package/build/components/dataviews/item-actions.js.map +1 -0
- package/build/components/dataviews/pagination.js +31 -50
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/{text-filter.js → search.js} +10 -10
- package/build/components/dataviews/search.js.map +1 -0
- package/build/components/dataviews/view-grid.js +3 -3
- package/build/components/dataviews/view-grid.js.map +1 -1
- package/build/components/dataviews/view-list.js +2 -2
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -8
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/page-pages/default-views.js +60 -0
- package/build/components/page-pages/default-views.js.map +1 -0
- package/build/components/page-pages/index.js +73 -52
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +72 -0
- package/build/components/sidebar-dataviews/index.js.map +1 -0
- package/build/hooks/commands/use-edit-mode-commands.js +3 -2
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/components/actions/index.js +108 -0
- package/build-module/components/actions/index.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +12 -4
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/dataviews/context.js +7 -0
- package/build-module/components/dataviews/context.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +10 -2
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filters.js +30 -17
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/in-filter.js +5 -7
- package/build-module/components/dataviews/in-filter.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +55 -0
- package/build-module/components/dataviews/item-actions.js.map +1 -0
- package/build-module/components/dataviews/pagination.js +32 -51
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/{text-filter.js → search.js} +9 -9
- package/build-module/components/dataviews/search.js.map +1 -0
- package/build-module/components/dataviews/view-grid.js +3 -3
- package/build-module/components/dataviews/view-grid.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +2 -2
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -8
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/page-pages/default-views.js +53 -0
- package/build-module/components/page-pages/default-views.js.map +1 -0
- package/build-module/components/page-pages/index.js +71 -52
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +64 -0
- package/build-module/components/sidebar-dataviews/index.js.map +1 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -3
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-style/style-rtl.css +9 -5
- package/build-style/style.css +9 -5
- package/package.json +40 -40
- package/src/components/actions/index.js +123 -0
- package/src/components/block-editor/use-site-editor-settings.js +21 -13
- package/src/components/dataviews/README.md +134 -47
- package/src/components/dataviews/context.js +7 -0
- package/src/components/dataviews/dataviews.js +11 -1
- package/src/components/dataviews/filters.js +35 -17
- package/src/components/dataviews/in-filter.js +5 -7
- package/src/components/dataviews/item-actions.js +69 -0
- package/src/components/dataviews/pagination.js +53 -74
- package/src/components/dataviews/{text-filter.js → search.js} +7 -7
- package/src/components/dataviews/style.scss +10 -5
- package/src/components/dataviews/view-grid.js +7 -2
- package/src/components/dataviews/view-list.js +2 -2
- package/src/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/src/components/global-styles/screen-block.js +1 -7
- package/src/components/page-pages/default-views.js +58 -0
- package/src/components/page-pages/index.js +85 -60
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar-dataviews/index.js +65 -0
- package/src/hooks/commands/use-edit-mode-commands.js +3 -1
- package/build/components/actions/trash-post.js +0 -48
- package/build/components/actions/trash-post.js.map +0 -1
- package/build/components/dataviews/field-actions.js +0 -30
- package/build/components/dataviews/field-actions.js.map +0 -1
- package/build/components/dataviews/text-filter.js.map +0 -1
- package/build-module/components/actions/trash-post.js +0 -41
- package/build-module/components/actions/trash-post.js.map +0 -1
- package/build-module/components/dataviews/field-actions.js +0 -22
- package/build-module/components/dataviews/field-actions.js.map +0 -1
- package/build-module/components/dataviews/text-filter.js.map +0 -1
- package/src/components/actions/trash-post.js +0 -55
- package/src/components/dataviews/field-actions.js +0 -28
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
5
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
-
import { useMemo } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
export default function useMoveToTrashAction() {
|
|
12
|
-
const { createSuccessNotice, createErrorNotice } =
|
|
13
|
-
useDispatch( noticesStore );
|
|
14
|
-
const { deleteEntityRecord } = useDispatch( coreStore );
|
|
15
|
-
|
|
16
|
-
return useMemo(
|
|
17
|
-
() => ( {
|
|
18
|
-
id: 'move-to-trash',
|
|
19
|
-
label: __( 'Move to Trash' ),
|
|
20
|
-
async perform( post ) {
|
|
21
|
-
try {
|
|
22
|
-
await deleteEntityRecord(
|
|
23
|
-
'postType',
|
|
24
|
-
post.type,
|
|
25
|
-
post.id,
|
|
26
|
-
{},
|
|
27
|
-
{ throwOnError: true }
|
|
28
|
-
);
|
|
29
|
-
createSuccessNotice(
|
|
30
|
-
sprintf(
|
|
31
|
-
/* translators: The page's title. */
|
|
32
|
-
__( '"%s" moved to the Trash.' ),
|
|
33
|
-
decodeEntities( post.title.rendered )
|
|
34
|
-
),
|
|
35
|
-
{
|
|
36
|
-
type: 'snackbar',
|
|
37
|
-
id: 'edit-site-page-trashed',
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
} catch ( error ) {
|
|
41
|
-
const errorMessage =
|
|
42
|
-
error.message && error.code !== 'unknown_error'
|
|
43
|
-
? error.message
|
|
44
|
-
: __(
|
|
45
|
-
'An error occurred while moving the page to the trash.'
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
isDesctructive: true,
|
|
52
|
-
} ),
|
|
53
|
-
[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]
|
|
54
|
-
);
|
|
55
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { moreVertical } from '@wordpress/icons';
|
|
7
|
-
|
|
8
|
-
function FieldActions( { item, actions } ) {
|
|
9
|
-
return (
|
|
10
|
-
<DropdownMenu icon={ moreVertical } label={ __( 'Actions' ) }>
|
|
11
|
-
{ () => (
|
|
12
|
-
<MenuGroup>
|
|
13
|
-
{ actions.map( ( action ) => (
|
|
14
|
-
<MenuItem
|
|
15
|
-
key={ action.id }
|
|
16
|
-
onClick={ () => action.perform( item ) }
|
|
17
|
-
isDestructive={ action.isDesctructive }
|
|
18
|
-
>
|
|
19
|
-
{ action.label }
|
|
20
|
-
</MenuItem>
|
|
21
|
-
) ) }
|
|
22
|
-
</MenuGroup>
|
|
23
|
-
) }
|
|
24
|
-
</DropdownMenu>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default FieldActions;
|