@wordpress/edit-site 3.0.15 → 3.0.16
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 +29 -18
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +30 -23
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +51 -0
- package/build/components/app/index.js.map +1 -0
- package/build/components/block-editor/back-button.js +8 -20
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/index.js +2 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +0 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +20 -8
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js +11 -30
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +10 -10
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/document-actions/index.js +3 -6
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/list/index.js +17 -15
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +4 -4
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -13
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +26 -24
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/routes/index.js +60 -0
- package/build/components/routes/index.js.map +1 -0
- package/build/components/routes/link.js +65 -0
- package/build/components/routes/link.js.map +1 -0
- package/build/components/routes/use-title.js +57 -0
- package/build/components/routes/use-title.js.map +1 -0
- package/build/components/sidebar/global-styles-sidebar.js +10 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/template-card/template-areas.js +7 -4
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/index.js +12 -10
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +27 -10
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/url-query-controller/index.js +41 -50
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +6 -0
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +1 -28
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +18 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/index.js +29 -35
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +3 -23
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/site-export.js +61 -0
- package/build/plugins/site-export.js.map +1 -0
- package/build/plugins/welcome-guide-menu-item.js +1 -7
- package/build/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build/store/actions.js +0 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -14
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +7 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -31
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +23 -0
- package/build/utils/get-is-list-page.js.map +1 -0
- package/build/utils/history.js +35 -0
- package/build/utils/history.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +27 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +28 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +35 -0
- package/build-module/components/app/index.js.map +1 -0
- package/build-module/components/block-editor/back-button.js +8 -19
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +0 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +17 -9
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js +13 -33
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +10 -10
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +3 -6
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/list/index.js +15 -15
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +4 -4
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +13 -13
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +24 -24
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/routes/index.js +47 -0
- package/build-module/components/routes/index.js.map +1 -0
- package/build-module/components/routes/link.js +51 -0
- package/build-module/components/routes/link.js.map +1 -0
- package/build-module/components/routes/use-title.js +44 -0
- package/build-module/components/routes/use-title.js.map +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js +8 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-areas.js +8 -4
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/index.js +10 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +24 -9
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +40 -49
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +7 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -26
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +18 -2
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/index.js +28 -33
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +2 -18
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/site-export.js +45 -0
- package/build-module/plugins/site-export.js.map +1 -0
- package/build-module/plugins/welcome-guide-menu-item.js +2 -7
- package/build-module/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build-module/store/actions.js +0 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -11
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +7 -16
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -27
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +16 -0
- package/build-module/utils/get-is-list-page.js.map +1 -0
- package/build-module/utils/history.js +25 -0
- package/build-module/utils/history.js.map +1 -0
- package/build-style/style-rtl.css +1 -6
- package/build-style/style.css +1 -6
- package/package.json +9 -8
- package/src/components/add-new-template/new-template-part.js +29 -11
- package/src/components/add-new-template/new-template.js +26 -12
- package/src/components/app/index.js +47 -0
- package/src/components/block-editor/back-button.js +6 -14
- package/src/components/block-editor/index.js +1 -0
- package/src/components/create-template-part-modal/index.js +0 -2
- package/src/components/edit-template-part-menu-button/index.js +16 -5
- package/src/components/editor/index.js +105 -131
- package/src/components/global-styles/gradients-palette-panel.js +12 -12
- package/src/components/global-styles/use-global-styles-output.js +0 -1
- package/src/components/header/document-actions/index.js +3 -9
- package/src/components/list/index.js +11 -12
- package/src/components/list/style.scss +6 -11
- package/src/components/list/table.js +5 -5
- package/src/components/navigation-sidebar/index.js +18 -17
- package/src/components/navigation-sidebar/navigation-panel/index.js +16 -22
- package/src/components/routes/index.js +53 -0
- package/src/components/routes/link.js +44 -0
- package/src/components/routes/use-title.js +56 -0
- package/src/components/sidebar/global-styles-sidebar.js +8 -0
- package/src/components/sidebar/template-card/template-areas.js +16 -4
- package/src/components/template-details/index.js +8 -6
- package/src/components/template-details/template-areas.js +31 -8
- package/src/components/template-part-converter/convert-to-template-part.js +4 -2
- package/src/components/url-query-controller/index.js +34 -45
- package/src/components/welcome-guide/editor.js +10 -1
- package/src/components/welcome-guide/index.js +6 -25
- package/src/components/welcome-guide/styles.js +20 -2
- package/src/index.js +33 -36
- package/src/plugins/index.js +2 -32
- package/src/plugins/site-export.js +48 -0
- package/src/plugins/welcome-guide-menu-item.js +2 -16
- package/src/store/actions.js +0 -23
- package/src/store/constants.js +0 -12
- package/src/store/reducer.js +12 -26
- package/src/store/selectors.js +1 -27
- package/src/store/test/reducer.js +22 -39
- package/src/store/test/selectors.js +3 -34
- package/src/utils/get-is-list-page.js +11 -0
- package/src/utils/history.js +35 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createElement } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -8,7 +9,6 @@ import { sprintf, __ } from '@wordpress/i18n';
|
|
|
8
9
|
import { Button, MenuGroup, MenuItem, __experimentalHeading as Heading, __experimentalText as Text } from '@wordpress/components';
|
|
9
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
11
|
import { store as editorStore } from '@wordpress/editor';
|
|
11
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
@@ -18,6 +18,7 @@ import { MENU_TEMPLATES, TEMPLATE_PARTS_SUB_MENUS } from '../navigation-sidebar/
|
|
|
18
18
|
import { store as editSiteStore } from '../../store';
|
|
19
19
|
import TemplateAreas from './template-areas';
|
|
20
20
|
import EditTemplateTitle from './edit-template-title';
|
|
21
|
+
import { useLink } from '../routes/link';
|
|
21
22
|
export default function TemplateDetails(_ref) {
|
|
22
23
|
let {
|
|
23
24
|
template,
|
|
@@ -45,6 +46,11 @@ export default function TemplateDetails(_ref) {
|
|
|
45
46
|
return area === (template === null || template === void 0 ? void 0 : template.area);
|
|
46
47
|
});
|
|
47
48
|
}, [template]);
|
|
49
|
+
const browseAllLinkProps = useLink({
|
|
50
|
+
// TODO: We should update this to filter by template part's areas as well.
|
|
51
|
+
postType: template.type,
|
|
52
|
+
postId: undefined
|
|
53
|
+
});
|
|
48
54
|
|
|
49
55
|
if (!template) {
|
|
50
56
|
return null;
|
|
@@ -77,14 +83,9 @@ export default function TemplateDetails(_ref) {
|
|
|
77
83
|
className: "edit-site-template-details__revert-button",
|
|
78
84
|
info: __('Restore template to default state'),
|
|
79
85
|
onClick: revert
|
|
80
|
-
}, __('Clear customizations'))), createElement(Button, {
|
|
81
|
-
className: "edit-site-template-details__show-all-button"
|
|
82
|
-
|
|
83
|
-
// TODO: We should update this to filter by template part's areas as well.
|
|
84
|
-
postId: undefined,
|
|
85
|
-
postType: template.type
|
|
86
|
-
})
|
|
87
|
-
}, sprintf(
|
|
86
|
+
}, __('Clear customizations'))), createElement(Button, _extends({
|
|
87
|
+
className: "edit-site-template-details__show-all-button"
|
|
88
|
+
}, browseAllLinkProps), sprintf(
|
|
88
89
|
/* translators: the template part's area name ("Headers", "Sidebars") or "templates". */
|
|
89
90
|
__('Browse all %s'), templateSubMenu.title)));
|
|
90
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["useMemo","sprintf","__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["useMemo","sprintf","__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","isTemplateRevertable","MENU_TEMPLATES","TEMPLATE_PARTS_SUB_MENUS","editSiteStore","TemplateAreas","EditTemplateTitle","useLink","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","templateSubMenu","type","menu","find","area","browseAllLinkProps","postType","postId","undefined","revert","is_custom"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,qBAAqB,IAAIC,OAJ1B,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SACCC,cADD,EAECC,wBAFD,QAGO,kDAHP;AAIA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,eAAe,SAASC,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyBd,SAAS,CACrCe,MAAF,IACCA,MAAM,CAAEb,WAAF,CAAN,CAAsBc,6BAAtB,CAAqDL,QAArD,CAFsC,EAGvC,EAHuC,CAAxC;AAKA,QAAM;AAAEM,IAAAA;AAAF,MAAqBlB,WAAW,CAAEO,aAAF,CAAtC;AAEA,QAAMY,eAAe,GAAG7B,OAAO,CAAE,MAAM;AACtC,QAAK,CAAAsB,QAAQ,SAAR,IAAAA,QAAQ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,IACD,cAAC,SAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGpB,EAAE,CAAE,mCAAF,CAFV;AAGC,IAAA,OAAO,EAAGoC;AAHX,KAKGpC,EAAE,CAAE,sBAAF,CALL,CADD,CA5BF,EAuCC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC;AADX,KAEMgC,kBAFN,GAIGjC,OAAO;AACR;AACAC,EAAAA,EAAE,CAAE,eAAF,CAFM,EAGR2B,eAAe,CAACL,KAHR,CAJV,CAvCD,CADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport {\n\tMENU_TEMPLATES,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../navigation-sidebar/navigation-panel/constants';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst templateSubMenu = useMemo( () => {\n\t\tif ( template?.type === 'wp_template' ) {\n\t\t\treturn { title: __( 'templates' ), menu: MENU_TEMPLATES };\n\t\t}\n\n\t\treturn TEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t( { area } ) => area === template?.area\n\t\t);\n\t}, [ template ] );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t{ template.is_custom ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Heading>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: the template part's area name (\"Headers\", \"Sidebars\") or \"templates\". */\n\t\t\t\t\t__( 'Browse all %s' ),\n\t\t\t\t\ttemplateSubMenu.title\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -6,7 +7,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
6
7
|
import { sprintf, __ } from '@wordpress/i18n';
|
|
7
8
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
8
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
-
import {
|
|
10
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
10
11
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
12
|
import { moreVertical } from '@wordpress/icons';
|
|
12
13
|
/**
|
|
@@ -14,8 +15,9 @@ import { moreVertical } from '@wordpress/icons';
|
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import { store as editSiteStore } from '../../store';
|
|
17
|
-
import { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';
|
|
18
18
|
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
19
|
+
import { useLocation } from '../routes';
|
|
20
|
+
import { useLink } from '../routes/link';
|
|
19
21
|
|
|
20
22
|
function TemplatePartItemMore(_ref) {
|
|
21
23
|
var _templatePart$title;
|
|
@@ -26,12 +28,20 @@ function TemplatePartItemMore(_ref) {
|
|
|
26
28
|
closeTemplateDetailsDropdown
|
|
27
29
|
} = _ref;
|
|
28
30
|
const {
|
|
29
|
-
pushTemplatePart,
|
|
30
31
|
revertTemplate
|
|
31
32
|
} = useDispatch(editSiteStore);
|
|
33
|
+
const {
|
|
34
|
+
params
|
|
35
|
+
} = useLocation();
|
|
36
|
+
const editLinkProps = useLink({
|
|
37
|
+
postId: templatePart.id,
|
|
38
|
+
postType: templatePart.type
|
|
39
|
+
}, {
|
|
40
|
+
fromTemplateId: params.postId
|
|
41
|
+
});
|
|
32
42
|
|
|
33
|
-
function editTemplatePart() {
|
|
34
|
-
|
|
43
|
+
function editTemplatePart(event) {
|
|
44
|
+
editLinkProps.onClick(event);
|
|
35
45
|
onClose();
|
|
36
46
|
closeTemplateDetailsDropdown();
|
|
37
47
|
}
|
|
@@ -42,9 +52,9 @@ function TemplatePartItemMore(_ref) {
|
|
|
42
52
|
closeTemplateDetailsDropdown();
|
|
43
53
|
}
|
|
44
54
|
|
|
45
|
-
return createElement(Fragment, null, createElement(MenuGroup, null, createElement(MenuItem, {
|
|
55
|
+
return createElement(Fragment, null, createElement(MenuGroup, null, createElement(MenuItem, _extends({}, editLinkProps, {
|
|
46
56
|
onClick: editTemplatePart
|
|
47
|
-
}, sprintf(
|
|
57
|
+
}), sprintf(
|
|
48
58
|
/* translators: %s: template part title */
|
|
49
59
|
__('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), isTemplateRevertable(templatePart) && createElement(MenuGroup, null, createElement(MenuItem, {
|
|
50
60
|
info: __('Restore template to default state'),
|
|
@@ -62,6 +72,11 @@ function TemplatePartItem(_ref2) {
|
|
|
62
72
|
selectBlock,
|
|
63
73
|
toggleBlockHighlight
|
|
64
74
|
} = useDispatch(blockEditorStore);
|
|
75
|
+
const templatePartArea = useSelect(select => {
|
|
76
|
+
const defaultAreas = select(editorStore).__experimentalGetDefaultTemplatePartAreas();
|
|
77
|
+
|
|
78
|
+
return defaultAreas.find(defaultArea => defaultArea.area === templatePart.area);
|
|
79
|
+
}, [templatePart.area]);
|
|
65
80
|
|
|
66
81
|
const highlightBlock = () => toggleBlockHighlight(clientId, true);
|
|
67
82
|
|
|
@@ -72,7 +87,7 @@ function TemplatePartItem(_ref2) {
|
|
|
72
87
|
className: "edit-site-template-details__template-areas-item"
|
|
73
88
|
}, createElement(MenuItem, {
|
|
74
89
|
role: "button",
|
|
75
|
-
icon:
|
|
90
|
+
icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon,
|
|
76
91
|
iconPosition: "left",
|
|
77
92
|
onClick: () => {
|
|
78
93
|
selectBlock(clientId);
|
|
@@ -81,7 +96,7 @@ function TemplatePartItem(_ref2) {
|
|
|
81
96
|
onMouseLeave: cancelHighlightBlock,
|
|
82
97
|
onFocus: highlightBlock,
|
|
83
98
|
onBlur: cancelHighlightBlock
|
|
84
|
-
},
|
|
99
|
+
}, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label), createElement(DropdownMenu, {
|
|
85
100
|
icon: moreVertical,
|
|
86
101
|
label: __('More options'),
|
|
87
102
|
className: "edit-site-template-details__template-areas-item-more"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["sprintf","__","DropdownMenu","MenuGroup","MenuItem","useSelect","useDispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["sprintf","__","DropdownMenu","MenuGroup","MenuItem","useSelect","useDispatch","store","editorStore","blockEditorStore","moreVertical","editSiteStore","isTemplateRevertable","useLocation","useLink","TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","revertTemplate","params","editLinkProps","postId","id","postType","type","fromTemplateId","editTemplatePart","event","onClick","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","templatePartArea","select","defaultAreas","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","area","highlightBlock","cancelHighlightBlock","icon","label","TemplateAreas","templateParts","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,YAAT,EAAuBC,SAAvB,EAAkCC,QAAlC,QAAkD,uBAAlD;AACA,SAASC,SA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ownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { useLocation } from '../routes';\nimport { useLink } from '../routes/link';\n\nfunction TemplatePartItemMore( {\n\tonClose,\n\ttemplatePart,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { params } = useLocation();\n\tconst editLinkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: templatePart.type,\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tfunction editTemplatePart( event ) {\n\t\teditLinkProps.onClick( event );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\tfunction clearCustomizations() {\n\t\trevertTemplate( templatePart );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem { ...editLinkProps } onClick={ editTemplatePart }>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\t\ttemplatePart.title?.rendered\n\t\t\t\t\t) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t\t{ isTemplateRevertable( templatePart ) && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ clearCustomizations }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction TemplatePartItem( {\n\ttemplatePart,\n\tclientId,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { selectBlock, toggleBlockHighlight } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst templatePartArea = useSelect(\n\t\t( select ) => {\n\t\t\tconst defaultAreas = select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\treturn defaultAreas.find(\n\t\t\t\t( defaultArea ) => defaultArea.area === templatePart.area\n\t\t\t);\n\t\t},\n\t\t[ templatePart.area ]\n\t);\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<div\n\t\t\trole=\"menuitem\"\n\t\t\tclassName=\"edit-site-template-details__template-areas-item\"\n\t\t>\n\t\t\t<MenuItem\n\t\t\t\trole=\"button\"\n\t\t\t\ticon={ templatePartArea?.icon }\n\t\t\t\ticonPosition=\"left\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} }\n\t\t\t\tonMouseOver={ highlightBlock }\n\t\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\t\tonFocus={ highlightBlock }\n\t\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\t>\n\t\t\t\t{ templatePartArea?.label }\n\t\t\t</MenuItem>\n\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\tclassName=\"edit-site-template-details__template-areas-item-more\"\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<TemplatePartItemMore\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</div>\n\t);\n}\n\nexport default function TemplateAreas( { closeTemplateDetailsDropdown } ) {\n\tconst templateParts = useSelect(\n\t\t( select ) => select( editSiteStore ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup\n\t\t\tlabel={ __( 'Areas' ) }\n\t\t\tclassName=\"edit-site-template-details__group edit-site-template-details__template-areas\"\n\t\t>\n\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t<TemplatePartItem\n\t\t\t\t\tkey={ templatePart.slug }\n\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
|
@@ -54,20 +54,15 @@ export default function ConvertToTemplatePart(_ref) {
|
|
|
54
54
|
}));
|
|
55
55
|
createSuccessNotice(__('Template part created.'), {
|
|
56
56
|
type: 'snackbar'
|
|
57
|
-
});
|
|
57
|
+
}); // The modal and this component will be unmounted because of `replaceBlocks` above,
|
|
58
|
+
// so no need to call `closeModal` or `onClose`.
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
return createElement(Fragment, null, createElement(BlockSettingsMenuControls, null,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
onClick: () => {
|
|
66
|
-
setIsModalOpen(true);
|
|
67
|
-
onClose();
|
|
68
|
-
}
|
|
69
|
-
}, __('Make template part'));
|
|
70
|
-
}), isModalOpen && createElement(CreateTemplatePartModal, {
|
|
61
|
+
return createElement(Fragment, null, createElement(BlockSettingsMenuControls, null, () => createElement(MenuItem, {
|
|
62
|
+
onClick: () => {
|
|
63
|
+
setIsModalOpen(true);
|
|
64
|
+
}
|
|
65
|
+
}, __('Make template part'))), isModalOpen && createElement(CreateTemplatePartModal, {
|
|
71
66
|
closeModal: () => {
|
|
72
67
|
setIsModalOpen(false);
|
|
73
68
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["kebabCase","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","MenuItem","createBlock","serialize","__","useState","coreStore","noticesStore","CreateTemplatePartModal","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","saveEntityRecord","createSuccessNotice","onConvert","title","area","templatePart","slug","content","theme","type"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["kebabCase","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","MenuItem","createBlock","serialize","__","useState","coreStore","noticesStore","CreateTemplatePartModal","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","saveEntityRecord","createSuccessNotice","onConvert","title","area","templatePart","slug","content","theme","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,mBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,SAAlB,QAAmC,sBAAnC;AACA,SAASP,KAAK,IAAIQ,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,qBAAT,OAAwD;AAAA,MAAxB;AAAEC,IAAAA,SAAF;AA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AACA,KAHF;AAIC,IAAA,QAAQ,EAAGI;AAJZ,IAbF,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: kebabCase( title ),\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ () => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Make template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect } from '@wordpress/element';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { getQueryArg, addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
9
8
|
*/
|
|
10
9
|
|
|
10
|
+
import { useLocation, useHistory } from '../routes';
|
|
11
11
|
import { store as editSiteStore } from '../../store';
|
|
12
12
|
export default function URLQueryController() {
|
|
13
13
|
const {
|
|
@@ -15,18 +15,22 @@ export default function URLQueryController() {
|
|
|
15
15
|
setTemplatePart,
|
|
16
16
|
showHomepage,
|
|
17
17
|
setPage
|
|
18
|
-
} = useDispatch(editSiteStore);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!postId) {
|
|
25
|
-
showHomepage();
|
|
26
|
-
return;
|
|
18
|
+
} = useDispatch(editSiteStore);
|
|
19
|
+
const history = useHistory();
|
|
20
|
+
const {
|
|
21
|
+
params: {
|
|
22
|
+
postId,
|
|
23
|
+
postType
|
|
27
24
|
}
|
|
25
|
+
} = useLocation();
|
|
26
|
+
const {
|
|
27
|
+
getPage,
|
|
28
|
+
getEditedPostId,
|
|
29
|
+
getEditedPostType
|
|
30
|
+
} = useSelect(editSiteStore); // Set correct entity on page navigation.
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
let isMounted = true;
|
|
30
34
|
|
|
31
35
|
if ('page' === postType || 'post' === postType) {
|
|
32
36
|
setPage({
|
|
@@ -40,48 +44,35 @@ export default function URLQueryController() {
|
|
|
40
44
|
} else if ('wp_template_part' === postType) {
|
|
41
45
|
setTemplatePart(postId);
|
|
42
46
|
} else {
|
|
43
|
-
showHomepage()
|
|
44
|
-
|
|
45
|
-
}, []); // Update page URL when context changes.
|
|
46
|
-
|
|
47
|
-
const pageContext = useCurrentPageContext();
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
const newUrl = pageContext ? addQueryArgs(window.location.href, pageContext) : removeQueryArgs(window.location.href, 'postType', 'postId');
|
|
50
|
-
window.history.replaceState({}, '', newUrl);
|
|
51
|
-
}, [pageContext]);
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function useCurrentPageContext() {
|
|
56
|
-
return useSelect(select => {
|
|
57
|
-
var _page$context, _page$context2;
|
|
58
|
-
|
|
59
|
-
const {
|
|
60
|
-
getEditedPostType,
|
|
61
|
-
getEditedPostId,
|
|
62
|
-
getPage
|
|
63
|
-
} = select(editSiteStore);
|
|
64
|
-
const page = getPage();
|
|
65
|
-
|
|
66
|
-
let _postId = getEditedPostId(),
|
|
67
|
-
_postType = getEditedPostType(); // This doesn't seem right to me,
|
|
68
|
-
// we shouldn't be using the "page" and the "template" in the same way.
|
|
69
|
-
// This need to be investigated.
|
|
47
|
+
showHomepage().then(() => {
|
|
48
|
+
var _page$context, _page$context2;
|
|
70
49
|
|
|
50
|
+
if (!isMounted) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
71
53
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
54
|
+
const page = getPage();
|
|
55
|
+
const editedPostId = getEditedPostId();
|
|
56
|
+
const editedPostType = getEditedPostType();
|
|
76
57
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
58
|
+
if (page !== null && page !== void 0 && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId && page !== null && page !== void 0 && (_page$context2 = page.context) !== null && _page$context2 !== void 0 && _page$context2.postType) {
|
|
59
|
+
history.replace({
|
|
60
|
+
postId: page.context.postId,
|
|
61
|
+
postType: page.context.postType
|
|
62
|
+
});
|
|
63
|
+
} else if (editedPostId && editedPostType) {
|
|
64
|
+
history.replace({
|
|
65
|
+
postId: editedPostId,
|
|
66
|
+
postType: editedPostType
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
82
70
|
}
|
|
83
71
|
|
|
84
|
-
return
|
|
85
|
-
|
|
72
|
+
return () => {
|
|
73
|
+
isMounted = false;
|
|
74
|
+
};
|
|
75
|
+
}, [postId, postType]);
|
|
76
|
+
return null;
|
|
86
77
|
}
|
|
87
78
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useSelect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useSelect","useLocation","useHistory","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","showHomepage","setPage","history","params","postId","postType","getPage","getEditedPostId","getEditedPostType","isMounted","context","then","page","editedPostId","editedPostType","replace"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,WAAxC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA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M,EAAEQ,IAAI,CAACF,OAAL,CAAaN,MADL;AAEhBC,YAAAA,QAAQ,EAAEO,IAAI,CAACF,OAAL,CAAaL;AAFP,WAAjB;AAIA,SALD,MAKO,IAAKQ,YAAY,IAAIC,cAArB,EAAsC;AAC5CZ,UAAAA,OAAO,CAACa,OAAR,CAAiB;AAChBX,YAAAA,MAAM,EAAES,YADQ;AAEhBR,YAAAA,QAAQ,EAAES;AAFM,WAAjB;AAIA;AACD,OApBD;AAqBA;;AAED,WAAO,MAAM;AACZL,MAAAA,SAAS,GAAG,KAAZ;AACA,KAFD;AAGA,GApCQ,EAoCN,CAAEL,MAAF,EAAUC,QAAV,CApCM,CAAT;AAsCA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, showHomepage, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\tconst { getPage, getEditedPostId, getEditedPostType } = useSelect(\n\t\teditSiteStore\n\t);\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\n\t\tlet isMounted = true;\n\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t} else {\n\t\t\tshowHomepage().then( () => {\n\t\t\t\tif ( ! isMounted ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst page = getPage();\n\t\t\t\tconst editedPostId = getEditedPostId();\n\t\t\t\tconst editedPostType = getEditedPostType();\n\n\t\t\t\tif ( page?.context?.postId && page?.context?.postType ) {\n\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\tpostId: page.context.postId,\n\t\t\t\t\t\tpostType: page.context.postType,\n\t\t\t\t\t} );\n\t\t\t\t} else if ( editedPostId && editedPostType ) {\n\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\tpostId: editedPostId,\n\t\t\t\t\t\tpostType: editedPostType,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t};\n\t}, [ postId, postType ] );\n\n\treturn null;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { Guide } from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
9
|
import { createInterpolateElement } from '@wordpress/element';
|
|
@@ -17,6 +17,12 @@ export default function WelcomeGuideEditor() {
|
|
|
17
17
|
const {
|
|
18
18
|
toggleFeature
|
|
19
19
|
} = useDispatch(editSiteStore);
|
|
20
|
+
const isActive = useSelect(select => select(editSiteStore).isFeatureActive('welcomeGuide'), []);
|
|
21
|
+
|
|
22
|
+
if (!isActive) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
return createElement(Guide, {
|
|
21
27
|
className: "edit-site-welcome-guide",
|
|
22
28
|
contentLabel: __('Welcome to the site editor'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/editor.js"],"names":["useDispatch","Guide","__","createInterpolateElement","WelcomeGuideImage","store","editSiteStore","WelcomeGuideEditor","toggleFeature","image","content","StylesIconImage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/editor.js"],"names":["useDispatch","useSelect","Guide","__","createInterpolateElement","WelcomeGuideImage","store","editSiteStore","WelcomeGuideEditor","toggleFeature","isActive","select","isFeatureActive","image","content","StylesIconImage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,SAA9B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAoBT,WAAW,CAAEO,aAAF,CAArC;AAEA,QAAMG,QAAQ,GAAGT,SAAS,CACvBU,MAAF,IAAcA,MAAM,CAAEJ,aAAF,CAAN,CAAwBK,eAAxB,CAAyC,cAAzC,CADW,EAEzB,EAFyB,CAA1B;;AAKA,MAAK,CAAEF,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAGP,EAAE,CAAE,4BAAF,CAFlB;AAGC,IAAA,gBAAgB,EAAGA,EAAE,CAAE,aAAF,CAHtB;AAIC,IAAA,QAAQ,EAAG,MAAMM,aAAa,CAAE,cAAF,CAJ/B;AAKC,IAAA,KAAK,EAAG,CACP;AACCI,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,0DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGX,EAAE,CAAE,gBAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,2FADG,CADL,CAJD,EASC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGC,wBAAwB,CACzBD,EAAE,CACD,2GADC,CADuB,EAIzB;AACCY,QAAAA,eAAe,EACd;AACC,UAAA,GAAG,EAAGZ,EAAE,CAAE,QAAF,CADT;AAEC,UAAA,GAAG,EAAC;AAFL;AAFF,OAJyB,CAD3B,CATD;AARF,KADO;AALT,IADD;AA6CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideEditor() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\tconst isActive = useSelect(\n\t\t( select ) => select( editSiteStore ).isFeatureActive( 'welcomeGuide' ),\n\t\t[]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to the site editor' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/edit-your-site.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/edit-your-site.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Edit your site' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Design everything on your site — from the header right down to the footer — using blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tStylesIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'styles' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
8
3
|
/**
|
|
9
4
|
* Internal dependencies
|
|
10
5
|
*/
|
|
11
|
-
|
|
12
6
|
import WelcomeGuideEditor from './editor';
|
|
13
7
|
import WelcomeGuideStyles from './styles';
|
|
14
|
-
import { store as editSiteStore } from '../../store';
|
|
15
8
|
export default function WelcomeGuide() {
|
|
16
|
-
|
|
17
|
-
isActive,
|
|
18
|
-
isStylesOpen
|
|
19
|
-
} = useSelect(select => {
|
|
20
|
-
const sidebar = select(interfaceStore).getActiveComplementaryArea(editSiteStore.name);
|
|
21
|
-
const isStylesSidebar = sidebar === 'edit-site/global-styles';
|
|
22
|
-
const feature = isStylesSidebar ? 'welcomeGuideStyles' : 'welcomeGuide';
|
|
23
|
-
return {
|
|
24
|
-
isActive: select(editSiteStore).isFeatureActive(feature),
|
|
25
|
-
isStylesOpen: isStylesSidebar
|
|
26
|
-
};
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
if (!isActive) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return isStylesOpen ? createElement(WelcomeGuideStyles, null) : createElement(WelcomeGuideEditor, null);
|
|
9
|
+
return createElement(Fragment, null, createElement(WelcomeGuideEditor, null), createElement(WelcomeGuideStyles, null));
|
|
34
10
|
}
|
|
35
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/index.js"],"names":["WelcomeGuideEditor","WelcomeGuideStyles","WelcomeGuide"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,kBAAP,MAA+B,UAA/B;AACA,OAAOC,kBAAP,MAA+B,UAA/B;AAEA,eAAe,SAASC,YAAT,GAAwB;AACtC,SACC,8BACC,cAAC,kBAAD,OADD,EAEC,cAAC,kBAAD,OAFD,CADD;AAMA","sourcesContent":["/**\n * Internal dependencies\n */\nimport WelcomeGuideEditor from './editor';\nimport WelcomeGuideStyles from './styles';\n\nexport default function WelcomeGuide() {\n\treturn (\n\t\t<>\n\t\t\t<WelcomeGuideEditor />\n\t\t\t<WelcomeGuideStyles />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -3,9 +3,10 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { ExternalLink, Guide } from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
@@ -16,6 +17,21 @@ export default function WelcomeGuideStyles() {
|
|
|
16
17
|
const {
|
|
17
18
|
toggleFeature
|
|
18
19
|
} = useDispatch(editSiteStore);
|
|
20
|
+
const {
|
|
21
|
+
isActive,
|
|
22
|
+
isStylesOpen
|
|
23
|
+
} = useSelect(select => {
|
|
24
|
+
const sidebar = select(interfaceStore).getActiveComplementaryArea(editSiteStore.name);
|
|
25
|
+
return {
|
|
26
|
+
isActive: select(editSiteStore).isFeatureActive('welcomeGuideStyles'),
|
|
27
|
+
isStylesOpen: sidebar === 'edit-site/global-styles'
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
if (!isActive || !isStylesOpen) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
return createElement(Guide, {
|
|
20
36
|
className: "edit-site-welcome-guide",
|
|
21
37
|
contentLabel: __('Welcome to styles'),
|
|
@@ -61,7 +77,7 @@ export default function WelcomeGuideStyles() {
|
|
|
61
77
|
}, __('Learn more')), createElement("p", {
|
|
62
78
|
className: "edit-site-welcome-guide__text"
|
|
63
79
|
}, __('New to block themes and styling your site? '), createElement(ExternalLink, {
|
|
64
|
-
href: __('https://wordpress.org/support/article/
|
|
80
|
+
href: __('https://wordpress.org/support/article/styles-overview/')
|
|
65
81
|
}, __('Here’s a detailed guide to learn how to make the most of it.'))))
|
|
66
82
|
}]
|
|
67
83
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["useDispatch","ExternalLink","Guide","__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["useDispatch","useSelect","ExternalLink","Guide","__","store","interfaceStore","WelcomeGuideImage","editSiteStore","WelcomeGuideStyles","toggleFeature","isActive","isStylesOpen","select","sidebar","getActiveComplementaryArea","name","isFeatureActive","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,SAA9B;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAoBV,WAAW,CAAEQ,aAAF,CAArC;AAEA,QAAM;AAAEG,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA6BX,SAAS,CAAIY,MAAF,IAAc;AAC3D,UAAMC,OAAO,GAAGD,MAAM,CAAEP,cAAF,CAAN,CAAyBS,0BAAzB,CACfP,aAAa,CAACQ,IADC,CAAhB;AAIA,WAAO;AACNL,MAAAA,QAAQ,EAAEE,MAAM,CAAEL,aAAF,CAAN,CAAwBS,eAAxB,CACT,oBADS,CADJ;AAINL,MAAAA,YAAY,EAAEE,OAAO,K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O,EA6DP;AACCc,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGf,EAAE,CAAE,YAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,6CADG,CADL,EAIC,cAAC,YAAD;AACC,QAAA,IAAI,EAAGA,EAAE,CACR,wDADQ;AADV,SAKGA,EAAE,CACH,8DADG,CALL,CAJD,CAJD;AARF,KA7DO;AALT,IADD;AAmGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\tconst { isActive, isStylesOpen } = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\n\t\treturn {\n\t\t\tisActive: select( editSiteStore ).isFeatureActive(\n\t\t\t\t'welcomeGuideStyles'\n\t\t\t),\n\t\t\tisStylesOpen: sidebar === 'edit-site/global-styles',\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive || ! isStylesOpen ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to styles' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuideStyles' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to Styles' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Set the design' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Personalize blocks' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn more' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to block themes and styling your site? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/styles-overview/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Here’s a detailed guide to learn how to make the most of it.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
|