@wordpress/edit-site 5.12.6 → 5.12.7
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/block-editor/use-site-editor-settings.js +10 -5
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +1 -1
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -2
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +1 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +1 -1
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +2 -10
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/index.js +1 -0
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +68 -43
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-hub/index.js +1 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/template-actions/index.js +22 -6
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +2 -2
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +2 -2
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +1 -2
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +10 -5
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +1 -1
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -2
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +1 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +1 -1
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -3
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +2 -10
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/index.js +1 -0
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +71 -44
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-hub/index.js +1 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/template-actions/index.js +24 -7
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +2 -2
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +2 -2
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +1 -2
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +48 -7
- package/build-style/style.css +48 -7
- package/package.json +19 -19
- package/src/components/block-editor/use-site-editor-settings.js +8 -4
- package/src/components/create-pattern-modal/index.js +1 -1
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/header-edit-mode/document-actions/style.scss +8 -0
- package/src/components/header-edit-mode/index.js +17 -9
- package/src/components/layout/index.js +1 -1
- package/src/components/layout/style.scss +0 -11
- package/src/components/page/header.js +1 -1
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/grid-item.js +6 -1
- package/src/components/page-patterns/patterns-list.js +3 -3
- package/src/components/page-patterns/use-patterns.js +3 -9
- package/src/components/page-template-parts/index.js +1 -1
- package/src/components/page-templates/index.js +1 -1
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-navigation-screen/style.scss +19 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +56 -39
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +36 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +10 -6
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +85 -75
- package/src/components/sidebar-navigation-screen-patterns/style.scss +26 -1
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/site-hub/index.js +1 -1
- package/src/components/template-actions/index.js +38 -8
- package/src/components/welcome-guide/page.js +2 -2
- package/src/components/welcome-guide/template.js +2 -2
- package/src/hooks/commands/use-edit-mode-commands.js +0 -1
- package/src/store/private-actions.js +5 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/src/components/page-content-focus-manager/constants.js +0 -5
package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
CHANGED
|
@@ -2,19 +2,28 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
5
7
|
|
|
6
|
-
const
|
|
8
|
+
const useTemplatePartsGroupedByArea = items => {
|
|
7
9
|
const allItems = items || [];
|
|
10
|
+
const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []); // Create map of template areas ensuring that default areas are displayed before
|
|
11
|
+
// any custom registered template part areas.
|
|
12
|
+
|
|
13
|
+
const knownAreas = {
|
|
14
|
+
header: {},
|
|
15
|
+
footer: {},
|
|
16
|
+
sidebar: {},
|
|
17
|
+
uncategorized: {}
|
|
18
|
+
};
|
|
19
|
+
templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { ...templatePartArea,
|
|
20
|
+
templateParts: []
|
|
21
|
+
});
|
|
8
22
|
const groupedByArea = allItems.reduce((accumulator, item) => {
|
|
9
23
|
const key = accumulator[item.area] ? item.area : 'uncategorized';
|
|
10
|
-
accumulator[key].push(item);
|
|
24
|
+
accumulator[key].templateParts.push(item);
|
|
11
25
|
return accumulator;
|
|
12
|
-
},
|
|
13
|
-
header: [],
|
|
14
|
-
footer: [],
|
|
15
|
-
sidebar: [],
|
|
16
|
-
uncategorized: []
|
|
17
|
-
});
|
|
26
|
+
}, knownAreas);
|
|
18
27
|
return groupedByArea;
|
|
19
28
|
};
|
|
20
29
|
|
|
@@ -28,7 +37,7 @@ export default function useTemplatePartAreas() {
|
|
|
28
37
|
return {
|
|
29
38
|
hasTemplateParts: templateParts ? !!templateParts.length : false,
|
|
30
39
|
isLoading,
|
|
31
|
-
templatePartAreas:
|
|
40
|
+
templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
|
|
32
41
|
};
|
|
33
42
|
}
|
|
34
43
|
//# sourceMappingURL=use-template-part-areas.js.map
|
package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"names":["useEntityRecords","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"names":["useEntityRecords","useSelect","store","editorStore","useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","knownAreas","header","footer","sidebar","uncategorized","forEach","templatePartArea","area","templateParts","groupedByArea","reduce","accumulator","item","key","push","useTemplatePartAreas","records","isResolving","isLoading","per_page","hasTemplateParts","length"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,sBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;;AAEA,MAAMC,6BAA6B,GAAKC,KAAF,IAAa;AAClD,Q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AA,iBAAiB,EAAEH,6BAA6B,CAAEc,aAAF;AAH1C,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst useTemplatePartsGroupedByArea = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\t// Create map of template areas ensuring that default areas are displayed before\n\t// any custom registered template part areas.\n\tconst knownAreas = {\n\t\theader: {},\n\t\tfooter: {},\n\t\tsidebar: {},\n\t\tuncategorized: {},\n\t};\n\n\ttemplatePartAreas.forEach(\n\t\t( templatePartArea ) =>\n\t\t\t( knownAreas[ templatePartArea.area ] = {\n\t\t\t\t...templatePartArea,\n\t\t\t\ttemplateParts: [],\n\t\t\t} )\n\t);\n\n\tconst groupedByArea = allItems.reduce( ( accumulator, item ) => {\n\t\tconst key = accumulator[ item.area ] ? item.area : 'uncategorized';\n\t\taccumulator[ key ].templateParts.push( item );\n\t\treturn accumulator;\n\t}, knownAreas );\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: useTemplatePartsGroupedByArea( templateParts ),\n\t};\n}\n"]}
|
|
@@ -144,7 +144,7 @@ const SiteHub = forwardRef((props, ref) => {
|
|
|
144
144
|
className: "edit-site-site-hub_toggle-command-center",
|
|
145
145
|
icon: search,
|
|
146
146
|
onClick: () => openCommandCenter(),
|
|
147
|
-
label: __('Open command
|
|
147
|
+
label: __('Open command palette')
|
|
148
148
|
})));
|
|
149
149
|
});
|
|
150
150
|
export default SiteHub;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["classnames","useSelect","useDispatch","Button","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__experimentalHStack","HStack","useReducedMotion","__","store","blockEditorStore","coreStore","decodeEntities","forwardRef","search","external","commandsStore","editSiteStore","SiteIcon","unlock","HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","homeUrl","select","getCanvasMode","getSettings","getUnstableBase","__experimentalDashboardLink","home","open","openCommandCenter","disableMotion","setCanvasMode","clearSelectedBlock","isBackToDashboardButton","siteIconButtonProps","href","label","role","onClick","event","preventDefault","siteTitle","getEntityRecord","title","className","type","duration","ease","scale","opacity","delay"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,MADD,EAECC,gBAAgB,IAAIC,MAFrB,EAGCC,yBAAyB,IAAIC,eAH9B,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,kBAAjC;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,qBAAvC;AAEA;AACA;AACA;;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,aAAvC;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAMC,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAGR,UAAU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F,CALD,EA+EGS,UAAU,KAAK,MAAf,IACD,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,IAAI,EAAGV,MAFR;AAGC,IAAA,OAAO,EAAG,MAAMoB,iBAAiB,EAHlC;AAIC,IAAA,KAAK,EAAG1B,EAAE,CAAE,qBAAF;AAJX,IAhFF,CAXD,CADD;AAsGA,CArJyB,CAA1B;AAuJA,eAAea,OAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { forwardRef } from '@wordpress/element';\nimport { search, external } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../lock-unlock';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef( ( props, ref ) => {\n\tconst { canvasMode, dashboardLink, homeUrl } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tdashboardLink:\n\t\t\t\tgetSettings().__experimentalDashboardLink || 'index.php',\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tconst disableMotion = useReducedMotion();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink,\n\t\t\t\tlabel: __( 'Go back to the Dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\thref: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.\n\t\t\t\trole: 'button',\n\t\t\t\tlabel: __( 'Open Navigation' ),\n\t\t\t\tonClick: ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( canvasMode === 'edit' ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t };\n\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames( 'edit-site-site-hub', props.className ) }\n\t\t\tinitial={ false }\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"space-between\"\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"edit-site-site-hub__container\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\t\tspacing=\"0\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\t\tlayout\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 1,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\twhileHover={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 0.96,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ canvasMode === 'edit' }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: canvasMode === 'view' ? 1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__site-title\"\n\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\tdelay: canvasMode === 'view' ? 0.1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\tlabel={ __( 'View site' ) }\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'View site (opens in a new tab)'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__site-view-link\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-site-hub_toggle-command-center\"\n\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\t\tlabel={ __( 'Open command center' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["classnames","useSelect","useDispatch","Button","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__experimentalHStack","HStack","useReducedMotion","__","store","blockEditorStore","coreStore","decodeEntities","forwardRef","search","external","commandsStore","editSiteStore","SiteIcon","unlock","HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","homeUrl","select","getCanvasMode","getSettings","getUnstableBase","__experimentalDashboardLink","home","open","openCommandCenter","disableMotion","setCanvasMode","clearSelectedBlock","isBackToDashboardButton","siteIconButtonProps","href","label","role","onClick","event","preventDefault","siteTitle","getEntityRecord","title","className","type","duration","ease","scale","opacity","delay"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,MADD,EAECC,gBAAgB,IAAIC,MAFrB,EAGCC,yBAAyB,IAAIC,eAH9B,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,kBAAjC;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,qBAAvC;AAEA;AACA;AACA;;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,aAAvC;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAMC,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAGR,UAAU,CAAE,CAAES,KAAF,EAASC,GAAT,KAAkB;AAC7C,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6BC,IAAAA;AAA7B,MAAyC5B,SAAS,CAAI6B,MAAF,IAAc;AACvE,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAiCV,MAAM,CAC5CQ,MAAM,CAAEV,aAAF,CADsC,CAA7C;AAIA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","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { forwardRef } from '@wordpress/element';\nimport { search, external } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../lock-unlock';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef( ( props, ref ) => {\n\tconst { canvasMode, dashboardLink, homeUrl } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tdashboardLink:\n\t\t\t\tgetSettings().__experimentalDashboardLink || 'index.php',\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tconst disableMotion = useReducedMotion();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink,\n\t\t\t\tlabel: __( 'Go back to the Dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\thref: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.\n\t\t\t\trole: 'button',\n\t\t\t\tlabel: __( 'Open Navigation' ),\n\t\t\t\tonClick: ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( canvasMode === 'edit' ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t };\n\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames( 'edit-site-site-hub', props.className ) }\n\t\t\tinitial={ false }\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"space-between\"\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"edit-site-site-hub__container\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\t\tspacing=\"0\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\t\tlayout\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 1,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\twhileHover={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 0.96,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ canvasMode === 'edit' }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: canvasMode === 'view' ? 1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__site-title\"\n\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\tdelay: canvasMode === 'view' ? 0.1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\tlabel={ __( 'View site' ) }\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'View site (opens in a new tab)'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__site-view-link\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-site-hub_toggle-command-center\"\n\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\t\tlabel={ __( 'Open command palette' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"]}
|
|
@@ -5,8 +5,9 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { useState } from '@wordpress/element';
|
|
8
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
-
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
10
|
+
import { DropdownMenu, MenuGroup, MenuItem, __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
10
11
|
import { moreVertical } from '@wordpress/icons';
|
|
11
12
|
import { store as noticesStore } from '@wordpress/notices';
|
|
12
13
|
/**
|
|
@@ -73,15 +74,14 @@ export default function TemplateActions({
|
|
|
73
74
|
}) => createElement(MenuGroup, null, isRemovable && createElement(Fragment, null, createElement(RenameMenuItem, {
|
|
74
75
|
template: template,
|
|
75
76
|
onClose: onClose
|
|
76
|
-
}), createElement(
|
|
77
|
-
|
|
78
|
-
isTertiary: true,
|
|
79
|
-
onClick: () => {
|
|
77
|
+
}), createElement(DeleteMenuItem, {
|
|
78
|
+
onRemove: () => {
|
|
80
79
|
removeTemplate(template);
|
|
81
80
|
onRemove?.();
|
|
82
81
|
onClose();
|
|
83
|
-
}
|
|
84
|
-
|
|
82
|
+
},
|
|
83
|
+
isTemplate: template.type === 'wp_template'
|
|
84
|
+
})), isRevertable && createElement(MenuItem, {
|
|
85
85
|
info: __('Use the template as supplied by the theme.'),
|
|
86
86
|
onClick: () => {
|
|
87
87
|
revertAndSaveTemplate();
|
|
@@ -89,4 +89,21 @@ export default function TemplateActions({
|
|
|
89
89
|
}
|
|
90
90
|
}, __('Clear customizations'))));
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
function DeleteMenuItem({
|
|
94
|
+
onRemove,
|
|
95
|
+
isTemplate
|
|
96
|
+
}) {
|
|
97
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
98
|
+
return createElement(Fragment, null, createElement(MenuItem, {
|
|
99
|
+
isDestructive: true,
|
|
100
|
+
isTertiary: true,
|
|
101
|
+
onClick: () => setIsModalOpen(true)
|
|
102
|
+
}, __('Delete')), createElement(ConfirmDialog, {
|
|
103
|
+
isOpen: isModalOpen,
|
|
104
|
+
onConfirm: onRemove,
|
|
105
|
+
onCancel: () => setIsModalOpen(false),
|
|
106
|
+
confirmButtonText: __('Delete')
|
|
107
|
+
}, isTemplate ? __('Are you sure you want to delete this template?') : __('Are you sure you want to delete this template part?')));
|
|
108
|
+
}
|
|
92
109
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"names":["useDispatch","useSelect","store","coreStore","__","sprintf","DropdownMenu","MenuGroup","MenuItem","moreVertical","noticesStore","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenameMenuItem","TemplateActions","postType","postId","className","toggleProps","onRemove","template","select","getEntityRecord","removeTemplate","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","title","rendered","error","errorMessage","message","code","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"names":["useDispatch","useSelect","store","coreStore","useState","__","sprintf","DropdownMenu","MenuGroup","MenuItem","__experimentalConfirmDialog","ConfirmDialog","moreVertical","noticesStore","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenameMenuItem","TemplateActions","postType","postId","className","toggleProps","onRemove","template","select","getEntityRecord","removeTemplate","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","title","rendered","error","errorMessage","message","code","onClose","DeleteMenuItem","isTemplate","isModalOpen","setIsModalOpen"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,2BAA2B,IAAIC,aAJhC,QAKO,uBALP;AAMA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASV,KAAK,IAAIW,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,a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D,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC5C,QAAQ,CAAE,KAAF,CAAhD;AACA,SACC,8BACC,cAAC,QAAD;AACC,IAAA,aAAa,MADd;AAEC,IAAA,UAAU,MAFX;AAGC,IAAA,OAAO,EAAG,MAAM4C,cAAc,CAAE,IAAF;AAH/B,KAKG3C,EAAE,CAAE,QAAF,CALL,CADD,EAQC,cAAC,aAAD;AACC,IAAA,MAAM,EAAG0C,WADV;AAEC,IAAA,SAAS,EAAGxB,QAFb;AAGC,IAAA,QAAQ,EAAG,MAAMyB,cAAc,CAAE,KAAF,CAHhC;AAIC,IAAA,iBAAiB,EAAG3C,EAAE,CAAE,QAAF;AAJvB,KAMGyC,UAAU,GACTzC,EAAE,CAAE,gDAAF,CADO,GAETA,EAAE,CACF,qDADE,CARN,CARD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport RenameMenuItem from './rename-menu-item';\n\nexport default function TemplateActions( {\n\tpostType,\n\tpostId,\n\tclassName,\n\ttoggleProps,\n\tonRemove,\n} ) {\n\tconst template = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', postType, postId ),\n\t\t[ postType, postId ]\n\t);\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" reverted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while reverting the entity.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName={ className }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<DeleteMenuItem\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonRemove?.();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tisTemplate={ template.type === 'wp_template' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction DeleteMenuItem( { onRemove, isTemplate } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tisDestructive\n\t\t\t\tisTertiary\n\t\t\t\tonClick={ () => setIsModalOpen( true ) }\n\t\t\t>\n\t\t\t\t{ __( 'Delete' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ onRemove }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t>\n\t\t\t\t{ isTemplate\n\t\t\t\t\t? __( 'Are you sure you want to delete this template?' )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'Are you sure you want to delete this template part?'\n\t\t\t\t\t ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -29,7 +29,7 @@ export default function WelcomeGuidePage() {
|
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const heading = __('Editing
|
|
32
|
+
const heading = __('Editing a page');
|
|
33
33
|
|
|
34
34
|
return createElement(Guide, {
|
|
35
35
|
className: "edit-site-welcome-guide guide-page",
|
|
@@ -52,7 +52,7 @@ export default function WelcomeGuidePage() {
|
|
|
52
52
|
className: "edit-site-welcome-guide__heading"
|
|
53
53
|
}, heading), createElement("p", {
|
|
54
54
|
className: "edit-site-welcome-guide__text"
|
|
55
|
-
}, __('
|
|
55
|
+
}, __('It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.')))
|
|
56
56
|
}]
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/page.js"],"names":["useDispatch","useSelect","Guide","__","store","preferencesStore","editSiteStore","WelcomeGuidePage","toggle","isVisible","select","isPageActive","get","isEditorActive","hasPageContentFocus","heading","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,gBAAT,GAA4B;AAC1C,QAAM;AAAEC,IAAAA;AAAF,MAAaR,WAAW,CAAEK,gBAAF,CAA9B;AAEA,QAAMI,SAAS,GAAGR,SAAS,CAAIS,MAAF,IAAc;AAC1C,UAAMC,YAAY,GAAG,CAAC,CAAED,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CACvB,gBADuB,EAEvB,kBAFuB,CAAxB;AAIA,UAAMC,cAAc,GAAG,CAAC,CAAEH,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CACzB,gBADyB,EAEzB,cAFyB,CAA1B;AAIA,UAAM;AAAEE,MAAAA;AAAF,QAA0BJ,MAAM,CAAEJ,aAAF,CAAtC;AACA,WAAOK,YAAY,IAAI,CAAEE,cAAlB,IAAoCC,mBAAmB,EAA9D;AACA,GAX0B,EAWxB,EAXwB,CAA3B;;AAaA,MAAK,CAAEL,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMM,OAAO,GAAGZ,EAAE,CAAE,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/page.js"],"names":["useDispatch","useSelect","Guide","__","store","preferencesStore","editSiteStore","WelcomeGuidePage","toggle","isVisible","select","isPageActive","get","isEditorActive","hasPageContentFocus","heading","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,gBAAT,GAA4B;AAC1C,QAAM;AAAEC,IAAAA;AAAF,MAAaR,WAAW,CAAEK,gBAAF,CAA9B;AAEA,QAAMI,SAAS,GAAGR,SAAS,CAAIS,MAAF,IAAc;AAC1C,UAAMC,YAAY,GAAG,CAAC,CAAED,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CACvB,gBADuB,EAEvB,kBAFuB,CAAxB;AAIA,UAAMC,cAAc,GAAG,CAAC,CAAEH,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CACzB,gBADyB,EAEzB,cAFyB,CAA1B;AAIA,UAAM;AAAEE,MAAAA;AAAF,QAA0BJ,MAAM,CAAEJ,aAAF,CAAtC;AACA,WAAOK,YAAY,IAAI,CAAEE,cAAlB,IAAoCC,mBAAmB,EAA9D;AACA,GAX0B,EAWxB,EAXwB,CAA3B;;AAaA,MAAK,CAAEL,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMM,OAAO,GAAGZ,EAAE,CAAE,gBAAF,CAAlB;;AAEA,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,oCADX;AAEC,IAAA,YAAY,EAAGY,OAFhB;AAGC,IAAA,gBAAgB,EAAGZ,EAAE,CAAE,UAAF,CAHtB;AAIC,IAAA,QAAQ,EAAG,MAAMK,MAAM,CAAE,gBAAF,EAAoB,kBAApB,CAJxB;AAKC,IAAA,KAAK,EAAG,CACP;AACCQ,MAAAA,KAAK,EACJ;AACC,QAAA,SAAS,EAAC,gCADX;AAEC,QAAA,QAAQ,MAFT;AAGC,QAAA,IAAI,MAHL;AAIC,QAAA,KAAK,MAJN;AAKC,QAAA,KAAK,EAAC,KALP;AAMC,QAAA,MAAM,EAAC;AANR,SAQC;AACC,QAAA,GAAG,EAAC,2DADL;AAEC,QAAA,IAAI,EAAC;AAFN,QARD,CAFF;AAgBCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGF,OADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGZ,EAAE,CACH,uLADG,CADL,CAJD;AAjBF,KADO;AALT,IADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuidePage() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst isPageActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuidePage'\n\t\t);\n\t\tconst isEditorActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuide'\n\t\t);\n\t\tconst { hasPageContentFocus } = select( editSiteStore );\n\t\treturn isPageActive && ! isEditorActive && hasPageContentFocus();\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a page' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-page\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () => toggle( 'core/edit-site', 'welcomeGuidePage' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-page.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\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{ heading }\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'It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.'\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"]}
|
|
@@ -30,7 +30,7 @@ export default function WelcomeGuideTemplate() {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const heading = __('Editing
|
|
33
|
+
const heading = __('Editing a template');
|
|
34
34
|
|
|
35
35
|
return createElement(Guide, {
|
|
36
36
|
className: "edit-site-welcome-guide guide-template",
|
|
@@ -53,7 +53,7 @@ export default function WelcomeGuideTemplate() {
|
|
|
53
53
|
className: "edit-site-welcome-guide__heading"
|
|
54
54
|
}, heading), createElement("p", {
|
|
55
55
|
className: "edit-site-welcome-guide__text"
|
|
56
|
-
}, __('
|
|
56
|
+
}, __('Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.')))
|
|
57
57
|
}]
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/template.js"],"names":["useDispatch","useSelect","Guide","__","store","preferencesStore","editSiteStore","WelcomeGuideTemplate","toggle","isVisible","select","isTemplateActive","get","isEditorActive","isPage","hasPageContentFocus","heading","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAaR,WAAW,CAAEK,gBAAF,CAA9B;AAEA,QAAMI,SAAS,GAAGR,SAAS,CAAIS,MAAF,IAAc;AAC1C,UAAMC,gBAAgB,GAAG,CAAC,CAAED,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CAC3B,gBAD2B,EAE3B,sBAF2B,CAA5B;AAIA,UAAMC,cAAc,GAAG,CAAC,CAAEH,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CACzB,gBADyB,EAEzB,cAFyB,CAA1B;AAIA,UAAM;AAAEE,MAAAA,MAAF;AAAUC,MAAAA;AAAV,QAAkCL,MAAM,CAAEJ,aAAF,CAA9C;AACA,WACCK,gBAAgB,IAChB,CAAEE,cADF,IAEAC,MAAM,EAFN,IAGA,CAAEC,mBAAmB,EAJtB;AAMA,GAhB0B,EAgBxB,EAhBwB,CAA3B;;AAkBA,MAAK,CAAEN,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMO,OAAO,GAAGb,EAAE,CAAE,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/template.js"],"names":["useDispatch","useSelect","Guide","__","store","preferencesStore","editSiteStore","WelcomeGuideTemplate","toggle","isVisible","select","isTemplateActive","get","isEditorActive","isPage","hasPageContentFocus","heading","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAaR,WAAW,CAAEK,gBAAF,CAA9B;AAEA,QAAMI,SAAS,GAAGR,SAAS,CAAIS,MAAF,IAAc;AAC1C,UAAMC,gBAAgB,GAAG,CAAC,CAAED,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CAC3B,gBAD2B,EAE3B,sBAF2B,CAA5B;AAIA,UAAMC,cAAc,GAAG,CAAC,CAAEH,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CACzB,gBADyB,EAEzB,cAFyB,CAA1B;AAIA,UAAM;AAAEE,MAAAA,MAAF;AAAUC,MAAAA;AAAV,QAAkCL,MAAM,CAAEJ,aAAF,CAA9C;AACA,WACCK,gBAAgB,IAChB,CAAEE,cADF,IAEAC,MAAM,EAFN,IAGA,CAAEC,mBAAmB,EAJtB;AAMA,GAhB0B,EAgBxB,EAhBwB,CAA3B;;AAkBA,MAAK,CAAEN,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMO,OAAO,GAAGb,EAAE,CAAE,oBAAF,CAAlB;;AAEA,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,YAAY,EAAGa,OAFhB;AAGC,IAAA,gBAAgB,EAAGb,EAAE,CAAE,UAAF,CAHtB;AAIC,IAAA,QAAQ,EAAG,MACVK,MAAM,CAAE,gBAAF,EAAoB,sBAApB,CALR;AAOC,IAAA,KAAK,EAAG,CACP;AACCS,MAAAA,KAAK,EACJ;AACC,QAAA,SAAS,EAAC,gCADX;AAEC,QAAA,QAAQ,MAFT;AAGC,QAAA,IAAI,MAHL;AAIC,QAAA,KAAK,MAJN;AAKC,QAAA,KAAK,EAAC,KALP;AAMC,QAAA,MAAM,EAAC;AANR,SAQC;AACC,QAAA,GAAG,EAAC,+DADL;AAEC,QAAA,IAAI,EAAC;AAFN,QARD,CAFF;AAgBCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGF,OADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGb,EAAE,CACH,4MADG,CADL,CAJD;AAjBF,KADO;AAPT,IADD;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst isTemplateActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuideTemplate'\n\t\t);\n\t\tconst isEditorActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuide'\n\t\t);\n\t\tconst { isPage, hasPageContentFocus } = select( editSiteStore );\n\t\treturn (\n\t\t\tisTemplateActive &&\n\t\t\t! isEditorActive &&\n\t\t\tisPage() &&\n\t\t\t! hasPageContentFocus()\n\t\t);\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a template' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-template\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () =>\n\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideTemplate' )\n\t\t\t}\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-template.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\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{ heading }\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'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.'\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"]}
|
|
@@ -265,8 +265,7 @@ export function useEditModeCommands() {
|
|
|
265
265
|
});
|
|
266
266
|
useCommandLoader({
|
|
267
267
|
name: 'core/edit-site/manipulate-document',
|
|
268
|
-
hook: useManipulateDocumentCommands
|
|
269
|
-
context: 'site-editor-edit'
|
|
268
|
+
hook: useManipulateDocumentCommands
|
|
270
269
|
});
|
|
271
270
|
useCommandLoader({
|
|
272
271
|
name: 'core/edit-site/edit-ui',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"names":["useSelect","useDispatch","__","isRTL","trash","backup","layout","page","drawerLeft","drawerRight","blockDefault","cog","code","keyboardClose","useCommandLoader","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","unlock","useHistory","usePageContentFocusCommands","isPage","canvasMode","hasPageContentFocus","select","getCanvasMode","setHasPageContentFocus","isLoading","commands","push","name","label","icon","callback","close","useManipulateDocumentCommands","isLoaded","record","template","removeTemplate","revertTemplate","history","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","editorMode","activeSidebar","getEditorMode","getActiveComplementaryArea","openModal","toggle","useEditModeCommands","hook","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,KADD,EAECC,MAFD,EAGCC,MAHD,EAICC,IAJD,EAKCC,UALD,EA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BwB,IAAAA,IAAI,EAAE,wBADW;AAEjByB,IAAAA,IAAI,EAAEX;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\ttrash,\n\tbackup,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcog,\n\tcode,\n\tkeyboardClose,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { isPage, canvasMode, hasPageContentFocus } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisPage: select( editSiteStore ).isPage(),\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\thasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setHasPageContentFocus } = useDispatch( editSiteStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( hasPageContentFocus ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: __( 'Edit template' ),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( false );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( true );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst hasPageContentFocus = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentFocus(),\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Reset template' )\n\t\t\t\t: __( 'Reset template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: backup,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Delete template' )\n\t\t\t\t: __( 'Delete template part' );\n\t\tconst path =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar, switchEditorMode } =\n\t\tuseDispatch( editSiteStore );\n\tconst { canvasMode, editorMode, activeSidebar } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"names":["useSelect","useDispatch","__","isRTL","trash","backup","layout","page","drawerLeft","drawerRight","blockDefault","cog","code","keyboardClose","useCommandLoader","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","unlock","useHistory","usePageContentFocusCommands","isPage","canvasMode","hasPageContentFocus","select","getCanvasMode","setHasPageContentFocus","isLoading","commands","push","name","label","icon","callback","close","useManipulateDocumentCommands","isLoaded","record","template","removeTemplate","revertTemplate","history","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","editorMode","activeSidebar","getEditorMode","getActiveComplementaryArea","openModal","toggle","useEditModeCommands","hook","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,KADD,EAECC,MAFD,EAGCC,MAHD,EAICC,IAJD,EAKCC,UALD,EAMCC,WAND,EAOCC,YAPD,EAQCC,GARD,EASCC,IATD,EAUCC,aAVD,QAWO,kBAXP;AAYA,SAASC,gBAAT,QAAiC,qBAAjC;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SAASD,KAAK,IAAIE,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AACA,OAAOC,qBAAP,MAAkC,2CAAlC;AACA,OAAOC,mBAAP,MAAgC,mCAAhC;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,iCAAT,QAAkD,+CAAlD;AACA,SAASC,sBAAT,QAAuC,oCAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAiBD,MAAM,CAAEV,iBAAF,C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dC,IAAAA,IAAI,EAAE,yBADQ;AAEdC,IAAAA,KAAK,EAAErC,EAAE,CAAE,yBAAF,CAFK;AAGdsC,IAAAA,IAAI,EAAE3B,aAHQ;AAId4B,IAAAA,QAAQ,EAAE,MAAM;AACfmB,MAAAA,SAAS,CAAEpC,iCAAF,CAAT;AACA;AANa,GAAf;AASA,SAAO;AACNW,IAAAA,SAAS,EAAE,KADL;AAENC,IAAAA;AAFM,GAAP;AAIA;;AAED,OAAO,SAAS0B,mBAAT,GAA+B;AACrChD,EAAAA,gBAAgB,CAAE;AACjBwB,IAAAA,IAAI,EAAE,mCADW;AAEjByB,IAAAA,IAAI,EAAEnC,2BAFW;AAGjBoC,IAAAA,OAAO,EAAE;AAHQ,GAAF,CAAhB;AAMAlD,EAAAA,gBAAgB,CAAE;AACjBwB,IAAAA,IAAI,EAAE,oCADW;AAEjByB,IAAAA,IAAI,EAAEpB;AAFW,GAAF,CAAhB;AAKA7B,EAAAA,gBAAgB,CAAE;AACjBwB,IAAAA,IAAI,EAAE,wBADW;AAEjByB,IAAAA,IAAI,EAAEX;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\ttrash,\n\tbackup,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcog,\n\tcode,\n\tkeyboardClose,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { isPage, canvasMode, hasPageContentFocus } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisPage: select( editSiteStore ).isPage(),\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\thasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setHasPageContentFocus } = useDispatch( editSiteStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( hasPageContentFocus ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: __( 'Edit template' ),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( false );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( true );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst hasPageContentFocus = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentFocus(),\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Reset template' )\n\t\t\t\t: __( 'Reset template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: backup,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Delete template' )\n\t\t\t\t: __( 'Delete template part' );\n\t\tconst path =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar, switchEditorMode } =\n\t\tuseDispatch( editSiteStore );\n\tconst { canvasMode, editorMode, activeSidebar } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"]}
|
|
@@ -11,7 +11,8 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
11
11
|
|
|
12
12
|
export const setCanvasMode = mode => ({
|
|
13
13
|
registry,
|
|
14
|
-
dispatch
|
|
14
|
+
dispatch,
|
|
15
|
+
select
|
|
15
16
|
}) => {
|
|
16
17
|
registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
|
|
17
18
|
|
|
@@ -22,6 +23,11 @@ export const setCanvasMode = mode => ({
|
|
|
22
23
|
|
|
23
24
|
if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
|
|
24
25
|
dispatch.setIsListViewOpened(true);
|
|
26
|
+
} // Switch focus away from editing the template when switching to view mode.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if (mode === 'view' && select.isPage()) {
|
|
30
|
+
dispatch.setHasPageContentFocus(true);
|
|
25
31
|
}
|
|
26
32
|
};
|
|
27
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","select","__unstableSetEditorMode","type","get","setIsListViewOpened","isPage","setHasPageContentFocus","setEditorCanvasContainerView","view"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,QAAZ;AAAsBC,EAAAA;AAAtB,CAAF,KAAsC;AACrCF,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCO,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAFqC,CAMrC;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNE,MADF,CACUL,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA,GAdoC,CAerC;;;AACA,MAAKP,IAAI,KAAK,MAAT,IAAmBG,MAAM,CAACK,MAAP,EAAxB,EAA0C;AACzCN,IAAAA,QAAQ,CAACO,sBAAT,CAAiC,IAAjC;AACA;AACD,CArBK;AAuBP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAET,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch, select } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t\t// Switch focus away from editing the template when switching to view mode.\n\t\tif ( mode === 'view' && select.isPage() ) {\n\t\t\tdispatch.setHasPageContentFocus( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"]}
|
|
@@ -1459,6 +1459,16 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1459
1459
|
color: currentColor;
|
|
1460
1460
|
background: #e0e0e0;
|
|
1461
1461
|
}
|
|
1462
|
+
@media (min-width: 782px) {
|
|
1463
|
+
.edit-site-document-actions {
|
|
1464
|
+
width: 50%;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
@media (min-width: 960px) {
|
|
1468
|
+
.edit-site-document-actions {
|
|
1469
|
+
width: min(100%, 450px);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1462
1472
|
|
|
1463
1473
|
.edit-site-document-actions__command {
|
|
1464
1474
|
grid-column: 1/-1;
|
|
@@ -2533,11 +2543,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
2533
2543
|
display: flex;
|
|
2534
2544
|
flex-direction: column;
|
|
2535
2545
|
}
|
|
2536
|
-
@media (min-width: 782px) {
|
|
2537
|
-
.edit-site-layout .block-editor-block-contextual-toolbar.is-fixed {
|
|
2538
|
-
width: calc(100% - 240px - 64px - 56px);
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
2546
|
|
|
2542
2547
|
.edit-site-layout__hub {
|
|
2543
2548
|
position: fixed;
|
|
@@ -3015,6 +3020,20 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3015
3020
|
border-top: 1px solid #2f2f2f;
|
|
3016
3021
|
}
|
|
3017
3022
|
|
|
3023
|
+
.edit-site-sidebar__notice {
|
|
3024
|
+
background: #2f2f2f;
|
|
3025
|
+
color: #ddd;
|
|
3026
|
+
margin: 24px 0;
|
|
3027
|
+
}
|
|
3028
|
+
.edit-site-sidebar__notice.is-dismissible {
|
|
3029
|
+
padding-left: 8px;
|
|
3030
|
+
}
|
|
3031
|
+
.edit-site-sidebar__notice .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):focus,
|
|
3032
|
+
.edit-site-sidebar__notice .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):active,
|
|
3033
|
+
.edit-site-sidebar__notice .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover {
|
|
3034
|
+
color: #f0f0f0;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3018
3037
|
/* In general style overrides are discouraged.
|
|
3019
3038
|
* This is a temporary solution to override the InputControl component's styles.
|
|
3020
3039
|
* The `Theme` component will potentially be the more appropriate approach
|
|
@@ -3025,7 +3044,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3025
3044
|
width: 100%;
|
|
3026
3045
|
}
|
|
3027
3046
|
.edit-site-sidebar-navigation-screen__input-control .components-input-control__container {
|
|
3028
|
-
background:
|
|
3047
|
+
background: #2f2f2f;
|
|
3048
|
+
}
|
|
3049
|
+
.edit-site-sidebar-navigation-screen__input-control .components-input-control__container .components-button {
|
|
3050
|
+
color: #e0e0e0 !important;
|
|
3029
3051
|
}
|
|
3030
3052
|
.edit-site-sidebar-navigation-screen__input-control .components-input-control__input {
|
|
3031
3053
|
color: #e0e0e0 !important;
|
|
@@ -3174,7 +3196,26 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3174
3196
|
}
|
|
3175
3197
|
|
|
3176
3198
|
.edit-site-sidebar-navigation-screen-patterns__group {
|
|
3177
|
-
margin-bottom:
|
|
3199
|
+
margin-bottom: 32px;
|
|
3200
|
+
padding-bottom: 24px;
|
|
3201
|
+
border-bottom: 1px solid #2f2f2f;
|
|
3202
|
+
}
|
|
3203
|
+
.edit-site-sidebar-navigation-screen-patterns__group:last-of-type, .edit-site-sidebar-navigation-screen-patterns__group:first-of-type {
|
|
3204
|
+
border-bottom: 0;
|
|
3205
|
+
padding-bottom: 0;
|
|
3206
|
+
margin-bottom: 0;
|
|
3207
|
+
}
|
|
3208
|
+
.edit-site-sidebar-navigation-screen-patterns__group:first-of-type {
|
|
3209
|
+
margin-bottom: 32px;
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
.edit-site-sidebar-navigation-screen-patterns__group-header p {
|
|
3213
|
+
color: #949494;
|
|
3214
|
+
}
|
|
3215
|
+
.edit-site-sidebar-navigation-screen-patterns__group-header h2 {
|
|
3216
|
+
font-size: 11px;
|
|
3217
|
+
font-weight: 500;
|
|
3218
|
+
text-transform: uppercase;
|
|
3178
3219
|
}
|
|
3179
3220
|
|
|
3180
3221
|
.edit-site-sidebar-navigation-screen-template__added-by-description {
|
package/build-style/style.css
CHANGED
|
@@ -1460,6 +1460,16 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1460
1460
|
color: currentColor;
|
|
1461
1461
|
background: #e0e0e0;
|
|
1462
1462
|
}
|
|
1463
|
+
@media (min-width: 782px) {
|
|
1464
|
+
.edit-site-document-actions {
|
|
1465
|
+
width: 50%;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
@media (min-width: 960px) {
|
|
1469
|
+
.edit-site-document-actions {
|
|
1470
|
+
width: min(100%, 450px);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1463
1473
|
|
|
1464
1474
|
.edit-site-document-actions__command {
|
|
1465
1475
|
grid-column: 1/-1;
|
|
@@ -2534,11 +2544,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
2534
2544
|
display: flex;
|
|
2535
2545
|
flex-direction: column;
|
|
2536
2546
|
}
|
|
2537
|
-
@media (min-width: 782px) {
|
|
2538
|
-
.edit-site-layout .block-editor-block-contextual-toolbar.is-fixed {
|
|
2539
|
-
width: calc(100% - 240px - 64px - 56px);
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
2547
|
|
|
2543
2548
|
.edit-site-layout__hub {
|
|
2544
2549
|
position: fixed;
|
|
@@ -3016,6 +3021,20 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3016
3021
|
border-top: 1px solid #2f2f2f;
|
|
3017
3022
|
}
|
|
3018
3023
|
|
|
3024
|
+
.edit-site-sidebar__notice {
|
|
3025
|
+
background: #2f2f2f;
|
|
3026
|
+
color: #ddd;
|
|
3027
|
+
margin: 24px 0;
|
|
3028
|
+
}
|
|
3029
|
+
.edit-site-sidebar__notice.is-dismissible {
|
|
3030
|
+
padding-right: 8px;
|
|
3031
|
+
}
|
|
3032
|
+
.edit-site-sidebar__notice .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):focus,
|
|
3033
|
+
.edit-site-sidebar__notice .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):active,
|
|
3034
|
+
.edit-site-sidebar__notice .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover {
|
|
3035
|
+
color: #f0f0f0;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3019
3038
|
/* In general style overrides are discouraged.
|
|
3020
3039
|
* This is a temporary solution to override the InputControl component's styles.
|
|
3021
3040
|
* The `Theme` component will potentially be the more appropriate approach
|
|
@@ -3026,7 +3045,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3026
3045
|
width: 100%;
|
|
3027
3046
|
}
|
|
3028
3047
|
.edit-site-sidebar-navigation-screen__input-control .components-input-control__container {
|
|
3029
|
-
background:
|
|
3048
|
+
background: #2f2f2f;
|
|
3049
|
+
}
|
|
3050
|
+
.edit-site-sidebar-navigation-screen__input-control .components-input-control__container .components-button {
|
|
3051
|
+
color: #e0e0e0 !important;
|
|
3030
3052
|
}
|
|
3031
3053
|
.edit-site-sidebar-navigation-screen__input-control .components-input-control__input {
|
|
3032
3054
|
color: #e0e0e0 !important;
|
|
@@ -3175,7 +3197,26 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3175
3197
|
}
|
|
3176
3198
|
|
|
3177
3199
|
.edit-site-sidebar-navigation-screen-patterns__group {
|
|
3178
|
-
margin-bottom:
|
|
3200
|
+
margin-bottom: 32px;
|
|
3201
|
+
padding-bottom: 24px;
|
|
3202
|
+
border-bottom: 1px solid #2f2f2f;
|
|
3203
|
+
}
|
|
3204
|
+
.edit-site-sidebar-navigation-screen-patterns__group:last-of-type, .edit-site-sidebar-navigation-screen-patterns__group:first-of-type {
|
|
3205
|
+
border-bottom: 0;
|
|
3206
|
+
padding-bottom: 0;
|
|
3207
|
+
margin-bottom: 0;
|
|
3208
|
+
}
|
|
3209
|
+
.edit-site-sidebar-navigation-screen-patterns__group:first-of-type {
|
|
3210
|
+
margin-bottom: 32px;
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3213
|
+
.edit-site-sidebar-navigation-screen-patterns__group-header p {
|
|
3214
|
+
color: #949494;
|
|
3215
|
+
}
|
|
3216
|
+
.edit-site-sidebar-navigation-screen-patterns__group-header h2 {
|
|
3217
|
+
font-size: 11px;
|
|
3218
|
+
font-weight: 500;
|
|
3219
|
+
text-transform: uppercase;
|
|
3179
3220
|
}
|
|
3180
3221
|
|
|
3181
3222
|
.edit-site-sidebar-navigation-screen-template__added-by-description {
|