@wordpress/edit-site 5.3.6 → 5.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/build/components/block-editor/editor-canvas.js +2 -1
  2. package/build/components/block-editor/editor-canvas.js.map +1 -1
  3. package/build/components/layout/index.js +6 -0
  4. package/build/components/layout/index.js.map +1 -1
  5. package/build/components/list/index.js +2 -1
  6. package/build/components/list/index.js.map +1 -1
  7. package/build/components/routes/link.js +4 -1
  8. package/build/components/routes/link.js.map +1 -1
  9. package/build/components/save-button/index.js +2 -5
  10. package/build/components/save-button/index.js.map +1 -1
  11. package/build/components/save-hub/index.js +82 -0
  12. package/build/components/save-hub/index.js.map +1 -0
  13. package/build/components/sidebar/index.js +2 -4
  14. package/build/components/sidebar/index.js.map +1 -1
  15. package/build/components/sidebar-navigation-screen/index.js +5 -2
  16. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  17. package/build/components/sidebar-navigation-screen-main/index.js +1 -0
  18. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  19. package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
  20. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  21. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +139 -11
  22. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  23. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  24. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  25. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  26. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  27. package/build/components/sidebar-navigation-screen-template/index.js +18 -4
  28. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  29. package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
  30. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  31. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  32. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  33. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  34. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  35. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  36. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  37. package/build/components/template-details/index.js +0 -3
  38. package/build/components/template-details/index.js.map +1 -1
  39. package/build/components/use-edited-entity-record/index.js +6 -6
  40. package/build/components/use-edited-entity-record/index.js.map +1 -1
  41. package/build/index.js +3 -0
  42. package/build/index.js.map +1 -1
  43. package/build/utils/history.js +8 -2
  44. package/build/utils/history.js.map +1 -1
  45. package/build-module/components/block-editor/editor-canvas.js +2 -1
  46. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  47. package/build-module/components/layout/index.js +6 -0
  48. package/build-module/components/layout/index.js.map +1 -1
  49. package/build-module/components/list/index.js +2 -1
  50. package/build-module/components/list/index.js.map +1 -1
  51. package/build-module/components/routes/link.js +5 -2
  52. package/build-module/components/routes/link.js.map +1 -1
  53. package/build-module/components/save-button/index.js +2 -5
  54. package/build-module/components/save-button/index.js.map +1 -1
  55. package/build-module/components/save-hub/index.js +68 -0
  56. package/build-module/components/save-hub/index.js.map +1 -0
  57. package/build-module/components/sidebar/index.js +2 -4
  58. package/build-module/components/sidebar/index.js.map +1 -1
  59. package/build-module/components/sidebar-navigation-screen/index.js +5 -2
  60. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  61. package/build-module/components/sidebar-navigation-screen-main/index.js +1 -0
  62. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  63. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
  64. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  65. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +131 -11
  66. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  67. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  68. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  69. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  70. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  71. package/build-module/components/sidebar-navigation-screen-template/index.js +18 -5
  72. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  73. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
  74. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  75. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  76. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  77. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  78. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  79. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  80. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  81. package/build-module/components/template-details/index.js +0 -3
  82. package/build-module/components/template-details/index.js.map +1 -1
  83. package/build-module/components/use-edited-entity-record/index.js +6 -6
  84. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  85. package/build-module/index.js +4 -1
  86. package/build-module/index.js.map +1 -1
  87. package/build-module/utils/history.js +9 -3
  88. package/build-module/utils/history.js.map +1 -1
  89. package/build-style/style-rtl.css +80 -67
  90. package/build-style/style.css +80 -67
  91. package/package.json +7 -7
  92. package/src/components/block-editor/editor-canvas.js +2 -1
  93. package/src/components/layout/index.js +14 -0
  94. package/src/components/layout/style.scss +1 -3
  95. package/src/components/list/index.js +3 -1
  96. package/src/components/routes/link.js +9 -2
  97. package/src/components/save-button/index.js +2 -2
  98. package/src/components/save-hub/index.js +78 -0
  99. package/src/components/save-hub/style.scss +15 -0
  100. package/src/components/sidebar/index.js +2 -3
  101. package/src/components/sidebar/style.scss +4 -3
  102. package/src/components/sidebar-button/style.scss +2 -1
  103. package/src/components/sidebar-navigation-item/style.scss +0 -20
  104. package/src/components/sidebar-navigation-screen/index.js +6 -0
  105. package/src/components/sidebar-navigation-screen/style.scss +15 -0
  106. package/src/components/sidebar-navigation-screen-main/index.js +3 -0
  107. package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
  108. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +141 -10
  109. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  110. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  111. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +55 -4
  112. package/src/components/sidebar-navigation-screen-template/index.js +21 -7
  113. package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
  114. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
  115. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  116. package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
  117. package/src/components/template-details/index.js +0 -3
  118. package/src/components/use-edited-entity-record/index.js +26 -18
  119. package/src/index.js +5 -1
  120. package/src/style.scss +1 -1
  121. package/src/utils/history.js +13 -9
  122. package/build/components/navigation-inspector/index.js +0 -190
  123. package/build/components/navigation-inspector/index.js.map +0 -1
  124. package/build/components/navigation-inspector/navigation-menu.js +0 -62
  125. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  126. package/build-module/components/navigation-inspector/index.js +0 -173
  127. package/build-module/components/navigation-inspector/index.js.map +0 -1
  128. package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
  129. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  130. package/src/components/navigation-inspector/index.js +0 -223
  131. package/src/components/navigation-inspector/navigation-menu.js +0 -66
  132. package/src/components/navigation-inspector/style.scss +0 -46
@@ -15,7 +15,7 @@ import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-templa
15
15
  import useSyncPathWithURL, { getPathFromURL } from '../sync-state-with-url/use-sync-path-with-url';
16
16
  import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
17
17
  import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
18
- import SaveButton from '../save-button';
18
+ import SaveHub from '../save-hub';
19
19
  import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';
20
20
  import { useLocation } from '../routes';
21
21
 
@@ -46,9 +46,7 @@ function Sidebar() {
46
46
  initialPath: initialPath.current
47
47
  }, createElement(SidebarScreens, null)), createElement("div", {
48
48
  className: "edit-site-sidebar__footer"
49
- }, createElement(SaveButton, {
50
- showTooltip: false
51
- })));
49
+ }, createElement(SaveHub, null)));
52
50
  }
53
51
 
54
52
  export default memo(Sidebar);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenTemplatesBrowse","SaveButton","SidebarNavigationScreenNavigationItem","useLocation","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,MAAf,QAA6B,oBAA7B;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,kBAAP,IACCC,cADD,QAEO,+CAFP;AAGA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,qCAAP,MAAkD,8CAAlD;AACA,SAASC,WAAT,QAA4B,WAA5B;;AAEA,SAASC,cAAT,GAA0B;AACzBP,EAAAA,kBAAkB;AAElB,SACC,8BACC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,2BAAD,OADD,CADD,EAIC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAJD,EAOC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,qCAAD,OADD,CAPD,EAUC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,gCAAD,OADD,CAVD,EAaC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAbD,EAgBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,+BAAD,OADD,CAhBD,CADD;AAsBA;;AAED,SAASQ,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAAwBJ,WAAW,EAAzC;AACA,QAAMK,WAAW,GAAGnB,MAAM,CAAES,cAAc,CAAES,SAAF,CAAhB,CAA1B;AAEA,SACC,8BACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAGC,WAAW,CAACC;AAF3B,KAIC,cAAC,cAAD,OAJD,CADD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD;AAAY,IAAA,WAAW,EAAG;AAA1B,IADD,CARD,CADD;AAcA;;AAED,eAAerB,IAAI,CAAEiB,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveButton from '../save-button';\nimport SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';\nimport { useLocation } from '../routes';\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationItem />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\n\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t<SaveButton showTooltip={ false } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenTemplatesBrowse","SaveHub","SidebarNavigationScreenNavigationItem","useLocation","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,MAAf,QAA6B,oBAA7B;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,kBAAP,IACCC,cADD,QAEO,+CAFP;AAGA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,OAAOC,qCAAP,MAAkD,8CAAlD;AACA,SAASC,WAAT,QAA4B,WAA5B;;AAEA,SAASC,cAAT,GAA0B;AACzBP,EAAAA,kBAAkB;AAElB,SACC,8BACC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,2BAAD,OADD,CADD,EAIC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAJD,EAOC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,qCAAD,OADD,CAPD,EAUC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,gCAAD,OADD,CAVD,EAaC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAbD,EAgBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,+BAAD,OADD,CAhBD,CADD;AAsBA;;AAED,SAASQ,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAAwBJ,WAAW,EAAzC;AACA,QAAMK,WAAW,GAAGnB,MAAM,CAAES,cAAc,CAAES,SAAF,CAAhB,CAA1B;AAEA,SACC,8BACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAGC,WAAW,CAACC;AAF3B,KAIC,cAAC,cAAD,OAJD,CADD,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD,OADD,CAPD,CADD;AAaA;;AAED,eAAerB,IAAI,CAAEiB,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';\nimport { useLocation } from '../routes';\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationItem />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t<SaveHub />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
@@ -19,7 +19,8 @@ export default function SidebarNavigationScreen(_ref) {
19
19
  isRoot,
20
20
  title,
21
21
  actions,
22
- content
22
+ content,
23
+ description
23
24
  } = _ref;
24
25
  const {
25
26
  dashboardLink
@@ -50,6 +51,8 @@ export default function SidebarNavigationScreen(_ref) {
50
51
  className: "edit-site-sidebar-navigation-screen__title"
51
52
  }, title), actions), createElement("nav", {
52
53
  className: "edit-site-sidebar-navigation-screen__content"
53
- }, content));
54
+ }, description && createElement("p", {
55
+ className: "edit-site-sidebar-navigation-screen__description"
56
+ }, description), content));
54
57
  }
55
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","SidebarButton","SidebarNavigationScreen","isRoot","title","actions","content","dashboardLink","select","getSettings","__experimentalDashboardLink"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,QAIO,uBAJP;AAKA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,YAAT,EAAuBC,WAAvB,QAA0C,kBAA1C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,uBAAT,OAKX;AAAA,MAL6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBV,SAAS,CAAIW,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBT,MAAM,CAAEQ,MAAM,CAAET,aAAF,CAAR,CAA9B;AACA,WAAO;AACNQ,MAAAA,aAAa,EAAEE,WAAW,GAAGC;AADvB,KAAP;AAGA,GALkC,EAKhC,EALgC,CAAnC;AAOA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG,CAAEP,MAAF,GACD,cAAC,uBAAD;AACC,IAAA,EAAE,EAAGF,aADN;AAEC,IAAA,IAAI,EAAGR,KAAK,KAAKE,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,EAAE,CAAE,MAAF;AAHhB,IADC,GAOD,cAAC,aAAD;AACC,IAAA,IAAI,EAAGD,KAAK,KAAKE,YAAL,GAAoBC,WADjC;AAEC,kBAAaF,EAAE,CAAE,2BAAF,CAFhB;AAGC,IAAA,IAAI,EAAGa,aAAa,IAAI,WAHzB;AAIC,IAAA,KAAK,EAAGb,EAAE,CAAE,WAAF;AAJX,IAZF,EAmBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGU,KADH,CAnBD,EAsBGC,OAtBH,CADD,EA0BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CA1BD,CADD;AAgCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t>\n\t\t\t\t{ ! isRoot ? (\n\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\tas={ SidebarButton }\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</h2>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\n\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t{ content }\n\t\t\t</nav>\n\t\t</VStack>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","SidebarButton","SidebarNavigationScreen","isRoot","title","actions","content","description","dashboardLink","select","getSettings","__experimentalDashboardLink"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,QAIO,uBAJP;AAKA,SAASC,KAAT,EAAgBC,EAAhB,QAA0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sBGC,OAtBH,CADD,EA0BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGE,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CAFF,EAMGD,OANH,CA1BD,CADD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\n\tdescription,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t>\n\t\t\t\t{ ! isRoot ? (\n\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\tas={ SidebarButton }\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</h2>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\n\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t{ description && (\n\t\t\t\t\t<p className=\"edit-site-sidebar-navigation-screen__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ content }\n\t\t\t</nav>\n\t\t</VStack>\n\t);\n}\n"]}
@@ -31,6 +31,7 @@ export default function SidebarNavigationScreenMain() {
31
31
  return createElement(SidebarNavigationScreen, {
32
32
  isRoot: true,
33
33
  title: __('Design'),
34
+ description: __('Customize the appearance of your website using the block editor.'),
34
35
  content: createElement(ItemGroup, null, !!navigationMenus && navigationMenus.length > 0 && createElement(NavigatorButton, {
35
36
  as: SidebarNavigationItem,
36
37
  path: "/navigation",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__","layout","symbolFilled","navigation","useSelect","store","coreStore","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","per_page","status","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,UAA/B,QAAiD,kBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsBN,SAAS,CAAIO,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEL,SAAF,CAAnC;AACA,WAAO;AACNI,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DC,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GARoC,CAArC;AAUA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGd,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,OAAO,EACN,cAAC,SAAD,QACG,CAAC,CAAEU,eAAH,IAAsBA,eAAe,CAACK,MAAhB,GAAyB,CAA/C,IACD,cAAC,eAAD;AACC,MAAA,EAAE,EAAGP,qBADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGH,EAAE,CAAE,YAAF,CANL,CAFF,EAWC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGP;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CAXD,EAmBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGN;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CAnBD;AAJF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { navigationMenus } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\treturn {\n\t\t\tnavigationMenus: getEntityRecords( 'postType', 'wp_navigation', {\n\t\t\t\tper_page: -1,\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ !! navigationMenus && navigationMenus.length > 0 && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template_part\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__","layout","symbolFilled","navigation","useSelect","store","coreStore","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","per_page","status","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,UAA/B,QAAiD,kBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsBN,SAAS,CAAIO,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEL,SAAF,CAAnC;AACA,WAAO;AACNI,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DC,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GARoC,CAArC;AAUA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGd,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,kEADe,CAHjB;AAMC,IAAA,OAAO,EACN,cAAC,SAAD,QACG,CAAC,CAAEU,eAAH,IAAsBA,eAAe,CAACK,MAAhB,GAAyB,CAA/C,IACD,cAAC,eAAD;AACC,MAAA,EAAE,EAAGP,qBADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGH,EAAE,CAAE,YAAF,CANL,CAFF,EAWC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGP;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CAXD,EAmBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGN;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CAnBD;AAPF,IADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { navigationMenus } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\treturn {\n\t\t\tnavigationMenus: getEntityRecords( 'postType', 'wp_navigation', {\n\t\t\t\tper_page: -1,\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ !! navigationMenus && navigationMenus.length > 0 && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template_part\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -1,12 +1,12 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
- import { useDispatch, useSelect } from '@wordpress/data';
8
- import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
9
- import { store as coreStore } from '@wordpress/core-data';
7
+ import { useDispatch } from '@wordpress/data';
8
+ import { __experimentalUseNavigator as useNavigator, ExternalLink } from '@wordpress/components';
9
+ import { useEntityRecord } from '@wordpress/core-data';
10
10
  import { decodeEntities } from '@wordpress/html-entities';
11
11
  import { pencil } from '@wordpress/icons';
12
12
  /**
@@ -18,7 +18,7 @@ import { unlock } from '../../private-apis';
18
18
  import { store as editSiteStore } from '../../store';
19
19
  import SidebarButton from '../sidebar-button';
20
20
  export default function SidebarNavigationScreenNavigationItem() {
21
- var _post$title, _post$description;
21
+ var _record$title, _record$description;
22
22
 
23
23
  const {
24
24
  setCanvasMode
@@ -30,25 +30,20 @@ export default function SidebarNavigationScreenNavigationItem() {
30
30
  }
31
31
  } = useNavigator();
32
32
  const {
33
- post
34
- } = useSelect(select => {
35
- const {
36
- getEntityRecord
37
- } = select(coreStore); // The currently selected entity to display.
38
- // Typically template or template part in the site editor.
39
-
40
- return {
41
- post: postId && postType ? getEntityRecord('postType', postType, postId) : null
42
- };
43
- }, [postType, postId]);
33
+ record
34
+ } = useEntityRecord('postType', postType, postId);
44
35
  return createElement(SidebarNavigationScreen, {
45
- title: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$title = post.title) === null || _post$title === void 0 ? void 0 : _post$title.rendered) : null,
36
+ title: record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) : null,
46
37
  actions: createElement(SidebarButton, {
47
38
  onClick: () => setCanvasMode('edit'),
48
39
  label: __('Edit'),
49
40
  icon: pencil
50
41
  }),
51
- content: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$description = post.description) === null || _post$description === void 0 ? void 0 : _post$description.rendered) : null
42
+ description: postType === 'page' ? __('Pages are static and are not listed by date. Pages do not use tags or categories.') : __('Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'),
43
+ content: createElement(Fragment, null, record !== null && record !== void 0 && record.link ? createElement(ExternalLink, {
44
+ className: "edit-site-sidebar-navigation-screen__page-link",
45
+ href: record.link
46
+ }, record.link) : null, record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$description = record.description) === null || _record$description === void 0 ? void 0 : _record$description.rendered) : null)
52
47
  });
53
48
  }
54
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","__experimentalUseNavigator","useNavigator","store","coreStore","decodeEntities","pencil","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","SidebarNavigationScreenNavigationItem","setCanvasMode","params","postType","postId","post","select","getEntityRecord","title","rendered","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBJ,MAAM,CAAET,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEFb,YAAY,EAFhB;AAIA,QAAM;AAAEc,IAAAA;AAAF,MAAWhB,SAAS,CACvBiB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEb,SAAF,CAAlC,CADa,CAGb;AACA;;AACA,WAAO;AACNY,MAAAA,IAAI,EACHD,MAAM,IAAID,QAAV,GACGI,eAAe,CAAE,UAAF,EAAcJ,QAAd,EAAwBC,MAAxB,CADlB,GAEG;AAJE,KAAP;AAMA,GAZwB,EAazB,CAAED,QAAF,EAAYC,MAAZ,CAbyB,CAA1B;AAgBA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGC,IAAI,GAAGX,cAAc,CAAEW,IAAF,aAAEA,IAAF,sCAAEA,IAAI,CAAEG,KAAR,gDAAE,YAAaC,QAAf,CAAjB,GAA6C,IAD1D;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMR,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGQ;AAHR,MAHF;AASC,IAAA,OAAO,EACNU,IAAI,GAAGX,cAAc,CAAEW,IAAF,aAAEA,IAAF,4CAAEA,IAAI,CAAEK,WAAR,sDAAE,kBAAmBD,QAArB,CAAjB,GAAmD;AAVzD,IADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useNavigator();\n\n\tconst { post } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\t// The currently selected entity to display.\n\t\t\t// Typically template or template part in the site editor.\n\t\t\treturn {\n\t\t\t\tpost:\n\t\t\t\t\tpostId && postType\n\t\t\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ post ? decodeEntities( post?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\tpost ? decodeEntities( post?.description?.rendered ) : null\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","__experimentalUseNavigator","useNavigator","ExternalLink","useEntityRecord","decodeEntities","pencil","SidebarNavigationScreen","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenNavigationItem","setCanvasMode","params","postType","postId","record","title","rendered","link","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,YAFD,QAGO,uBAHP;AAIA,SAASC,eAAT,QAAgC,sBAAhC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBL,MAAM,CAAER,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEFd,YAAY,EAFhB;AAGA,QAAM;AAAEe,IAAAA;AAAF,MAAab,eAAe,CAAE,UAAF,EAAcW,QAAd,EAAwBC,MAAxB,CAAlC;AAEA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGC,MAAM,GAAGZ,cAAc,CAAEY,MAAF,aAAEA,MAAF,wCAAEA,MAAM,CAAEC,KAAV,kDAAE,cAAeC,QAAjB,CAAjB,GAA+C,IAD9D;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMN,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGO;AAHR,MAHF;AASC,IAAA,WAAW,EACVS,QAAQ,KAAK,MAAb,GACGhB,EAAE,CACF,mFADE,CADL,GAIGA,EAAE,CACF,oGADE,CAdP;AAkBC,IAAA,OAAO,EACN,8BACGkB,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEG,IAAR,GACD,cAAC,YAAD;AACC,MAAA,SAAS,EAAC,gDADX;AAEC,MAAA,IAAI,EAAGH,MAAM,CAACG;AAFf,OAIGH,MAAM,CAACG,IAJV,CADC,GAOE,IARL,EASGH,MAAM,GACLZ,cAAc,CAAEY,MAAF,aAAEA,MAAF,8CAAEA,MAAM,CAAEI,WAAV,wDAAE,oBAAqBF,QAAvB,CADT,GAEL,IAXJ;AAnBF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useNavigator();\n\tconst { record } = useEntityRecord( 'postType', postType, postId );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ record ? decodeEntities( record?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Pages are static and are not listed by date. Pages do not use tags or categories.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'\n\t\t\t\t\t )\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ record?.link ? (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\t\t\thref={ record.link }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ record.link }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) : null }\n\t\t\t\t\t{ record\n\t\t\t\t\t\t? decodeEntities( record?.description?.rendered )\n\t\t\t\t\t\t: null }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -4,19 +4,85 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
- import { useCallback } from '@wordpress/element';
7
+ import { useCallback, useMemo } from '@wordpress/element';
8
+ import { useSelect } from '@wordpress/data';
9
+ import { store as coreStore } from '@wordpress/core-data';
10
+ import { BlockEditorProvider, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
11
+ import { createBlock } from '@wordpress/blocks';
8
12
  /**
9
13
  * Internal dependencies
10
14
  */
11
15
 
12
16
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
13
- import NavigationInspector from '../navigation-inspector';
14
17
  import { useHistory } from '../routes';
18
+ import NavigationMenuContent from './navigation-menu-content';
19
+ import SidebarButton from '../sidebar-button';
20
+ import { NavigationMenuLoader } from './loader';
21
+ import { unlock } from '../../private-apis';
22
+ import { store as editSiteStore } from '../../store';
23
+
24
+ const noop = () => {};
25
+
26
+ const NAVIGATION_MENUS_QUERY = {
27
+ per_page: -1,
28
+ status: 'publish'
29
+ };
30
+
31
+ function SidebarNavigationScreenWrapper(_ref) {
32
+ let {
33
+ children,
34
+ actions
35
+ } = _ref;
36
+ return createElement(SidebarNavigationScreen, {
37
+ title: __('Navigation'),
38
+ actions: actions,
39
+ description: __('Browse your site, edit pages, and manage your primary navigation menu.'),
40
+ content: children
41
+ });
42
+ }
43
+
44
+ const prioritizedInserterBlocks = ['core/navigation-link/page', 'core/navigation-link'];
15
45
  export default function SidebarNavigationScreenNavigationMenus() {
46
+ var _orderedNavigationMen;
47
+
16
48
  const history = useHistory();
49
+ const {
50
+ navigationMenus,
51
+ hasResolvedNavigationMenus,
52
+ storedSettings
53
+ } = useSelect(select => {
54
+ const {
55
+ getSettings
56
+ } = unlock(select(editSiteStore));
57
+ const {
58
+ getEntityRecords,
59
+ hasFinishedResolution
60
+ } = select(coreStore);
61
+ const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY];
62
+ return {
63
+ storedSettings: getSettings(false),
64
+ navigationMenus: getEntityRecords(...navigationMenusQuery),
65
+ hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
66
+ };
67
+ }, []); // Sort navigation menus by date.
68
+
69
+ const orderedNavigationMenus = useMemo(() => navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.sort((menuA, menuB) => {
70
+ const menuADate = new Date(menuA.date);
71
+ const menuBDate = new Date(menuB.date);
72
+ return menuADate.getTime() > menuBDate.getTime();
73
+ }), [navigationMenus]);
74
+ const firstNavigationMenu = orderedNavigationMenus === null || orderedNavigationMenus === void 0 ? void 0 : (_orderedNavigationMen = orderedNavigationMenus[0]) === null || _orderedNavigationMen === void 0 ? void 0 : _orderedNavigationMen.id;
75
+ const blocks = useMemo(() => {
76
+ return [createBlock('core/navigation', {
77
+ ref: firstNavigationMenu
78
+ })];
79
+ }, [firstNavigationMenu]);
80
+ const isLoading = !hasResolvedNavigationMenus;
81
+ const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
17
82
  const onSelect = useCallback(selectedBlock => {
18
83
  const {
19
- attributes
84
+ attributes,
85
+ name
20
86
  } = selectedBlock;
21
87
 
22
88
  if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
@@ -25,14 +91,68 @@ export default function SidebarNavigationScreenNavigationMenus() {
25
91
  postId: attributes.id
26
92
  });
27
93
  }
94
+
95
+ if (name === 'core/page-list-item' && attributes.id && history) {
96
+ history.push({
97
+ postType: 'page',
98
+ postId: attributes.id
99
+ });
100
+ }
28
101
  }, [history]);
29
- return createElement(SidebarNavigationScreen, {
30
- title: __('Navigation'),
31
- content: createElement("div", {
32
- className: "edit-site-sidebar-navigation-screen-navigation-menus"
33
- }, createElement(NavigationInspector, {
34
- onSelect: onSelect
35
- }))
36
- });
102
+ const orderInitialBlockItems = useCallback(items => {
103
+ items.sort((_ref2, _ref3) => {
104
+ let {
105
+ id: aName
106
+ } = _ref2;
107
+ let {
108
+ id: bName
109
+ } = _ref3;
110
+ // Sort block items according to `prioritizedInserterBlocks`.
111
+ let aIndex = prioritizedInserterBlocks.indexOf(aName);
112
+ let bIndex = prioritizedInserterBlocks.indexOf(bName); // All other block items should come after that.
113
+
114
+ if (aIndex < 0) aIndex = prioritizedInserterBlocks.length;
115
+ if (bIndex < 0) bIndex = prioritizedInserterBlocks.length;
116
+ return aIndex - bIndex;
117
+ });
118
+ return items;
119
+ }, []);
120
+
121
+ if (hasResolvedNavigationMenus && !hasNavigationMenus) {
122
+ return createElement(SidebarNavigationScreenWrapper, null, __('There are no Navigation Menus.'));
123
+ }
124
+
125
+ if (!hasResolvedNavigationMenus || isLoading) {
126
+ return createElement(SidebarNavigationScreenWrapper, null, createElement(NavigationMenuLoader, null));
127
+ }
128
+
129
+ const {
130
+ PrivateInserter
131
+ } = unlock(blockEditorPrivateApis);
132
+ return createElement(BlockEditorProvider, {
133
+ settings: storedSettings,
134
+ value: blocks,
135
+ onChange: noop,
136
+ onInput: noop
137
+ }, createElement(SidebarNavigationScreenWrapper, {
138
+ actions: createElement(PrivateInserter, {
139
+ rootClientId: blocks[0].clientId,
140
+ position: "bottom right",
141
+ isAppender: true,
142
+ selectBlockOnInsert: false,
143
+ shouldDirectInsert: false,
144
+ __experimentalIsQuick: true,
145
+ toggleProps: {
146
+ as: SidebarButton,
147
+ label: __('Add menu item')
148
+ },
149
+ orderInitialBlockItems: orderInitialBlockItems
150
+ })
151
+ }, createElement("div", {
152
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
153
+ }, createElement(NavigationMenuContent, {
154
+ rootClientId: blocks[0].clientId,
155
+ onSelect: onSelect
156
+ }))));
37
157
  }
38
158
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,WAA3B;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAMG,QAAQ,GAAGN,WAAW,CACzBO,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE;AAFN,OAAd;AAIA;AACD,GAd0B,EAe3B,CAAEL,OAAF,CAf2B,CAA5B;AAiBA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGN,EAAE,CAAE,YAAF,CADX;AAEC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAGO;AAAhC,MADD;AAHF,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","useMemo","useSelect","store","coreStore","BlockEditorProvider","privateApis","blockEditorPrivateApis","createBlock","SidebarNavigationScreen","useHistory","NavigationMenuContent","SidebarButton","NavigationMenuLoader","unlock","editSiteStore","noop","NAVIGATION_MENUS_QUERY","per_page","status","SidebarNavigationScreenWrapper","children","actions","prioritizedInserterBlocks","SidebarNavigationScreenNavigationMenus","history","navigationMenus","hasResolvedNavigationMenus","storedSettings","select","getSettings","getEntityRecords","hasFinishedResolution","navigationMenusQuery","orderedNavigationMenus","sort","menuA","menuB","menuADate","Date","date","menuBDate","getTime","firstNavigationMenu","id","blocks","ref","isLoading","hasNavigationMenus","length","onSelect","selectedBlock","attributes","name","kind","type","push","postType","postId","orderInitialBlockItems","items","aName","bName","aIndex","indexOf","bIndex","PrivateInserter","clientId","as","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,oBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,mBADD,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,WAAT,QAA4B,mBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,SAASC,oBAAT,QAAqC,UAArC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;;AAEA,MAAMC,IAAI,GAAG,M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AAQ,EAAG7B,IAHZ;AAIC,IAAA,OAAO,EAAGA;AAJX,KAMC,cAAC,8BAAD;AACC,IAAA,OAAO,EACN,cAAC,eAAD;AACC,MAAA,YAAY,EAAG6B,MAAM,CAAE,CAAF,CAAN,CAAYsB,QAD5B;AAEC,MAAA,QAAQ,EAAC,cAFV;AAGC,MAAA,UAAU,MAHX;AAIC,MAAA,mBAAmB,EAAG,KAJvB;AAKC,MAAA,kBAAkB,EAAG,KALtB;AAMC,MAAA,qBAAqB,MANtB;AAOC,MAAA,WAAW,EAAG;AACbC,QAAAA,EAAE,EAAExD,aADS;AAEbyD,QAAAA,KAAK,EAAEtE,EAAE,CAAE,eAAF;AAFI,OAPf;AAWC,MAAA,sBAAsB,EAAG4D;AAX1B;AAFF,KAiBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,qBAAD;AACC,IAAA,YAAY,EAAGd,MAAM,CAAE,CAAF,CAAN,CAAYsB,QAD5B;AAEC,IAAA,QAAQ,EAAGjB;AAFZ,IADD,CAjBD,CAND,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useHistory } from '../routes';\nimport NavigationMenuContent from './navigation-menu-content';\nimport SidebarButton from '../sidebar-button';\nimport { NavigationMenuLoader } from './loader';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst noop = () => {};\nconst NAVIGATION_MENUS_QUERY = { per_page: -1, status: 'publish' };\n\nfunction SidebarNavigationScreenWrapper( { children, actions } ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ __(\n\t\t\t\t'Browse your site, edit pages, and manage your primary navigation menu.'\n\t\t\t) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst prioritizedInserterBlocks = [\n\t'core/navigation-link/page',\n\t'core/navigation-link',\n];\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst { navigationMenus, hasResolvedNavigationMenus, storedSettings } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst navigationMenusQuery = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tNAVIGATION_MENUS_QUERY,\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( false ),\n\t\t\t\tnavigationMenus: getEntityRecords( ...navigationMenusQuery ),\n\t\t\t\thasResolvedNavigationMenus: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tnavigationMenusQuery\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\t// Sort navigation menus by date.\n\tconst orderedNavigationMenus = useMemo(\n\t\t() =>\n\t\t\tnavigationMenus?.sort( ( menuA, menuB ) => {\n\t\t\t\tconst menuADate = new Date( menuA.date );\n\t\t\t\tconst menuBDate = new Date( menuB.date );\n\t\t\t\treturn menuADate.getTime() > menuBDate.getTime();\n\t\t\t} ),\n\t\t[ navigationMenus ]\n\t);\n\tconst firstNavigationMenu = orderedNavigationMenus?.[ 0 ]?.id;\n\tconst blocks = useMemo( () => {\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', { ref: firstNavigationMenu } ),\n\t\t];\n\t}, [ firstNavigationMenu ] );\n\n\tconst isLoading = ! hasResolvedNavigationMenus;\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: 'page',\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\tconst orderInitialBlockItems = useCallback( ( items ) => {\n\t\titems.sort( ( { id: aName }, { id: bName } ) => {\n\t\t\t// Sort block items according to `prioritizedInserterBlocks`.\n\t\t\tlet aIndex = prioritizedInserterBlocks.indexOf( aName );\n\t\t\tlet bIndex = prioritizedInserterBlocks.indexOf( bName );\n\t\t\t// All other block items should come after that.\n\t\t\tif ( aIndex < 0 ) aIndex = prioritizedInserterBlocks.length;\n\t\t\tif ( bIndex < 0 ) bIndex = prioritizedInserterBlocks.length;\n\t\t\treturn aIndex - bIndex;\n\t\t} );\n\t\treturn items;\n\t}, [] );\n\n\tif ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t{ __( 'There are no Navigation Menus.' ) }\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! hasResolvedNavigationMenus || isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<NavigationMenuLoader />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\tconst { PrivateInserter } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tactions={\n\t\t\t\t\t<PrivateInserter\n\t\t\t\t\t\trootClientId={ blocks[ 0 ].clientId }\n\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\tisAppender\n\t\t\t\t\t\tselectBlockOnInsert={ false }\n\t\t\t\t\t\tshouldDirectInsert={ false }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t\tlabel: __( 'Add menu item' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t\torderInitialBlockItems={ orderInitialBlockItems }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t\t<NavigationMenuContent\n\t\t\t\t\t\trootClientId={ blocks[ 0 ].clientId }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+ export function NavigationMenuLoader() {
3
+ return createElement(Fragment, null, createElement("div", {
4
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
5
+ }), createElement("div", {
6
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
7
+ }), createElement("div", {
8
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
9
+ }));
10
+ }
11
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/loader.js"],"names":["NavigationMenuLoader"],"mappings":";AAAA,OAAO,SAASA,oBAAT,GAAgC;AACtC,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,IAFD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,IAHD,CADD;AAOA","sourcesContent":["export function NavigationMenuLoader() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,66 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { privateApis as blockEditorPrivateApis, store as blockEditorStore, BlockList, BlockTools } from '@wordpress/block-editor';
7
+ import { useDispatch, useSelect } from '@wordpress/data';
8
+ import { createBlock } from '@wordpress/blocks';
9
+ import { useCallback } from '@wordpress/element';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { unlock } from '../../private-apis';
15
+ import { NavigationMenuLoader } from './loader';
16
+ export default function NavigationMenuContent(_ref) {
17
+ let {
18
+ rootClientId,
19
+ onSelect
20
+ } = _ref;
21
+ const {
22
+ clientIdsTree,
23
+ isLoading
24
+ } = useSelect(select => {
25
+ const {
26
+ __unstableGetClientIdsTree,
27
+ areInnerBlocksControlled
28
+ } = select(blockEditorStore);
29
+ return {
30
+ clientIdsTree: __unstableGetClientIdsTree(rootClientId),
31
+ // This is a small hack to wait for the navigation block
32
+ // to actually load its inner blocks.
33
+ isLoading: !areInnerBlocksControlled(rootClientId)
34
+ };
35
+ }, [rootClientId]);
36
+ const {
37
+ replaceBlock,
38
+ __unstableMarkNextChangeAsNotPersistent
39
+ } = useDispatch(blockEditorStore);
40
+ const {
41
+ OffCanvasEditor,
42
+ LeafMoreMenu
43
+ } = unlock(blockEditorPrivateApis);
44
+ const offCanvasOnselect = useCallback(block => {
45
+ if (block.name === 'core/navigation-link' && !block.attributes.url) {
46
+ __unstableMarkNextChangeAsNotPersistent();
47
+
48
+ replaceBlock(block.clientId, createBlock('core/navigation-link', block.attributes));
49
+ } else {
50
+ onSelect(block);
51
+ }
52
+ }, [onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock]); // The hidden block is needed because it makes block edit side effects trigger.
53
+ // For example a navigation page list load its items has an effect on edit to load its items.
54
+
55
+ return createElement(Fragment, null, isLoading && createElement(NavigationMenuLoader, null), !isLoading && createElement(OffCanvasEditor, {
56
+ blocks: clientIdsTree,
57
+ onSelect: offCanvasOnselect,
58
+ LeafMoreMenu: LeafMoreMenu,
59
+ showAppender: false
60
+ }), createElement("div", {
61
+ style: {
62
+ visibility: 'hidden'
63
+ }
64
+ }, createElement(BlockTools, null, createElement(BlockList, null))));
65
+ }
66
+ //# sourceMappingURL=navigation-menu-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","BlockList","BlockTools","useDispatch","useSelect","createBlock","useCallback","unlock","NavigationMenuLoader","NavigationMenuContent","rootClientId","onSelect","clientIdsTree","isLoading","select","__unstableGetClientIdsTree","areInnerBlocksControlled","replaceBlock","__unstableMarkNextChangeAsNotPersistent","OffCanvasEditor","LeafMoreMenu","offCanvasOnselect","block","name","attributes","url","clientId","visibility"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,EAGCC,SAHD,EAICC,UAJD,QAKO,yBALP;AAMA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,oBAAT,QAAqC,UAArC;AAEA,eAAe,SAASC,qBAAT,O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AAGD,YAHhB;AAIC,IAAA,YAAY,EAAG;AAJhB,IAHF,EAUC;AAAK,IAAA,KAAK,EAAG;AAAEO,MAAAA,UAAU,EAAE;AAAd;AAAb,KACC,cAAC,UAAD,QACC,cAAC,SAAD,OADD,CADD,CAVD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockList,\n\tBlockTools,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { NavigationMenuLoader } from './loader';\n\nexport default function NavigationMenuContent( { rootClientId, onSelect } ) {\n\tconst { clientIdsTree, isLoading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __unstableGetClientIdsTree, areInnerBlocksControlled } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tclientIdsTree: __unstableGetClientIdsTree( rootClientId ),\n\n\t\t\t\t// This is a small hack to wait for the navigation block\n\t\t\t\t// to actually load its inner blocks.\n\t\t\t\tisLoading: ! areInnerBlocksControlled( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );\n\n\tconst offCanvasOnselect = useCallback(\n\t\t( block ) => {\n\t\t\tif (\n\t\t\t\tblock.name === 'core/navigation-link' &&\n\t\t\t\t! block.attributes.url\n\t\t\t) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlock(\n\t\t\t\t\tblock.clientId,\n\t\t\t\t\tcreateBlock( 'core/navigation-link', block.attributes )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tonSelect( block );\n\t\t\t}\n\t\t},\n\t\t[ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]\n\t);\n\n\t// The hidden block is needed because it makes block edit side effects trigger.\n\t// For example a navigation page list load its items has an effect on edit to load its items.\n\treturn (\n\t\t<>\n\t\t\t{ isLoading && <NavigationMenuLoader /> }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<OffCanvasEditor\n\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\tonSelect={ offCanvasOnselect }\n\t\t\t\t\tLeafMoreMenu={ LeafMoreMenu }\n\t\t\t\t\tshowAppender={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div style={ { visibility: 'hidden' } }>\n\t\t\t\t<BlockTools>\n\t\t\t\t\t<BlockList />\n\t\t\t\t</BlockTools>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -3,9 +3,10 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { __ } from '@wordpress/i18n';
6
+ import { __, sprintf } from '@wordpress/i18n';
7
7
  import { useDispatch } from '@wordpress/data';
8
8
  import { pencil } from '@wordpress/icons';
9
+ import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
@@ -16,6 +17,13 @@ import { unlock } from '../../private-apis';
16
17
  import { store as editSiteStore } from '../../store';
17
18
  import SidebarButton from '../sidebar-button';
18
19
  export default function SidebarNavigationScreenTemplate() {
20
+ const {
21
+ params
22
+ } = useNavigator();
23
+ const {
24
+ postType,
25
+ postId
26
+ } = params;
19
27
  const {
20
28
  setCanvasMode
21
29
  } = unlock(useDispatch(editSiteStore));
@@ -23,11 +31,16 @@ export default function SidebarNavigationScreenTemplate() {
23
31
  getDescription,
24
32
  getTitle,
25
33
  record
26
- } = useEditedEntityRecord();
34
+ } = useEditedEntityRecord(postType, postId);
27
35
  let description = getDescription();
28
36
 
29
- if (!description && record.is_custom) {
30
- description = __('This is a custom template that can be applied manually to any Post or Page.');
37
+ if (!description) {
38
+ if (record.type === 'wp_template' && record.is_custom) {
39
+ description = __('This is a custom template that can be applied manually to any Post or Page.');
40
+ } else if (record.type === 'wp_template_part') {
41
+ description = sprintf( // translators: %s: template part title e.g: "Header".
42
+ __('This is your %s template part.'), getTitle());
43
+ }
31
44
  }
32
45
 
33
46
  return createElement(SidebarNavigationScreen, {
@@ -37,7 +50,7 @@ export default function SidebarNavigationScreenTemplate() {
37
50
  label: __('Edit'),
38
51
  icon: pencil
39
52
  }),
40
- content: description ? createElement("p", null, description) : undefined
53
+ description: description
41
54
  });
42
55
  }
43
56
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","useDispatch","pencil","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenTemplate","setCanvasMode","getDescription","getTitle","record","description","is_custom","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,+BAAT,GAA2C;AACzD,QAAM;AAAEC,IAAAA;AAAF,MAAoBL,MAAM,CAAEJ,WAAW,CAAEM,aAAF,CAAb,CAAhC;AACA,QAAM;AAAEI,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCT,qBAAqB,EAAlE;AACA,MAAIU,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAF,IAAiBD,MAAM,CAACE,SAA7B,EAAyC;AACxCD,IAAAA,WAAW,GAAGd,EAAE,CACf,6EADe,CAAhB;AAGA;;AAED,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGY,QAAQ,EADjB;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGV,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGE;AAHR,MAHF;AASC,IAAA,OAAO,EAAGY,WAAW,GAAG,yBAAKA,WAAL,CAAH,GAA4BE;AATlD,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord();\n\tlet description = getDescription();\n\tif ( ! description && record.is_custom ) {\n\t\tdescription = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ getTitle() }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tcontent={ description ? <p>{ description }</p> : undefined }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","sprintf","useDispatch","pencil","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenTemplate","params","postType","postId","setCanvasMode","getDescription","getTitle","record","description","type","is_custom"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,+BAAT,GAA2C;AACzD,QAAM;AAAEC,IAAAA;AAAF,MAAaR,YAAY,EAA/B;AACA,QAAM;AAAES,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAuBF,MAA7B;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAoBR,MAAM,CAAEN,WAAW,CAAEQ,aAAF,CAAb,CAAhC;AACA,QAAM;AAAEO,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCZ,qBAAqB,CACjEO,QADiE,EAEjEC,MAFiE,CAAlE;AAIA,MAAIK,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAP,EAAqB;AACpB,QAAKD,MAAM,CAACE,IAAP,KAAgB,aAAhB,IAAiCF,MAAM,CAACG,SAA7C,EAAyD;AACxDF,MAAAA,WAAW,GAAGpB,EAAE,CACf,6EADe,CAAhB;AAGA,KAJD,MAIO,IAAKmB,MAAM,CAACE,IAAP,KAAgB,kBAArB,EAA0C;AAChDD,MAAAA,WAAW,GAAGnB,OAAO,EACpB;AACAD,MAAAA,EAAE,CAAE,gCAAF,CAFkB,EAGpBkB,QAAQ,EAHY,CAArB;AAKA;AACD;;AAED,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGA,QAAQ,EADjB;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGhB,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGG;AAHR,MAHF;AASC,IAAA,WAAW,EAAGiB;AATf,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst { params } = useNavigator();\n\tconst { postType, postId } = params;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tlet description = getDescription();\n\tif ( ! description ) {\n\t\tif ( record.type === 'wp_template' && record.is_custom ) {\n\t\t\tdescription = __(\n\t\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t\t);\n\t\t} else if ( record.type === 'wp_template_part' ) {\n\t\t\tdescription = sprintf(\n\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t__( 'This is your %s template part.' ),\n\t\t\t\tgetTitle()\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ getTitle() }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t/>\n\t);\n}\n"]}
@@ -26,7 +26,8 @@ const config = {
26
26
  title: __('Templates'),
27
27
  loading: __('Loading templates'),
28
28
  notFound: __('No templates found'),
29
- manage: __('Manage all templates')
29
+ manage: __('Manage all templates'),
30
+ description: __('Express the layout of your site with templates.')
30
31
  }
31
32
  },
32
33
  wp_template_part: {
@@ -34,7 +35,8 @@ const config = {
34
35
  title: __('Template parts'),
35
36
  loading: __('Loading template parts'),
36
37
  notFound: __('No template parts found'),
37
- manage: __('Manage all template parts')
38
+ manage: __('Manage all template parts'),
39
+ description: __('Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.')
38
40
  }
39
41
  }
40
42
  };
@@ -78,6 +80,7 @@ export default function SidebarNavigationScreenTemplates() {
78
80
  return createElement(SidebarNavigationScreen, {
79
81
  isRoot: isTemplatePartsMode,
80
82
  title: config[postType].labels.title,
83
+ description: config[postType].labels.description,
81
84
  actions: canCreate && createElement(AddNewTemplate, {
82
85
  templateType: postType,
83
86
  toggleProps: {