@wordpress/edit-site 4.0.1 → 4.1.0-next.e230fbab09.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/add-new-template/new-template-part.js +4 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/app/index.js +20 -0
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +7 -3
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/editor/index.js +3 -18
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +11 -27
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +70 -0
- package/build/components/error-boundary/warning.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +7 -27
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +31 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +5 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +21 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -2
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header/index.js +1 -1
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +9 -21
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/site-export.js +1 -1
- package/build/components/header/more-menu/site-export.js.map +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js +4 -8
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/table.js +9 -20
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +9 -3
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +15 -4
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -11
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +5 -5
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +4 -1
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/welcome-guide/editor.js +6 -6
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/styles.js +6 -4
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/index.js +22 -7
- package/build/index.js.map +1 -1
- package/build/store/actions.js +203 -163
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +3 -9
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +0 -44
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +33 -10
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +4 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/app/index.js +16 -0
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +6 -3
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/editor/index.js +4 -17
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +9 -26
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +60 -0
- package/build-module/components/error-boundary/warning.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +8 -28
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +31 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +6 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +20 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header/index.js +1 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +11 -22
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/site-export.js +1 -1
- package/build-module/components/header/more-menu/site-export.js.map +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js +4 -8
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/table.js +9 -21
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +9 -3
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +12 -4
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -12
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +4 -4
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +5 -5
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +5 -4
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/index.js +20 -7
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +181 -154
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +4 -9
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +0 -40
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +28 -10
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +102 -39
- package/build-style/style.css +102 -39
- package/package.json +33 -27
- package/src/components/add-new-template/new-template-part.js +7 -1
- package/src/components/app/index.js +19 -0
- package/src/components/editor/global-styles-renderer.js +7 -1
- package/src/components/editor/index.js +2 -20
- package/src/components/error-boundary/index.js +11 -28
- package/src/components/error-boundary/warning.js +59 -0
- package/src/components/global-styles/navigation-button.js +6 -25
- package/src/components/global-styles/screen-block-list.js +27 -2
- package/src/components/global-styles/screen-typography.js +1 -2
- package/src/components/global-styles/typography-panel.js +12 -5
- package/src/components/global-styles/use-global-styles-output.js +19 -3
- package/src/components/global-styles/utils.js +2 -2
- package/src/components/header/index.js +1 -1
- package/src/components/header/more-menu/index.js +12 -29
- package/src/components/header/more-menu/site-export.js +1 -1
- package/src/components/header/more-menu/welcome-guide-menu-item.js +3 -7
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/list/table.js +18 -23
- package/src/components/navigation-sidebar/navigation-panel/index.js +16 -11
- package/src/components/navigation-sidebar/navigation-toggle/index.js +13 -4
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +32 -31
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +1 -1
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -11
- package/src/components/sidebar/global-styles-sidebar.js +6 -3
- package/src/components/sidebar/style.scss +1 -1
- package/src/components/template-part-converter/convert-to-template-part.js +6 -1
- package/src/components/welcome-guide/editor.js +8 -4
- package/src/components/welcome-guide/styles.js +5 -3
- package/src/index.js +25 -7
- package/src/store/actions.js +180 -215
- package/src/store/index.js +2 -8
- package/src/store/reducer.js +0 -30
- package/src/store/selectors.js +37 -10
- package/src/store/test/actions.js +203 -92
- package/src/store/test/reducer.js +0 -22
- package/src/store/test/selectors.js +22 -53
- package/src/style.scss +0 -1
- package/build/components/header/feature-toggle/index.js +0 -66
- package/build/components/header/feature-toggle/index.js.map +0 -1
- package/build/components/routes/redirect-to-homepage.js +0 -87
- package/build/components/routes/redirect-to-homepage.js.map +0 -1
- package/build/store/defaults.js +0 -15
- package/build/store/defaults.js.map +0 -1
- package/build-module/components/header/feature-toggle/index.js +0 -52
- package/build-module/components/header/feature-toggle/index.js.map +0 -1
- package/build-module/components/routes/redirect-to-homepage.js +0 -75
- package/build-module/components/routes/redirect-to-homepage.js.map +0 -1
- package/build-module/store/defaults.js +0 -8
- package/build-module/store/defaults.js.map +0 -1
- package/src/components/header/feature-toggle/index.js +0 -55
- package/src/components/header/more-menu/style.scss +0 -29
- package/src/components/routes/redirect-to-homepage.js +0 -71
- package/src/store/defaults.js +0 -7
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = redirectToHomepage;
|
|
9
|
-
|
|
10
|
-
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
11
|
-
|
|
12
|
-
var _url = require("@wordpress/url");
|
|
13
|
-
|
|
14
|
-
var _history = _interopRequireDefault(require("../../utils/history"));
|
|
15
|
-
|
|
16
|
-
var _getIsListPage = _interopRequireDefault(require("../../utils/get-is-list-page"));
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
function getNeedsHomepageRedirect(params) {
|
|
26
|
-
const {
|
|
27
|
-
postType
|
|
28
|
-
} = params;
|
|
29
|
-
return !(0, _getIsListPage.default)(params) && !['post', 'page', 'wp_template', 'wp_template_part'].includes(postType);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function getHomepageParams(siteUrl) {
|
|
33
|
-
const siteSettings = await (0, _apiFetch.default)({
|
|
34
|
-
path: '/wp/v2/settings'
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
if (!siteSettings) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const {
|
|
42
|
-
show_on_front: showOnFront,
|
|
43
|
-
page_on_front: frontpageId
|
|
44
|
-
} = siteSettings; // If the user has set a page as the homepage, use those details.
|
|
45
|
-
|
|
46
|
-
if (showOnFront === 'page') {
|
|
47
|
-
return {
|
|
48
|
-
postType: 'page',
|
|
49
|
-
postId: frontpageId
|
|
50
|
-
};
|
|
51
|
-
} // Else get the home template.
|
|
52
|
-
// This matches the logic in `__experimentalGetTemplateForLink`.
|
|
53
|
-
// (packages/core-data/src/resolvers.js)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const template = await window.fetch((0, _url.addQueryArgs)(siteUrl, {
|
|
57
|
-
'_wp-find-template': true
|
|
58
|
-
})).then(res => res.json()).then(_ref => {
|
|
59
|
-
let {
|
|
60
|
-
data
|
|
61
|
-
} = _ref;
|
|
62
|
-
return data;
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
if (!(template !== null && template !== void 0 && template.id)) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
postType: 'wp_template',
|
|
71
|
-
postId: template.id
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function redirectToHomepage(siteUrl) {
|
|
76
|
-
const searchParams = new URLSearchParams(_history.default.location.search);
|
|
77
|
-
const params = Object.fromEntries(searchParams.entries());
|
|
78
|
-
|
|
79
|
-
if (getNeedsHomepageRedirect(params)) {
|
|
80
|
-
const homepageParams = await getHomepageParams(siteUrl);
|
|
81
|
-
|
|
82
|
-
if (homepageParams) {
|
|
83
|
-
_history.default.replace(homepageParams);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=redirect-to-homepage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/redirect-to-homepage.js"],"names":["getNeedsHomepageRedirect","params","postType","includes","getHomepageParams","siteUrl","siteSettings","path","show_on_front","showOnFront","page_on_front","frontpageId","postId","template","window","fetch","then","res","json","data","id","redirectToHomepage","searchParams","URLSearchParams","history","location","search","Object","fromEntries","entries","homepageParams","replace"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,wBAAT,CAAmCC,MAAnC,EAA4C;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAeD,MAArB;AACA,SACC,CAAE,4BAAeA,MAAf,CAAF,IACA,CAAE,CAAE,MAAF,EAAU,MAAV,EAAkB,aAAlB,EAAiC,kBAAjC,EAAsDE,QAAtD,CACDD,QADC,CAFH;AAMA;;AAED,eAAeE,iBAAf,CAAkCC,OAAlC,EAA4C;AAC3C,QAAMC,YAAY,GAAG,MAAM,uBAAU;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAAV,CAA3B;;AACA,MAAK,CAAED,YAAP,EAAsB;AACrB;AACA;;AAED,QAAM;AACLE,IAAAA,aAAa,EAAEC,WADV;AAELC,IAAAA,aAAa,EAAEC;AAFV,MAGFL,YAHJ,CAN2C,CAW3C;;AACA,MAAKG,WAAW,KAAK,MAArB,EAA8B;AAC7B,WAAO;AACNP,MAAAA,QAAQ,EAAE,MADJ;AAENU,MAAAA,MAAM,EAAED;AAFF,KAAP;AAIA,GAjB0C,CAmB3C;AACA;AACA;;;AACA,QAAME,QAAQ,GAAG,MAAMC,MAAM,CAC3BC,KADqB,CACd,uBAAcV,OAAd,EAAuB;AAAE,yBAAqB;AAAvB,GAAvB,CADc,EAErBW,IAFqB,CAEbC,GAAF,IAAWA,GAAG,CAACC,IAAJ,EAFI,EAGrBF,IAHqB,CAGf;AAAA,QAAE;AAAEG,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAhB;AAAA,GAHe,CAAvB;;AAKA,MAAK,EAAEN,QAAF,aAAEA,QAAF,eAAEA,QAAQ,CAAEO,EAAZ,CAAL,EAAsB;AACrB;AACA;;AAED,SAAO;AACNlB,IAAAA,QAAQ,EAAE,aADJ;AAENU,IAAAA,MAAM,EAAEC,QAAQ,CAACO;AAFX,GAAP;AAIA;;AAEc,eAAeC,kBAAf,CAAmChB,OAAnC,EAA6C;AAC3D,QAAMiB,YAAY,GAAG,IAAIC,eAAJ,CAAqBC,iBAAQC,QAAR,CAAiBC,MAAtC,CAArB;AACA,QAAMzB,MAAM,GAAG0B,MAAM,CAACC,WAAP,CAAoBN,YAAY,CAACO,OAAb,EAApB,CAAf;;AAEA,MAAK7B,wBAAwB,CAAEC,MAAF,CAA7B,EAA0C;AACzC,UAAM6B,cAAc,GAAG,MAAM1B,iBAAiB,CAAEC,OAAF,CAA9C;;AAEA,QAAKyB,cAAL,EAAsB;AACrBN,uBAAQO,OAAR,CAAiBD,cAAjB;AACA;AACD;AACD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\nimport getIsListPage from '../../utils/get-is-list-page';\n\nfunction getNeedsHomepageRedirect( params ) {\n\tconst { postType } = params;\n\treturn (\n\t\t! getIsListPage( params ) &&\n\t\t! [ 'post', 'page', 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t)\n\t);\n}\n\nasync function getHomepageParams( siteUrl ) {\n\tconst siteSettings = await apiFetch( { path: '/wp/v2/settings' } );\n\tif ( ! siteSettings ) {\n\t\treturn;\n\t}\n\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = siteSettings;\n\n\t// If the user has set a page as the homepage, use those details.\n\tif ( showOnFront === 'page' ) {\n\t\treturn {\n\t\t\tpostType: 'page',\n\t\t\tpostId: frontpageId,\n\t\t};\n\t}\n\n\t// Else get the home template.\n\t// This matches the logic in `__experimentalGetTemplateForLink`.\n\t// (packages/core-data/src/resolvers.js)\n\tconst template = await window\n\t\t.fetch( addQueryArgs( siteUrl, { '_wp-find-template': true } ) )\n\t\t.then( ( res ) => res.json() )\n\t\t.then( ( { data } ) => data );\n\n\tif ( ! template?.id ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tpostType: 'wp_template',\n\t\tpostId: template.id,\n\t};\n}\n\nexport default async function redirectToHomepage( siteUrl ) {\n\tconst searchParams = new URLSearchParams( history.location.search );\n\tconst params = Object.fromEntries( searchParams.entries() );\n\n\tif ( getNeedsHomepageRedirect( params ) ) {\n\t\tconst homepageParams = await getHomepageParams( siteUrl );\n\n\t\tif ( homepageParams ) {\n\t\t\thistory.replace( homepageParams );\n\t\t}\n\t}\n}\n"]}
|
package/build/store/defaults.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PREFERENCES_DEFAULTS = void 0;
|
|
7
|
-
const PREFERENCES_DEFAULTS = {
|
|
8
|
-
features: {
|
|
9
|
-
welcomeGuide: true,
|
|
10
|
-
welcomeGuideStyles: true
|
|
11
|
-
},
|
|
12
|
-
editorMode: 'visual'
|
|
13
|
-
};
|
|
14
|
-
exports.PREFERENCES_DEFAULTS = PREFERENCES_DEFAULTS;
|
|
15
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","features","welcomeGuide","welcomeGuideStyles","editorMode"],"mappings":";;;;;;AAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,QAAQ,EAAE;AACTC,IAAAA,YAAY,EAAE,IADL;AAETC,IAAAA,kBAAkB,EAAE;AAFX,GADyB;AAKnCC,EAAAA,UAAU,EAAE;AALuB,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tfeatures: {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t},\n\teditorMode: 'visual',\n};\n"]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { flow } from 'lodash';
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import { MenuItem } from '@wordpress/components';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
|
-
import { check } from '@wordpress/icons';
|
|
15
|
-
import { speak } from '@wordpress/a11y';
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { store as editSiteStore } from '../../../store';
|
|
21
|
-
export default function FeatureToggle(_ref) {
|
|
22
|
-
let {
|
|
23
|
-
feature,
|
|
24
|
-
label,
|
|
25
|
-
info,
|
|
26
|
-
messageActivated,
|
|
27
|
-
messageDeactivated
|
|
28
|
-
} = _ref;
|
|
29
|
-
|
|
30
|
-
const speakMessage = () => {
|
|
31
|
-
if (isActive) {
|
|
32
|
-
speak(messageDeactivated || __('Feature deactivated'));
|
|
33
|
-
} else {
|
|
34
|
-
speak(messageActivated || __('Feature activated'));
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const isActive = useSelect(select => {
|
|
39
|
-
return select(editSiteStore).isFeatureActive(feature);
|
|
40
|
-
}, []);
|
|
41
|
-
const {
|
|
42
|
-
toggleFeature
|
|
43
|
-
} = useDispatch(editSiteStore);
|
|
44
|
-
return createElement(MenuItem, {
|
|
45
|
-
icon: isActive && check,
|
|
46
|
-
isSelected: isActive,
|
|
47
|
-
onClick: flow(toggleFeature.bind(null, feature), speakMessage),
|
|
48
|
-
role: "menuitemcheckbox",
|
|
49
|
-
info: info
|
|
50
|
-
}, label);
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header/feature-toggle/index.js"],"names":["flow","useSelect","useDispatch","MenuItem","__","check","speak","store","editSiteStore","FeatureToggle","feature","label","info","messageActivated","messageDeactivated","speakMessage","isActive","select","isFeatureActive","toggleFeature","bind"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;AAEA,eAAe,SAASC,aAAT,OAMX;AAAA,MANmC;AACtCC,IAAAA,OADsC;AAEtCC,IAAAA,KAFsC;AAGtCC,IAAAA,IAHsC;AAItCC,IAAAA,gBAJsC;AAKtCC,IAAAA;AALsC,GAMnC;;AACH,QAAMC,YAAY,GAAG,MAAM;AAC1B,QAAKC,QAAL,EAAgB;AACfV,MAAAA,KAAK,CAAEQ,kBAAkB,IAAIV,EAAE,CAAE,qBAAF,CAA1B,CAAL;AACA,KAFD,MAEO;AACNE,MAAAA,KAAK,CAAEO,gBAAgB,IAAIT,EAAE,CAAE,mBAAF,CAAxB,CAAL;AACA;AACD,GAND;;AAQA,QAAMY,QAAQ,GAAGf,SAAS,CAAIgB,MAAF,IAAc;AACzC,WAAOA,MAAM,CAAET,aAAF,CAAN,CAAwBU,eAAxB,CAAyCR,OAAzC,CAAP;AACA,GAFyB,EAEvB,EAFuB,CAA1B;AAIA,QAAM;AAAES,IAAAA;AAAF,MAAoBjB,WAAW,CAAEM,aAAF,CAArC;AAEA,SACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAGQ,QAAQ,IAAIX,KADpB;AAEC,IAAA,UAAU,EAAGW,QAFd;AAGC,IAAA,OAAO,EAAGhB,IAAI,CACbmB,aAAa,CAACC,IAAd,CAAoB,IAApB,EAA0BV,OAA1B,CADa,EAEbK,YAFa,CAHf;AAOC,IAAA,IAAI,EAAC,kBAPN;AAQC,IAAA,IAAI,EAAGH;AARR,KAUGD,KAVH,CADD;AAcA","sourcesContent":["/**\n * External dependencies\n */\nimport { flow } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nexport default function FeatureToggle( {\n\tfeature,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n} ) {\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tspeak( messageDeactivated || __( 'Feature deactivated' ) );\n\t\t} else {\n\t\t\tspeak( messageActivated || __( 'Feature activated' ) );\n\t\t}\n\t};\n\n\tconst isActive = useSelect( ( select ) => {\n\t\treturn select( editSiteStore ).isFeatureActive( feature );\n\t}, [] );\n\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ flow(\n\t\t\t\ttoggleFeature.bind( null, feature ),\n\t\t\t\tspeakMessage\n\t\t\t) }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import apiFetch from '@wordpress/api-fetch';
|
|
5
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import history from '../../utils/history';
|
|
11
|
-
import getIsListPage from '../../utils/get-is-list-page';
|
|
12
|
-
|
|
13
|
-
function getNeedsHomepageRedirect(params) {
|
|
14
|
-
const {
|
|
15
|
-
postType
|
|
16
|
-
} = params;
|
|
17
|
-
return !getIsListPage(params) && !['post', 'page', 'wp_template', 'wp_template_part'].includes(postType);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async function getHomepageParams(siteUrl) {
|
|
21
|
-
const siteSettings = await apiFetch({
|
|
22
|
-
path: '/wp/v2/settings'
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
if (!siteSettings) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
show_on_front: showOnFront,
|
|
31
|
-
page_on_front: frontpageId
|
|
32
|
-
} = siteSettings; // If the user has set a page as the homepage, use those details.
|
|
33
|
-
|
|
34
|
-
if (showOnFront === 'page') {
|
|
35
|
-
return {
|
|
36
|
-
postType: 'page',
|
|
37
|
-
postId: frontpageId
|
|
38
|
-
};
|
|
39
|
-
} // Else get the home template.
|
|
40
|
-
// This matches the logic in `__experimentalGetTemplateForLink`.
|
|
41
|
-
// (packages/core-data/src/resolvers.js)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const template = await window.fetch(addQueryArgs(siteUrl, {
|
|
45
|
-
'_wp-find-template': true
|
|
46
|
-
})).then(res => res.json()).then(_ref => {
|
|
47
|
-
let {
|
|
48
|
-
data
|
|
49
|
-
} = _ref;
|
|
50
|
-
return data;
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
if (!(template !== null && template !== void 0 && template.id)) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
postType: 'wp_template',
|
|
59
|
-
postId: template.id
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default async function redirectToHomepage(siteUrl) {
|
|
64
|
-
const searchParams = new URLSearchParams(history.location.search);
|
|
65
|
-
const params = Object.fromEntries(searchParams.entries());
|
|
66
|
-
|
|
67
|
-
if (getNeedsHomepageRedirect(params)) {
|
|
68
|
-
const homepageParams = await getHomepageParams(siteUrl);
|
|
69
|
-
|
|
70
|
-
if (homepageParams) {
|
|
71
|
-
history.replace(homepageParams);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=redirect-to-homepage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/redirect-to-homepage.js"],"names":["apiFetch","addQueryArgs","history","getIsListPage","getNeedsHomepageRedirect","params","postType","includes","getHomepageParams","siteUrl","siteSettings","path","show_on_front","showOnFront","page_on_front","frontpageId","postId","template","window","fetch","then","res","json","data","id","redirectToHomepage","searchParams","URLSearchParams","location","search","Object","fromEntries","entries","homepageParams","replace"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,qBAApB;AACA,OAAOC,aAAP,MAA0B,8BAA1B;;AAEA,SAASC,wBAAT,CAAmCC,MAAnC,EAA4C;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAeD,MAArB;AACA,SACC,CAAEF,aAAa,CAAEE,MAAF,CAAf,IACA,CAAE,CAAE,MAAF,EAAU,MAAV,EAAkB,aAAlB,EAAiC,kBAAjC,EAAsDE,QAAtD,CACDD,QADC,CAFH;AAMA;;AAED,eAAeE,iBAAf,CAAkCC,OAAlC,EAA4C;AAC3C,QAAMC,YAAY,GAAG,MAAMV,QAAQ,CAAE;AAAEW,IAAAA,IAAI,EAAE;AAAR,GAAF,CAAnC;;AACA,MAAK,CAAED,YAAP,EAAsB;AACrB;AACA;;AAED,QAAM;AACLE,IAAAA,aAAa,EAAEC,WADV;AAELC,IAAAA,aAAa,EAAEC;AAFV,MAGFL,YAHJ,CAN2C,CAW3C;;AACA,MAAKG,WAAW,KAAK,MAArB,EAA8B;AAC7B,WAAO;AACNP,MAAAA,QAAQ,EAAE,MADJ;AAENU,MAAAA,MAAM,EAAED;AAFF,KAAP;AAIA,GAjB0C,CAmB3C;AACA;AACA;;;AACA,QAAME,QAAQ,GAAG,MAAMC,MAAM,CAC3BC,KADqB,CACdlB,YAAY,CAAEQ,OAAF,EAAW;AAAE,yBAAqB;AAAvB,GAAX,CADE,EAErBW,IAFqB,CAEbC,GAAF,IAAWA,GAAG,CAACC,IAAJ,EAFI,EAGrBF,IAHqB,CAGf;AAAA,QAAE;AAAEG,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAhB;AAAA,GAHe,CAAvB;;AAKA,MAAK,EAAEN,QAAF,aAAEA,QAAF,eAAEA,QAAQ,CAAEO,EAAZ,CAAL,EAAsB;AACrB;AACA;;AAED,SAAO;AACNlB,IAAAA,QAAQ,EAAE,aADJ;AAENU,IAAAA,MAAM,EAAEC,QAAQ,CAACO;AAFX,GAAP;AAIA;;AAED,eAAe,eAAeC,kBAAf,CAAmChB,OAAnC,EAA6C;AAC3D,QAAMiB,YAAY,GAAG,IAAIC,eAAJ,CAAqBzB,OAAO,CAAC0B,QAAR,CAAiBC,MAAtC,CAArB;AACA,QAAMxB,MAAM,GAAGyB,MAAM,CAACC,WAAP,CAAoBL,YAAY,CAACM,OAAb,EAApB,CAAf;;AAEA,MAAK5B,wBAAwB,CAAEC,MAAF,CAA7B,EAA0C;AACzC,UAAM4B,cAAc,GAAG,MAAMzB,iBAAiB,CAAEC,OAAF,CAA9C;;AAEA,QAAKwB,cAAL,EAAsB;AACrB/B,MAAAA,OAAO,CAACgC,OAAR,CAAiBD,cAAjB;AACA;AACD;AACD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\nimport getIsListPage from '../../utils/get-is-list-page';\n\nfunction getNeedsHomepageRedirect( params ) {\n\tconst { postType } = params;\n\treturn (\n\t\t! getIsListPage( params ) &&\n\t\t! [ 'post', 'page', 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t)\n\t);\n}\n\nasync function getHomepageParams( siteUrl ) {\n\tconst siteSettings = await apiFetch( { path: '/wp/v2/settings' } );\n\tif ( ! siteSettings ) {\n\t\treturn;\n\t}\n\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = siteSettings;\n\n\t// If the user has set a page as the homepage, use those details.\n\tif ( showOnFront === 'page' ) {\n\t\treturn {\n\t\t\tpostType: 'page',\n\t\t\tpostId: frontpageId,\n\t\t};\n\t}\n\n\t// Else get the home template.\n\t// This matches the logic in `__experimentalGetTemplateForLink`.\n\t// (packages/core-data/src/resolvers.js)\n\tconst template = await window\n\t\t.fetch( addQueryArgs( siteUrl, { '_wp-find-template': true } ) )\n\t\t.then( ( res ) => res.json() )\n\t\t.then( ( { data } ) => data );\n\n\tif ( ! template?.id ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tpostType: 'wp_template',\n\t\tpostId: template.id,\n\t};\n}\n\nexport default async function redirectToHomepage( siteUrl ) {\n\tconst searchParams = new URLSearchParams( history.location.search );\n\tconst params = Object.fromEntries( searchParams.entries() );\n\n\tif ( getNeedsHomepageRedirect( params ) ) {\n\t\tconst homepageParams = await getHomepageParams( siteUrl );\n\n\t\tif ( homepageParams ) {\n\t\t\thistory.replace( homepageParams );\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","features","welcomeGuide","welcomeGuideStyles","editorMode"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,QAAQ,EAAE;AACTC,IAAAA,YAAY,EAAE,IADL;AAETC,IAAAA,kBAAkB,EAAE;AAFX,GADyB;AAKnCC,EAAAA,UAAU,EAAE;AALuB,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tfeatures: {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t},\n\teditorMode: 'visual',\n};\n"]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { flow } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import { MenuItem } from '@wordpress/components';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import { check } from '@wordpress/icons';
|
|
13
|
-
import { speak } from '@wordpress/a11y';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { store as editSiteStore } from '../../../store';
|
|
19
|
-
|
|
20
|
-
export default function FeatureToggle( {
|
|
21
|
-
feature,
|
|
22
|
-
label,
|
|
23
|
-
info,
|
|
24
|
-
messageActivated,
|
|
25
|
-
messageDeactivated,
|
|
26
|
-
} ) {
|
|
27
|
-
const speakMessage = () => {
|
|
28
|
-
if ( isActive ) {
|
|
29
|
-
speak( messageDeactivated || __( 'Feature deactivated' ) );
|
|
30
|
-
} else {
|
|
31
|
-
speak( messageActivated || __( 'Feature activated' ) );
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const isActive = useSelect( ( select ) => {
|
|
36
|
-
return select( editSiteStore ).isFeatureActive( feature );
|
|
37
|
-
}, [] );
|
|
38
|
-
|
|
39
|
-
const { toggleFeature } = useDispatch( editSiteStore );
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<MenuItem
|
|
43
|
-
icon={ isActive && check }
|
|
44
|
-
isSelected={ isActive }
|
|
45
|
-
onClick={ flow(
|
|
46
|
-
toggleFeature.bind( null, feature ),
|
|
47
|
-
speakMessage
|
|
48
|
-
) }
|
|
49
|
-
role="menuitemcheckbox"
|
|
50
|
-
info={ info }
|
|
51
|
-
>
|
|
52
|
-
{ label }
|
|
53
|
-
</MenuItem>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.edit-site-more-menu {
|
|
2
|
-
margin-left: -4px;
|
|
3
|
-
|
|
4
|
-
// the padding and margin of the more menu is intentionally non-standard
|
|
5
|
-
.components-button {
|
|
6
|
-
width: auto;
|
|
7
|
-
padding: 0 2px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@include break-small() {
|
|
11
|
-
margin-left: 4px;
|
|
12
|
-
|
|
13
|
-
.components-button {
|
|
14
|
-
padding: 0 4px;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.edit-site-more-menu__content .components-popover__content {
|
|
20
|
-
min-width: 260px;
|
|
21
|
-
|
|
22
|
-
.components-dropdown-menu__menu {
|
|
23
|
-
padding: 0;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.components-popover.edit-site-more-menu__content {
|
|
28
|
-
z-index: z-index(".components-popover.edit-site-more-menu__content");
|
|
29
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import apiFetch from '@wordpress/api-fetch';
|
|
5
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import history from '../../utils/history';
|
|
11
|
-
import getIsListPage from '../../utils/get-is-list-page';
|
|
12
|
-
|
|
13
|
-
function getNeedsHomepageRedirect( params ) {
|
|
14
|
-
const { postType } = params;
|
|
15
|
-
return (
|
|
16
|
-
! getIsListPage( params ) &&
|
|
17
|
-
! [ 'post', 'page', 'wp_template', 'wp_template_part' ].includes(
|
|
18
|
-
postType
|
|
19
|
-
)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function getHomepageParams( siteUrl ) {
|
|
24
|
-
const siteSettings = await apiFetch( { path: '/wp/v2/settings' } );
|
|
25
|
-
if ( ! siteSettings ) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
show_on_front: showOnFront,
|
|
31
|
-
page_on_front: frontpageId,
|
|
32
|
-
} = siteSettings;
|
|
33
|
-
|
|
34
|
-
// If the user has set a page as the homepage, use those details.
|
|
35
|
-
if ( showOnFront === 'page' ) {
|
|
36
|
-
return {
|
|
37
|
-
postType: 'page',
|
|
38
|
-
postId: frontpageId,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Else get the home template.
|
|
43
|
-
// This matches the logic in `__experimentalGetTemplateForLink`.
|
|
44
|
-
// (packages/core-data/src/resolvers.js)
|
|
45
|
-
const template = await window
|
|
46
|
-
.fetch( addQueryArgs( siteUrl, { '_wp-find-template': true } ) )
|
|
47
|
-
.then( ( res ) => res.json() )
|
|
48
|
-
.then( ( { data } ) => data );
|
|
49
|
-
|
|
50
|
-
if ( ! template?.id ) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
postType: 'wp_template',
|
|
56
|
-
postId: template.id,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default async function redirectToHomepage( siteUrl ) {
|
|
61
|
-
const searchParams = new URLSearchParams( history.location.search );
|
|
62
|
-
const params = Object.fromEntries( searchParams.entries() );
|
|
63
|
-
|
|
64
|
-
if ( getNeedsHomepageRedirect( params ) ) {
|
|
65
|
-
const homepageParams = await getHomepageParams( siteUrl );
|
|
66
|
-
|
|
67
|
-
if ( homepageParams ) {
|
|
68
|
-
history.replace( homepageParams );
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|