@wordpress/edit-site 5.3.0 → 5.3.1

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.
Files changed (87) hide show
  1. package/build/components/add-new-template/new-template-part.js +5 -4
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/add-new-template/new-template.js +5 -4
  4. package/build/components/add-new-template/new-template.js.map +1 -1
  5. package/build/components/block-editor/editor-canvas.js +13 -2
  6. package/build/components/block-editor/editor-canvas.js.map +1 -1
  7. package/build/components/block-editor/index.js +3 -3
  8. package/build/components/block-editor/index.js.map +1 -1
  9. package/build/components/editor/index.js +5 -3
  10. package/build/components/editor/index.js.map +1 -1
  11. package/build/components/global-styles/ui.js +21 -2
  12. package/build/components/global-styles/ui.js.map +1 -1
  13. package/build/components/layout/index.js +5 -3
  14. package/build/components/layout/index.js.map +1 -1
  15. package/build/components/navigation-inspector/index.js +8 -4
  16. package/build/components/navigation-inspector/index.js.map +1 -1
  17. package/build/components/navigation-inspector/navigation-menu.js +4 -2
  18. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  19. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +18 -1
  20. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  21. package/build/components/site-hub/index.js +9 -8
  22. package/build/components/site-hub/index.js.map +1 -1
  23. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -4
  24. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  25. package/build/store/actions.js +1 -27
  26. package/build/store/actions.js.map +1 -1
  27. package/build/store/index.js +8 -0
  28. package/build/store/index.js.map +1 -1
  29. package/build/store/private-actions.js +40 -0
  30. package/build/store/private-actions.js.map +1 -0
  31. package/build/store/private-selectors.js +18 -0
  32. package/build/store/private-selectors.js.map +1 -0
  33. package/build/store/selectors.js +0 -13
  34. package/build/store/selectors.js.map +1 -1
  35. package/build-module/components/add-new-template/new-template-part.js +4 -4
  36. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  37. package/build-module/components/add-new-template/new-template.js +4 -4
  38. package/build-module/components/add-new-template/new-template.js.map +1 -1
  39. package/build-module/components/block-editor/editor-canvas.js +13 -3
  40. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  41. package/build-module/components/block-editor/index.js +3 -3
  42. package/build-module/components/block-editor/index.js.map +1 -1
  43. package/build-module/components/editor/index.js +4 -3
  44. package/build-module/components/editor/index.js.map +1 -1
  45. package/build-module/components/global-styles/ui.js +20 -2
  46. package/build-module/components/global-styles/ui.js.map +1 -1
  47. package/build-module/components/layout/index.js +4 -3
  48. package/build-module/components/layout/index.js.map +1 -1
  49. package/build-module/components/navigation-inspector/index.js +8 -4
  50. package/build-module/components/navigation-inspector/index.js.map +1 -1
  51. package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
  52. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  53. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +18 -1
  54. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  55. package/build-module/components/site-hub/index.js +8 -8
  56. package/build-module/components/site-hub/index.js.map +1 -1
  57. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -4
  58. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  59. package/build-module/store/actions.js +0 -23
  60. package/build-module/store/actions.js.map +1 -1
  61. package/build-module/store/index.js +5 -0
  62. package/build-module/store/index.js.map +1 -1
  63. package/build-module/store/private-actions.js +29 -0
  64. package/build-module/store/private-actions.js.map +1 -0
  65. package/build-module/store/private-selectors.js +11 -0
  66. package/build-module/store/private-selectors.js.map +1 -0
  67. package/build-module/store/selectors.js +0 -11
  68. package/build-module/store/selectors.js.map +1 -1
  69. package/package.json +31 -31
  70. package/src/components/add-new-template/new-template-part.js +3 -2
  71. package/src/components/add-new-template/new-template.js +5 -3
  72. package/src/components/block-editor/editor-canvas.js +12 -2
  73. package/src/components/block-editor/index.js +4 -3
  74. package/src/components/block-editor/style.scss +1 -0
  75. package/src/components/editor/index.js +4 -3
  76. package/src/components/global-styles/ui.js +23 -4
  77. package/src/components/layout/index.js +3 -2
  78. package/src/components/navigation-inspector/index.js +5 -2
  79. package/src/components/navigation-inspector/navigation-menu.js +2 -2
  80. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +21 -1
  81. package/src/components/site-hub/index.js +7 -9
  82. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -3
  83. package/src/store/actions.js +0 -24
  84. package/src/store/index.js +5 -0
  85. package/src/store/private-actions.js +29 -0
  86. package/src/store/private-selectors.js +10 -0
  87. package/src/store/selectors.js +0 -11
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","Platform","preferencesStore","getFilteredTemplatePartBlocks","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateType","templateId","template","getEditedEntityRecord","templateParts","blocks","getEditorMode","__unstableGetCanvasMode","canvasMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened"],"mappings":"AAAA;AACA;AACA;AACA,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,aAAa,GAAG5D,MAAM,CAAER,aAAF,CAAN,CAAwBuB,gBAAxB,CACrB,UADqB,EAErB,kBAFqB,EAGrB;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAHqB,CAAtB;AAMA,SAAOlB,6BAA6B,CAAE4D,QAAQ,CAACG,MAAX,EAAmBD,aAAnB,CAApC;AACA,CAjBmE,CAA9D;AAoBP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,CAAwB7D,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS8D,uBAAT,CAAkC9D,KAAlC,EAA0C;AAChD,SAAOA,KAAK,CAAC+D,UAAb;AACA;AAED;AACA;AACA;;AACA,OAAO,SAASC,wCAAT,GAAoD;AAC1DvE,EAAAA,UAAU,CACT,uEADS,EAET;AACCY,IAAAA,KAAK,EAAE,KADR;AAEC+B,IAAAA,OAAO,EAAE;AAFV,GAFS,CAAV;AAOA;AAED;AACA;AACA;;AACA,OAAO,SAAS6B,4BAAT,GAAwC;AAC9CxE,EAAAA,UAAU,CAAE,2DAAF,EAA+D;AACxEY,IAAAA,KAAK,EAAE,KADiE;AAExE+B,IAAAA,OAAO,EAAE;AAF+D,GAA/D,CAAV;AAIA;AAED;AACA;AACA;;AACA,OAAO,SAAS8B,kBAAT,GAA8B;AACpCzE,EAAAA,UAAU,CAAE,iDAAF,EAAqD;AAC9DY,IAAAA,KAAK,EAAE,KADuD;AAE9D+B,IAAAA,OAAO,EAAE;AAFqD,GAArD,CAAV;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\treturn getFilteredTemplatePartBlocks( template.blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * Returns the current canvas mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Canvas mode.\n */\nexport function __unstableGetCanvasMode( state ) {\n\treturn state.canvasMode;\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","Platform","preferencesStore","getFilteredTemplatePartBlocks","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateType","templateId","template","getEditedEntityRecord","templateParts","blocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASC,6BAAT,QAA8C,SAA9C;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GAAGN,sBAAsB,CAC1DO,MAAF,IAAc,CAAEC,KAAF,EAASC,IAAT,KACbF,MAAM,CAAEH,gBAAF,CAAN,CAA2BM,GAA3B,CAAgC,gBAAhC,EAAkDD,IAAlD,CAF2D,CAAtD;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,eAAT,CAA0BH,KAA1B,EAAiCI,WAAjC,EAA+C;AACrDX,EAAAA,UAAU,CAAG,4CAAH,EAAgD;AACzDY,I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,CAAV;AAIA;AAED;AACA;AACA;;AACA,OAAO,SAAS4B,kBAAT,GAA8B;AACpCvE,EAAAA,UAAU,CAAE,iDAAF,EAAqD;AAC9DY,IAAAA,KAAK,EAAE,KADuD;AAE9D+B,IAAAA,OAAO,EAAE;AAFqD,GAArD,CAAV;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\treturn getFilteredTemplatePartBlocks( template.blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.3.0",
3
+ "version": "5.3.1",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,35 +27,35 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.26.0",
31
- "@wordpress/api-fetch": "^6.23.0",
32
- "@wordpress/block-editor": "^11.3.0",
33
- "@wordpress/block-library": "^8.3.0",
34
- "@wordpress/blocks": "^12.3.0",
35
- "@wordpress/components": "^23.3.0",
36
- "@wordpress/compose": "^6.3.0",
37
- "@wordpress/core-data": "^6.3.0",
38
- "@wordpress/data": "^8.3.0",
39
- "@wordpress/deprecated": "^3.26.0",
40
- "@wordpress/editor": "^13.3.0",
41
- "@wordpress/element": "^5.3.0",
42
- "@wordpress/experiments": "^0.8.0",
43
- "@wordpress/hooks": "^3.26.0",
44
- "@wordpress/html-entities": "^3.26.0",
45
- "@wordpress/i18n": "^4.26.0",
46
- "@wordpress/icons": "^9.17.0",
47
- "@wordpress/interface": "^5.3.0",
48
- "@wordpress/keyboard-shortcuts": "^4.3.0",
49
- "@wordpress/keycodes": "^3.26.0",
50
- "@wordpress/media-utils": "^4.17.0",
51
- "@wordpress/notices": "^3.26.0",
52
- "@wordpress/plugins": "^5.3.0",
53
- "@wordpress/preferences": "^3.3.0",
54
- "@wordpress/reusable-blocks": "^4.3.0",
55
- "@wordpress/style-engine": "^1.9.0",
56
- "@wordpress/url": "^3.27.0",
57
- "@wordpress/viewport": "^5.3.0",
58
- "@wordpress/widgets": "^3.3.0",
30
+ "@wordpress/a11y": "^3.26.1",
31
+ "@wordpress/api-fetch": "^6.23.1",
32
+ "@wordpress/block-editor": "^11.3.1",
33
+ "@wordpress/block-library": "^8.3.1",
34
+ "@wordpress/blocks": "^12.3.1",
35
+ "@wordpress/components": "^23.3.1",
36
+ "@wordpress/compose": "^6.3.1",
37
+ "@wordpress/core-data": "^6.3.1",
38
+ "@wordpress/data": "^8.3.1",
39
+ "@wordpress/deprecated": "^3.26.1",
40
+ "@wordpress/editor": "^13.3.1",
41
+ "@wordpress/element": "^5.3.1",
42
+ "@wordpress/experiments": "^0.8.1",
43
+ "@wordpress/hooks": "^3.26.1",
44
+ "@wordpress/html-entities": "^3.26.1",
45
+ "@wordpress/i18n": "^4.26.1",
46
+ "@wordpress/icons": "^9.17.1",
47
+ "@wordpress/interface": "^5.3.1",
48
+ "@wordpress/keyboard-shortcuts": "^4.3.1",
49
+ "@wordpress/keycodes": "^3.26.1",
50
+ "@wordpress/media-utils": "^4.17.1",
51
+ "@wordpress/notices": "^3.26.1",
52
+ "@wordpress/plugins": "^5.3.1",
53
+ "@wordpress/preferences": "^3.3.1",
54
+ "@wordpress/reusable-blocks": "^4.3.1",
55
+ "@wordpress/style-engine": "^1.9.1",
56
+ "@wordpress/url": "^3.27.1",
57
+ "@wordpress/viewport": "^5.3.1",
58
+ "@wordpress/widgets": "^3.3.1",
59
59
  "classnames": "^2.3.1",
60
60
  "colord": "^2.9.2",
61
61
  "downloadjs": "^1.4.7",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "cab6ebe2b4c5dbacfd753dcae4a2406559c4813c"
76
+ "gitHead": "e9ff92d836928aba65dde94d9d193bc401a934d7"
77
77
  }
@@ -20,6 +20,7 @@ import {
20
20
  getUniqueTemplatePartTitle,
21
21
  getCleanTemplatePartSlug,
22
22
  } from '../../utils/template-part-create';
23
+ import { unlock } from '../../experiments';
23
24
 
24
25
  export default function NewTemplatePart( {
25
26
  postType,
@@ -30,7 +31,7 @@ export default function NewTemplatePart( {
30
31
  const [ isModalOpen, setIsModalOpen ] = useState( false );
31
32
  const { createErrorNotice } = useDispatch( noticesStore );
32
33
  const { saveEntityRecord } = useDispatch( coreStore );
33
- const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
34
+ const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
34
35
  const existingTemplateParts = useExistingTemplateParts();
35
36
 
36
37
  async function createTemplatePart( { title, area } ) {
@@ -63,7 +64,7 @@ export default function NewTemplatePart( {
63
64
  setIsModalOpen( false );
64
65
 
65
66
  // Switch to edit mode.
66
- __unstableSetCanvasMode( 'edit' );
67
+ setCanvasMode( 'edit' );
67
68
 
68
69
  // Navigate to the created template part editor.
69
70
  history.push( {
@@ -48,6 +48,7 @@ import AddCustomGenericTemplateModal from './add-custom-generic-template-modal';
48
48
  import TemplateActionsLoadingScreen from './template-actions-loading-screen';
49
49
  import { useHistory } from '../routes';
50
50
  import { store as editSiteStore } from '../../store';
51
+ import { unlock } from '../../experiments';
51
52
 
52
53
  const DEFAULT_TEMPLATE_SLUGS = [
53
54
  'front-page',
@@ -98,8 +99,9 @@ export default function NewTemplate( {
98
99
  const { saveEntityRecord } = useDispatch( coreStore );
99
100
  const { createErrorNotice, createSuccessNotice } =
100
101
  useDispatch( noticesStore );
101
- const { setTemplate, __unstableSetCanvasMode } =
102
- useDispatch( editSiteStore );
102
+ const { setTemplate, setCanvasMode } = unlock(
103
+ useDispatch( editSiteStore )
104
+ );
103
105
 
104
106
  async function createTemplate( template, isWPSuggestion = true ) {
105
107
  if ( isCreatingTemplate ) {
@@ -140,7 +142,7 @@ export default function NewTemplate( {
140
142
  setTemplate( newTemplate.id, newTemplate.slug );
141
143
 
142
144
  // Switch to edit mode.
143
- __unstableSetCanvasMode( 'edit' );
145
+ setCanvasMode( 'edit' );
144
146
 
145
147
  // Navigate to the created template editor.
146
148
  history.push( {
@@ -8,24 +8,27 @@ import {
8
8
  __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,
9
9
  store as blockEditorStore,
10
10
  } from '@wordpress/block-editor';
11
- import { useSelect } from '@wordpress/data';
11
+ import { useSelect, useDispatch } from '@wordpress/data';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
+ import { unlock } from '../../experiments';
16
17
  import { store as editSiteStore } from '../../store';
17
18
 
18
19
  function EditorCanvas( { enableResizing, settings, children, ...props } ) {
19
- const { deviceType, isZoomOutMode } = useSelect(
20
+ const { canvasMode, deviceType, isZoomOutMode } = useSelect(
20
21
  ( select ) => ( {
21
22
  deviceType:
22
23
  select( editSiteStore ).__experimentalGetPreviewDeviceType(),
23
24
  isZoomOutMode:
24
25
  select( blockEditorStore ).__unstableGetEditorMode() ===
25
26
  'zoom-out',
27
+ canvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),
26
28
  } ),
27
29
  []
28
30
  );
31
+ const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
29
32
  const deviceStyles = useResizeCanvas( deviceType );
30
33
  const mouseMoveTypingRef = useMouseMoveTypingReset();
31
34
  return (
@@ -57,6 +60,13 @@ function EditorCanvas( { enableResizing, settings, children, ...props } ) {
57
60
  name="editor-canvas"
58
61
  className="edit-site-visual-editor__editor-canvas"
59
62
  { ...props }
63
+ role={ canvasMode === 'view' ? 'button' : undefined }
64
+ onClick={
65
+ canvasMode === 'view'
66
+ ? () => setCanvasMode( 'edit' )
67
+ : undefined
68
+ }
69
+ readonly={ canvasMode === 'view' }
60
70
  >
61
71
  { /* Filters need to be rendered before children to avoid Safari rendering issues. */ }
62
72
  { settings.svgFilters }
@@ -51,13 +51,14 @@ export default function BlockEditor() {
51
51
  const { setIsInserterOpened } = useDispatch( editSiteStore );
52
52
  const { storedSettings, templateType, canvasMode } = useSelect(
53
53
  ( select ) => {
54
- const { getSettings, getEditedPostType, __unstableGetCanvasMode } =
55
- select( editSiteStore );
54
+ const { getSettings, getEditedPostType, getCanvasMode } = unlock(
55
+ select( editSiteStore )
56
+ );
56
57
 
57
58
  return {
58
59
  storedSettings: getSettings( setIsInserterOpened ),
59
60
  templateType: getEditedPostType(),
60
- canvasMode: __unstableGetCanvasMode(),
61
+ canvasMode: getCanvasMode(),
61
62
  };
62
63
  },
63
64
  [ setIsInserterOpened ]
@@ -158,3 +158,4 @@
158
158
  box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color);
159
159
  }
160
160
  }
161
+
@@ -38,6 +38,7 @@ import { GlobalStylesRenderer } from '../global-styles-renderer';
38
38
  import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
39
39
  import useTitle from '../routes/use-title';
40
40
  import CanvasSpinner from '../canvas-spinner';
41
+ import { unlock } from '../../experiments';
41
42
 
42
43
  const interfaceLabels = {
43
44
  /* translators: accessibility text for the editor content landmark region. */
@@ -71,11 +72,11 @@ export default function Editor() {
71
72
  getEditedPostId,
72
73
  getEditedPostContext,
73
74
  getEditorMode,
74
- __unstableGetCanvasMode,
75
+ getCanvasMode,
75
76
  isInserterOpened,
76
77
  isListViewOpened,
77
78
  isSaveViewOpened,
78
- } = select( editSiteStore );
79
+ } = unlock( select( editSiteStore ) );
79
80
  const { hasFinishedResolution, getEntityRecord } = select( coreStore );
80
81
  const { __unstableGetEditorMode } = select( blockEditorStore );
81
82
  const { getActiveComplementaryArea } = select( interfaceStore );
@@ -99,7 +100,7 @@ export default function Editor() {
99
100
  ] )
100
101
  : false,
101
102
  editorMode: getEditorMode(),
102
- canvasMode: __unstableGetCanvasMode(),
103
+ canvasMode: getCanvasMode(),
103
104
  blockEditorMode: __unstableGetEditorMode(),
104
105
  isInserterOpen: isInserterOpened(),
105
106
  isListViewOpen: isListViewOpened(),
@@ -14,6 +14,7 @@ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
14
14
  import { __ } from '@wordpress/i18n';
15
15
  import { store as preferencesStore } from '@wordpress/preferences';
16
16
  import { moreVertical } from '@wordpress/icons';
17
+ import { store as coreStore } from '@wordpress/core-data';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -44,6 +45,20 @@ const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =
44
45
 
45
46
  function GlobalStylesActionMenu() {
46
47
  const { toggle } = useDispatch( preferencesStore );
48
+ const { canEditCSS } = useSelect( ( select ) => {
49
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
50
+ select( coreStore );
51
+
52
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
53
+ const globalStyles = globalStylesId
54
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
55
+ : undefined;
56
+
57
+ return {
58
+ canEditCSS:
59
+ !! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
60
+ };
61
+ }, [] );
47
62
  const { useGlobalStylesReset } = unlock( blockEditorExperiments );
48
63
  const [ canReset, onReset ] = useGlobalStylesReset();
49
64
  const { goTo } = useNavigator();
@@ -64,10 +79,14 @@ function GlobalStylesActionMenu() {
64
79
  onClick: () =>
65
80
  toggle( 'core/edit-site', 'welcomeGuideStyles' ),
66
81
  },
67
- {
68
- title: __( 'Additional CSS' ),
69
- onClick: loadCustomCSS,
70
- },
82
+ ...( canEditCSS
83
+ ? [
84
+ {
85
+ title: __( 'Additional CSS' ),
86
+ onClick: loadCustomCSS,
87
+ },
88
+ ]
89
+ : [] ),
71
90
  ] }
72
91
  />
73
92
  </GlobalStylesMenuFill>
@@ -38,6 +38,7 @@ import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-e
38
38
  import SiteHub from '../site-hub';
39
39
  import ResizeHandle from '../block-editor/resize-handle';
40
40
  import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
41
+ import { unlock } from '../../experiments';
41
42
 
42
43
  const ANIMATION_DURATION = 0.5;
43
44
  const emptyResizeHandleStyles = {
@@ -66,9 +67,9 @@ export default function Layout() {
66
67
  const { getAllShortcutKeyCombinations } = select(
67
68
  keyboardShortcutsStore
68
69
  );
69
- const { __unstableGetCanvasMode } = select( editSiteStore );
70
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
70
71
  return {
71
- canvasMode: __unstableGetCanvasMode(),
72
+ canvasMode: getCanvasMode(),
72
73
  previousShortcut: getAllShortcutKeyCombinations(
73
74
  'core/edit-site/previous-region'
74
75
  ),
@@ -20,7 +20,7 @@ import NavigationMenu from './navigation-menu';
20
20
 
21
21
  const NAVIGATION_MENUS_QUERY = [ { per_page: -1, status: 'publish' } ];
22
22
 
23
- export default function NavigationInspector() {
23
+ export default function NavigationInspector( { onSelect } ) {
24
24
  const {
25
25
  selectedNavigationBlockId,
26
26
  clientIdToRef,
@@ -206,7 +206,10 @@ export default function NavigationInspector() {
206
206
  onChange={ onChange }
207
207
  onInput={ onInput }
208
208
  >
209
- <NavigationMenu innerBlocks={ publishedInnerBlocks } />
209
+ <NavigationMenu
210
+ innerBlocks={ publishedInnerBlocks }
211
+ onSelect={ onSelect }
212
+ />
210
213
  </BlockEditorProvider>
211
214
  ) }
212
215
 
@@ -36,7 +36,7 @@ const ALLOWED_BLOCKS = {
36
36
  ],
37
37
  };
38
38
 
39
- export default function NavigationMenu( { innerBlocks } ) {
39
+ export default function NavigationMenu( { innerBlocks, onSelect } ) {
40
40
  const { updateBlockListSettings } = useDispatch( blockEditorStore );
41
41
 
42
42
  const { OffCanvasEditor } = unlock( blockEditorExperiments );
@@ -56,5 +56,5 @@ export default function NavigationMenu( { innerBlocks } ) {
56
56
  } );
57
57
  }, [ updateBlockListSettings, innerBlocks ] );
58
58
 
59
- return <OffCanvasEditor blocks={ innerBlocks } />;
59
+ return <OffCanvasEditor blocks={ innerBlocks } onSelect={ onSelect } />;
60
60
  }
@@ -2,14 +2,34 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { useCallback } from '@wordpress/element';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
10
11
  import NavigationInspector from '../navigation-inspector';
12
+ import { useHistory } from '../routes';
11
13
 
12
14
  export default function SidebarNavigationScreenNavigationMenus() {
15
+ const history = useHistory();
16
+ const onSelect = useCallback(
17
+ ( selectedBlock ) => {
18
+ const { attributes } = selectedBlock;
19
+ if (
20
+ attributes.kind === 'post-type' &&
21
+ attributes.id &&
22
+ attributes.type &&
23
+ history
24
+ ) {
25
+ history.push( {
26
+ postType: attributes.type,
27
+ postId: attributes.id,
28
+ } );
29
+ }
30
+ },
31
+ [ history ]
32
+ );
13
33
  return (
14
34
  <SidebarNavigationScreen
15
35
  path="/navigation"
@@ -17,7 +37,7 @@ export default function SidebarNavigationScreenNavigationMenus() {
17
37
  title={ __( 'Navigation' ) }
18
38
  content={
19
39
  <div className="edit-site-sidebar-navigation-screen-navigation-menus">
20
- <NavigationInspector />
40
+ <NavigationInspector onSelect={ onSelect } />
21
41
  </div>
22
42
  }
23
43
  />
@@ -27,6 +27,7 @@ import { useLocation } from '../routes';
27
27
  import getIsListPage from '../../utils/get-is-list-page';
28
28
  import SiteIcon from '../site-icon';
29
29
  import useEditedEntityRecord from '../use-edited-entity-record';
30
+ import { unlock } from '../../experiments';
30
31
 
31
32
  const HUB_ANIMATION_DURATION = 0.3;
32
33
 
@@ -38,13 +39,10 @@ const SiteHub = forwardRef(
38
39
  const { canvasMode, dashboardLink, entityConfig } = useSelect(
39
40
  ( select ) => {
40
41
  select( editSiteStore ).getEditedPostType();
41
- const {
42
- __unstableGetCanvasMode,
43
- getSettings,
44
- getEditedPostType,
45
- } = select( editSiteStore );
42
+ const { getCanvasMode, getSettings, getEditedPostType } =
43
+ unlock( select( editSiteStore ) );
46
44
  return {
47
- canvasMode: __unstableGetCanvasMode(),
45
+ canvasMode: getCanvasMode(),
48
46
  dashboardLink: getSettings().__experimentalDashboardLink,
49
47
  entityConfig: select( coreStore ).getEntityConfig(
50
48
  'postType',
@@ -56,7 +54,7 @@ const SiteHub = forwardRef(
56
54
  );
57
55
  const disableMotion = useReducedMotion();
58
56
  const isMobileViewport = useViewportMatch( 'medium', '<' );
59
- const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
57
+ const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
60
58
  const { clearSelectedBlock } = useDispatch( blockEditorStore );
61
59
  const showEditButton =
62
60
  ( isEditorPage && canvasMode === 'view' && ! isMobileViewport ) ||
@@ -77,7 +75,7 @@ const SiteHub = forwardRef(
77
75
  onClick: () => {
78
76
  clearSelectedBlock();
79
77
  setIsMobileCanvasVisible( false );
80
- __unstableSetCanvasMode( 'view' );
78
+ setCanvasMode( 'view' );
81
79
  },
82
80
  };
83
81
  const { getTitle } = useEditedEntityRecord();
@@ -137,7 +135,7 @@ const SiteHub = forwardRef(
137
135
  <Button
138
136
  className="edit-site-site-hub__edit-button"
139
137
  onClick={ () => {
140
- __unstableSetCanvasMode( 'edit' );
138
+ setCanvasMode( 'edit' );
141
139
  } }
142
140
  variant="primary"
143
141
  >
@@ -9,15 +9,16 @@ import { useSelect, useDispatch } from '@wordpress/data';
9
9
  */
10
10
  import { store as editSiteStore } from '../../store';
11
11
  import { useLocation, useHistory } from '../routes';
12
+ import { unlock } from '../../experiments';
12
13
 
13
14
  export default function useSyncCanvasModeWithURL() {
14
15
  const history = useHistory();
15
16
  const { params } = useLocation();
16
17
  const canvasMode = useSelect(
17
- ( select ) => select( editSiteStore ).__unstableGetCanvasMode(),
18
+ ( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),
18
19
  []
19
20
  );
20
- const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
21
+ const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
21
22
  const currentCanvasMode = useRef( canvasMode );
22
23
  const { canvas: canvasInUrl = 'view' } = params;
23
24
  const currentCanvasInUrl = useRef( canvasInUrl );
@@ -34,7 +35,7 @@ export default function useSyncCanvasModeWithURL() {
34
35
  useEffect( () => {
35
36
  currentCanvasInUrl.current = canvasInUrl;
36
37
  if ( canvasInUrl !== currentCanvasMode.current ) {
37
- __unstableSetCanvasMode( canvasInUrl );
38
+ setCanvasMode( canvasInUrl );
38
39
  }
39
40
  }, [ canvasInUrl ] );
40
41
  }
@@ -530,27 +530,3 @@ export const switchEditorMode =
530
530
  speak( __( 'Mosaic view selected' ), 'assertive' );
531
531
  }
532
532
  };
533
-
534
- /**
535
- * Action that switches the canvas mode.
536
- *
537
- * @param {?string} mode Canvas mode.
538
- */
539
- export const __unstableSetCanvasMode =
540
- ( mode ) =>
541
- ( { registry, dispatch } ) => {
542
- registry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );
543
- dispatch( {
544
- type: 'SET_CANVAS_MODE',
545
- mode,
546
- } );
547
- // Check if the block list view should be open by default.
548
- if (
549
- mode === 'edit' &&
550
- registry
551
- .select( preferencesStore )
552
- .get( 'core/edit-site', 'showListViewByDefault' )
553
- ) {
554
- dispatch.setIsListViewOpened( true );
555
- }
556
- };
@@ -8,8 +8,11 @@ import { createReduxStore, register } from '@wordpress/data';
8
8
  */
9
9
  import reducer from './reducer';
10
10
  import * as actions from './actions';
11
+ import * as privateActions from './private-actions';
11
12
  import * as selectors from './selectors';
13
+ import * as privateSelectors from './private-selectors';
12
14
  import { STORE_NAME } from './constants';
15
+ import { unlock } from '../experiments';
13
16
 
14
17
  export const storeConfig = {
15
18
  reducer,
@@ -19,3 +22,5 @@ export const storeConfig = {
19
22
 
20
23
  export const store = createReduxStore( STORE_NAME, storeConfig );
21
24
  register( store );
25
+ unlock( store ).registerPrivateSelectors( privateSelectors );
26
+ unlock( store ).registerPrivateActions( privateActions );
@@ -0,0 +1,29 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as blockEditorStore } from '@wordpress/block-editor';
5
+ import { store as preferencesStore } from '@wordpress/preferences';
6
+
7
+ /**
8
+ * Action that switches the canvas mode.
9
+ *
10
+ * @param {?string} mode Canvas mode.
11
+ */
12
+ export const setCanvasMode =
13
+ ( mode ) =>
14
+ ( { registry, dispatch } ) => {
15
+ registry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );
16
+ dispatch( {
17
+ type: 'SET_CANVAS_MODE',
18
+ mode,
19
+ } );
20
+ // Check if the block list view should be open by default.
21
+ if (
22
+ mode === 'edit' &&
23
+ registry
24
+ .select( preferencesStore )
25
+ .get( 'core/edit-site', 'showListViewByDefault' )
26
+ ) {
27
+ dispatch.setIsListViewOpened( true );
28
+ }
29
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns the current canvas mode.
3
+ *
4
+ * @param {Object} state Global application state.
5
+ *
6
+ * @return {string} Canvas mode.
7
+ */
8
+ export function getCanvasMode( state ) {
9
+ return state.canvasMode;
10
+ }
@@ -288,17 +288,6 @@ export function getEditorMode( state ) {
288
288
  return __unstableGetPreference( state, 'editorMode' );
289
289
  }
290
290
 
291
- /**
292
- * Returns the current canvas mode.
293
- *
294
- * @param {Object} state Global application state.
295
- *
296
- * @return {string} Canvas mode.
297
- */
298
- export function __unstableGetCanvasMode( state ) {
299
- return state.canvasMode;
300
- }
301
-
302
291
  /**
303
292
  * @deprecated
304
293
  */