@wordpress/editor 13.4.0 → 13.5.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/document-outline/index.js +7 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/page-attributes/check.js +6 -10
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/parent.js +9 -6
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +3 -7
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +7 -12
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -7
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +3 -7
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-preview-button/index.js +3 -3
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -4
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +3 -7
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -8
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +3 -7
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +5 -9
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +3 -7
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-schedule/check.js +3 -7
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-sticky/check.js +3 -7
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +12 -7
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +18 -12
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +1 -8
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-visibility/check.js +3 -7
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/theme-support-check/index.js +3 -7
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/store/utils/notice-builder.js +4 -8
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build-module/components/document-outline/index.js +8 -2
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +6 -9
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +9 -5
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +3 -6
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +7 -11
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -6
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +3 -6
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +3 -2
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +4 -3
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +3 -6
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -7
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +3 -6
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +5 -8
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +3 -6
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-schedule/check.js +3 -6
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-sticky/check.js +3 -6
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +12 -6
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +18 -11
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -7
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-visibility/check.js +3 -6
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +3 -6
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +4 -7
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +30 -30
- package/src/components/document-outline/index.js +6 -3
- package/src/components/page-attributes/check.js +3 -12
- package/src/components/page-attributes/parent.js +41 -41
- package/src/components/post-author/check.js +2 -10
- package/src/components/post-featured-image/index.js +5 -10
- package/src/components/post-locked-modal/index.js +1 -6
- package/src/components/post-pending-status/check.js +2 -10
- package/src/components/post-preview-button/index.js +1 -2
- package/src/components/post-publish-button/index.js +3 -7
- package/src/components/post-publish-button/label.js +2 -10
- package/src/components/post-publish-panel/index.js +3 -11
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -10
- package/src/components/post-publish-panel/postpublish.js +3 -8
- package/src/components/post-publish-panel/prepublish.js +2 -10
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-schedule/check.js +2 -10
- package/src/components/post-sticky/check.js +1 -10
- package/src/components/post-taxonomies/flat-term-selector.js +14 -32
- package/src/components/post-taxonomies/hierarchical-term-selector.js +15 -37
- package/src/components/post-taxonomies/most-used-terms.js +1 -7
- package/src/components/post-visibility/check.js +2 -10
- package/src/components/theme-support-check/index.js +1 -6
- package/src/store/utils/notice-builder.js +2 -7
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { get } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { BaseControl, Button } from '@wordpress/components';
|
|
12
7
|
import { useSelect } from '@wordpress/data';
|
|
13
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -46,13 +41,12 @@ export default function MostUsedTerms(_ref) {
|
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
const terms = unescapeTerms(_terms);
|
|
49
|
-
const label = get(taxonomy, ['labels', 'most_used']);
|
|
50
44
|
return createElement("div", {
|
|
51
45
|
className: "editor-post-taxonomies__flat-term-most-used"
|
|
52
46
|
}, createElement(BaseControl.VisualLabel, {
|
|
53
47
|
as: "h3",
|
|
54
48
|
className: "editor-post-taxonomies__flat-term-most-used-label"
|
|
55
|
-
},
|
|
49
|
+
}, taxonomy.labels.most_used), createElement("ul", {
|
|
56
50
|
role: "list",
|
|
57
51
|
className: "editor-post-taxonomies__flat-term-most-used-list"
|
|
58
52
|
}, terms.map(term => createElement("li", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/most-used-terms.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/most-used-terms.js"],"names":["BaseControl","Button","useSelect","store","coreStore","unescapeTerms","MIN_MOST_USED_TERMS","DEFAULT_QUERY","per_page","orderby","order","hide_empty","_fields","context","MostUsedTerms","onSelect","taxonomy","_terms","showTerms","select","mostUsedTerms","getEntityRecords","slug","length","terms","labels","most_used","map","term","id","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,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AAK,CAACG,GAAN,CAAaC,IAAF,IACZ;AAAI,IAAA,GAAG,EAAGA,IAAI,CAACC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MAAMd,QAAQ,CAAEa,IAAF;AAFzB,KAIGA,IAAI,CAACE,IAJR,CADD,CADC,CAJH,CAZD,CADD;AA+BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unescapeTerms } from '../../utils/terms';\n\nconst MIN_MOST_USED_TERMS = 3;\nconst DEFAULT_QUERY = {\n\tper_page: 10,\n\torderby: 'count',\n\torder: 'desc',\n\thide_empty: true,\n\t_fields: 'id,name,count',\n\tcontext: 'view',\n};\n\nexport default function MostUsedTerms( { onSelect, taxonomy } ) {\n\tconst { _terms, showTerms } = useSelect(\n\t\t( select ) => {\n\t\t\tconst mostUsedTerms = select( coreStore ).getEntityRecords(\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\tDEFAULT_QUERY\n\t\t\t);\n\t\t\treturn {\n\t\t\t\t_terms: mostUsedTerms,\n\t\t\t\tshowTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS,\n\t\t\t};\n\t\t},\n\t\t[ taxonomy.slug ]\n\t);\n\n\tif ( ! showTerms ) {\n\t\treturn null;\n\t}\n\n\tconst terms = unescapeTerms( _terms );\n\n\treturn (\n\t\t<div className=\"editor-post-taxonomies__flat-term-most-used\">\n\t\t\t<BaseControl.VisualLabel\n\t\t\t\tas=\"h3\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-label\"\n\t\t\t>\n\t\t\t\t{ taxonomy.labels.most_used }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\trole=\"list\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-list\"\n\t\t\t>\n\t\t\t\t{ terms.map( ( term ) => (\n\t\t\t\t\t<li key={ term.id }>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () => onSelect( term ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ term.name }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
8
|
-
|
|
9
4
|
import { compose } from '@wordpress/compose';
|
|
10
5
|
import { withSelect } from '@wordpress/data';
|
|
11
6
|
/**
|
|
@@ -24,12 +19,14 @@ export function PostVisibilityCheck(_ref) {
|
|
|
24
19
|
});
|
|
25
20
|
}
|
|
26
21
|
export default compose([withSelect(select => {
|
|
22
|
+
var _getCurrentPost$_link, _getCurrentPost$_link2;
|
|
23
|
+
|
|
27
24
|
const {
|
|
28
25
|
getCurrentPost,
|
|
29
26
|
getCurrentPostType
|
|
30
27
|
} = select(editorStore);
|
|
31
28
|
return {
|
|
32
|
-
hasPublishAction:
|
|
29
|
+
hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost$_link2 = getCurrentPost()._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
|
|
33
30
|
postType: getCurrentPostType()
|
|
34
31
|
};
|
|
35
32
|
})])(PostVisibilityCheck);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-visibility/check.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-visibility/check.js"],"names":["compose","withSelect","store","editorStore","PostVisibilityCheck","hasPublishAction","render","canEdit","select","getCurrentPost","getCurrentPostType","_links","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,OAA6D;AAAA,MAA/B;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAA+B;AACnE,QAAMC,OAAO,GAAGF,gBAAhB;AACA,SAAOC,MAAM,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAAb;AACA;AAED,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAF,IAAc;AAAA;;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAyCF,MAAM,CAAEL,WAAF,CAArD;AACA,SAAO;AACNE,IAAAA,gBAAgB,qDACfI,cAAc,GAAGE,MADF,2DACf,uBAA2B,mBAA3B,CADe,yEACqC,KAF/C;AAGNC,IAAAA,QAAQ,EAAEF,kBAAkB;AAHtB,GAAP;AAKA,CAPS,CADa,CAAF,CAAP,CASVN,mBATU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostVisibilityCheck( { hasPublishAction, render } ) {\n\tconst canEdit = hasPublishAction;\n\treturn render( { canEdit } );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostVisibilityCheck );\n"]}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
8
|
-
|
|
9
4
|
import { withSelect } from '@wordpress/data';
|
|
10
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
6
|
/**
|
|
@@ -21,7 +16,9 @@ export function ThemeSupportCheck(_ref) {
|
|
|
21
16
|
supportKeys
|
|
22
17
|
} = _ref;
|
|
23
18
|
const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
|
|
24
|
-
|
|
19
|
+
var _themeSupports$key;
|
|
20
|
+
|
|
21
|
+
const supported = (_themeSupports$key = themeSupports === null || themeSupports === void 0 ? void 0 : themeSupports[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false; // 'post-thumbnails' can be boolean or an array of post types.
|
|
25
22
|
// In the latter case, we need to verify `postType` exists
|
|
26
23
|
// within `supported`. If `postType` isn't passed, then the check
|
|
27
24
|
// should fail.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["withSelect","store","coreStore","editorStore","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","supported","includes","select","getThemeSupports","getEditedPostAttribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,OAKH;AAAA,MAL+B;AAClCC,IAAAA,aADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAN,CAAeH,WAAf,IAA+BA,WAA/B,GAA6C,CAAEA,WAAF,CAD1B,EAEjBI,IAFiB,CAETC,GAAF,IAAW;AAAA;;AACnB,UAAMC,SAAS,yBAAGT,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAIQ,GAAJ,CAAhB,mEAA6B,KAA5C,CADmB,CAEnB;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6BH,KAAK,CAACC,OAAN,CAAeG,SAAf,CAAlC,EAA+D;AAC9D,aAAOA,SAAS,CAACC,QAAV,CAAoBR,QAApB,CAAP;AACA;;AACD,WAAOO,SAAP;AACA,GAZmB,CAApB;;AAcA,MAAK,CAAEL,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;AAED,eAAeN,UAAU,CAAIgB,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEd,SAAF,CAAnC;AACA,QAAM;AAAEgB,IAAAA;AAAF,MAA6BF,MAAM,CAAEb,WAAF,CAAzC;AACA,SAAO;AACNI,IAAAA,QAAQ,EAAEW,sBAAsB,CAAE,MAAF,CAD1B;AAENb,IAAAA,aAAa,EAAEY,gBAAgB;AAFzB,GAAP;AAIA,CAPwB,CAAV,CAOVb,iBAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t ).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
|
|
@@ -7,11 +7,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
|
|
10
|
-
/**
|
|
11
|
-
* External dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { get } from 'lodash';
|
|
15
10
|
/**
|
|
16
11
|
* Builds the arguments for a success notification dispatch.
|
|
17
12
|
*
|
|
@@ -22,13 +17,15 @@ import { get } from 'lodash';
|
|
|
22
17
|
*/
|
|
23
18
|
|
|
24
19
|
export function getNotificationArgumentsForSaveSuccess(data) {
|
|
20
|
+
var _data$options, _postType$viewable;
|
|
21
|
+
|
|
25
22
|
const {
|
|
26
23
|
previousPost,
|
|
27
24
|
post,
|
|
28
25
|
postType
|
|
29
26
|
} = data; // Autosaves are neither shown a notice nor redirected.
|
|
30
27
|
|
|
31
|
-
if (
|
|
28
|
+
if ((_data$options = data.options) !== null && _data$options !== void 0 && _data$options.isAutosave) {
|
|
32
29
|
return [];
|
|
33
30
|
} // No notice is shown after trashing a post
|
|
34
31
|
|
|
@@ -41,7 +38,7 @@ export function getNotificationArgumentsForSaveSuccess(data) {
|
|
|
41
38
|
const isPublished = publishStatus.includes(previousPost.status);
|
|
42
39
|
const willPublish = publishStatus.includes(post.status);
|
|
43
40
|
let noticeMessage;
|
|
44
|
-
let shouldShowLink =
|
|
41
|
+
let shouldShowLink = (_postType$viewable = postType === null || postType === void 0 ? void 0 : postType.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
|
|
45
42
|
let isDraft; // Always should a notice, which will be spoken for accessibility.
|
|
46
43
|
|
|
47
44
|
if (!isPublished && !willPublish) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","isAutosave","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAAA;;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,CAD8D,CAE9D;;AACA,uBAAKA,IAAI,CAACI,OAAV,0CAAK,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AEJ,KAAK,CAAC3B,MAAR,CADX,GAEGV,EAAE,CAAE,kBAAF,CAHN,CAjB2D,CAsB3D;AACA;;AACA,MAAKsC,KAAK,CAACI,OAAN,IAAiB,CAAE,aAAaC,IAAb,CAAmBL,KAAK,CAACI,OAAzB,CAAxB,EAA6D;AAC5D3B,IAAAA,aAAa,GAAG,CAAEA,aAAF,EAAiBuB,KAAK,CAACI,OAAvB,EAAiCE,IAAjC,CAAuC,GAAvC,CAAhB;AACA;;AACD,SAAO,CACN7B,aADM,EAEN;AACCmB,IAAAA,EAAE,EAAEjC;AADL,GAFM,CAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS4C,oCAAT,CAA+CzC,IAA/C,EAAsD;AAC5D,SAAO,CACNA,IAAI,CAACkC,KAAL,CAAWI,OAAX,IAAsBtC,IAAI,CAACkC,KAAL,CAAWC,IAAX,KAAoB,eAA1C,GACGnC,IAAI,CAACkC,KAAL,CAAWI,OADd,GAEG1C,EAAE,CAAE,iBAAF,CAHC,EAIN;AACCkC,IAAAA,EAAE,EAAEhC;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
|
package/build-style/style.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.5.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,34 +31,34 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^11.
|
|
38
|
-
"@wordpress/blocks": "^12.
|
|
39
|
-
"@wordpress/components": "^23.
|
|
40
|
-
"@wordpress/compose": "^6.
|
|
41
|
-
"@wordpress/core-data": "^6.
|
|
42
|
-
"@wordpress/data": "^8.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^3.
|
|
55
|
-
"@wordpress/preferences": "^3.
|
|
56
|
-
"@wordpress/private-apis": "^0.
|
|
57
|
-
"@wordpress/reusable-blocks": "^4.
|
|
58
|
-
"@wordpress/rich-text": "^6.
|
|
59
|
-
"@wordpress/server-side-render": "^4.
|
|
60
|
-
"@wordpress/url": "^3.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.28.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.25.0",
|
|
36
|
+
"@wordpress/blob": "^3.28.0",
|
|
37
|
+
"@wordpress/block-editor": "^11.5.0",
|
|
38
|
+
"@wordpress/blocks": "^12.5.0",
|
|
39
|
+
"@wordpress/components": "^23.5.0",
|
|
40
|
+
"@wordpress/compose": "^6.5.0",
|
|
41
|
+
"@wordpress/core-data": "^6.5.0",
|
|
42
|
+
"@wordpress/data": "^8.5.0",
|
|
43
|
+
"@wordpress/date": "^4.28.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.28.0",
|
|
45
|
+
"@wordpress/dom": "^3.28.0",
|
|
46
|
+
"@wordpress/element": "^5.5.0",
|
|
47
|
+
"@wordpress/hooks": "^3.28.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.28.0",
|
|
49
|
+
"@wordpress/i18n": "^4.28.0",
|
|
50
|
+
"@wordpress/icons": "^9.19.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.5.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.28.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.19.0",
|
|
54
|
+
"@wordpress/notices": "^3.28.0",
|
|
55
|
+
"@wordpress/preferences": "^3.5.0",
|
|
56
|
+
"@wordpress/private-apis": "^0.10.0",
|
|
57
|
+
"@wordpress/reusable-blocks": "^4.5.0",
|
|
58
|
+
"@wordpress/rich-text": "^6.5.0",
|
|
59
|
+
"@wordpress/server-side-render": "^4.5.0",
|
|
60
|
+
"@wordpress/url": "^3.29.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.28.0",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"date-fns": "^2.28.0",
|
|
64
64
|
"escape-html": "^1.0.3",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d5e03a74b79e3ca84afda24375474a103a063ee4"
|
|
79
79
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { compose } from '@wordpress/compose';
|
|
6
|
-
import { withSelect } from '@wordpress/data';
|
|
6
|
+
import { withSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { create, getTextContent } from '@wordpress/rich-text';
|
|
8
8
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -68,7 +68,7 @@ export const DocumentOutline = ( {
|
|
|
68
68
|
hasOutlineItemsDisabled,
|
|
69
69
|
} ) => {
|
|
70
70
|
const headings = computeOutlineHeadings( blocks );
|
|
71
|
-
|
|
71
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
72
72
|
if ( headings.length < 1 ) {
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
@@ -121,7 +121,10 @@ export const DocumentOutline = ( {
|
|
|
121
121
|
isValid={ isValid }
|
|
122
122
|
isDisabled={ hasOutlineItemsDisabled }
|
|
123
123
|
href={ `#block-${ item.clientId }` }
|
|
124
|
-
onSelect={
|
|
124
|
+
onSelect={ () => {
|
|
125
|
+
selectBlock( item.clientId );
|
|
126
|
+
onSelect?.();
|
|
127
|
+
} }
|
|
125
128
|
>
|
|
126
129
|
{ item.isEmpty
|
|
127
130
|
? emptyHeadingContent
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -15,17 +10,13 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
15
10
|
import { store as editorStore } from '../../store';
|
|
16
11
|
|
|
17
12
|
export function PageAttributesCheck( { children } ) {
|
|
18
|
-
const
|
|
13
|
+
const supportsPageAttributes = useSelect( ( select ) => {
|
|
19
14
|
const { getEditedPostAttribute } = select( editorStore );
|
|
20
15
|
const { getPostType } = select( coreStore );
|
|
16
|
+
const postType = getPostType( getEditedPostAttribute( 'type' ) );
|
|
21
17
|
|
|
22
|
-
return
|
|
18
|
+
return !! postType?.supports?.[ 'page-attributes' ];
|
|
23
19
|
}, [] );
|
|
24
|
-
const supportsPageAttributes = get(
|
|
25
|
-
postType,
|
|
26
|
-
[ 'supports', 'page-attributes' ],
|
|
27
|
-
false
|
|
28
|
-
);
|
|
29
20
|
|
|
30
21
|
// Only render fields if post type supports page attributes or available templates exist.
|
|
31
22
|
if ( ! supportsPageAttributes ) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import removeAccents from 'remove-accents';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -44,47 +43,48 @@ export const getItemPriority = ( name, searchValue ) => {
|
|
|
44
43
|
export function PageAttributesParent() {
|
|
45
44
|
const { editPost } = useDispatch( editorStore );
|
|
46
45
|
const [ fieldValue, setFieldValue ] = useState( false );
|
|
47
|
-
const { parentPost, parentPostId, items, postType } =
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
46
|
+
const { isHierarchical, parentPost, parentPostId, items, postType } =
|
|
47
|
+
useSelect(
|
|
48
|
+
( select ) => {
|
|
49
|
+
const { getPostType, getEntityRecords, getEntityRecord } =
|
|
50
|
+
select( coreStore );
|
|
51
|
+
const { getCurrentPostId, getEditedPostAttribute } =
|
|
52
|
+
select( editorStore );
|
|
53
|
+
const postTypeSlug = getEditedPostAttribute( 'type' );
|
|
54
|
+
const pageId = getEditedPostAttribute( 'parent' );
|
|
55
|
+
const pType = getPostType( postTypeSlug );
|
|
56
|
+
const postId = getCurrentPostId();
|
|
57
|
+
const postIsHierarchical = pType?.hierarchical ?? false;
|
|
58
|
+
const query = {
|
|
59
|
+
per_page: 100,
|
|
60
|
+
exclude: postId,
|
|
61
|
+
parent_exclude: postId,
|
|
62
|
+
orderby: 'menu_order',
|
|
63
|
+
order: 'asc',
|
|
64
|
+
_fields: 'id,title,parent',
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Perform a search when the field is changed.
|
|
68
|
+
if ( !! fieldValue ) {
|
|
69
|
+
query.search = fieldValue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
isHierarchical: postIsHierarchical,
|
|
74
|
+
parentPostId: pageId,
|
|
75
|
+
parentPost: pageId
|
|
76
|
+
? getEntityRecord( 'postType', postTypeSlug, pageId )
|
|
77
|
+
: null,
|
|
78
|
+
items: postIsHierarchical
|
|
79
|
+
? getEntityRecords( 'postType', postTypeSlug, query )
|
|
80
|
+
: [],
|
|
81
|
+
postType: pType,
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
[ fieldValue ]
|
|
85
|
+
);
|
|
85
86
|
|
|
86
|
-
const
|
|
87
|
-
const parentPageLabel = get( postType, [ 'labels', 'parent_item_colon' ] );
|
|
87
|
+
const parentPageLabel = postType?.labels?.parent_item_colon;
|
|
88
88
|
const pageItems = items || [];
|
|
89
89
|
|
|
90
90
|
const parentOptions = useMemo( () => {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -21,11 +16,8 @@ export default function PostAuthorCheck( { children } ) {
|
|
|
21
16
|
const post = select( editorStore ).getCurrentPost();
|
|
22
17
|
const authors = select( coreStore ).getUsers( AUTHORS_QUERY );
|
|
23
18
|
return {
|
|
24
|
-
hasAssignAuthorAction:
|
|
25
|
-
post,
|
|
26
|
-
[ '_links', 'wp:action-assign-author' ],
|
|
27
|
-
false
|
|
28
|
-
),
|
|
19
|
+
hasAssignAuthorAction:
|
|
20
|
+
post._links?.[ 'wp:action-assign-author' ] ?? false,
|
|
29
21
|
hasAuthors: authors?.length >= 1,
|
|
30
22
|
};
|
|
31
23
|
}, [] );
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -105,7 +100,6 @@ function PostFeaturedImage( {
|
|
|
105
100
|
const mediaUpload = useSelect( ( select ) => {
|
|
106
101
|
return select( blockEditorStore ).getSettings().mediaUpload;
|
|
107
102
|
}, [] );
|
|
108
|
-
const postLabel = get( postType, [ 'labels' ], {} );
|
|
109
103
|
const { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(
|
|
110
104
|
media,
|
|
111
105
|
currentPostId
|
|
@@ -159,7 +153,7 @@ function PostFeaturedImage( {
|
|
|
159
153
|
<MediaUploadCheck fallback={ instructions }>
|
|
160
154
|
<MediaUpload
|
|
161
155
|
title={
|
|
162
|
-
|
|
156
|
+
postType?.labels?.featured_image ||
|
|
163
157
|
DEFAULT_FEATURE_IMAGE_LABEL
|
|
164
158
|
}
|
|
165
159
|
onSelect={ onUpdateImage }
|
|
@@ -201,7 +195,8 @@ function PostFeaturedImage( {
|
|
|
201
195
|
{ isLoading && <Spinner /> }
|
|
202
196
|
{ ! featuredImageId &&
|
|
203
197
|
! isLoading &&
|
|
204
|
-
(
|
|
198
|
+
( postType?.labels
|
|
199
|
+
?.set_featured_image ||
|
|
205
200
|
DEFAULT_SET_FEATURE_IMAGE_LABEL ) }
|
|
206
201
|
</Button>
|
|
207
202
|
<DropZone onFilesDrop={ onDropFiles } />
|
|
@@ -215,7 +210,7 @@ function PostFeaturedImage( {
|
|
|
215
210
|
{ media && (
|
|
216
211
|
<MediaUpload
|
|
217
212
|
title={
|
|
218
|
-
|
|
213
|
+
postType?.labels?.featured_image ||
|
|
219
214
|
DEFAULT_FEATURE_IMAGE_LABEL
|
|
220
215
|
}
|
|
221
216
|
onSelect={ onUpdateImage }
|
|
@@ -237,7 +232,7 @@ function PostFeaturedImage( {
|
|
|
237
232
|
variant="link"
|
|
238
233
|
isDestructive
|
|
239
234
|
>
|
|
240
|
-
{
|
|
235
|
+
{ postType?.labels?.remove_featured_image ||
|
|
241
236
|
DEFAULT_REMOVE_FEATURE_IMAGE_LABEL }
|
|
242
237
|
</Button>
|
|
243
238
|
</MediaUploadCheck>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -164,7 +159,7 @@ export default function PostLockedModal() {
|
|
|
164
159
|
_wpnonce: postLockUtils.nonce,
|
|
165
160
|
} );
|
|
166
161
|
const allPostsUrl = addQueryArgs( 'edit.php', {
|
|
167
|
-
post_type:
|
|
162
|
+
post_type: postType?.slug,
|
|
168
163
|
} );
|
|
169
164
|
const allPostsLabel = __( 'Exit editor' );
|
|
170
165
|
return (
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -31,11 +26,8 @@ export default compose(
|
|
|
31
26
|
const { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =
|
|
32
27
|
select( editorStore );
|
|
33
28
|
return {
|
|
34
|
-
hasPublishAction:
|
|
35
|
-
getCurrentPost(),
|
|
36
|
-
[ '_links', 'wp:action-publish' ],
|
|
37
|
-
false
|
|
38
|
-
),
|
|
29
|
+
hasPublishAction:
|
|
30
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
39
31
|
isPublished: isCurrentPostPublished(),
|
|
40
32
|
postType: getCurrentPostType(),
|
|
41
33
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import classnames from 'classnames';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -256,7 +255,7 @@ export default compose( [
|
|
|
256
255
|
forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
|
|
257
256
|
isSaveable: isEditedPostSaveable(),
|
|
258
257
|
isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
|
|
259
|
-
isViewable:
|
|
258
|
+
isViewable: postType?.viewable ?? false,
|
|
260
259
|
isDraft:
|
|
261
260
|
[ 'draft', 'auto-draft' ].indexOf(
|
|
262
261
|
getEditedPostAttribute( 'status' )
|