@wordpress/edit-site 5.5.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-template/new-template-part.js +3 -11
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +23 -17
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +7 -9
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +2 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +20 -159
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -72
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +3 -4
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +5 -7
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +13 -5
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +22 -211
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -1
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +4 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +5 -35
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/layout/index.js +7 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +128 -136
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +6 -5
- package/build/components/list/table.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +2 -5
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +2 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +5 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +59 -10
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +44 -9
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +133 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +0 -3
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +8 -12
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +2 -2
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +19 -14
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +3 -9
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +25 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -1
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +3 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +8 -10
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +2 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +21 -157
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +4 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -66
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -4
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +5 -5
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +11 -2
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +23 -208
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +4 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +5 -30
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -2
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/layout/index.js +7 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +126 -137
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +6 -5
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -5
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +45 -10
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +133 -21
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +0 -3
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +20 -15
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +172 -128
- package/build-style/style.css +172 -128
- package/package.json +31 -31
- package/src/components/add-new-template/new-template-part.js +1 -6
- package/src/components/add-new-template/new-template.js +60 -38
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/add-new-template/utils.js +1 -1
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +13 -22
- package/src/components/editor/index.js +61 -65
- package/src/components/global-styles/border-panel.js +24 -199
- package/src/components/global-styles/context-menu.js +4 -4
- package/src/components/global-styles/hooks.js +0 -101
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/screen-block-list.js +4 -4
- package/src/components/global-styles/screen-border.js +9 -2
- package/src/components/global-styles/screen-colors.js +25 -229
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +5 -1
- package/src/components/global-styles/screen-typography-element.js +4 -0
- package/src/components/global-styles/screen-typography.js +6 -0
- package/src/components/global-styles/stories/index.js +425 -0
- package/src/components/global-styles/style.scss +14 -18
- package/src/components/global-styles/ui.js +6 -31
- package/src/components/global-styles-renderer/index.js +1 -2
- package/src/components/layout/index.js +15 -0
- package/src/components/layout/style.scss +1 -3
- package/src/components/list/added-by.js +144 -140
- package/src/components/list/index.js +3 -1
- package/src/components/list/table.js +7 -4
- package/src/components/routes/link.js +9 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/style.scss +2 -1
- package/src/components/sidebar-navigation-item/style.scss +1 -23
- package/src/components/sidebar-navigation-screen/index.js +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +21 -8
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
- package/src/components/sidebar-navigation-screen-template/index.js +82 -11
- package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
- package/src/components/site-hub/index.js +5 -1
- package/src/components/site-hub/style.scss +5 -1
- package/src/components/start-template-options/index.js +40 -8
- package/src/components/style-book/index.js +203 -54
- package/src/components/style-book/style.scss +2 -46
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
- package/src/components/template-details/index.js +0 -3
- package/src/components/template-part-converter/convert-to-regular.js +10 -17
- package/src/components/template-part-converter/convert-to-template-part.js +9 -16
- package/src/components/template-part-converter/index.js +28 -12
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/hooks/push-changes-to-global-styles/index.js +1 -0
- package/src/index.js +5 -1
- package/src/store/test/actions.js +0 -2
- package/src/style.scss +2 -1
- package/src/utils/history.js +13 -9
- package/build/components/global-styles/color-utils.js +0 -17
- package/build/components/global-styles/color-utils.js.map +0 -1
- package/build/components/global-styles/screen-background-color.js +0 -114
- package/build/components/global-styles/screen-background-color.js.map +0 -1
- package/build/components/global-styles/screen-button-color.js +0 -88
- package/build/components/global-styles/screen-button-color.js.map +0 -1
- package/build/components/global-styles/screen-heading-color.js +0 -165
- package/build/components/global-styles/screen-heading-color.js.map +0 -1
- package/build/components/global-styles/screen-link-color.js +0 -105
- package/build/components/global-styles/screen-link-color.js.map +0 -1
- package/build/components/global-styles/screen-text-color.js +0 -71
- package/build/components/global-styles/screen-text-color.js.map +0 -1
- package/build/components/navigation-inspector/index.js +0 -161
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -79
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/global-styles/color-utils.js +0 -9
- package/build-module/components/global-styles/color-utils.js.map +0 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -97
- package/build-module/components/global-styles/screen-background-color.js.map +0 -1
- package/build-module/components/global-styles/screen-button-color.js +0 -73
- package/build-module/components/global-styles/screen-button-color.js.map +0 -1
- package/build-module/components/global-styles/screen-heading-color.js +0 -149
- package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -89
- package/build-module/components/global-styles/screen-link-color.js.map +0 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -56
- package/build-module/components/global-styles/screen-text-color.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -146
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/global-styles/color-utils.js +0 -14
- package/src/components/global-styles/screen-background-color.js +0 -132
- package/src/components/global-styles/screen-button-color.js +0 -104
- package/src/components/global-styles/screen-heading-color.js +0 -206
- package/src/components/global-styles/screen-link-color.js +0 -124
- package/src/components/global-styles/screen-text-color.js +0 -62
- package/src/components/navigation-inspector/index.js +0 -191
- package/src/components/navigation-inspector/navigation-menu.js +0 -84
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"names":["useSelect","useDispatch","Button","__experimentalHStack","HStack","sprintf","__","_n","store","coreStore","displayShortcut","check","editSiteStore","SaveButton","countUnsavedChanges","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","isSaveViewOpened","length","some","record","kind","name","key","setIsSaveViewOpened","disabled","label","undefined","primary"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,EAAiBC,oBAAoB,IAAIC,MAAzC,QAAuD,uBAAvD;AACA,SAASC,OAAT,EAAkBC,EAAlB,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA,OAAvB;AAAgCC,IAAAA,QAAhC;AAA0CC,IAAAA;AAA1C,MACLjB,SAAS,CAAIkB,MAAF,IAAc;AACxB,UAAM;AACLC,MAAAA,mCADK;AAELC,MAAAA;AAFK,QAGFF,MAAM,CAAET,SAAF,CAHV;;AAIA,UAAMY,kBAAkB,GAAGF,mCAAmC,EAA9D;;AACA,UAAM;AAAEG,MAAAA;AAA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,GAAGE,SAAH,GAAetB,eAAe,CAACuB,OAAhB,CAAyB,GAAzB,CAfzB;AAiBC,IAAA,IAAI,EAAGH,QAAQ,GAAGnB,KAAH,GAAWqB;AAjB3B,KAmBGD,KAnBH,CAdD,CADD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, __experimentalHStack as HStack } from '@wordpress/components';\nimport { sprintf, __, _n } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function SaveButton() {\n\tconst { countUnsavedChanges, isDirty, isSaving, isSaveViewOpen } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tisSavingEntityRecord,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\treturn {\n\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t\t),\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\tcountUnsavedChanges: dirtyEntityRecords.length,\n\t\t\t};\n\t\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst disabled = ! isDirty || isSaving;\n\n\tconst label = disabled ? __( 'Saved' ) : __( 'Save' );\n\n\treturn (\n\t\t<HStack className=\"edit-site-save-hub\" alignment=\"right\" spacing={ 4 }>\n\t\t\t{ isDirty && (\n\t\t\t\t<span>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d unsaved change',\n\t\t\t\t\t\t\t'%d unsaved changes',\n\t\t\t\t\t\t\tcountUnsavedChanges\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcountUnsavedChanges\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\tvariant={ disabled ? undefined : 'primary' }\n\t\t\t\taria-disabled={ disabled }\n\t\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\t\tisBusy={ isSaving }\n\t\t\t\tonClick={\n\t\t\t\t\tdisabled ? undefined : () => setIsSaveViewOpened( true )\n\t\t\t\t}\n\t\t\t\tlabel={ label }\n\t\t\t\t/*\n\t\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t\t */\n\t\t\t\tshortcut={\n\t\t\t\t\tdisabled ? undefined : displayShortcut.primary( 's' )\n\t\t\t\t}\n\t\t\t\ticon={ disabled ? check : undefined }\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</Button>\n\t\t</HStack>\n\t);\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
7
|
import { Button } from '@wordpress/components';
|
|
8
8
|
import { useFocusOnMount, useFocusReturn, useInstanceId, useMergeRefs } from '@wordpress/compose';
|
|
9
9
|
import { useDispatch } from '@wordpress/data';
|
|
@@ -15,6 +15,7 @@ import { ESCAPE } from '@wordpress/keycodes';
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { store as editSiteStore } from '../../store';
|
|
18
|
+
import { unlock } from '../../private-apis';
|
|
18
19
|
export default function ListViewSidebar() {
|
|
19
20
|
const {
|
|
20
21
|
setIsListViewOpened
|
|
@@ -31,6 +32,9 @@ export default function ListViewSidebar() {
|
|
|
31
32
|
|
|
32
33
|
const instanceId = useInstanceId(ListViewSidebar);
|
|
33
34
|
const labelId = `edit-site-editor__list-view-panel-label-${instanceId}`;
|
|
35
|
+
const {
|
|
36
|
+
PrivateListView
|
|
37
|
+
} = unlock(blockEditorPrivateApis);
|
|
34
38
|
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
35
39
|
createElement("div", {
|
|
36
40
|
"aria-labelledby": labelId,
|
|
@@ -48,7 +52,7 @@ export default function ListViewSidebar() {
|
|
|
48
52
|
})), createElement("div", {
|
|
49
53
|
className: "edit-site-editor__list-view-panel-content",
|
|
50
54
|
ref: useMergeRefs([contentFocusReturnRef, focusOnMountRef])
|
|
51
|
-
}, createElement(
|
|
55
|
+
}, createElement(PrivateListView, null)))
|
|
52
56
|
);
|
|
53
57
|
}
|
|
54
58
|
//# sourceMappingURL=list-view-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["privateApis","blockEditorPrivateApis","Button","useFocusOnMount","useFocusReturn","useInstanceId","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editSiteStore","unlock","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","instanceId","labelId","PrivateListView"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,aAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,Q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BF,eAFmB,CAAF;AAFnB,OAOC,cAAC,eAAD,OAPD,CAhBD;AAFD;AA6BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-site-editor__list-view-panel-label-${ instanceId }`;\n\tconst { PrivateListView } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<PrivateListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -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
|
|
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(
|
|
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","
|
|
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
|
-
},
|
|
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,
|
|
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,QAA0B,i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C,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"]}
|
|
@@ -15,23 +15,23 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
15
15
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
16
16
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
17
17
|
export default function SidebarNavigationScreenMain() {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
};
|
|
18
|
+
const hasNavigationMenus = useSelect(select => {
|
|
19
|
+
// The query needs to be the same as in the "SidebarNavigationScreenNavigationMenus" component,
|
|
20
|
+
// to avoid double network calls.
|
|
21
|
+
const navigationMenus = select(coreStore).getEntityRecords('postType', 'wp_navigation', {
|
|
22
|
+
per_page: 1,
|
|
23
|
+
status: 'publish',
|
|
24
|
+
order: 'desc',
|
|
25
|
+
orderby: 'date'
|
|
26
|
+
});
|
|
27
|
+
return (navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.length) > 0;
|
|
30
28
|
});
|
|
29
|
+
const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN ? hasNavigationMenus : false;
|
|
31
30
|
return createElement(SidebarNavigationScreen, {
|
|
32
31
|
isRoot: true,
|
|
33
32
|
title: __('Design'),
|
|
34
|
-
|
|
33
|
+
description: __('Customize the appearance of your website using the block editor.'),
|
|
34
|
+
content: createElement(ItemGroup, null, showNavigationScreen && createElement(NavigatorButton, {
|
|
35
35
|
as: SidebarNavigationItem,
|
|
36
36
|
path: "/navigation",
|
|
37
37
|
withChevron: true,
|
|
@@ -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","
|
|
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","hasNavigationMenus","select","navigationMenus","getEntityRecords","per_page","status","order","orderby","length","showNavigationScreen","process","env","IS_GUTENBERG_PLUGIN"],"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,QAAMC,kBAAkB,GAAGN,SAAS,CAAIO,MAAF,IAAc;AACnD;AACA;AACA,UAAMC,eAAe,GAAGD,MAAM,CAAEL,SAAF,CAAN,CAAoBO,gBAApB,CACvB,UADuB,EAEvB,eAFuB,EAGvB;AACCC,MAAAA,QAAQ,EAAE,CADX;AAECC,MAAAA,MAAM,EAAE,SAFT;AAGCC,MAAAA,KAAK,EAAE,MAHR;AAICC,MAAAA,OAAO,EAAE;AAJV,KAHuB,CAAxB;AAWA,WAAO,CAAAL,eAAe,SAAf,IAAAA,eAAe,WAAf,YAAAA,eAAe,CAAEM,MAAjB,IAA0B,CAAjC;AACA,GAfmC,CAApC;AAiBA,QAAMC,oBAAoB,GAAGC,OAAO,CAACC,GAAR,CAAYC,mBAAZ,GAC1BZ,kBAD0B,GAE1B,KAFH;AAGA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,kEADe,CAHjB;AAMC,IAAA,OAAO,EACN,cAAC,SAAD,QACGmB,oBAAoB,IACrB,cAAC,eAAD;AACC,MAAA,EAAE,EAAGX,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 hasNavigationMenus = useSelect( ( select ) => {\n\t\t// The query needs to be the same as in the \"SidebarNavigationScreenNavigationMenus\" component,\n\t\t// to avoid double network calls.\n\t\tconst navigationMenus = select( coreStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_navigation',\n\t\t\t{\n\t\t\t\tper_page: 1,\n\t\t\t\tstatus: 'publish',\n\t\t\t\torder: 'desc',\n\t\t\t\torderby: 'date',\n\t\t\t}\n\t\t);\n\n\t\treturn navigationMenus?.length > 0;\n\t} );\n\n\tconst showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN\n\t\t? hasNavigationMenus\n\t\t: false;\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{ showNavigationScreen && (\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
|
|
8
|
-
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
9
|
-
import {
|
|
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
|
|
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
|
-
|
|
34
|
-
} =
|
|
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:
|
|
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
|
-
|
|
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","
|
|
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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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,16 +4,75 @@ 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 } 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 { NavigationMenuLoader } from './loader';
|
|
20
|
+
import { unlock } from '../../private-apis';
|
|
21
|
+
import { store as editSiteStore } from '../../store';
|
|
22
|
+
|
|
23
|
+
const noop = () => {};
|
|
24
|
+
|
|
25
|
+
const NAVIGATION_MENUS_QUERY = {
|
|
26
|
+
per_page: 1,
|
|
27
|
+
status: 'publish',
|
|
28
|
+
order: 'desc',
|
|
29
|
+
orderby: 'date'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function SidebarNavigationScreenWrapper(_ref) {
|
|
33
|
+
let {
|
|
34
|
+
children,
|
|
35
|
+
actions
|
|
36
|
+
} = _ref;
|
|
37
|
+
return createElement(SidebarNavigationScreen, {
|
|
38
|
+
title: __('Navigation'),
|
|
39
|
+
actions: actions,
|
|
40
|
+
description: __('Browse your site, edit pages, and manage your primary navigation menu.'),
|
|
41
|
+
content: children
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
15
45
|
export default function SidebarNavigationScreenNavigationMenus() {
|
|
46
|
+
var _navigationMenus$;
|
|
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
|
+
}, []);
|
|
68
|
+
const firstNavigationMenu = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id;
|
|
69
|
+
const blocks = useMemo(() => {
|
|
70
|
+
return [createBlock('core/navigation', {
|
|
71
|
+
ref: firstNavigationMenu
|
|
72
|
+
})];
|
|
73
|
+
}, [firstNavigationMenu]);
|
|
74
|
+
const isLoading = !hasResolvedNavigationMenus;
|
|
75
|
+
const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
|
|
17
76
|
const onSelect = useCallback(selectedBlock => {
|
|
18
77
|
const {
|
|
19
78
|
attributes,
|
|
@@ -34,13 +93,25 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
34
93
|
});
|
|
35
94
|
}
|
|
36
95
|
}, [history]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
96
|
+
|
|
97
|
+
if (hasResolvedNavigationMenus && !hasNavigationMenus) {
|
|
98
|
+
return createElement(SidebarNavigationScreenWrapper, null, __('There are no Navigation Menus.'));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!hasResolvedNavigationMenus || isLoading) {
|
|
102
|
+
return createElement(SidebarNavigationScreenWrapper, null, createElement(NavigationMenuLoader, null));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return createElement(BlockEditorProvider, {
|
|
106
|
+
settings: storedSettings,
|
|
107
|
+
value: blocks,
|
|
108
|
+
onChange: noop,
|
|
109
|
+
onInput: noop
|
|
110
|
+
}, createElement(SidebarNavigationScreenWrapper, null, createElement("div", {
|
|
111
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
|
|
112
|
+
}, createElement(NavigationMenuContent, {
|
|
113
|
+
rootClientId: blocks[0].clientId,
|
|
114
|
+
onSelect: onSelect
|
|
115
|
+
}))));
|
|
45
116
|
}
|
|
46
117
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","useMemo","useSelect","store","coreStore","BlockEditorProvider","createBlock","SidebarNavigationScreen","useHistory","NavigationMenuContent","NavigationMenuLoader","unlock","editSiteStore","noop","NAVIGATION_MENUS_QUERY","per_page","status","order","orderby","SidebarNavigationScreenWrapper","children","actions","SidebarNavigationScreenNavigationMenus","history","navigationMenus","hasResolvedNavigationMenus","storedSettings","select","getSettings","getEntityRecords","hasFinishedResolution","navigationMenusQuery","firstNavigationMenu","id","blocks","ref","isLoading","hasNavigationMenus","length","onSelect","selectedBlock","attributes","name","kind","type","push","postType","postId","clientId"],"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,SAASC,mBAAT,QAAoC,yBAApC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,SAASC,oBAAT,QAAqC,UAArC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASR,KAAK,IAAIS,aAAlB,QAAuC,aAAvC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAE,CADoB;AAE9BC,EAAAA,MAAM,EAAE,SAFsB;AAG9BC,EAAAA,KAAK,EAAE,MAHuB;AAI9BC,EAAAA,OAAO,EAAE;AAJqB,CAA/B;;AAOA,SAASC,8BAAT,OAAiE;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGtB,EAAE,CAAE,YAAF,CADX;AAEC,IAAA,OAAO,EAAGsB,OAFX;AAGC,IAAA,WAAW,EAAGtB,EAAE,CACf,wEADe,CAHjB;AAMC,IAAA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AAAA,UAAF;AAAcC,MAAAA;AAAd,QAAuBF,aAA7B;;AACA,QACCC,UAAU,CAACE,IAAX,KAAoB,WAApB,IACAF,UAAU,CAACR,EADX,IAEAQ,UAAU,CAACG,IAFX,IAGArB,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACsB,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACR;AAFN,OAAd;AAIA;;AACD,QAAKS,IAAI,KAAK,qBAAT,IAAkCD,UAAU,CAACR,EAA7C,IAAmDV,OAAxD,EAAkE;AACjEA,MAAAA,OAAO,CAACsB,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAE,MADG;AAEbC,QAAAA,MAAM,EAAEN,UAAU,CAACR;AAFN,OAAd;AAIA;AACD,GApB0B,EAqB3B,CAAEV,OAAF,CArB2B,CAA5B;;AAwBA,MAAKE,0BAA0B,IAAI,CAAEY,kBAArC,EAA0D;AACzD,WACC,cAAC,8BAAD,QACGtC,EAAE,CAAE,gCAAF,CADL,CADD;AAKA;;AAED,MAAK,CAAE0B,0BAAF,IAAgCW,SAArC,EAAiD;AAChD,WACC,cAAC,8BAAD,QACC,cAAC,oBAAD,OADD,CADD;AAKA;;AAED,SACC,cAAC,mBAAD;AACC,IAAA,QAAQ,EAAGV,cADZ;AAEC,IAAA,KAAK,EAAGQ,MAFT;AAGC,IAAA,QAAQ,EAAGrB,IAHZ;AAIC,IAAA,OAAO,EAAGA;AAJX,KAMC,cAAC,8BAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,qBAAD;AACC,IAAA,YAAY,EAAGqB,MAAM,CAAE,CAAF,CAAN,CAAYc,QAD5B;AAEC,IAAA,QAAQ,EAAGT;AAFZ,IADD,CADD,CAND,CADD;AAiBA","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 { BlockEditorProvider } 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 { NavigationMenuLoader } from './loader';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst noop = () => {};\nconst NAVIGATION_MENUS_QUERY = {\n\tper_page: 1,\n\tstatus: 'publish',\n\torder: 'desc',\n\torderby: 'date',\n};\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\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\tconst firstNavigationMenu = navigationMenus?.[ 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\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\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\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,OAA6D;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;AAC3E,QA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;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"]}
|