@wordpress/edit-site 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/editor/index.js +6 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +35 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +6 -8
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +11 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +53 -0
- package/build/components/global-styles/effects-panel.js.map +1 -0
- package/build/components/global-styles/filters-panel.js +45 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/global-styles-provider.js +7 -4
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/preview.js +1 -1
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +14 -8
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-effects.js +15 -7
- package/build/components/global-styles/screen-effects.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +2 -2
- package/build/components/global-styles/screen-filters.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +8 -118
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +149 -0
- package/build/components/global-styles/style-variations-container.js.map +1 -0
- package/build/components/global-styles/ui.js +46 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +1 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -137
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +8 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -0
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/index.js +4 -0
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +8 -6
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +58 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js +5 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +114 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/site-hub/index.js +4 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/index.js +19 -0
- package/build/hooks/commands/index.js.map +1 -0
- package/build/hooks/commands/use-navigation-commands.js +117 -0
- package/build/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build/hooks/commands/use-wp-admin-commands.js +94 -0
- package/build/hooks/commands/use-wp-admin-commands.js.map +1 -0
- package/build/hooks/template-part-edit.js +2 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +2 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/editor/index.js +6 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +34 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +6 -6
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +11 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +43 -0
- package/build-module/components/global-styles/effects-panel.js.map +1 -0
- package/build-module/components/global-styles/filters-panel.js +35 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/global-styles-provider.js +8 -5
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/preview.js +1 -1
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +13 -8
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-effects.js +13 -4
- package/build-module/components/global-styles/screen-effects.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +2 -2
- package/build-module/components/global-styles/screen-filters.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -114
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +130 -0
- package/build-module/components/global-styles/style-variations-container.js.map +1 -0
- package/build-module/components/global-styles/ui.js +44 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -135
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +6 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -0
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -0
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +9 -7
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +41 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js +6 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +113 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/index.js +10 -0
- package/build-module/hooks/commands/index.js.map +1 -0
- package/build-module/hooks/commands/use-navigation-commands.js +101 -0
- package/build-module/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js +79 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -0
- package/build-module/hooks/template-part-edit.js +2 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +2 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +20 -46
- package/build-style/style.css +20 -46
- package/package.json +33 -31
- package/src/components/editor/index.js +11 -3
- package/src/components/global-styles/border-panel.js +32 -1
- package/src/components/global-styles/context-menu.js +6 -6
- package/src/components/global-styles/dimensions-panel.js +11 -0
- package/src/components/global-styles/effects-panel.js +40 -0
- package/src/components/global-styles/filters-panel.js +33 -0
- package/src/components/global-styles/global-styles-provider.js +4 -4
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/screen-block-list.js +9 -5
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-effects.js +12 -5
- package/src/components/global-styles/screen-filters.js +2 -2
- package/src/components/global-styles/screen-style-variations.js +10 -129
- package/src/components/global-styles/style-variations-container.js +136 -0
- package/src/components/global-styles/style.scss +0 -39
- package/src/components/global-styles/ui.js +44 -2
- package/src/components/header-edit-mode/more-menu/index.js +1 -1
- package/src/components/keyboard-shortcuts/index.js +1 -155
- package/src/components/layout/index.js +4 -0
- package/src/components/preferences-modal/index.js +7 -0
- package/src/components/sidebar/index.js +4 -0
- package/src/components/sidebar-navigation-screen/index.js +10 -5
- package/src/components/sidebar-navigation-screen/style.scss +20 -5
- package/src/components/sidebar-navigation-screen-global-styles/index.js +41 -0
- package/src/components/sidebar-navigation-screen-main/index.js +9 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +134 -9
- package/src/components/site-hub/index.js +3 -3
- package/src/components/start-template-options/style.scss +7 -14
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/hooks/commands/index.js +10 -0
- package/src/hooks/commands/use-navigation-commands.js +103 -0
- package/src/hooks/commands/use-wp-admin-commands.js +77 -0
- package/src/hooks/template-part-edit.js +1 -0
- package/src/index.js +1 -0
- package/src/store/selectors.js +2 -1
- package/build/components/global-styles/duotone-panel.js +0 -78
- package/build/components/global-styles/duotone-panel.js.map +0 -1
- package/build/components/global-styles/filter-utils.js +0 -17
- package/build/components/global-styles/filter-utils.js.map +0 -1
- package/build/components/global-styles/shadow-panel.js +0 -197
- package/build/components/global-styles/shadow-panel.js.map +0 -1
- package/build-module/components/global-styles/duotone-panel.js +0 -67
- package/build-module/components/global-styles/duotone-panel.js.map +0 -1
- package/build-module/components/global-styles/filter-utils.js +0 -9
- package/build-module/components/global-styles/filter-utils.js.map +0 -1
- package/build-module/components/global-styles/shadow-panel.js +0 -178
- package/build-module/components/global-styles/shadow-panel.js.map +0 -1
- package/src/components/global-styles/duotone-panel.js +0 -82
- package/src/components/global-styles/filter-utils.js +0 -9
- package/src/components/global-styles/shadow-panel.js +0 -178
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","select","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","select","getCanvasMode","getSettings","editSiteStore","__experimentalDashboardLink","disableMotion","setCanvasMode","clearSelectedBlock","blockEditorStore","isBackToDashboardButton","showLabels","siteIconButtonProps","href","label","onClick","siteTitle","coreStore","getEntityRecord","title","className","type","duration","ease"],"mappings":";;;;;;;;;AAkBA;;;;AAfA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAKA,MAAMA,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAG,yBAAY,CAAEC,KAAF,EAASC,GAAT,KAAkB;AAC7C,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAgC,qBAAaC,MAAF,IAAc;AAC9D,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAiC,yBACtCF,MAAM,CAAEG,YAAF,CADgC,CAAvC;AAGA,WAAO;AACNL,MAAAA,UAAU,EAAEG,aAAa,EADnB;AAENF,MAAAA,aAAa,EAAEG,WAAW,GAAGE;AAFvB,KAAP;AAIA,GARqC,EAQnC,EARmC,CAAtC;AASA,QAAMC,aAAa,GAAG,gCAAtB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaH,YAAb,CAAR,CAA1B;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAyB,uBAAaC,kBAAb,CAA/B;AACA,QAAMC,uBAAuB,GAAGX,UAAU,KAAK,MAA/C;AACA,QAAMY,UAAU,GAAGZ,UAAU,KAAK,MAAlC;AACA,QAAMa,mBAAmB,GAAGF,uBAAuB,GAChD;AACAG,IAAAA,IAAI,EAAEb,aAAa,IAAI,WADvB;AAEAc,IAAAA,KAAK,EAAE,cAAI,0BAAJ;AAFP,GADgD,GAKhD;AACAA,IAAAA,KAAK,EAAE,cAAI,yBAAJ,CADP;AAEAC,IAAAA,OAAO,EAAE,MAAM;AACdP,MAAAA,kBAAkB;AAClBD,MAAAA,aAAa,CAAE,MAAF,CAAb;AACA;AALD,GALH;AAYA,QAAMS,SAAS,GAAG,qBACff,MAAF;AAAA;;AAAA,oCACCA,MAAM,CAAEgB,eAAF,CAAN,CAAoBC,eAApB,CAAqC,MAArC,EAA6C,MAA7C,CADD,0DACC,sBAAuDC,KADxD;AAAA,GADiB,EAGjB,EAHiB,CAAlB;AAMA,SACC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,GAAG,EAAGrB;AADP,KAEMD,KAFN;AAGC,IAAA,SAAS,EAAG,yBAAY,oBAAZ,EAAkCA,KAAK,CAACuB,SAAxC,CAHb;AAIC,IAAA,MAAM,MAJP;AAKC,IAAA,UAAU,EAAG;AACZC,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEhB,aAAa,GAAG,CAAH,GAAOX,sBAFlB;AAGZ4B,MAAAA,IAAI,EAAE;AAHM;AALd,MAWC,4BAAC,gCAAD;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,SAAS,EAAC,kCAFX;AAGC,IAAA,OAAO,EAAC;AAHT,KAKC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,MAAM,MAFP;AAGC,IAAA,UAAU,EAAG;AACZF,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEhB,aAAa,GAAG,CAAH,GAAOX,sBAFlB;AAGZ4B,MAAAA,IAAI,EAAE;AAHM;AAHd,KASC,4BAAC,kBAAD,6BACMX,mBADN;AAEC,IAAA,SAAS,EAAC;AAFX,MAIC,4BAAC,iBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,IAJD,CATD,CALD,EAsBGD,UAAU,IACX;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,kCAAgBK,SAAhB,CADH,CAvBF,CAXD,CADD;AA0CA,CA3Ee,CAAhB;eA6EepB,O","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__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 { forwardRef } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../private-apis';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef( ( props, ref ) => {\n\tconst { canvasMode, dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\tconst disableMotion = useReducedMotion();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst showLabels = canvasMode !== 'edit';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink || 'index.php',\n\t\t\t\tlabel: __( 'Go back to the Dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\tlabel: __( 'Open Navigation Sidebar' ),\n\t\t\t\tonClick: () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t},\n\t\t };\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\tlayout\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=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\tspacing=\"0\"\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\tlayout\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</motion.div>\n\n\t\t\t\t{ showLabels && (\n\t\t\t\t\t<div className=\"edit-site-site-hub__site-title\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"]}
|
|
@@ -94,7 +94,7 @@ function WelcomeGuideStyles() {
|
|
|
94
94
|
}, (0, _i18n.__)('Learn more')), (0, _element.createElement)("p", {
|
|
95
95
|
className: "edit-site-welcome-guide__text"
|
|
96
96
|
}, (0, _i18n.__)('New to block themes and styling your site? '), (0, _element.createElement)(_components.ExternalLink, {
|
|
97
|
-
href: (0, _i18n.__)('https://wordpress.org/
|
|
97
|
+
href: (0, _i18n.__)('https://wordpress.org/documentation/article/styles-overview/')
|
|
98
98
|
}, (0, _i18n.__)('Here’s a detailed guide to learn how to make the most of it.'))))
|
|
99
99
|
}]
|
|
100
100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["WelcomeGuideStyles","toggle","preferencesStore","isActive","isStylesOpen","select","sidebar","interfaceStore","getActiveComplementaryArea","editSiteStore","name","get","image","content"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIe,SAASA,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AAEA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA6B,qBAAaC,MAAF,IAAc;AAC3D,UAAMC,OAAO,GAAGD,MAAM,CAAEE,gBAAF,CAAN,CAAyBC,0BAAzB,CACfC,aAAcC,IADC,CAAhB;AAIA,WAAO;AACNP,MAAAA,QAAQ,EAAE,CAAC,CAAEE,MAAM,CAAEH,kBAAF,CAAN,CAA2BS,GAA3B,CACZ,gBADY,EAEZ,oBAFY,CADP;AAKNP,MAAAA,YAAY,EAAEE,OAAO,KAAK;AALpB,KAAP;AAOA,GAZkC,EAYhC,EAZgC,CAAnC;;AAcA,MAAK,CAAEH,QAAF,IAAc,CAAEC,YAArB,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAG,cAAI,mBAAJ,CAFhB;AAGC,IAAA,gBAAgB,EAAG,cAAI,aAAJ,CAHpB;AAIC,IAAA,QAAQ,EAAG,MAAMH,MAAM,CAAE,gBAAF,EAAoB,oBAApB,CAJxB;AAKC,IAAA,KAAK,EAAG,CACP;AACCW,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,6DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,mBAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,2KADC,CADH,CAJD;AARF,KADO,EAqBP;AACCD,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,0DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,gBAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,8JADC,CADH,CAJD;AARF,KArBO,EAyCP;AACCD,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,8DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,oBAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,qLADC,CADH,CAJD;AARF,KAzCO,EA6DP;AACCD,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,YAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,6CADC,CADH,EAIC,4BAAC,wBAAD;AACC,QAAA,IAAI,EAAG,cACN,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["WelcomeGuideStyles","toggle","preferencesStore","isActive","isStylesOpen","select","sidebar","interfaceStore","getActiveComplementaryArea","editSiteStore","name","get","image","content"],"mappings":";;;;;;;;;;;AAGA;;AACA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AAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,gBAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,8JADC,CADH,CAJD;AARF,KArBO,EAyCP;AACCD,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,8DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,oBAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,qLADC,CADH,CAJD;AARF,KAzCO,EA6DP;AACCD,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,YAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,6CADC,CADH,EAIC,4BAAC,wBAAD;AACC,QAAA,IAAI,EAAG,cACN,8DADM;AADR,SAKG,cACD,8DADC,CALH,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';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggle } = useDispatch( preferencesStore );\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( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\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={ () => toggle( 'core/edit-site', '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/documentation/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"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCommands = useCommands;
|
|
7
|
+
|
|
8
|
+
var _useNavigationCommands = require("./use-navigation-commands");
|
|
9
|
+
|
|
10
|
+
var _useWpAdminCommands = require("./use-wp-admin-commands");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
function useCommands() {
|
|
16
|
+
(0, _useWpAdminCommands.useWPAdminCommands)();
|
|
17
|
+
(0, _useNavigationCommands.useNavigationCommands)();
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/index.js"],"names":["useCommands"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIO,SAASA,WAAT,GAAuB;AAC7B;AACA;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useNavigationCommands } from './use-navigation-commands';\nimport { useWPAdminCommands } from './use-wp-admin-commands';\n\nexport function useCommands() {\n\tuseWPAdminCommands();\n\tuseNavigationCommands();\n}\n"]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useNavigationCommands = useNavigationCommands;
|
|
7
|
+
|
|
8
|
+
var _commands = require("@wordpress/commands");
|
|
9
|
+
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
13
|
+
|
|
14
|
+
var _data = require("@wordpress/data");
|
|
15
|
+
|
|
16
|
+
var _coreData = require("@wordpress/core-data");
|
|
17
|
+
|
|
18
|
+
var _store = require("../../store");
|
|
19
|
+
|
|
20
|
+
var _privateApis = require("../../private-apis");
|
|
21
|
+
|
|
22
|
+
var _routes = require("../../components/routes");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
const {
|
|
32
|
+
useCommandLoader
|
|
33
|
+
} = (0, _privateApis.unlock)(_commands.privateApis);
|
|
34
|
+
|
|
35
|
+
const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader(_ref) {
|
|
36
|
+
let {
|
|
37
|
+
search
|
|
38
|
+
} = _ref;
|
|
39
|
+
const supportsSearch = !['wp_template', 'wp_template_part'].includes(postType);
|
|
40
|
+
const deps = supportsSearch ? [search] : [];
|
|
41
|
+
const history = (0, _routes.useHistory)();
|
|
42
|
+
const {
|
|
43
|
+
canvasMode,
|
|
44
|
+
records,
|
|
45
|
+
isLoading
|
|
46
|
+
} = (0, _data.useSelect)(select => {
|
|
47
|
+
const {
|
|
48
|
+
getEntityRecords
|
|
49
|
+
} = select(_coreData.store);
|
|
50
|
+
const query = supportsSearch ? {
|
|
51
|
+
search: !!search ? search : undefined,
|
|
52
|
+
per_page: 10,
|
|
53
|
+
orderby: search ? 'relevance' : 'date'
|
|
54
|
+
} : {
|
|
55
|
+
per_page: -1
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
records: getEntityRecords('postType', postType, query),
|
|
59
|
+
isLoading: !select(_coreData.store).hasFinishedResolution('getEntityRecords', ['postType', postType, query]),
|
|
60
|
+
canvasMode: (0, _privateApis.unlock)(select(_store.store)).getCanvasMode()
|
|
61
|
+
};
|
|
62
|
+
}, deps);
|
|
63
|
+
const commands = (0, _element.useMemo)(() => {
|
|
64
|
+
return (records !== null && records !== void 0 ? records : []).slice(0, 10).map(record => {
|
|
65
|
+
var _record$title, _record$title2, _record$title3;
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
name: ((_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) + ' ' + record.id,
|
|
69
|
+
label: (_record$title2 = record.title) !== null && _record$title2 !== void 0 && _record$title2.rendered ? (_record$title3 = record.title) === null || _record$title3 === void 0 ? void 0 : _record$title3.rendered : (0, _i18n.__)('(no title)'),
|
|
70
|
+
callback: _ref2 => {
|
|
71
|
+
let {
|
|
72
|
+
close
|
|
73
|
+
} = _ref2;
|
|
74
|
+
history.push({
|
|
75
|
+
postType,
|
|
76
|
+
postId: record.id,
|
|
77
|
+
canvas: canvasMode === 'edit' ? canvasMode : undefined
|
|
78
|
+
});
|
|
79
|
+
close();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}, [records, history, canvasMode]);
|
|
84
|
+
return {
|
|
85
|
+
commands,
|
|
86
|
+
isLoading
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const usePageNavigationCommandLoader = getNavigationCommandLoaderPerPostType('page');
|
|
91
|
+
const usePostNavigationCommandLoader = getNavigationCommandLoaderPerPostType('post');
|
|
92
|
+
const useTemplateNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template');
|
|
93
|
+
const useTemplatePartNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template_part');
|
|
94
|
+
|
|
95
|
+
function useNavigationCommands() {
|
|
96
|
+
useCommandLoader({
|
|
97
|
+
name: 'core/edit-site/navigate-pages',
|
|
98
|
+
group: (0, _i18n.__)('Pages'),
|
|
99
|
+
hook: usePageNavigationCommandLoader
|
|
100
|
+
});
|
|
101
|
+
useCommandLoader({
|
|
102
|
+
name: 'core/edit-site/navigate-posts',
|
|
103
|
+
group: (0, _i18n.__)('Posts'),
|
|
104
|
+
hook: usePostNavigationCommandLoader
|
|
105
|
+
});
|
|
106
|
+
useCommandLoader({
|
|
107
|
+
name: 'core/edit-site/navigate-templates',
|
|
108
|
+
group: (0, _i18n.__)('Templates'),
|
|
109
|
+
hook: useTemplateNavigationCommandLoader
|
|
110
|
+
});
|
|
111
|
+
useCommandLoader({
|
|
112
|
+
name: 'core/edit-site/navigate-template-parts',
|
|
113
|
+
group: (0, _i18n.__)('Template Parts'),
|
|
114
|
+
hook: useTemplatePartNavigationCommandLoader
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=use-navigation-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-navigation-commands.js"],"names":["useCommandLoader","privateApis","getNavigationCommandLoaderPerPostType","postType","useNavigationCommandLoader","search","supportsSearch","includes","deps","history","canvasMode","records","isLoading","select","getEntityRecords","coreStore","query","undefined","per_page","orderby","hasFinishedResolution","editSiteStore","getCanvasMode","commands","slice","map","record","name","title","rendered","id","label","callback","close","push","postId","canvas","usePageNavigationCommandLoader","usePostNavigationCommandLoader","useTemplateNavigationCommandLoader","useTemplatePartNavigationCommandLoader","useNavigationCommands","group","hook"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAdA;AACA;AACA;;AAOA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAuB,yBAAQC,qBAAR,CAA7B;;AAEA,MAAMC,qCAAqC,GAAKC,QAAF,IAC7C,SAASC,0BAAT,OAAkD;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AACjD,QAAMC,cAAc,GAAG,CAAE,CAAE,aAAF,EAAiB,kBAAjB,EAAsCC,QAAtC,CACxBJ,QADwB,CAAzB;AAGA,QAAMK,IAAI,GAAGF,cAAc,GAAG,CAAED,MAAF,CAAH,GAAgB,EAA3C;AACA,QAAMI,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,OAAd;AAAuBC,IAAAA;AAAvB,MAAqC,qBAAaC,MAAF,IAAc;AACnE,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,eAAF,CAAnC;AACA,UAAMC,KAAK,GAAGV,cAAc,GACzB;AACAD,MAAAA,MAAM,EAAE,CAAC,CAAEA,MAAH,GAAYA,MAAZ,GAAqBY,SAD7B;AAEAC,MAAAA,QAAQ,EAAE,EAFV;AAGAC,MAAAA,OAAO,EAAEd,MAAM,GAAG,WAAH,GAAiB;AAHhC,KADyB,GAMzB;AACAa,MAAAA,QAAQ,EAAE,CAAC;AADX,KANH;AASA,WAAO;AACNP,MAAAA,OAAO,EAAEG,gBAAgB,CAAE,UAAF,EAAcX,QAAd,EAAwBa,KAAxB,CADnB;AAENJ,MAAAA,SAAS,EAAE,CAAEC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AMoC,8BAA8B,GACnCpC,qCAAqC,CAAE,MAAF,CADtC;AAEA,MAAMqC,kCAAkC,GACvCrC,qCAAqC,CAAE,aAAF,CADtC;AAEA,MAAMsC,sCAAsC,GAC3CtC,qCAAqC,CAAE,kBAAF,CADtC;;AAGO,SAASuC,qBAAT,GAAiC;AACvCzC,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,+BADW;AAEjBe,IAAAA,KAAK,EAAE,cAAI,OAAJ,CAFU;AAGjBC,IAAAA,IAAI,EAAEN;AAHW,GAAF,CAAhB;AAKArC,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,+BADW;AAEjBe,IAAAA,KAAK,EAAE,cAAI,OAAJ,CAFU;AAGjBC,IAAAA,IAAI,EAAEL;AAHW,GAAF,CAAhB;AAKAtC,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,mCADW;AAEjBe,IAAAA,KAAK,EAAE,cAAI,WAAJ,CAFU;AAGjBC,IAAAA,IAAI,EAAEJ;AAHW,GAAF,CAAhB;AAKAvC,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,wCADW;AAEjBe,IAAAA,KAAK,EAAE,cAAI,gBAAJ,CAFU;AAGjBC,IAAAA,IAAI,EAAEH;AAHW,GAAF,CAAhB;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport { useHistory } from '../../components/routes';\n\nconst { useCommandLoader } = unlock( privateApis );\n\nconst getNavigationCommandLoaderPerPostType = ( postType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst supportsSearch = ! [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t);\n\t\tconst deps = supportsSearch ? [ search ] : [];\n\t\tconst history = useHistory();\n\t\tconst { canvasMode, records, isLoading } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst query = supportsSearch\n\t\t\t\t? {\n\t\t\t\t\t\tsearch: !! search ? search : undefined,\n\t\t\t\t\t\tper_page: 10,\n\t\t\t\t\t\torderby: search ? 'relevance' : 'date',\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t };\n\t\t\treturn {\n\t\t\t\trecords: getEntityRecords( 'postType', postType, query ),\n\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'postType', postType, query ]\n\t\t\t\t),\n\t\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\t};\n\t\t}, deps );\n\n\t\tconst commands = useMemo( () => {\n\t\t\treturn ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {\n\t\t\t\treturn {\n\t\t\t\t\tname: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t? record.title?.rendered\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\tpostId: record.id,\n\t\t\t\t\t\t\tcanvas:\n\t\t\t\t\t\t\t\tcanvasMode === 'edit' ? canvasMode : undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} );\n\t\t}, [ records, history, canvasMode ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst usePageNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'page' );\nconst usePostNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'post' );\nconst useTemplateNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'wp_template' );\nconst useTemplatePartNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'wp_template_part' );\n\nexport function useNavigationCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\tgroup: __( 'Pages' ),\n\t\thook: usePageNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\tgroup: __( 'Posts' ),\n\t\thook: usePostNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\tgroup: __( 'Templates' ),\n\t\thook: useTemplateNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\tgroup: __( 'Template Parts' ),\n\t\thook: useTemplatePartNavigationCommandLoader,\n\t} );\n}\n"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWPAdminCommands = useWPAdminCommands;
|
|
7
|
+
|
|
8
|
+
var _commands = require("@wordpress/commands");
|
|
9
|
+
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
|
|
14
|
+
var _url = require("@wordpress/url");
|
|
15
|
+
|
|
16
|
+
var _element = require("@wordpress/element");
|
|
17
|
+
|
|
18
|
+
var _store = require("../../store");
|
|
19
|
+
|
|
20
|
+
var _privateApis = require("../../private-apis");
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal dependencies
|
|
28
|
+
*/
|
|
29
|
+
const {
|
|
30
|
+
useCommandLoader
|
|
31
|
+
} = (0, _privateApis.unlock)(_commands.privateApis);
|
|
32
|
+
|
|
33
|
+
const getWPAdminAddCommandLoader = postType => function useAddCommandLoader(_ref) {
|
|
34
|
+
let {
|
|
35
|
+
search
|
|
36
|
+
} = _ref;
|
|
37
|
+
let label;
|
|
38
|
+
|
|
39
|
+
if (postType === 'post') {
|
|
40
|
+
label = (0, _i18n.__)('Add a new post');
|
|
41
|
+
} else if (postType === 'page') {
|
|
42
|
+
label = (0, _i18n.__)('Add a new page');
|
|
43
|
+
} else {
|
|
44
|
+
throw 'unsupported post type ' + postType;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const hasRecordTitle = !!search && !label.toLowerCase().includes(search.toLowerCase());
|
|
48
|
+
|
|
49
|
+
if (postType === 'post' && hasRecordTitle) {
|
|
50
|
+
/* translators: %s: Post title placeholder */
|
|
51
|
+
label = (0, _i18n.sprintf)((0, _i18n.__)('Add a new post "%s"'), search);
|
|
52
|
+
} else if (postType === 'page' && hasRecordTitle) {
|
|
53
|
+
/* translators: %s: Page title placeholder */
|
|
54
|
+
label = (0, _i18n.sprintf)((0, _i18n.__)('Add a new page "%s"'), search);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const newPostLink = (0, _data.useSelect)(select => {
|
|
58
|
+
var _getSettings$newPostL;
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
getSettings
|
|
62
|
+
} = (0, _privateApis.unlock)(select(_store.store));
|
|
63
|
+
return (_getSettings$newPostL = getSettings().newPostLink) !== null && _getSettings$newPostL !== void 0 ? _getSettings$newPostL : 'post-new.php';
|
|
64
|
+
}, []);
|
|
65
|
+
const commands = (0, _element.useMemo)(() => [{
|
|
66
|
+
name: 'core/wp-admin/add-' + postType,
|
|
67
|
+
label,
|
|
68
|
+
callback: () => {
|
|
69
|
+
document.location.href = (0, _url.addQueryArgs)(newPostLink, {
|
|
70
|
+
post_type: postType,
|
|
71
|
+
post_title: hasRecordTitle ? search : undefined
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}], [newPostLink, hasRecordTitle, search, label]);
|
|
75
|
+
return {
|
|
76
|
+
isLoading: false,
|
|
77
|
+
commands
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const useAddPostLoader = getWPAdminAddCommandLoader('post');
|
|
82
|
+
const useAddPageLoader = getWPAdminAddCommandLoader('page');
|
|
83
|
+
|
|
84
|
+
function useWPAdminCommands() {
|
|
85
|
+
useCommandLoader({
|
|
86
|
+
name: 'core/wp-admin/add-post-loader',
|
|
87
|
+
hook: useAddPostLoader
|
|
88
|
+
});
|
|
89
|
+
useCommandLoader({
|
|
90
|
+
name: 'core/wp-admin/add-page-loader',
|
|
91
|
+
hook: useAddPageLoader
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=use-wp-admin-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-wp-admin-commands.js"],"names":["useCommandLoader","privateApis","getWPAdminAddCommandLoader","postType","useAddCommandLoader","search","label","hasRecordTitle","toLowerCase","includes","newPostLink","select","getSettings","editSiteStore","commands","name","callback","document","location","href","post_type","post_title","undefined","isLoading","useAddPostLoader","useAddPageLoader","useWPAdminCommands","hook"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAuB,yBAAQC,qBAAR,CAA7B;;AAEA,MAAMC,0BAA0B,GAAKC,QAAF,IAClC,SAASC,mBAAT,OAA2C;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC1C,MAAIC,KAAJ;;AACA,MAAKH,QAAQ,KAAK,MAAlB,EAA2B;AAC1BG,IAAAA,KAAK,GAAG,cAAI,gBAAJ,CAAR;AACA,GAFD,MAEO,IAAKH,QAAQ,K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IAAAA;AAFM,GAAP;AAIA,CA7CF;;AA+CA,MAAMU,gBAAgB,GAAGtB,0BAA0B,CAAE,MAAF,CAAnD;AACA,MAAMuB,gBAAgB,GAAGvB,0BAA0B,CAAE,MAAF,CAAnD;;AAEO,SAASwB,kBAAT,GAA8B;AACpC1B,EAAAA,gBAAgB,CAAE;AACjBe,IAAAA,IAAI,EAAE,+BADW;AAEjBY,IAAAA,IAAI,EAAEH;AAFW,GAAF,CAAhB;AAIAxB,EAAAA,gBAAgB,CAAE;AACjBe,IAAAA,IAAI,EAAE,+BADW;AAEjBY,IAAAA,IAAI,EAAEF;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/commands';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useCommandLoader } = unlock( privateApis );\n\nconst getWPAdminAddCommandLoader = ( postType ) =>\n\tfunction useAddCommandLoader( { search } ) {\n\t\tlet label;\n\t\tif ( postType === 'post' ) {\n\t\t\tlabel = __( 'Add a new post' );\n\t\t} else if ( postType === 'page' ) {\n\t\t\tlabel = __( 'Add a new page' );\n\t\t} else {\n\t\t\tthrow 'unsupported post type ' + postType;\n\t\t}\n\t\tconst hasRecordTitle =\n\t\t\t!! search && ! label.toLowerCase().includes( search.toLowerCase() );\n\t\tif ( postType === 'post' && hasRecordTitle ) {\n\t\t\t/* translators: %s: Post title placeholder */\n\t\t\tlabel = sprintf( __( 'Add a new post \"%s\"' ), search );\n\t\t} else if ( postType === 'page' && hasRecordTitle ) {\n\t\t\t/* translators: %s: Page title placeholder */\n\t\t\tlabel = sprintf( __( 'Add a new page \"%s\"' ), search );\n\t\t}\n\n\t\tconst newPostLink = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\treturn getSettings().newPostLink ?? 'post-new.php';\n\t\t}, [] );\n\n\t\tconst commands = useMemo(\n\t\t\t() => [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/wp-admin/add-' + postType,\n\t\t\t\t\tlabel,\n\t\t\t\t\tcallback: () => {\n\t\t\t\t\t\tdocument.location.href = addQueryArgs( newPostLink, {\n\t\t\t\t\t\t\tpost_type: postType,\n\t\t\t\t\t\t\tpost_title: hasRecordTitle ? search : undefined,\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\t[ newPostLink, hasRecordTitle, search, label ]\n\t\t);\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nconst useAddPostLoader = getWPAdminAddCommandLoader( 'post' );\nconst useAddPageLoader = getWPAdminAddCommandLoader( 'page' );\n\nexport function useWPAdminCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/wp-admin/add-post-loader',\n\t\thook: useAddPostLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/wp-admin/add-page-loader',\n\t\thook: useAddPageLoader,\n\t} );\n}\n"]}
|
|
@@ -53,7 +53,8 @@ function EditTemplatePartMenuItem(_ref) {
|
|
|
53
53
|
}, [theme, slug]);
|
|
54
54
|
const linkProps = (0, _link.useLink)({
|
|
55
55
|
postId: templatePart === null || templatePart === void 0 ? void 0 : templatePart.id,
|
|
56
|
-
postType: templatePart === null || templatePart === void 0 ? void 0 : templatePart.type
|
|
56
|
+
postType: templatePart === null || templatePart === void 0 ? void 0 : templatePart.type,
|
|
57
|
+
canvas: 'edit'
|
|
57
58
|
}, {
|
|
58
59
|
fromTemplateId: params.postId
|
|
59
60
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","coreStore","getEntityRecord","linkProps","postId","id","postType","type","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,wBAAT,OAAoD;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,OAAGN,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA,GARmB,EASpB,CAAED,KAAF,EAASC,IAAT,CAToB,CAArB;AAYA,QAAMM,SAAS,GAAG,mBACjB;AACCC,IAAAA,MAAM,EAAEL,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEM,EADvB;AAECC,IAAAA,QAAQ,EAAEP,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEQ;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","coreStore","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,wBAAT,OAAoD;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAA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":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../components/routes';\nimport { useLink } from '../components/routes/link';\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
|
package/build/index.js
CHANGED
|
@@ -112,7 +112,8 @@ function initializeEditor(id, settings) {
|
|
|
112
112
|
keepCaretInsideBlock: false,
|
|
113
113
|
welcomeGuide: true,
|
|
114
114
|
welcomeGuideStyles: true,
|
|
115
|
-
showListViewByDefault: false
|
|
115
|
+
showListViewByDefault: false,
|
|
116
|
+
showBlockBreadcrumbs: true
|
|
116
117
|
});
|
|
117
118
|
(0, _data.dispatch)(_interface.store).setDefaultComplementaryArea('core/edit-site', 'edit-site/template');
|
|
118
119
|
(0, _data.dispatch)(_store.store).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["initializeEditor","id","settings","target","document","getElementById","root","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","interfaceStore","setDefaultComplementaryArea","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["initializeEditor","id","settings","target","document","getElementById","root","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","showBlockBreadcrumbs","interfaceStore","setDefaultComplementaryArea","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AA2EA;;AACA;;AACA;;AA1GA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBJ,EAAzB,CAAf;AACA,QAAMK,IAAI,GAAG,yBAAYH,MAAZ,CAAb;;AAEAD,EAAAA,QAAQ,CAACK,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6CP,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACQ,8BAAT,GAA0CC,oCAA1C;;AAEA,sBAAUC,aAAV,EAAwBC,qCAAxB;;AACA,QAAMC,UAAU,GAAG,iDAA8BC,MAA9B,CAClB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAI,KAAK,eAAzB;AAAA,GADkB,CAAnB;AAGA,wCAAoBF,UAApB;AACA,sBAAUF,aAAV,EAAwBK,4BAAxB,CAAsD,WAAtD;AACA,0CAA2B;AAAEC,IAAAA,QAAQ,EAAE;AAAZ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A8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t\tshowBlockBreadcrumbs: true,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
|
package/build/store/selectors.js
CHANGED
|
@@ -69,6 +69,7 @@ const __unstableGetPreference = (0, _data.createRegistrySelector)(select => (sta
|
|
|
69
69
|
/**
|
|
70
70
|
* Returns whether the given feature is enabled or not.
|
|
71
71
|
*
|
|
72
|
+
* @deprecated
|
|
72
73
|
* @param {Object} state Global application state.
|
|
73
74
|
* @param {string} featureName Feature slug.
|
|
74
75
|
*
|
|
@@ -79,7 +80,7 @@ const __unstableGetPreference = (0, _data.createRegistrySelector)(select => (sta
|
|
|
79
80
|
exports.__unstableGetPreference = __unstableGetPreference;
|
|
80
81
|
|
|
81
82
|
function isFeatureActive(state, featureName) {
|
|
82
|
-
(0, _deprecated.default)(`select( 'core/
|
|
83
|
+
(0, _deprecated.default)(`select( 'core/edit-site' ).isFeatureActive`, {
|
|
83
84
|
since: '6.0',
|
|
84
85
|
alternative: `select( 'core/preferences' ).get`
|
|
85
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["__unstableGetPreference","select","state","name","preferencesStore","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateType","templateId","template","getEditedEntityRecord","templateParts","blocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;A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AAA,OAAO,EAAE;AAFV,GAFD;AAOA;AAED;AACA;AACA;;;AACO,SAAS2B,4BAAT,GAAwC;AAC9C,2BAAY,2DAAZ,EAAyE;AACxE5D,IAAAA,KAAK,EAAE,KADiE;AAExEiC,IAAAA,OAAO,EAAE;AAF+D,GAAzE;AAIA;AAED;AACA;AACA;;;AACO,SAAS4B,kBAAT,GAA8B;AACpC,2BAAY,iDAAZ,EAA+D;AAC9D7D,IAAAA,KAAK,EAAE,KADuD;AAE9DiC,IAAAA,OAAO,EAAE;AAFqD,GAA/D;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\treturn getFilteredTemplatePartBlocks( template.blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["__unstableGetPreference","select","state","name","preferencesStore","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateType","templateId","template","getEditedEntityRecord","templateParts","blocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAG,kCACpCC,MAAF,IAAc,CAAEC,KAAF,EAASC,IAAT,KACbF,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,gBAAhC,EAAkDF,IAAlD,CAFq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;AACpC,2BAAY,iDAAZ,EAA+D;AAC9D7D,IAAAA,KAAK,EAAE,KADuD;AAE9DiC,IAAAA,OAAO,EAAE;AAFqD,GAA/D;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\treturn getFilteredTemplatePartBlocks( template.blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n"]}
|
|
@@ -61,7 +61,8 @@ export default function Editor() {
|
|
|
61
61
|
isRightSidebarOpen,
|
|
62
62
|
isInserterOpen,
|
|
63
63
|
isListViewOpen,
|
|
64
|
-
showIconLabels
|
|
64
|
+
showIconLabels,
|
|
65
|
+
showBlockBreadcrumbs
|
|
65
66
|
} = useSelect(select => {
|
|
66
67
|
const {
|
|
67
68
|
getEditedPostContext,
|
|
@@ -86,7 +87,8 @@ export default function Editor() {
|
|
|
86
87
|
isInserterOpen: isInserterOpened(),
|
|
87
88
|
isListViewOpen: isListViewOpened(),
|
|
88
89
|
isRightSidebarOpen: getActiveComplementaryArea(editSiteStore.name),
|
|
89
|
-
showIconLabels: select(preferencesStore).get('core/edit-site', 'showIconLabels')
|
|
90
|
+
showIconLabels: select(preferencesStore).get('core/edit-site', 'showIconLabels'),
|
|
91
|
+
showBlockBreadcrumbs: select(preferencesStore).get('core/edit-site', 'showBlockBreadcrumbs')
|
|
90
92
|
};
|
|
91
93
|
}, []);
|
|
92
94
|
const {
|
|
@@ -95,7 +97,7 @@ export default function Editor() {
|
|
|
95
97
|
const isViewMode = canvasMode === 'view';
|
|
96
98
|
const isEditMode = canvasMode === 'edit';
|
|
97
99
|
const showVisualEditor = isViewMode || editorMode === 'visual';
|
|
98
|
-
const
|
|
100
|
+
const shouldShowBlockBreakcrumbs = showBlockBreadcrumbs && isEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';
|
|
99
101
|
const shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;
|
|
100
102
|
const shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;
|
|
101
103
|
const secondarySidebarLabel = isListViewOpen ? __('List View') : __('Block Library');
|
|
@@ -145,7 +147,7 @@ export default function Editor() {
|
|
|
145
147
|
sidebar: isEditMode && isRightSidebarOpen && createElement(ComplementaryArea.Slot, {
|
|
146
148
|
scope: "core/edit-site"
|
|
147
149
|
}),
|
|
148
|
-
footer:
|
|
150
|
+
footer: shouldShowBlockBreakcrumbs && createElement(BlockBreadcrumb, {
|
|
149
151
|
rootLabelText: __('Template')
|
|
150
152
|
}),
|
|
151
153
|
labels: { ...interfaceLabels,
|