@wordpress/edit-post 8.12.0 → 8.13.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/components/browser-url/index.js +2 -3
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/layout/index.js +8 -11
- package/build/components/layout/index.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js +10 -24
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/preferences-modal/enable-custom-fields.js +5 -7
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js +27 -19
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/store/index.js +0 -3
- package/build/store/index.js.map +1 -1
- package/build/store/selectors.js +6 -3
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/browser-url/index.js +2 -3
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/layout/index.js +8 -11
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +11 -25
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js +6 -7
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js +27 -19
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/store/index.js +0 -3
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/selectors.js +6 -3
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +2 -2
- package/src/components/browser-url/index.js +2 -3
- package/src/components/layout/index.js +11 -7
- package/src/components/meta-boxes/meta-box-visibility.js +14 -23
- package/src/components/preferences-modal/enable-custom-fields.js +5 -7
- package/src/components/preferences-modal/enable-panel.js +27 -17
- package/src/components/preferences-modal/test/enable-custom-fields.js +22 -13
- package/src/store/index.js +0 -3
- package/src/store/selectors.js +7 -4
- package/build/store/private-selectors.js +0 -62
- package/build/store/private-selectors.js.map +0 -1
- package/build-module/store/private-selectors.js +0 -55
- package/build-module/store/private-selectors.js.map +0 -1
- package/src/store/private-selectors.js +0 -61
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getEditedPostTemplateId = void 0;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _coreData = require("@wordpress/core-data");
|
|
9
|
-
var _editor = require("@wordpress/editor");
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const getEditedPostTemplateId = exports.getEditedPostTemplateId = (0, _data.createRegistrySelector)(select => () => {
|
|
15
|
-
const {
|
|
16
|
-
id: postId,
|
|
17
|
-
type: postType,
|
|
18
|
-
slug
|
|
19
|
-
} = select(_editor.store).getCurrentPost();
|
|
20
|
-
const {
|
|
21
|
-
getEntityRecord,
|
|
22
|
-
getEntityRecords,
|
|
23
|
-
canUser
|
|
24
|
-
} = select(_coreData.store);
|
|
25
|
-
const siteSettings = canUser('read', {
|
|
26
|
-
kind: 'root',
|
|
27
|
-
name: 'site'
|
|
28
|
-
}) ? getEntityRecord('root', 'site') : undefined;
|
|
29
|
-
// First check if the current page is set as the posts page.
|
|
30
|
-
const isPostsPage = +postId === siteSettings?.page_for_posts;
|
|
31
|
-
if (isPostsPage) {
|
|
32
|
-
return select(_coreData.store).getDefaultTemplateId({
|
|
33
|
-
slug: 'home'
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
const currentTemplate = select(_editor.store).getEditedPostAttribute('template');
|
|
37
|
-
if (currentTemplate) {
|
|
38
|
-
const templateWithSameSlug = getEntityRecords('postType', 'wp_template', {
|
|
39
|
-
per_page: -1
|
|
40
|
-
})?.find(template => template.slug === currentTemplate);
|
|
41
|
-
if (!templateWithSameSlug) {
|
|
42
|
-
return templateWithSameSlug;
|
|
43
|
-
}
|
|
44
|
-
return templateWithSameSlug.id;
|
|
45
|
-
}
|
|
46
|
-
let slugToCheck;
|
|
47
|
-
// In `draft` status we might not have a slug available, so we use the `single`
|
|
48
|
-
// post type templates slug(ex page, single-post, single-product etc..).
|
|
49
|
-
// Pages do not need the `single` prefix in the slug to be prioritized
|
|
50
|
-
// through template hierarchy.
|
|
51
|
-
if (slug) {
|
|
52
|
-
slugToCheck = postType === 'page' ? `${postType}-${slug}` : `single-${postType}-${slug}`;
|
|
53
|
-
} else {
|
|
54
|
-
slugToCheck = postType === 'page' ? 'page' : `single-${postType}`;
|
|
55
|
-
}
|
|
56
|
-
if (postType) {
|
|
57
|
-
return select(_coreData.store).getDefaultTemplateId({
|
|
58
|
-
slug: slugToCheck
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=private-selectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_editor","getEditedPostTemplateId","exports","createRegistrySelector","select","id","postId","type","postType","slug","editorStore","getCurrentPost","getEntityRecord","getEntityRecords","canUser","coreStore","siteSettings","kind","name","undefined","isPostsPage","page_for_posts","getDefaultTemplateId","currentTemplate","getEditedPostAttribute","templateWithSameSlug","per_page","find","template","slugToCheck"],"sources":["@wordpress/edit-post/src/store/private-selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport const getEditedPostTemplateId = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst {\n\t\t\tid: postId,\n\t\t\ttype: postType,\n\t\t\tslug,\n\t\t} = select( editorStore ).getCurrentPost();\n\t\tconst { getEntityRecord, getEntityRecords, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\t// First check if the current page is set as the posts page.\n\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\tif ( isPostsPage ) {\n\t\t\treturn select( coreStore ).getDefaultTemplateId( { slug: 'home' } );\n\t\t}\n\t\tconst currentTemplate =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t)?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn templateWithSameSlug.id;\n\t\t}\n\t\tlet slugToCheck;\n\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t// through template hierarchy.\n\t\tif ( slug ) {\n\t\t\tslugToCheck =\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? `${ postType }-${ slug }`\n\t\t\t\t\t: `single-${ postType }-${ slug }`;\n\t\t} else {\n\t\t\tslugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;\n\t\t}\n\n\t\tif ( postType ) {\n\t\t\treturn select( coreStore ).getDefaultTemplateId( {\n\t\t\t\tslug: slugToCheck,\n\t\t\t} );\n\t\t}\n\t}\n);\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKO,MAAMG,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAAE,4BAAsB,EAC1DC,MAAM,IAAM,MAAM;EACnB,MAAM;IACLC,EAAE,EAAEC,MAA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QAAQ,EAAG;EACpE;EAEA,IAAKA,QAAQ,EAAG;IACf,OAAOJ,MAAM,CAAEW,eAAU,CAAC,CAACO,oBAAoB,CAAE;MAChDb,IAAI,EAAEoB;IACP,CAAE,CAAC;EACJ;AACD,CACD,CAAC","ignoreList":[]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
5
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
-
export const getEditedPostTemplateId = createRegistrySelector(select => () => {
|
|
8
|
-
const {
|
|
9
|
-
id: postId,
|
|
10
|
-
type: postType,
|
|
11
|
-
slug
|
|
12
|
-
} = select(editorStore).getCurrentPost();
|
|
13
|
-
const {
|
|
14
|
-
getEntityRecord,
|
|
15
|
-
getEntityRecords,
|
|
16
|
-
canUser
|
|
17
|
-
} = select(coreStore);
|
|
18
|
-
const siteSettings = canUser('read', {
|
|
19
|
-
kind: 'root',
|
|
20
|
-
name: 'site'
|
|
21
|
-
}) ? getEntityRecord('root', 'site') : undefined;
|
|
22
|
-
// First check if the current page is set as the posts page.
|
|
23
|
-
const isPostsPage = +postId === siteSettings?.page_for_posts;
|
|
24
|
-
if (isPostsPage) {
|
|
25
|
-
return select(coreStore).getDefaultTemplateId({
|
|
26
|
-
slug: 'home'
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
const currentTemplate = select(editorStore).getEditedPostAttribute('template');
|
|
30
|
-
if (currentTemplate) {
|
|
31
|
-
const templateWithSameSlug = getEntityRecords('postType', 'wp_template', {
|
|
32
|
-
per_page: -1
|
|
33
|
-
})?.find(template => template.slug === currentTemplate);
|
|
34
|
-
if (!templateWithSameSlug) {
|
|
35
|
-
return templateWithSameSlug;
|
|
36
|
-
}
|
|
37
|
-
return templateWithSameSlug.id;
|
|
38
|
-
}
|
|
39
|
-
let slugToCheck;
|
|
40
|
-
// In `draft` status we might not have a slug available, so we use the `single`
|
|
41
|
-
// post type templates slug(ex page, single-post, single-product etc..).
|
|
42
|
-
// Pages do not need the `single` prefix in the slug to be prioritized
|
|
43
|
-
// through template hierarchy.
|
|
44
|
-
if (slug) {
|
|
45
|
-
slugToCheck = postType === 'page' ? `${postType}-${slug}` : `single-${postType}-${slug}`;
|
|
46
|
-
} else {
|
|
47
|
-
slugToCheck = postType === 'page' ? 'page' : `single-${postType}`;
|
|
48
|
-
}
|
|
49
|
-
if (postType) {
|
|
50
|
-
return select(coreStore).getDefaultTemplateId({
|
|
51
|
-
slug: slugToCheck
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=private-selectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createRegistrySelector","store","coreStore","editorStore","getEditedPostTemplateId","select","id","postId","type","postType","slug","getCurrentPost","getEntityRecord","getEntityRecords","canUser","siteSettings","kind","name","undefined","isPostsPage","page_for_posts","getDefaultTemplateId","currentTemplate","getEditedPostAttribute","templateWithSameSlug","per_page","find","template","slugToCheck"],"sources":["@wordpress/edit-post/src/store/private-selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport const getEditedPostTemplateId = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst {\n\t\t\tid: postId,\n\t\t\ttype: postType,\n\t\t\tslug,\n\t\t} = select( editorStore ).getCurrentPost();\n\t\tconst { getEntityRecord, getEntityRecords, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\t// First check if the current page is set as the posts page.\n\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\tif ( isPostsPage ) {\n\t\t\treturn select( coreStore ).getDefaultTemplateId( { slug: 'home' } );\n\t\t}\n\t\tconst currentTemplate =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t)?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn templateWithSameSlug.id;\n\t\t}\n\t\tlet slugToCheck;\n\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t// through template hierarchy.\n\t\tif ( slug ) {\n\t\t\tslugToCheck =\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? `${ postType }-${ slug }`\n\t\t\t\t\t: `single-${ postType }-${ slug }`;\n\t\t} else {\n\t\t\tslugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;\n\t\t}\n\n\t\tif ( postType ) {\n\t\t\treturn select( coreStore ).getDefaultTemplateId( {\n\t\t\t\tslug: slugToCheck,\n\t\t\t} );\n\t\t}\n\t}\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AAExD,OAAO,MAAMC,uBAAuB,GAAGJ,sBAAsB,CAC1DK,MAAM,IAAM,MAAM;EACnB,MAAM;IACLC,EAAE,EAAEC,MAAM;IACVC,IAAI,EAAEC,QAAQ;IACdC;EACD,CAAC,GAAGL,MAAM,CAAEF,WAAY,CAAC,CAACQ,cAAc,CAAC,CAAC;EAC1C,MAAM;IAAEC,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AAEkB;IACP,CAAE,CAAC;EACJ;AACD,CACD,CAAC","ignoreList":[]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
5
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
-
|
|
8
|
-
export const getEditedPostTemplateId = createRegistrySelector(
|
|
9
|
-
( select ) => () => {
|
|
10
|
-
const {
|
|
11
|
-
id: postId,
|
|
12
|
-
type: postType,
|
|
13
|
-
slug,
|
|
14
|
-
} = select( editorStore ).getCurrentPost();
|
|
15
|
-
const { getEntityRecord, getEntityRecords, canUser } =
|
|
16
|
-
select( coreStore );
|
|
17
|
-
const siteSettings = canUser( 'read', {
|
|
18
|
-
kind: 'root',
|
|
19
|
-
name: 'site',
|
|
20
|
-
} )
|
|
21
|
-
? getEntityRecord( 'root', 'site' )
|
|
22
|
-
: undefined;
|
|
23
|
-
// First check if the current page is set as the posts page.
|
|
24
|
-
const isPostsPage = +postId === siteSettings?.page_for_posts;
|
|
25
|
-
if ( isPostsPage ) {
|
|
26
|
-
return select( coreStore ).getDefaultTemplateId( { slug: 'home' } );
|
|
27
|
-
}
|
|
28
|
-
const currentTemplate =
|
|
29
|
-
select( editorStore ).getEditedPostAttribute( 'template' );
|
|
30
|
-
if ( currentTemplate ) {
|
|
31
|
-
const templateWithSameSlug = getEntityRecords(
|
|
32
|
-
'postType',
|
|
33
|
-
'wp_template',
|
|
34
|
-
{ per_page: -1 }
|
|
35
|
-
)?.find( ( template ) => template.slug === currentTemplate );
|
|
36
|
-
if ( ! templateWithSameSlug ) {
|
|
37
|
-
return templateWithSameSlug;
|
|
38
|
-
}
|
|
39
|
-
return templateWithSameSlug.id;
|
|
40
|
-
}
|
|
41
|
-
let slugToCheck;
|
|
42
|
-
// In `draft` status we might not have a slug available, so we use the `single`
|
|
43
|
-
// post type templates slug(ex page, single-post, single-product etc..).
|
|
44
|
-
// Pages do not need the `single` prefix in the slug to be prioritized
|
|
45
|
-
// through template hierarchy.
|
|
46
|
-
if ( slug ) {
|
|
47
|
-
slugToCheck =
|
|
48
|
-
postType === 'page'
|
|
49
|
-
? `${ postType }-${ slug }`
|
|
50
|
-
: `single-${ postType }-${ slug }`;
|
|
51
|
-
} else {
|
|
52
|
-
slugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if ( postType ) {
|
|
56
|
-
return select( coreStore ).getDefaultTemplateId( {
|
|
57
|
-
slug: slugToCheck,
|
|
58
|
-
} );
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
);
|