@wordpress/edit-site 6.12.0 → 6.12.1-next.082ed6819.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/utils.js +1 -2
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +0 -3
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +4 -12
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +18 -27
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +13 -5
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +133 -0
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +8 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/screen-block.js +18 -5
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +11 -5
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +17 -1
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -2
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +4 -8
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/post-edit/index.js +10 -12
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +3 -3
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js +3 -4
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app-routes/home.js +48 -0
- package/build/components/posts-app-routes/home.js.map +1 -0
- package/build/components/posts-app-routes/index.js +37 -0
- package/build/components/posts-app-routes/index.js.map +1 -0
- package/build/components/posts-app-routes/posts-edit.js +44 -0
- package/build/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view.js +48 -0
- package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-view.js +41 -0
- package/build/components/posts-app-routes/posts-view.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-editor-routes/index.js +1 -2
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/style-book/examples.js +24 -2
- package/build/components/style-book/examples.js.map +1 -1
- package/build/index.js +0 -9
- package/build/index.js.map +1 -1
- package/build/store/actions.js +13 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +21 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -2
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +0 -3
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +18 -27
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +13 -5
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +8 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +18 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -5
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +18 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -2
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +4 -8
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/post-edit/index.js +9 -11
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +2 -2
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +3 -4
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app-routes/home.js +40 -0
- package/build-module/components/posts-app-routes/home.js.map +1 -0
- package/build-module/components/posts-app-routes/index.js +30 -0
- package/build-module/components/posts-app-routes/index.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-edit.js +36 -0
- package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
- package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view.js +33 -0
- package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +1 -2
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/style-book/examples.js +24 -2
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/index.js +1 -10
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +13 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/posts-rtl.css +59 -18
- package/build-style/posts.css +59 -18
- package/build-style/style-rtl.css +74 -57
- package/build-style/style.css +74 -57
- package/package.json +38 -38
- package/src/components/add-new-template/utils.js +2 -2
- package/src/components/app/index.js +0 -3
- package/src/components/block-editor/use-site-editor-settings.js +7 -21
- package/src/components/editor/index.js +22 -33
- package/src/components/editor/use-editor-title.js +17 -4
- package/src/components/editor/use-resolve-edited-entity.js +132 -0
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/global-styles/block-preview-panel.js +10 -10
- package/src/components/global-styles/screen-block.js +26 -8
- package/src/components/global-styles/screen-style-variations.js +14 -5
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/global-styles-sidebar/index.js +16 -2
- package/src/components/page-patterns/header.js +3 -2
- package/src/components/page-patterns/use-patterns.js +9 -7
- package/src/components/page-templates/style.scss +1 -0
- package/src/components/post-edit/index.js +10 -13
- package/src/components/post-list/index.js +1 -2
- package/src/components/posts-app/index.js +3 -4
- package/src/components/posts-app-routes/home.js +36 -0
- package/src/components/posts-app-routes/index.js +36 -0
- package/src/components/posts-app-routes/posts-edit.js +31 -0
- package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
- package/src/components/posts-app-routes/posts-list-view.js +40 -0
- package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
- package/src/components/posts-app-routes/posts-view.js +35 -0
- package/src/components/sidebar-navigation-screen/style.scss +7 -2
- package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-global-styles/index.js +8 -17
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
- package/src/components/site-editor-routes/README.md +2 -2
- package/src/components/site-editor-routes/index.js +0 -2
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/examples.tsx +24 -2
- package/src/index.js +1 -13
- package/src/store/actions.js +15 -0
- package/src/store/selectors.js +24 -1
- package/src/style.scss +0 -2
- package/build/components/post-fields/index.js +0 -96
- package/build/components/post-fields/index.js.map +0 -1
- package/build/components/posts-app/router.js +0 -85
- package/build/components/posts-app/router.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build/components/site-editor-routes/styles-edit.js +0 -33
- package/build/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/build-module/components/post-fields/index.js +0 -88
- package/build-module/components/post-fields/index.js.map +0 -1
- package/build-module/components/posts-app/router.js +0 -77
- package/build-module/components/posts-app/router.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build-module/components/site-editor-routes/styles-edit.js +0 -25
- package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/src/components/post-fields/index.js +0 -107
- package/src/components/post-fields/style.scss +0 -3
- package/src/components/posts-app/router.js +0 -69
- package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
- package/src/components/site-editor-routes/styles-edit.js +0 -26
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -257
- package/src/store/test/actions.js +0 -83
- package/src/store/test/reducer.js +0 -69
- package/src/store/test/selectors.js +0 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_deprecated","_interopRequireDefault","_coreData","_blockEditor","_editor","_preferences","_constants","_lockUnlock","interfaceStore","unlock","editorPrivateApis","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","version","hint","editorStore","setDeviceType","exports","setTemplate","type","addTemplate","template","newTemplate","coreStore","saveEntityRecord","TEMPLATE_POST_TYPE","content","editEntityRecord","id","blocks","parse","undoIgnore","postType","removeTemplate","removeTemplates","setTemplatePart","templatePartId","TEMPLATE_PART_POST_TYPE","setNavigationMenu","navigationMenuId","NAVIGATION_POST_TYPE","setEditedEntity","postId","context","setHomeTemplateId","setEditedPostContext","setPage","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","setIsListViewOpened","isOpen","updateSettings","settings","setIsSaveViewOpened","revertTemplate","options","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","setHasPageContentFocus","hasPageContentFocus","blockEditorStore","clearSelectedBlock","toggleDistractionFree"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @deprecated\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\t( { registry } ) => {\n\t\treturn unlock( registry.dispatch( editorStore ) ).removeTemplates( [\n\t\t\ttemplate,\n\t\t] );\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, options ) =>\n\t( { registry } ) => {\n\t\treturn unlock( registry.dispatch( editorStore ) ).revertTemplate(\n\t\t\ttemplate,\n\t\t\toptions\n\t\t);\n\t};\n\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( 'core', name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry.dispatch( interfaceStore ).disableComplementaryArea( 'core' );\n\t};\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @deprecated\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).switchEditorMode\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').switchEditorMode\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).switchEditorMode( mode );\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tdeprecated( `dispatch( 'core/edit-site' ).setHasPageContentFocus`, {\n\t\t\tsince: '6.5',\n\t\t} );\n\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n *\n * @deprecated\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).toggleDistractionFree\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').toggleDistractionFree\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleDistractionFree();\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAIA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AArBA;AACA;AACA;;AAWA;AACA;AACA;;AAQA,MAAM;EAAES;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAAEC,WAAW,EAAG;EAC5C,OAAO,UAAW;IAAEC;EAAS,CAAC,EAAG;IAChC,IAAAC,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,WAAW,EACV;IACF,CACD,CAAC;IAEDH,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5BC,MAAM,CAAE,gBAAgB,EAAEP,WAAY,CAAC;EAC1C,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,kCAAkC,GAC5CC,UAAU,IACZ,CAAE;EAAER;AAAS,CAAC,KAAM;EACnB,IAAAC,mBAAU,EACT,iEAAiE,EACjE;IACCC,KAAK,EAAE,K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HH,QAAQ,CAACI,QAAQ,CAAEO,aAAY,CAAC,CAACuD,qBAAqB,CAAC,CAAC;AACzD,CAAC;AAACrD,OAAA,CAAAqD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_deprecated","_interopRequireDefault","_coreData","_blockEditor","_editor","_preferences","_constants","_lockUnlock","interfaceStore","unlock","editorPrivateApis","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","version","hint","editorStore","setDeviceType","exports","setTemplate","type","addTemplate","template","newTemplate","coreStore","saveEntityRecord","TEMPLATE_POST_TYPE","content","editEntityRecord","id","blocks","parse","undoIgnore","postType","removeTemplate","removeTemplates","setTemplatePart","templatePartId","TEMPLATE_PART_POST_TYPE","setNavigationMenu","navigationMenuId","NAVIGATION_POST_TYPE","setEditedEntity","postId","context","setHomeTemplateId","setEditedPostContext","setPage","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","setIsListViewOpened","isOpen","updateSettings","settings","setIsSaveViewOpened","revertTemplate","options","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","setHasPageContentFocus","hasPageContentFocus","blockEditorStore","clearSelectedBlock","toggleDistractionFree"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @deprecated\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\t( { registry } ) => {\n\t\treturn unlock( registry.dispatch( editorStore ) ).removeTemplates( [\n\t\t\ttemplate,\n\t\t] );\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @deprecated\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplatePart\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @deprecated\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationMenu\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @deprecated\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @deprecated\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setEditedPostContext\", {\n\t\tsince: '6.8',\n\t} );\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, options ) =>\n\t( { registry } ) => {\n\t\treturn unlock( registry.dispatch( editorStore ) ).revertTemplate(\n\t\t\ttemplate,\n\t\t\toptions\n\t\t);\n\t};\n\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( 'core', name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry.dispatch( interfaceStore ).disableComplementaryArea( 'core' );\n\t};\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @deprecated\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).switchEditorMode\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').switchEditorMode\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).switchEditorMode( mode );\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tdeprecated( `dispatch( 'core/edit-site' ).setHasPageContentFocus`, {\n\t\t\tsince: '6.5',\n\t\t} );\n\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n *\n * @deprecated\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).toggleDistractionFree\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').toggleDistractionFree\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleDistractionFree();\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAIA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AArBA;AACA;AACA;;AAWA;AACA;AACA;;AAQA,MAAM;EAAES;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAAEC,WAAW,EAAG;EAC5C,OAAO,UAAW;IAAEC;EAAS,CAAC,EAAG;IAChC,IAAAC,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,WAAW,EACV;IACF,CACD,CAAC;IAEDH,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5BC,MAAM,CAAE,gBAAgB,EAAEP,WAAY,CAAC;EAC1C,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,kCAAkC,GAC5CC,UAAU,IACZ,CAAE;EAAER;AAAS,CAAC,KAAM;EACnB,IAAAC,mBAAU,EACT,iEAAiE,EACjE;IACCC,KAAK,E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AAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AANAlD,OAAA,CAAAiD,sBAAA,GAAAA,sBAAA;AAOO,MAAMI,qBAAqB,GACjCA,CAAA,KACA,CAAE;EAAElE;AAAS,CAAC,KAAM;EACnB,IAAAC,mBAAU,EAAE,oDAAoD,EAAE;IACjEC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EACHH,QAAQ,CAACI,QAAQ,CAAEO,aAAY,CAAC,CAACuD,qBAAqB,CAAC,CAAC;AACzD,CAAC;AAACrD,OAAA,CAAAqD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
package/build/store/selectors.js
CHANGED
|
@@ -139,22 +139,32 @@ function getHomeTemplateId() {
|
|
|
139
139
|
/**
|
|
140
140
|
* Returns the current edited post type (wp_template or wp_template_part).
|
|
141
141
|
*
|
|
142
|
+
* @deprecated
|
|
142
143
|
* @param {Object} state Global application state.
|
|
143
144
|
*
|
|
144
145
|
* @return {?TemplateType} Template type.
|
|
145
146
|
*/
|
|
146
147
|
function getEditedPostType(state) {
|
|
148
|
+
(0, _deprecated.default)("select( 'core/edit-site' ).getEditedPostType", {
|
|
149
|
+
since: '6.8',
|
|
150
|
+
alternative: "select( 'core/editor' ).getCurrentPostType"
|
|
151
|
+
});
|
|
147
152
|
return state.editedPost.postType;
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
/**
|
|
151
156
|
* Returns the ID of the currently edited template or template part.
|
|
152
157
|
*
|
|
158
|
+
* @deprecated
|
|
153
159
|
* @param {Object} state Global application state.
|
|
154
160
|
*
|
|
155
161
|
* @return {?string} Post ID.
|
|
156
162
|
*/
|
|
157
163
|
function getEditedPostId(state) {
|
|
164
|
+
(0, _deprecated.default)("select( 'core/edit-site' ).getEditedPostId", {
|
|
165
|
+
since: '6.8',
|
|
166
|
+
alternative: "select( 'core/editor' ).getCurrentPostId"
|
|
167
|
+
});
|
|
158
168
|
return state.editedPost.id;
|
|
159
169
|
}
|
|
160
170
|
|
|
@@ -167,6 +177,9 @@ function getEditedPostId(state) {
|
|
|
167
177
|
* @return {Object} Page.
|
|
168
178
|
*/
|
|
169
179
|
function getEditedPostContext(state) {
|
|
180
|
+
(0, _deprecated.default)("select( 'core/edit-site' ).getEditedPostContext", {
|
|
181
|
+
since: '6.8'
|
|
182
|
+
});
|
|
170
183
|
return state.editedPost.context;
|
|
171
184
|
}
|
|
172
185
|
|
|
@@ -179,6 +192,9 @@ function getEditedPostContext(state) {
|
|
|
179
192
|
* @return {Object} Page.
|
|
180
193
|
*/
|
|
181
194
|
function getPage(state) {
|
|
195
|
+
(0, _deprecated.default)("select( 'core/edit-site' ).getPage", {
|
|
196
|
+
since: '6.8'
|
|
197
|
+
});
|
|
182
198
|
return {
|
|
183
199
|
context: state.editedPost.context
|
|
184
200
|
};
|
|
@@ -317,12 +333,16 @@ function isNavigationOpened() {
|
|
|
317
333
|
* Whether or not the editor has a page loaded into it.
|
|
318
334
|
*
|
|
319
335
|
* @see setPage
|
|
320
|
-
*
|
|
336
|
+
* @deprecated
|
|
321
337
|
* @param {Object} state Global application state.
|
|
322
338
|
*
|
|
323
339
|
* @return {boolean} Whether or not the editor has a page loaded into it.
|
|
324
340
|
*/
|
|
325
341
|
function isPage(state) {
|
|
342
|
+
(0, _deprecated.default)("select( 'core/edit-site' ).isPage", {
|
|
343
|
+
since: '6.8',
|
|
344
|
+
alternative: "select( 'core/editor' ).getCurrentPostType"
|
|
345
|
+
});
|
|
326
346
|
return !!state.editedPost.context?.postId;
|
|
327
347
|
}
|
|
328
348
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_editor","_blockEditor","_lockUnlock","_constants","_getFilteredTemplateParts","isFeatureActive","exports","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInserter","isListViewOpened","isSaveViewOpened","saveViewPanel","getBlocksAndTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","getBlocksByName","getBlocksByClientId","blockEditorStore","clientIds","blocks","getCurrentTemplateTemplateParts","createSelector","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector, createSelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport getFilteredTemplatePartBlocks from '../utils/get-filtered-template-parts';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\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 const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\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 ) => () => {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\talternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )`,\n\t\t\t}\n\t\t);\n\n\t\treturn select( coreDataStore ).canUser( 'create', 'media' );\n\t}\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\tdeprecated( `select( 'core/edit-site' ).getReusableBlocks()`, {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\talternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`,\n\t} );\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 site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\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 true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\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 const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInserter();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\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\nfunction getBlocksAndTemplateParts( select ) {\n\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\tconst { getBlocksByName, getBlocksByClientId } = select( blockEditorStore );\n\n\tconst clientIds = getBlocksByName( 'core/template-part' );\n\tconst blocks = getBlocksByClientId( clientIds );\n\treturn [ blocks, templateParts ];\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @deprecated\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 ) =>\n\t\tcreateSelector(\n\t\t\t() => {\n\t\t\t\tdeprecated(\n\t\t\t\t\t`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,\n\t\t\t\t\t{\n\t\t\t\t\t\tsince: '6.7',\n\t\t\t\t\t\tversion: '6.9',\n\t\t\t\t\t\talternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\treturn getFilteredTemplatePartBlocks(\n\t\t\t\t\t...getBlocksAndTemplateParts( select )\n\t\t\t\t);\n\t\t\t},\n\t\t\t() => getBlocksAndTemplateParts( select )\n\t\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 const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', '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\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA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,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAAS6C,kBAAkBA,CAAA,EAAG;EACpC,IAAAnD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS8C,MAAMA,CAAEjC,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEyB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAAtD,mBAAU,EAAE,gDAAgD,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_editor","_blockEditor","_lockUnlock","_constants","_getFilteredTemplateParts","isFeatureActive","exports","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInserter","isListViewOpened","isSaveViewOpened","saveViewPanel","getBlocksAndTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","getBlocksByName","getBlocksByClientId","blockEditorStore","clientIds","blocks","getCurrentTemplateTemplateParts","createSelector","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector, createSelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport getFilteredTemplatePartBlocks from '../utils/get-filtered-template-parts';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\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 const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\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 ) => () => {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\talternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )`,\n\t\t\t}\n\t\t);\n\n\t\treturn select( coreDataStore ).canUser( 'create', 'media' );\n\t}\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\tdeprecated( `select( 'core/edit-site' ).getReusableBlocks()`, {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\talternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`,\n\t} );\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 site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\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 * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?TemplateType} Template type.\n */\nexport function getEditedPostType( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostType\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?string} Post ID.\n */\nexport function getEditedPostId( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostId\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostId\",\n\t} );\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\tdeprecated( \"select( 'core/edit-site' ).getEditedPostContext\", {\n\t\tsince: '6.8',\n\t} );\n\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\tdeprecated( \"select( 'core/edit-site' ).getPage\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\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 const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInserter();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\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\nfunction getBlocksAndTemplateParts( select ) {\n\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\tconst { getBlocksByName, getBlocksByClientId } = select( blockEditorStore );\n\n\tconst clientIds = getBlocksByName( 'core/template-part' );\n\tconst blocks = getBlocksByClientId( clientIds );\n\treturn [ blocks, templateParts ];\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @deprecated\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 ) =>\n\t\tcreateSelector(\n\t\t\t() => {\n\t\t\t\tdeprecated(\n\t\t\t\t\t`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,\n\t\t\t\t\t{\n\t\t\t\t\t\tsince: '6.7',\n\t\t\t\t\t\tversion: '6.9',\n\t\t\t\t\t\talternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\treturn getFilteredTemplatePartBlocks(\n\t\t\t\t\t...getBlocksAndTemplateParts( select )\n\t\t\t\t);\n\t\t\t},\n\t\t\t() => getBlocksAndTemplateParts( select )\n\t\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 const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', '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\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).isPage\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,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AM,IAAM,MAAM;EACxE,OAAOA,MAAM,CAAEM,kBAAiB,CAAC,CAACC,GAAG,CAAE,MAAM,EAAE,YAAa,CAAC;AAC9D,CAAE,CAAC;;AAEH;AACA;AACA;AACO,SAAS6C,wCAAwCA,CAAA,EAAG;EAC1D,IAAAjD,mBAAU,EACT,uEAAuE,EACvE;IACCC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACO,SAAS4C,4BAA4BA,CAAA,EAAG;EAC9C,IAAAlD,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAAS6C,kBAAkBA,CAAA,EAAG;EACpC,IAAAnD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS8C,MAAMA,CAAEjC,KAAK,EAAG;EAC/B,IAAAnB,mBAAU,EAAE,mCAAmC,EAAE;IAChDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EAEH,OAAO,CAAC,CAAEiB,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEyB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAAtD,mBAAU,EAAE,gDAAgD,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb","ignoreList":[]}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
6
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
7
|
import { useMemo, useCallback } from '@wordpress/element';
|
|
9
8
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
@@ -57,7 +56,7 @@ export const useExistingTemplates = () => {
|
|
|
57
56
|
}), []);
|
|
58
57
|
};
|
|
59
58
|
export const useDefaultTemplateTypes = () => {
|
|
60
|
-
return useSelect(select => select(
|
|
59
|
+
return useSelect(select => select(coreStore).getEntityRecord('root', '__unstableBase')?.default_template_types || [], []);
|
|
61
60
|
};
|
|
62
61
|
const usePublicPostTypes = () => {
|
|
63
62
|
const postTypes = useSelect(select => select(coreStore).getPostTypes({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","store","coreStore","editorStore","decodeEntities","useMemo","useCallback","__","_x","sprintf","blockMeta","post","archive","TEMPLATE_POST_TYPE","EMPTY_OBJECT","getValueFromObjectPath","object","path","value","split","forEach","fieldName","mapToIHasNameAndId","entities","map","entity","name","useExistingTemplates","select","getEntityRecords","per_page","useDefaultTemplateTypes","__experimentalGetDefaultTemplateTypes","usePublicPostTypes","postTypes","getPostTypes","excludedPostTypes","filter","viewable","slug","includes","usePublicTaxonomies","taxonomies","getTaxonomies","visibility","publicly_queryable","usePostTypeArchiveMenuItems","publicPostTypes","postTypesWithArchives","postType","has_archive","existingTemplates","postTypeLabels","reduce","accumulator","labels","singularName","singular_name","toLowerCase","needsUniqueIdentifier","some","existingTemplate","title","description","icon","startsWith","slice","templatePrefix","usePostTypeMenuItems","onClickMenuItem","defaultTemplateTypes","templateLabels","templateName","template_name","templatePrefixes","suffix","postTypesInfo","useEntitiesInfo","existingTemplateSlugs","menuItems","generalTemplateSlug","defaultTemplateType","find","_slug","hasGeneralTemplate","_needsUniqueIdentifier","menuItemTitle","menuItem","hasEntities","onClick","template","type","config","recordNamePath","queryArgs","search","_fields","orderBy","exclude","existingEntitiesIds","getSpecificTemplate","suggestion","templateSlug","push","postTypesMenuItems","key","defaultPostTypesMenuItems","useTaxonomiesMenuItems","publicTaxonomies","taxonomyLabels","taxonomiesInfo","taxonomy","taxonomiesMenuItems","defaultTaxonomiesMenuItems","USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX","user","USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS","who","useAuthorMenuItem","authorInfo","authorMenuItem","search_items","not_found","all_items","useExistingTemplateSlugs","existingSlugs","Object","entries","prefix","slugsWithTemplates","_accumulator","_prefix","substring","length","useTemplatesToExclude","entityName","additionalQueryParameters","slugsToExcludePerEntity","recordsToExcludePerEntity","entitiesWithTemplates","context","entitiesHasRecords","keys","id","entitiesInfo"],"sources":["@wordpress/edit-site/src/components/add-new-template/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { blockMeta, post, archive } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.split( '.' ).forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * @typedef {Object} EntitiesInfo\n * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).\n * @property {number[]} existingEntitiesIds An array of the existing entities ids.\n */\n\nexport const useExistingTemplates = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t),\n\t\t[]\n\t);\n};\n\nexport const useDefaultTemplateTypes = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplateTypes(),\n\t\t[]\n\t);\n};\n\nconst usePublicPostTypes = () => {\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\treturn postTypes?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t}, [ postTypes ] );\n};\n\nconst usePublicTaxonomies = () => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\nexport function usePostTypeArchiveMenuItems() {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst postTypesWithArchives = useMemo(\n\t\t() => publicPostTypes?.filter( ( postType ) => postType.has_archive ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst existingTemplates = useExistingTemplates();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst postTypeLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\t\taccumulator[ singularName ] =\n\t\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\treturn postTypeLabels[ singularName ] > 1 && singularName !== slug;\n\t\t},\n\t\t[ postTypeLabels ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tpostTypesWithArchives\n\t\t\t\t?.filter(\n\t\t\t\t\t( postType ) =>\n\t\t\t\t\t\t! ( existingTemplates || [] ).some(\n\t\t\t\t\t\t\t( existingTemplate ) =>\n\t\t\t\t\t\t\t\texistingTemplate.slug ===\n\t\t\t\t\t\t\t\t'archive-' + postType.slug\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( postType ) => {\n\t\t\t\t\tlet title;\n\t\t\t\t\tif ( needsUniqueIdentifier( postType ) ) {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t__( 'Archive: %1$s (%2$s)' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name,\n\t\t\t\t\t\t\tpostType.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Archive: %s' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tslug: 'archive-' + postType.slug,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Displays an archive with the latest posts of type: %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof postType.icon === 'string' &&\n\t\t\t\t\t\t\tpostType.icon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? postType.icon.slice( 10 )\n\t\t\t\t\t\t\t\t: archive,\n\t\t\t\t\t\ttemplatePrefix: 'archive',\n\t\t\t\t\t};\n\t\t\t\t} ) || [],\n\t\t[ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]\n\t);\n}\n\nexport const usePostTypeMenuItems = ( onClickMenuItem ) => {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst templateLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst templateName = (\n\t\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t\t).toLowerCase();\n\t\t\t\taccumulator[ templateName ] =\n\t\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\treturn templateLabels[ templateName ] > 1 && templateName !== slug;\n\t\t},\n\t\t[ templateLabels ]\n\t);\n\n\t// `page`is a special case in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( slug !== 'page' ) {\n\t\t\t\t\tsuffix = `single-${ suffix }`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicPostTypes || [] ).reduce(\n\t\t( accumulator, postType ) => {\n\t\t\tconst { slug, labels, icon } = postType;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier( postType );\n\t\t\tlet menuItemTitle =\n\t\t\t\tlabels.template_name ||\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t__( 'Single item: %s' ),\n\t\t\t\t\tlabels.singular_name\n\t\t\t\t);\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Single Item: Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'post type menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the post type e.g: \"Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Single item: %1$s (%2$s)',\n\t\t\t\t\t\t\t\t'post type menu label'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Displays a single item: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof icon === 'string' &&\n\t\t\t\t\t\t\ticon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? icon.slice( 10 )\n\t\t\t\t\t\t\t\t: post,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = postTypesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'postType',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\trecordNamePath: 'title.rendered',\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,title,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'relevance' : 'modified',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\tpostTypesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default post types\n\t// and one for the rest.\n\tconst postTypesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, postType ) => {\n\t\t\t\t\tconst { slug } = postType;\n\t\t\t\t\tlet key = 'postTypesMenuItems';\n\t\t\t\t\tif ( slug === 'page' ) {\n\t\t\t\t\t\tkey = 'defaultPostTypesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( postType );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn postTypesMenuItems;\n};\n\nexport const useTaxonomiesMenuItems = ( onClickMenuItem ) => {\n\tconst publicTaxonomies = usePublicTaxonomies();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// `category` and `post_tag` are special cases in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicTaxonomies?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( ! [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\t\t\tsuffix = `taxonomy-${ suffix }`;\n\t\t\t\t}\n\t\t\t\tif ( slug === 'post_tag' ) {\n\t\t\t\t\tsuffix = `tag`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicTaxonomies ]\n\t);\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst taxonomyLabels = publicTaxonomies?.reduce(\n\t\t( accumulator, { labels } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\taccumulator[ templateName ] =\n\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{}\n\t);\n\tconst needsUniqueIdentifier = ( labels, slug ) => {\n\t\tif ( [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst templateName = (\n\t\t\tlabels.template_name || labels.singular_name\n\t\t).toLowerCase();\n\t\treturn taxonomyLabels[ templateName ] > 1 && templateName !== slug;\n\t};\n\tconst taxonomiesInfo = useEntitiesInfo( 'taxonomy', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicTaxonomies || [] ).reduce(\n\t\t( accumulator, taxonomy ) => {\n\t\t\tconst { slug, labels } = taxonomy;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier(\n\t\t\t\tlabels,\n\t\t\t\tslug\n\t\t\t);\n\t\t\tlet menuItemTitle = labels.template_name || labels.singular_name;\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Products by Category\". 2s: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy template menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the taxonomy e.g: \"Category\". 2: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy menu label' ),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the taxonomy e.g: \"Product Categories\".\n\t\t\t\t\t\t\t__( 'Displays taxonomy: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ticon: blockMeta,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = taxonomiesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'taxonomy',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'name' : 'count',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\ttaxonomiesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default taxonomies\n\t// and one for the rest.\n\tconst taxonomiesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, taxonomy ) => {\n\t\t\t\t\tconst { slug } = taxonomy;\n\t\t\t\t\tlet key = 'taxonomiesMenuItems';\n\t\t\t\t\tif ( [ 'category', 'tag' ].includes( slug ) ) {\n\t\t\t\t\t\tkey = 'defaultTaxonomiesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( taxonomy );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn taxonomiesMenuItems;\n};\n\nconst USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };\nconst USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };\nexport function useAuthorMenuItem( onClickMenuItem ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst authorInfo = useEntitiesInfo(\n\t\t'root',\n\t\tUSE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,\n\t\tUSE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS\n\t);\n\tlet authorMenuItem = defaultTemplateTypes?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( ! authorMenuItem ) {\n\t\tauthorMenuItem = {\n\t\t\tdescription: __(\n\t\t\t\t'Displays latest posts written by a single author.'\n\t\t\t),\n\t\t\tslug: 'author',\n\t\t\ttitle: 'Author',\n\t\t};\n\t}\n\tconst hasGeneralTemplate = !! existingTemplates?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( authorInfo.user?.hasEntities ) {\n\t\tauthorMenuItem = { ...authorMenuItem, templatePrefix: 'author' };\n\t\tauthorMenuItem.onClick = ( template ) => {\n\t\t\tonClickMenuItem( {\n\t\t\t\ttype: 'root',\n\t\t\t\tslug: 'user',\n\t\t\t\tconfig: {\n\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\torderBy: search ? 'name' : 'registered_date',\n\t\t\t\t\t\t\texclude: authorInfo.user.existingEntitiesIds,\n\t\t\t\t\t\t\twho: 'authors',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\tconst templateSlug = `author-${ suggestion.slug }`;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\ttemplatePrefix: 'author',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlabels: {\n\t\t\t\t\tsingular_name: __( 'Author' ),\n\t\t\t\t\tsearch_items: __( 'Search Authors' ),\n\t\t\t\t\tnot_found: __( 'No authors found.' ),\n\t\t\t\t\tall_items: __( 'All Authors' ),\n\t\t\t\t},\n\t\t\t\thasGeneralTemplate,\n\t\t\t\ttemplate,\n\t\t\t} );\n\t\t};\n\t}\n\tif ( ! hasGeneralTemplate || authorInfo.user?.hasEntities ) {\n\t\treturn authorMenuItem;\n\t}\n}\n\n/**\n * Helper hook that filters all the existing templates by the given\n * object with the entity's slug as key and the template prefix as value.\n *\n * Example:\n * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]\n * `templatePrefixes` is: { post_tag: 'tag' }\n * It will return: { post_tag: ['apple'] }\n *\n * Note: We append the `-` to the given template prefix in this function for our checks.\n *\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.\n */\nconst useExistingTemplateSlugs = ( templatePrefixes ) => {\n\tconst existingTemplates = useExistingTemplates();\n\tconst existingSlugs = useMemo( () => {\n\t\treturn Object.entries( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, [ slug, prefix ] ) => {\n\t\t\t\tconst slugsWithTemplates = ( existingTemplates || [] ).reduce(\n\t\t\t\t\t( _accumulator, existingTemplate ) => {\n\t\t\t\t\t\tconst _prefix = `${ prefix }-`;\n\t\t\t\t\t\tif ( existingTemplate.slug.startsWith( _prefix ) ) {\n\t\t\t\t\t\t\t_accumulator.push(\n\t\t\t\t\t\t\t\texistingTemplate.slug.substring(\n\t\t\t\t\t\t\t\t\t_prefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn _accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tif ( slugsWithTemplates.length ) {\n\t\t\t\t\taccumulator[ slug ] = slugsWithTemplates;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, existingTemplates ] );\n\treturn existingSlugs;\n};\n\n/**\n * Helper hook that finds the existing records with an associated template,\n * as they need to be excluded from the template suggestions.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.\n */\nconst useTemplatesToExclude = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst slugsToExcludePerEntity =\n\t\tuseExistingTemplateSlugs( templatePrefixes );\n\tconst recordsToExcludePerEntity = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.entries( slugsToExcludePerEntity || {} ).reduce(\n\t\t\t\t( accumulator, [ slug, slugsWithTemplates ] ) => {\n\t\t\t\t\tconst entitiesWithTemplates = select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\tslug: slugsWithTemplates,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} );\n\t\t\t\t\tif ( entitiesWithTemplates?.length ) {\n\t\t\t\t\t\taccumulator[ slug ] = entitiesWithTemplates;\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ slugsToExcludePerEntity ]\n\t);\n\treturn recordsToExcludePerEntity;\n};\n\n/**\n * Helper hook that returns information about an entity having\n * records that we can create a specific template for.\n *\n * For example we can search for `terms` in `taxonomy` entity or\n * `posts` in `postType` entity.\n *\n * First we need to find the existing records with an associated template,\n * to query afterwards for any remaining record, by excluding them.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.\n */\nconst useEntitiesInfo = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = EMPTY_OBJECT\n) => {\n\tconst recordsToExcludePerEntity = useTemplatesToExclude(\n\t\tentityName,\n\t\ttemplatePrefixes,\n\t\tadditionalQueryParameters\n\t);\n\tconst entitiesHasRecords = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t\t( accumulator, slug ) => {\n\t\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t\t) || [];\n\t\t\t\t\taccumulator[ slug ] = !! select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\texclude: existingEntitiesIds,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} )?.length;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[\n\t\t\ttemplatePrefixes,\n\t\t\trecordsToExcludePerEntity,\n\t\t\tentityName,\n\t\t\tadditionalQueryParameters,\n\t\t]\n\t);\n\tconst entitiesInfo = useMemo( () => {\n\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, slug ) => {\n\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t) || [];\n\t\t\t\taccumulator[ slug ] = {\n\t\t\t\t\thasEntities: entitiesHasRecords[ slug ],\n\t\t\t\t\texistingEntitiesIds,\n\t\t\t\t};\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords ] );\n\treturn entitiesInfo;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,OAAO,EAAEC,WAAW,QAAQ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E,EAAEf,GAAG,CACvC,CAAE;QAAEuH;MAAG,CAAC,KAAMA,EACf,CAAC,IAAI,EAAE;MACRzF,WAAW,CAAEf,IAAI,CAAE,GAAG,CAAC,CAAEX,MAAM,CAC9B1B,SACD,CAAC,CAAC2B,gBAAgB,CAAE0G,UAAU,EAAEhG,IAAI,EAAE;QACrCT,QAAQ,EAAE,CAAC;QACXkE,OAAO,EAAE,IAAI;QACb4C,OAAO,EAAE,MAAM;QACf1C,OAAO,EAAEC,mBAAmB;QAC5B,GAAGqC,yBAAyB,CAAEjG,IAAI;MACnC,CAAE,CAAC,EAAE8F,MAAM;MACX,OAAO/E,WAAW;IACnB,CAAC,EACD,CAAC,CACF,CAAC;EACF,CAAC,EACD,CACCoB,gBAAgB,EAChBgE,yBAAyB,EACzBH,UAAU,EACVC,yBAAyB,CAE3B,CAAC;EACD,MAAMQ,YAAY,GAAG3I,OAAO,CAAE,MAAM;IACnC,OAAOyH,MAAM,CAACgB,IAAI,CAAEpE,gBAAgB,IAAI,CAAC,CAAE,CAAC,CAACrB,MAAM,CAClD,CAAEC,WAAW,EAAEf,IAAI,KAAM;MACxB,MAAM4D,mBAAmB,GACxBuC,yBAAyB,GAAInG,IAAI,CAAE,EAAEf,GAAG,CACvC,CAAE;QAAEuH;MAAG,CAAC,KAAMA,EACf,CAAC,IAAI,EAAE;MACRzF,WAAW,CAAEf,IAAI,CAAE,GAAG;QACrBiD,WAAW,EAAEqD,kBAAkB,CAAEtG,IAAI,CAAE;QACvC4D;MACD,CAAC;MACD,OAAO7C,WAAW;IACnB,CAAC,EACD,CAAC,CACF,CAAC;EACF,CAAC,EAAE,CAAEoB,gBAAgB,EAAEgE,yBAAyB,EAAEG,kBAAkB,CAAG,CAAC;EACxE,OAAOG,YAAY;AACpB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","store","coreStore","decodeEntities","useMemo","useCallback","__","_x","sprintf","blockMeta","post","archive","TEMPLATE_POST_TYPE","EMPTY_OBJECT","getValueFromObjectPath","object","path","value","split","forEach","fieldName","mapToIHasNameAndId","entities","map","entity","name","useExistingTemplates","select","getEntityRecords","per_page","useDefaultTemplateTypes","getEntityRecord","default_template_types","usePublicPostTypes","postTypes","getPostTypes","excludedPostTypes","filter","viewable","slug","includes","usePublicTaxonomies","taxonomies","getTaxonomies","visibility","publicly_queryable","usePostTypeArchiveMenuItems","publicPostTypes","postTypesWithArchives","postType","has_archive","existingTemplates","postTypeLabels","reduce","accumulator","labels","singularName","singular_name","toLowerCase","needsUniqueIdentifier","some","existingTemplate","title","description","icon","startsWith","slice","templatePrefix","usePostTypeMenuItems","onClickMenuItem","defaultTemplateTypes","templateLabels","templateName","template_name","templatePrefixes","suffix","postTypesInfo","useEntitiesInfo","existingTemplateSlugs","menuItems","generalTemplateSlug","defaultTemplateType","find","_slug","hasGeneralTemplate","_needsUniqueIdentifier","menuItemTitle","menuItem","hasEntities","onClick","template","type","config","recordNamePath","queryArgs","search","_fields","orderBy","exclude","existingEntitiesIds","getSpecificTemplate","suggestion","templateSlug","push","postTypesMenuItems","key","defaultPostTypesMenuItems","useTaxonomiesMenuItems","publicTaxonomies","taxonomyLabels","taxonomiesInfo","taxonomy","taxonomiesMenuItems","defaultTaxonomiesMenuItems","USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX","user","USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS","who","useAuthorMenuItem","authorInfo","authorMenuItem","search_items","not_found","all_items","useExistingTemplateSlugs","existingSlugs","Object","entries","prefix","slugsWithTemplates","_accumulator","_prefix","substring","length","useTemplatesToExclude","entityName","additionalQueryParameters","slugsToExcludePerEntity","recordsToExcludePerEntity","entitiesWithTemplates","context","entitiesHasRecords","keys","id","entitiesInfo"],"sources":["@wordpress/edit-site/src/components/add-new-template/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { blockMeta, post, archive } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.split( '.' ).forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * @typedef {Object} EntitiesInfo\n * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).\n * @property {number[]} existingEntitiesIds An array of the existing entities ids.\n */\n\nexport const useExistingTemplates = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t),\n\t\t[]\n\t);\n};\n\nexport const useDefaultTemplateTypes = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_types || [],\n\t\t[]\n\t);\n};\n\nconst usePublicPostTypes = () => {\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\treturn postTypes?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t}, [ postTypes ] );\n};\n\nconst usePublicTaxonomies = () => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\nexport function usePostTypeArchiveMenuItems() {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst postTypesWithArchives = useMemo(\n\t\t() => publicPostTypes?.filter( ( postType ) => postType.has_archive ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst existingTemplates = useExistingTemplates();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst postTypeLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\t\taccumulator[ singularName ] =\n\t\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\treturn postTypeLabels[ singularName ] > 1 && singularName !== slug;\n\t\t},\n\t\t[ postTypeLabels ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tpostTypesWithArchives\n\t\t\t\t?.filter(\n\t\t\t\t\t( postType ) =>\n\t\t\t\t\t\t! ( existingTemplates || [] ).some(\n\t\t\t\t\t\t\t( existingTemplate ) =>\n\t\t\t\t\t\t\t\texistingTemplate.slug ===\n\t\t\t\t\t\t\t\t'archive-' + postType.slug\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( postType ) => {\n\t\t\t\t\tlet title;\n\t\t\t\t\tif ( needsUniqueIdentifier( postType ) ) {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t__( 'Archive: %1$s (%2$s)' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name,\n\t\t\t\t\t\t\tpostType.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Archive: %s' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tslug: 'archive-' + postType.slug,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Displays an archive with the latest posts of type: %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof postType.icon === 'string' &&\n\t\t\t\t\t\t\tpostType.icon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? postType.icon.slice( 10 )\n\t\t\t\t\t\t\t\t: archive,\n\t\t\t\t\t\ttemplatePrefix: 'archive',\n\t\t\t\t\t};\n\t\t\t\t} ) || [],\n\t\t[ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]\n\t);\n}\n\nexport const usePostTypeMenuItems = ( onClickMenuItem ) => {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst templateLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst templateName = (\n\t\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t\t).toLowerCase();\n\t\t\t\taccumulator[ templateName ] =\n\t\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\treturn templateLabels[ templateName ] > 1 && templateName !== slug;\n\t\t},\n\t\t[ templateLabels ]\n\t);\n\n\t// `page`is a special case in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( slug !== 'page' ) {\n\t\t\t\t\tsuffix = `single-${ suffix }`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicPostTypes || [] ).reduce(\n\t\t( accumulator, postType ) => {\n\t\t\tconst { slug, labels, icon } = postType;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier( postType );\n\t\t\tlet menuItemTitle =\n\t\t\t\tlabels.template_name ||\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t__( 'Single item: %s' ),\n\t\t\t\t\tlabels.singular_name\n\t\t\t\t);\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Single Item: Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'post type menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the post type e.g: \"Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Single item: %1$s (%2$s)',\n\t\t\t\t\t\t\t\t'post type menu label'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Displays a single item: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof icon === 'string' &&\n\t\t\t\t\t\t\ticon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? icon.slice( 10 )\n\t\t\t\t\t\t\t\t: post,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = postTypesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'postType',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\trecordNamePath: 'title.rendered',\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,title,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'relevance' : 'modified',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\tpostTypesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default post types\n\t// and one for the rest.\n\tconst postTypesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, postType ) => {\n\t\t\t\t\tconst { slug } = postType;\n\t\t\t\t\tlet key = 'postTypesMenuItems';\n\t\t\t\t\tif ( slug === 'page' ) {\n\t\t\t\t\t\tkey = 'defaultPostTypesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( postType );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn postTypesMenuItems;\n};\n\nexport const useTaxonomiesMenuItems = ( onClickMenuItem ) => {\n\tconst publicTaxonomies = usePublicTaxonomies();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// `category` and `post_tag` are special cases in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicTaxonomies?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( ! [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\t\t\tsuffix = `taxonomy-${ suffix }`;\n\t\t\t\t}\n\t\t\t\tif ( slug === 'post_tag' ) {\n\t\t\t\t\tsuffix = `tag`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicTaxonomies ]\n\t);\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst taxonomyLabels = publicTaxonomies?.reduce(\n\t\t( accumulator, { labels } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\taccumulator[ templateName ] =\n\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{}\n\t);\n\tconst needsUniqueIdentifier = ( labels, slug ) => {\n\t\tif ( [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst templateName = (\n\t\t\tlabels.template_name || labels.singular_name\n\t\t).toLowerCase();\n\t\treturn taxonomyLabels[ templateName ] > 1 && templateName !== slug;\n\t};\n\tconst taxonomiesInfo = useEntitiesInfo( 'taxonomy', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicTaxonomies || [] ).reduce(\n\t\t( accumulator, taxonomy ) => {\n\t\t\tconst { slug, labels } = taxonomy;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier(\n\t\t\t\tlabels,\n\t\t\t\tslug\n\t\t\t);\n\t\t\tlet menuItemTitle = labels.template_name || labels.singular_name;\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Products by Category\". 2s: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy template menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the taxonomy e.g: \"Category\". 2: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy menu label' ),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the taxonomy e.g: \"Product Categories\".\n\t\t\t\t\t\t\t__( 'Displays taxonomy: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ticon: blockMeta,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = taxonomiesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'taxonomy',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'name' : 'count',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\ttaxonomiesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default taxonomies\n\t// and one for the rest.\n\tconst taxonomiesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, taxonomy ) => {\n\t\t\t\t\tconst { slug } = taxonomy;\n\t\t\t\t\tlet key = 'taxonomiesMenuItems';\n\t\t\t\t\tif ( [ 'category', 'tag' ].includes( slug ) ) {\n\t\t\t\t\t\tkey = 'defaultTaxonomiesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( taxonomy );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn taxonomiesMenuItems;\n};\n\nconst USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };\nconst USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };\nexport function useAuthorMenuItem( onClickMenuItem ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst authorInfo = useEntitiesInfo(\n\t\t'root',\n\t\tUSE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,\n\t\tUSE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS\n\t);\n\tlet authorMenuItem = defaultTemplateTypes?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( ! authorMenuItem ) {\n\t\tauthorMenuItem = {\n\t\t\tdescription: __(\n\t\t\t\t'Displays latest posts written by a single author.'\n\t\t\t),\n\t\t\tslug: 'author',\n\t\t\ttitle: 'Author',\n\t\t};\n\t}\n\tconst hasGeneralTemplate = !! existingTemplates?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( authorInfo.user?.hasEntities ) {\n\t\tauthorMenuItem = { ...authorMenuItem, templatePrefix: 'author' };\n\t\tauthorMenuItem.onClick = ( template ) => {\n\t\t\tonClickMenuItem( {\n\t\t\t\ttype: 'root',\n\t\t\t\tslug: 'user',\n\t\t\t\tconfig: {\n\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\torderBy: search ? 'name' : 'registered_date',\n\t\t\t\t\t\t\texclude: authorInfo.user.existingEntitiesIds,\n\t\t\t\t\t\t\twho: 'authors',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\tconst templateSlug = `author-${ suggestion.slug }`;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\ttemplatePrefix: 'author',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlabels: {\n\t\t\t\t\tsingular_name: __( 'Author' ),\n\t\t\t\t\tsearch_items: __( 'Search Authors' ),\n\t\t\t\t\tnot_found: __( 'No authors found.' ),\n\t\t\t\t\tall_items: __( 'All Authors' ),\n\t\t\t\t},\n\t\t\t\thasGeneralTemplate,\n\t\t\t\ttemplate,\n\t\t\t} );\n\t\t};\n\t}\n\tif ( ! hasGeneralTemplate || authorInfo.user?.hasEntities ) {\n\t\treturn authorMenuItem;\n\t}\n}\n\n/**\n * Helper hook that filters all the existing templates by the given\n * object with the entity's slug as key and the template prefix as value.\n *\n * Example:\n * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]\n * `templatePrefixes` is: { post_tag: 'tag' }\n * It will return: { post_tag: ['apple'] }\n *\n * Note: We append the `-` to the given template prefix in this function for our checks.\n *\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.\n */\nconst useExistingTemplateSlugs = ( templatePrefixes ) => {\n\tconst existingTemplates = useExistingTemplates();\n\tconst existingSlugs = useMemo( () => {\n\t\treturn Object.entries( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, [ slug, prefix ] ) => {\n\t\t\t\tconst slugsWithTemplates = ( existingTemplates || [] ).reduce(\n\t\t\t\t\t( _accumulator, existingTemplate ) => {\n\t\t\t\t\t\tconst _prefix = `${ prefix }-`;\n\t\t\t\t\t\tif ( existingTemplate.slug.startsWith( _prefix ) ) {\n\t\t\t\t\t\t\t_accumulator.push(\n\t\t\t\t\t\t\t\texistingTemplate.slug.substring(\n\t\t\t\t\t\t\t\t\t_prefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn _accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tif ( slugsWithTemplates.length ) {\n\t\t\t\t\taccumulator[ slug ] = slugsWithTemplates;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, existingTemplates ] );\n\treturn existingSlugs;\n};\n\n/**\n * Helper hook that finds the existing records with an associated template,\n * as they need to be excluded from the template suggestions.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.\n */\nconst useTemplatesToExclude = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst slugsToExcludePerEntity =\n\t\tuseExistingTemplateSlugs( templatePrefixes );\n\tconst recordsToExcludePerEntity = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.entries( slugsToExcludePerEntity || {} ).reduce(\n\t\t\t\t( accumulator, [ slug, slugsWithTemplates ] ) => {\n\t\t\t\t\tconst entitiesWithTemplates = select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\tslug: slugsWithTemplates,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} );\n\t\t\t\t\tif ( entitiesWithTemplates?.length ) {\n\t\t\t\t\t\taccumulator[ slug ] = entitiesWithTemplates;\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ slugsToExcludePerEntity ]\n\t);\n\treturn recordsToExcludePerEntity;\n};\n\n/**\n * Helper hook that returns information about an entity having\n * records that we can create a specific template for.\n *\n * For example we can search for `terms` in `taxonomy` entity or\n * `posts` in `postType` entity.\n *\n * First we need to find the existing records with an associated template,\n * to query afterwards for any remaining record, by excluding them.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.\n */\nconst useEntitiesInfo = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = EMPTY_OBJECT\n) => {\n\tconst recordsToExcludePerEntity = useTemplatesToExclude(\n\t\tentityName,\n\t\ttemplatePrefixes,\n\t\tadditionalQueryParameters\n\t);\n\tconst entitiesHasRecords = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t\t( accumulator, slug ) => {\n\t\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t\t) || [];\n\t\t\t\t\taccumulator[ slug ] = !! select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\texclude: existingEntitiesIds,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} )?.length;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[\n\t\t\ttemplatePrefixes,\n\t\t\trecordsToExcludePerEntity,\n\t\t\tentityName,\n\t\t\tadditionalQueryParameters,\n\t\t]\n\t);\n\tconst entitiesInfo = useMemo( () => {\n\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, slug ) => {\n\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t) || [];\n\t\t\t\taccumulator[ slug ] = {\n\t\t\t\t\thasEntities: entitiesHasRecords[ slug ],\n\t\t\t\t\texistingEntitiesIds,\n\t\t\t\t};\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords ] );\n\treturn entitiesInfo;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,kBAAkB;;AAE3D;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,MAAMC,YAAY,GAAG,CAAC,CAAC;;AAEvB;AACA;AACA;AACA;AACA;;AAEA,MAAMC,sBAAsB,GAAGA,CAAEC,MAAM,EAAEC,IAAI,KAAM;EAClD,IAAIC,KAAK,GAAGF,MAAM;EAClBC,IAAI,CAACE,KAAK,CAAE,GAAI,CAAC,CAACC,OAAO,CAAIC,SAAS,IAAM;IAC3CH,KAAK,GAAGA,KAAK,GAAIG,SAAS,CAAE;EAC7B,CAAE,CAAC;EACH,OAAOH,KAAK;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,kBAA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C;EACD,MAAMQ,YAAY,GAAG5I,OAAO,CAAE,MAAM;IACnC,OAAO0H,MAAM,CAACgB,IAAI,CAAEpE,gBAAgB,IAAI,CAAC,CAAE,CAAC,CAACrB,MAAM,CAClD,CAAEC,WAAW,EAAEf,IAAI,KAAM;MACxB,MAAM4D,mBAAmB,GACxBuC,yBAAyB,GAAInG,IAAI,CAAE,EAAEhB,GAAG,CACvC,CAAE;QAAEwH;MAAG,CAAC,KAAMA,EACf,CAAC,IAAI,EAAE;MACRzF,WAAW,CAAEf,IAAI,CAAE,GAAG;QACrBiD,WAAW,EAAEqD,kBAAkB,CAAEtG,IAAI,CAAE;QACvC4D;MACD,CAAC;MACD,OAAO7C,WAAW;IACnB,CAAC,EACD,CAAC,CACF,CAAC;EACF,CAAC,EAAE,CAAEoB,gBAAgB,EAAEgE,yBAAyB,EAAEG,kBAAkB,CAAG,CAAC;EACxE,OAAOG,YAAY;AACpB,CAAC","ignoreList":[]}
|
|
@@ -15,7 +15,6 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
15
15
|
import Layout from '../layout';
|
|
16
16
|
import { unlock } from '../../lock-unlock';
|
|
17
17
|
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
|
|
18
|
-
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
19
18
|
import useActiveRoute from '../layout/router';
|
|
20
19
|
import useSetCommandContext from '../../hooks/commands/use-set-command-context';
|
|
21
20
|
import { useRegisterSiteEditorRoutes } from '../site-editor-routes';
|
|
@@ -27,8 +26,6 @@ const {
|
|
|
27
26
|
GlobalStylesProvider
|
|
28
27
|
} = unlock(editorPrivateApis);
|
|
29
28
|
function AppLayout() {
|
|
30
|
-
// This ensures the edited entity id and type are initialized properly.
|
|
31
|
-
useInitEditedEntityFromURL();
|
|
32
29
|
useCommonCommands();
|
|
33
30
|
useSetCommandContext();
|
|
34
31
|
useRegisterSiteEditorRoutes();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SlotFillProvider","UnsavedChangesWarning","privateApis","editorPrivateApis","store","noticesStore","useDispatch","__","sprintf","PluginArea","routerPrivateApis","Layout","unlock","useCommonCommands","
|
|
1
|
+
{"version":3,"names":["SlotFillProvider","UnsavedChangesWarning","privateApis","editorPrivateApis","store","noticesStore","useDispatch","__","sprintf","PluginArea","routerPrivateApis","Layout","unlock","useCommonCommands","useActiveRoute","useSetCommandContext","useRegisterSiteEditorRoutes","jsx","_jsx","jsxs","_jsxs","RouterProvider","GlobalStylesProvider","AppLayout","route","App","createErrorNotice","onPluginAreaError","name","children","onError"],"sources":["@wordpress/edit-site/src/components/app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport useActiveRoute from '../layout/router';\nimport useSetCommandContext from '../../hooks/commands/use-set-command-context';\nimport { useRegisterSiteEditorRoutes } from '../site-editor-routes';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nfunction AppLayout() {\n\tuseCommonCommands();\n\tuseSetCommandContext();\n\tuseRegisterSiteEditorRoutes();\n\tconst route = useActiveRoute();\n\n\treturn <Layout route={ route } />;\n}\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<GlobalStylesProvider>\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<RouterProvider>\n\t\t\t\t\t<AppLayout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</RouterProvider>\n\t\t\t</GlobalStylesProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,uBAAuB;AACxD,SACCC,qBAAqB,EACrBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASP,WAAW,IAAIQ,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,0CAA0C;AAC5E,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,oBAAoB,MAAM,8CAA8C;AAC/E,SAASC,2BAA2B,QAAQ,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpE,MAAM;EAAEC;AAAe,CAAC,GAAGT,MAAM,CAAEF,iBAAkB,CAAC;AACtD,MAAM;EAAEY;AAAqB,CAAC,GAAGV,MAAM,CAAET,iBAAkB,CAAC;AAE5D,SAASoB,SAASA,CAAA,EAAG;EACpBV,iBAAiB,CAAC,CAAC;EACnBE,oBAAoB,CAAC,CAAC;EACtBC,2BAA2B,CAAC,CAAC;EAC7B,MAAMQ,KAAK,GAAGV,cAAc,CAAC,CAAC;EAE9B,oBAAOI,IAAA,CAACP,MAAM;IAACa,KAAK,EAAGA;EAAO,CAAE,CAAC;AAClC;AAEA,eAAe,SAASC,GAAGA,CAAA,EAAG;EAC7B,MAAM;IAAEC;EAAkB,CAAC,GAAGpB,WAAW,CAAED,YAAa,CAAC;EAEzD,SAASsB,iBAAiBA,CAAEC,IAAI,EAAG;IAClCF,iBAAiB,CAChBlB,OAAO,CACN;IACAD,EAAE,CACD,kEACD,CAAC,EACDqB,IACD,CACD,CAAC;EACF;EAEA,oBACCV,IAAA,CAAClB,gBAAgB;IAAA6B,QAAA,eAChBT,KAAA,CAACE,oBAAoB;MAAAO,QAAA,gBACpBX,IAAA,CAACjB,qBAAqB,IAAE,CAAC,eACzBmB,KAAA,CAACC,cAAc;QAAAQ,QAAA,gBACdX,IAAA,CAACK,SAAS,IAAE,CAAC,eACbL,IAAA,CAACT,UAAU;UAACqB,OAAO,EAAGH;QAAmB,CAAE,CAAC;MAAA,CAC7B,CAAC;IAAA,CACI;EAAC,CACN,CAAC;AAErB","ignoreList":[]}
|
|
@@ -41,22 +41,15 @@ export function useSpecificEditorSettings() {
|
|
|
41
41
|
} = params;
|
|
42
42
|
const onNavigateToEntityRecord = useNavigateToEntityRecord();
|
|
43
43
|
const {
|
|
44
|
-
settings
|
|
45
|
-
shouldUseTemplateAsDefaultRenderingMode
|
|
44
|
+
settings
|
|
46
45
|
} = useSelect(select => {
|
|
47
46
|
const {
|
|
48
|
-
getEditedPostContext,
|
|
49
47
|
getSettings
|
|
50
|
-
} =
|
|
51
|
-
const _context = getEditedPostContext();
|
|
48
|
+
} = select(editSiteStore);
|
|
52
49
|
return {
|
|
53
|
-
settings: getSettings()
|
|
54
|
-
// TODO: The `postType` check should be removed when the default rendering mode per post type is merged.
|
|
55
|
-
// @see https://github.com/WordPress/gutenberg/pull/62304/
|
|
56
|
-
shouldUseTemplateAsDefaultRenderingMode: _context?.postId && _context?.postType !== 'post'
|
|
50
|
+
settings: getSettings()
|
|
57
51
|
};
|
|
58
52
|
}, []);
|
|
59
|
-
const defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode ? 'template-locked' : 'post-only';
|
|
60
53
|
const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
|
|
61
54
|
const defaultEditorSettings = useMemo(() => {
|
|
62
55
|
return {
|
|
@@ -64,12 +57,11 @@ export function useSpecificEditorSettings() {
|
|
|
64
57
|
richEditingEnabled: true,
|
|
65
58
|
supportsTemplateMode: true,
|
|
66
59
|
focusMode: canvas !== 'view',
|
|
67
|
-
defaultRenderingMode,
|
|
68
60
|
onNavigateToEntityRecord,
|
|
69
61
|
onNavigateToPreviousEntityRecord,
|
|
70
62
|
isPreviewMode: canvas === 'view'
|
|
71
63
|
};
|
|
72
|
-
}, [settings, canvas,
|
|
64
|
+
}, [settings, canvas, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]);
|
|
73
65
|
return defaultEditorSettings;
|
|
74
66
|
}
|
|
75
67
|
//# sourceMappingURL=use-site-editor-settings.js.map
|