@wordpress/edit-site 5.21.0 → 5.22.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/actions/index.js +121 -0
  3. package/build/components/actions/index.js.map +1 -0
  4. package/build/components/block-editor/use-site-editor-settings.js +12 -4
  5. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  6. package/build/components/dataviews/dataviews.js +10 -2
  7. package/build/components/dataviews/dataviews.js.map +1 -1
  8. package/build/components/dataviews/filters.js +30 -17
  9. package/build/components/dataviews/filters.js.map +1 -1
  10. package/build/components/dataviews/in-filter.js +5 -7
  11. package/build/components/dataviews/in-filter.js.map +1 -1
  12. package/build/components/dataviews/item-actions.js +62 -0
  13. package/build/components/dataviews/item-actions.js.map +1 -0
  14. package/build/components/dataviews/pagination.js +31 -50
  15. package/build/components/dataviews/pagination.js.map +1 -1
  16. package/build/components/dataviews/{text-filter.js → search.js} +10 -10
  17. package/build/components/dataviews/search.js.map +1 -0
  18. package/build/components/dataviews/view-grid.js +3 -3
  19. package/build/components/dataviews/view-grid.js.map +1 -1
  20. package/build/components/dataviews/view-list.js +2 -2
  21. package/build/components/dataviews/view-list.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/font-collection.js +1 -1
  23. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  24. package/build/components/global-styles/screen-block.js +1 -8
  25. package/build/components/global-styles/screen-block.js.map +1 -1
  26. package/build/components/page-pages/default-views.js +62 -0
  27. package/build/components/page-pages/default-views.js.map +1 -0
  28. package/build/components/page-pages/index.js +73 -52
  29. package/build/components/page-pages/index.js.map +1 -1
  30. package/build/components/page-patterns/rename-category-menu-item.js +27 -9
  31. package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
  32. package/build/components/save-button/index.js +4 -2
  33. package/build/components/save-button/index.js.map +1 -1
  34. package/build/components/sidebar/index.js +3 -1
  35. package/build/components/sidebar/index.js.map +1 -1
  36. package/build/components/sidebar-dataviews/index.js +74 -0
  37. package/build/components/sidebar-dataviews/index.js.map +1 -0
  38. package/build/components/sidebar-navigation-screen-page/page-details.js +1 -1
  39. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  40. package/build/hooks/commands/use-edit-mode-commands.js +3 -2
  41. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  42. package/build/utils/use-activate-theme.js +8 -0
  43. package/build/utils/use-activate-theme.js.map +1 -1
  44. package/build-module/components/actions/index.js +108 -0
  45. package/build-module/components/actions/index.js.map +1 -0
  46. package/build-module/components/block-editor/use-site-editor-settings.js +12 -4
  47. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  48. package/build-module/components/dataviews/dataviews.js +10 -2
  49. package/build-module/components/dataviews/dataviews.js.map +1 -1
  50. package/build-module/components/dataviews/filters.js +30 -17
  51. package/build-module/components/dataviews/filters.js.map +1 -1
  52. package/build-module/components/dataviews/in-filter.js +5 -7
  53. package/build-module/components/dataviews/in-filter.js.map +1 -1
  54. package/build-module/components/dataviews/item-actions.js +55 -0
  55. package/build-module/components/dataviews/item-actions.js.map +1 -0
  56. package/build-module/components/dataviews/pagination.js +32 -51
  57. package/build-module/components/dataviews/pagination.js.map +1 -1
  58. package/build-module/components/dataviews/{text-filter.js → search.js} +9 -9
  59. package/build-module/components/dataviews/search.js.map +1 -0
  60. package/build-module/components/dataviews/view-grid.js +3 -3
  61. package/build-module/components/dataviews/view-grid.js.map +1 -1
  62. package/build-module/components/dataviews/view-list.js +2 -2
  63. package/build-module/components/dataviews/view-list.js.map +1 -1
  64. package/build-module/components/global-styles/font-library-modal/font-collection.js +1 -1
  65. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  66. package/build-module/components/global-styles/screen-block.js +1 -8
  67. package/build-module/components/global-styles/screen-block.js.map +1 -1
  68. package/build-module/components/page-pages/default-views.js +55 -0
  69. package/build-module/components/page-pages/default-views.js.map +1 -0
  70. package/build-module/components/page-pages/index.js +71 -52
  71. package/build-module/components/page-pages/index.js.map +1 -1
  72. package/build-module/components/page-patterns/rename-category-menu-item.js +25 -9
  73. package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
  74. package/build-module/components/save-button/index.js +4 -2
  75. package/build-module/components/save-button/index.js.map +1 -1
  76. package/build-module/components/sidebar/index.js +3 -1
  77. package/build-module/components/sidebar/index.js.map +1 -1
  78. package/build-module/components/sidebar-dataviews/index.js +66 -0
  79. package/build-module/components/sidebar-dataviews/index.js.map +1 -0
  80. package/build-module/components/sidebar-navigation-screen-page/page-details.js +1 -1
  81. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  82. package/build-module/hooks/commands/use-edit-mode-commands.js +4 -3
  83. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  84. package/build-module/utils/use-activate-theme.js +8 -0
  85. package/build-module/utils/use-activate-theme.js.map +1 -1
  86. package/build-style/style-rtl.css +9 -5
  87. package/build-style/style.css +9 -5
  88. package/package.json +40 -40
  89. package/src/components/actions/index.js +123 -0
  90. package/src/components/block-editor/use-site-editor-settings.js +21 -13
  91. package/src/components/dataviews/README.md +134 -47
  92. package/src/components/dataviews/dataviews.js +11 -1
  93. package/src/components/dataviews/filters.js +35 -17
  94. package/src/components/dataviews/in-filter.js +5 -7
  95. package/src/components/dataviews/item-actions.js +69 -0
  96. package/src/components/dataviews/pagination.js +53 -74
  97. package/src/components/dataviews/{text-filter.js → search.js} +7 -7
  98. package/src/components/dataviews/style.scss +10 -5
  99. package/src/components/dataviews/view-grid.js +7 -2
  100. package/src/components/dataviews/view-list.js +2 -2
  101. package/src/components/global-styles/font-library-modal/font-collection.js +1 -1
  102. package/src/components/global-styles/screen-block.js +1 -7
  103. package/src/components/page-pages/default-views.js +60 -0
  104. package/src/components/page-pages/index.js +85 -60
  105. package/src/components/page-patterns/rename-category-menu-item.js +29 -12
  106. package/src/components/save-button/index.js +10 -5
  107. package/src/components/sidebar/index.js +2 -0
  108. package/src/components/sidebar-dataviews/index.js +66 -0
  109. package/src/components/sidebar-navigation-screen-page/page-details.js +3 -1
  110. package/src/hooks/commands/use-edit-mode-commands.js +3 -1
  111. package/src/utils/use-activate-theme.js +5 -0
  112. package/build/components/actions/trash-post.js +0 -48
  113. package/build/components/actions/trash-post.js.map +0 -1
  114. package/build/components/dataviews/field-actions.js +0 -30
  115. package/build/components/dataviews/field-actions.js.map +0 -1
  116. package/build/components/dataviews/text-filter.js.map +0 -1
  117. package/build-module/components/actions/trash-post.js +0 -41
  118. package/build-module/components/actions/trash-post.js.map +0 -1
  119. package/build-module/components/dataviews/field-actions.js +0 -22
  120. package/build-module/components/dataviews/field-actions.js.map +0 -1
  121. package/build-module/components/dataviews/text-filter.js.map +0 -1
  122. package/src/components/actions/trash-post.js +0 -55
  123. 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;