@wordpress/fields 0.22.1-next.836ecdcae.0 → 0.23.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/CHANGELOG.md +2 -0
- package/build/actions/duplicate-post.js +4 -3
- package/build/actions/duplicate-post.js.map +1 -1
- package/build/actions/rename-post.js +1 -6
- package/build/actions/rename-post.js.map +1 -1
- package/build/actions/trash-post.js +1 -1
- package/build/actions/trash-post.js.map +1 -1
- package/build-module/actions/duplicate-post.js +4 -3
- package/build-module/actions/duplicate-post.js.map +1 -1
- package/build-module/actions/rename-post.js +2 -7
- package/build-module/actions/rename-post.js.map +1 -1
- package/build-module/actions/trash-post.js +2 -2
- package/build-module/actions/trash-post.js.map +1 -1
- package/build-types/actions/duplicate-post.d.ts.map +1 -1
- package/build-types/actions/rename-post.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/actions/duplicate-post.tsx +9 -3
- package/src/actions/rename-post.tsx +1 -16
- package/src/actions/trash-post.tsx +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -21,12 +21,7 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { unlock } from '../lock-unlock';
|
|
24
|
-
import {
|
|
25
|
-
getItemTitle,
|
|
26
|
-
isTemplateRemovable,
|
|
27
|
-
isTemplate,
|
|
28
|
-
isTemplatePart,
|
|
29
|
-
} from './utils';
|
|
24
|
+
import { getItemTitle, isTemplatePart } from './utils';
|
|
30
25
|
import type { CoreDataError, PostWithPermissions } from '../types';
|
|
31
26
|
|
|
32
27
|
// Patterns.
|
|
@@ -43,7 +38,6 @@ const renamePost: Action< PostWithPermissions > = {
|
|
|
43
38
|
// Templates, template parts and patterns have special checks for renaming.
|
|
44
39
|
if (
|
|
45
40
|
! [
|
|
46
|
-
'wp_template',
|
|
47
41
|
'wp_template_part',
|
|
48
42
|
...Object.values( PATTERN_TYPES ),
|
|
49
43
|
].includes( post.type )
|
|
@@ -51,15 +45,6 @@ const renamePost: Action< PostWithPermissions > = {
|
|
|
51
45
|
return post.permissions?.update;
|
|
52
46
|
}
|
|
53
47
|
|
|
54
|
-
// In the case of templates, we can only rename custom templates.
|
|
55
|
-
if ( isTemplate( post ) ) {
|
|
56
|
-
return (
|
|
57
|
-
isTemplateRemovable( post ) &&
|
|
58
|
-
post.is_custom &&
|
|
59
|
-
post.permissions?.update
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
48
|
if ( isTemplatePart( post ) ) {
|
|
64
49
|
return (
|
|
65
50
|
post.source === 'custom' &&
|
|
@@ -18,7 +18,7 @@ import type { Action } from '@wordpress/dataviews';
|
|
|
18
18
|
/**
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
|
-
import { getItemTitle
|
|
21
|
+
import { getItemTitle } from './utils';
|
|
22
22
|
import type { CoreDataError, PostWithPermissions } from '../types';
|
|
23
23
|
|
|
24
24
|
const trashPost: Action< PostWithPermissions > = {
|
|
@@ -27,7 +27,7 @@ const trashPost: Action< PostWithPermissions > = {
|
|
|
27
27
|
isPrimary: true,
|
|
28
28
|
icon: trash,
|
|
29
29
|
isEligible( item ) {
|
|
30
|
-
if (
|
|
30
|
+
if ( item.type === 'wp_template_part' || item.type === 'wp_block' ) {
|
|
31
31
|
return false;
|
|
32
32
|
}
|
|
33
33
|
|