@wordpress/edit-site 3.0.7 → 3.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/index.js +49 -0
- package/build/components/add-new-template/index.js.map +1 -0
- package/build/components/add-new-template/new-template-part.js +78 -0
- package/build/components/add-new-template/new-template-part.js.map +1 -0
- package/build/components/add-new-template/new-template.js +114 -0
- package/build/components/add-new-template/new-template.js.map +1 -0
- package/build/components/block-editor/block-inspector-button.js +4 -3
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/index.js +12 -8
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +6 -5
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +6 -4
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +115 -0
- package/build/components/create-template-part-modal/index.js.map +1 -0
- package/build/components/edit-template-part-menu-button/index.js +15 -11
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js +25 -20
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +5 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -4
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +33 -9
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +5 -4
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +5 -4
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +11 -46
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/header.js +6 -5
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +34 -30
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +6 -6
- package/build/components/global-styles/navigation-button.js +8 -7
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +13 -9
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +4 -3
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +13 -4
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +4 -3
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +4 -3
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +19 -15
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +8 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +4 -3
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +4 -3
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/subtitle.js +4 -3
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +10 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +4 -3
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +61 -44
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +4 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header/document-actions/index.js +23 -19
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/feature-toggle/index.js +9 -7
- package/build/components/header/feature-toggle/index.js.map +1 -1
- package/build/components/header/index.js +15 -15
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +30 -27
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +10 -7
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +30 -3
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/header.js +50 -0
- package/build/components/list/header.js.map +1 -0
- package/build/components/list/index.js +87 -0
- package/build/components/list/index.js.map +1 -0
- package/build/components/list/table.js +127 -0
- package/build/components/list/table.js.map +1 -0
- package/build/components/list/use-register-shortcuts.js +52 -0
- package/build/components/list/use-register-shortcuts.js.map +1 -0
- package/build/components/main-dashboard-button/index.js +4 -3
- package/build/components/main-dashboard-button/index.js.map +1 -1
- package/build/components/navigate-to-link/index.js +7 -6
- package/build/components/navigate-to-link/index.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +25 -10
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -1
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +37 -55
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
- package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +8 -5
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +7 -27
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/save-button/index.js +5 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/constants.js +1 -1
- package/build/components/sidebar/default-sidebar.js +11 -10
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +5 -4
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +4 -3
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/template-card/template-areas.js +17 -13
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/index.js +14 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +38 -29
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +15 -11
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +29 -86
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/welcome-guide/editor.js +58 -0
- package/build/components/welcome-guide/editor.js.map +1 -0
- package/build/components/welcome-guide/image.js +27 -0
- package/build/components/welcome-guide/image.js.map +1 -0
- package/build/components/welcome-guide/index.js +49 -0
- package/build/components/welcome-guide/index.js.map +1 -0
- package/build/components/welcome-guide/styles.js +83 -0
- package/build/components/welcome-guide/styles.js.map +1 -0
- package/build/index.js +40 -16
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +4 -2
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item.js +39 -0
- package/build/plugins/welcome-guide-menu-item.js.map +1 -0
- package/build/store/actions.js +24 -24
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -1
- package/build/store/defaults.js +4 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +5 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +36 -14
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -19
- package/build/store/selectors.js.map +1 -1
- package/build/utils/is-template-removable.js +21 -0
- package/build/utils/is-template-removable.js.map +1 -0
- package/build-module/components/add-new-template/index.js +36 -0
- package/build-module/components/add-new-template/index.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +65 -0
- package/build-module/components/add-new-template/new-template-part.js.map +1 -0
- package/build-module/components/add-new-template/new-template.js +97 -0
- package/build-module/components/add-new-template/new-template.js.map +1 -0
- package/build-module/components/block-editor/block-inspector-button.js +4 -3
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +12 -8
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +6 -5
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +6 -4
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +102 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -0
- package/build-module/components/edit-template-part-menu-button/index.js +15 -11
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js +24 -21
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +5 -4
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +4 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +33 -10
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +5 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +4 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +12 -42
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/header.js +6 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +32 -28
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +8 -7
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +13 -9
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +4 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +11 -4
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +4 -3
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +4 -3
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +19 -15
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -3
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +4 -3
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +4 -3
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +4 -3
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +9 -7
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +60 -43
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +3 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +23 -19
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/feature-toggle/index.js +9 -7
- package/build-module/components/header/feature-toggle/index.js.map +1 -1
- package/build-module/components/header/index.js +15 -13
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +30 -27
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +10 -7
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +30 -3
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/header.js +37 -0
- package/build-module/components/list/header.js.map +1 -0
- package/build-module/components/list/index.js +69 -0
- package/build-module/components/list/index.js.map +1 -0
- package/build-module/components/list/table.js +111 -0
- package/build-module/components/list/table.js.map +1 -0
- package/build-module/components/list/use-register-shortcuts.js +41 -0
- package/build-module/components/list/use-register-shortcuts.js.map +1 -0
- package/build-module/components/main-dashboard-button/index.js +4 -3
- package/build-module/components/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/navigate-to-link/index.js +7 -6
- package/build-module/components/navigate-to-link/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +25 -8
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +39 -55
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +6 -3
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +8 -27
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +11 -10
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +5 -4
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +4 -3
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-areas.js +17 -13
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/index.js +14 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +38 -29
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +15 -11
- 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 +29 -86
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +45 -0
- package/build-module/components/welcome-guide/editor.js.map +1 -0
- package/build-module/components/welcome-guide/image.js +19 -0
- package/build-module/components/welcome-guide/image.js.map +1 -0
- package/build-module/components/welcome-guide/index.js +35 -0
- package/build-module/components/welcome-guide/index.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +69 -0
- package/build-module/components/welcome-guide/styles.js.map +1 -0
- package/build-module/index.js +21 -1
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +3 -2
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item.js +27 -0
- package/build-module/plugins/welcome-guide-menu-item.js.map +1 -0
- package/build-module/store/actions.js +11 -11
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +4 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +31 -10
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +17 -10
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/is-template-removable.js +14 -0
- package/build-module/utils/is-template-removable.js.map +1 -0
- package/build-style/style-rtl.css +348 -32
- package/build-style/style.css +348 -32
- package/package.json +27 -27
- package/src/components/add-new-template/index.js +30 -0
- package/src/components/add-new-template/new-template-part.js +66 -0
- package/src/components/add-new-template/new-template.js +116 -0
- package/src/components/add-new-template/style.scss +11 -0
- package/src/components/create-template-part-modal/index.js +132 -0
- package/src/components/{template-part-converter → create-template-part-modal}/style.scss +9 -9
- package/src/components/editor/index.js +22 -15
- package/src/components/editor/style.scss +8 -0
- package/src/components/global-styles/color-palette-panel.js +64 -7
- package/src/components/global-styles/global-styles-provider.js +7 -36
- package/src/components/global-styles/hooks.js +58 -26
- package/src/components/global-styles/screen-block-list.js +11 -1
- package/src/components/global-styles/test/use-global-styles-output.js +2 -2
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/header/index.js +0 -6
- package/src/components/keyboard-shortcuts/index.js +32 -0
- package/src/components/list/header.js +34 -0
- package/src/components/list/index.js +80 -0
- package/src/components/list/style.scss +113 -0
- package/src/components/list/table.js +132 -0
- package/src/components/list/use-register-shortcuts.js +45 -0
- package/src/components/navigation-sidebar/index.js +31 -8
- package/src/components/navigation-sidebar/navigation-panel/index.js +45 -55
- package/src/components/navigation-sidebar/navigation-panel/style.scss +4 -2
- package/src/components/navigation-sidebar/navigation-toggle/index.js +4 -28
- package/src/components/template-details/index.js +3 -2
- package/src/components/template-part-converter/convert-to-template-part.js +20 -140
- package/src/components/welcome-guide/editor.js +63 -0
- package/src/components/welcome-guide/image.js +11 -0
- package/src/components/welcome-guide/index.js +33 -0
- package/src/components/welcome-guide/style.scss +37 -0
- package/src/components/welcome-guide/styles.js +116 -0
- package/src/index.js +21 -1
- package/src/plugins/index.js +3 -1
- package/src/plugins/welcome-guide-menu-item.js +35 -0
- package/src/store/actions.js +11 -9
- package/src/store/defaults.js +4 -1
- package/src/store/test/actions.js +14 -20
- package/src/style.scss +9 -6
- package/src/utils/is-template-removable.js +13 -0
- package/build/components/header/navigation-link/index.js +0 -86
- package/build/components/header/navigation-link/index.js.map +0 -1
- package/build-module/components/header/navigation-link/index.js +0 -73
- package/build-module/components/header/navigation-link/index.js.map +0 -1
- package/src/components/header/navigation-link/index.js +0 -71
- package/src/components/header/navigation-link/style.scss +0 -69
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
7
|
+
import { ExternalLink, Guide } from '@wordpress/components';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import WelcomeGuideImage from './image';
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
export default function WelcomeGuideStyles() {
|
|
16
|
+
const {
|
|
17
|
+
toggleFeature
|
|
18
|
+
} = useDispatch(editSiteStore);
|
|
19
|
+
return createElement(Guide, {
|
|
20
|
+
className: "edit-site-welcome-guide",
|
|
21
|
+
contentLabel: __('Welcome to styles'),
|
|
22
|
+
finishButtonText: __('Get Started'),
|
|
23
|
+
onFinish: () => toggleFeature('welcomeGuideStyles'),
|
|
24
|
+
pages: [{
|
|
25
|
+
image: createElement(WelcomeGuideImage, {
|
|
26
|
+
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
|
|
27
|
+
animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
|
|
28
|
+
}),
|
|
29
|
+
content: createElement(Fragment, null, createElement("h1", {
|
|
30
|
+
className: "edit-site-welcome-guide__heading"
|
|
31
|
+
}, __('Welcome to Styles')), createElement("p", {
|
|
32
|
+
className: "edit-site-welcome-guide__text"
|
|
33
|
+
}, __('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.')))
|
|
34
|
+
}, {
|
|
35
|
+
image: createElement(WelcomeGuideImage, {
|
|
36
|
+
nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
|
|
37
|
+
animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
|
|
38
|
+
}),
|
|
39
|
+
content: createElement(Fragment, null, createElement("h1", {
|
|
40
|
+
className: "edit-site-welcome-guide__heading"
|
|
41
|
+
}, __('Set the design')), createElement("p", {
|
|
42
|
+
className: "edit-site-welcome-guide__text"
|
|
43
|
+
}, __('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! ')))
|
|
44
|
+
}, {
|
|
45
|
+
image: createElement(WelcomeGuideImage, {
|
|
46
|
+
nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
|
|
47
|
+
animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
|
|
48
|
+
}),
|
|
49
|
+
content: createElement(Fragment, null, createElement("h1", {
|
|
50
|
+
className: "edit-site-welcome-guide__heading"
|
|
51
|
+
}, __('Personalize blocks')), createElement("p", {
|
|
52
|
+
className: "edit-site-welcome-guide__text"
|
|
53
|
+
}, __('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.')))
|
|
54
|
+
}, {
|
|
55
|
+
image: createElement(WelcomeGuideImage, {
|
|
56
|
+
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
|
|
57
|
+
animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
|
|
58
|
+
}),
|
|
59
|
+
content: createElement(Fragment, null, createElement("h1", {
|
|
60
|
+
className: "edit-site-welcome-guide__heading"
|
|
61
|
+
}, __('Learn more')), createElement("p", {
|
|
62
|
+
className: "edit-site-welcome-guide__text"
|
|
63
|
+
}, __('New to block themes and styling your site? '), createElement(ExternalLink, {
|
|
64
|
+
href: __('https://wordpress.org/support/article/wordpress-editor/')
|
|
65
|
+
}, __('Here’s a detailed guide to learn how to make the most of it.'))))
|
|
66
|
+
}]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["useDispatch","ExternalLink","Guide","__","WelcomeGuideImage","store","editSiteStore","WelcomeGuideStyles","toggleFeature","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,iBAA5B;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,SAA9B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAoBR,WAAW,CAAEM,aAAF,CAArC;AAEA,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAGH,EAAE,CAAE,mBAAF,CAFlB;AAGC,IAAA,gBAAgB,EAAGA,EAAE,CAAE,aAAF,CAHtB;AAIC,IAAA,QAAQ,EAAG,MAAMK,aAAa,CAAE,oBAAF,CAJ/B;AAKC,IAAA,KAAK,EAAG,CACP;AACCC,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,6DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGP,EAAE,CAAE,mBAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,2KADG,CADL,CAJD;AARF,KADO,EAqBP;AACCM,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,0DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGP,EAAE,CAAE,gBAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,8JADG,CADL,CAJD;AARF,KArBO,EAyCP;AACCM,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,8DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGP,EAAE,CAAE,oBAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,qLADG,CADL,CAJD;AARF,KAzCO,EA6DP;AACCM,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGP,EAAE,CAAE,YAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,6CADG,CADL,EAIC,cAAC,YAAD;AACC,QAAA,IAAI,EAAGA,EAAE,CACR,yDADQ;AADV,SAKGA,EAAE,CACH,8DADG,CALL,CAJD,CAJD;AARF,KA7DO;AALT,IADD;AAmGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to styles' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuideStyles' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to Styles' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Set the design' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Personalize blocks' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn more' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to block themes and styling your site? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Here’s a detailed guide to learn how to make the most of it.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { registerCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from
|
|
|
8
8
|
import { dispatch } from '@wordpress/data';
|
|
9
9
|
import { render, unmountComponentAtNode } from '@wordpress/element';
|
|
10
10
|
import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
|
|
11
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
13
14
|
*/
|
|
@@ -16,6 +17,7 @@ import './plugins';
|
|
|
16
17
|
import './hooks';
|
|
17
18
|
import './store';
|
|
18
19
|
import Editor from './components/editor';
|
|
20
|
+
import List from './components/list';
|
|
19
21
|
/**
|
|
20
22
|
* Reinitializes the editor after the user chooses to reboot the editor after
|
|
21
23
|
* an unhandled error occurs, replacing previously mounted editor element using
|
|
@@ -40,7 +42,7 @@ export function reinitializeEditor(target, settings) {
|
|
|
40
42
|
* @param {Object} settings Editor settings.
|
|
41
43
|
*/
|
|
42
44
|
|
|
43
|
-
export function
|
|
45
|
+
export function initializeEditor(id, settings) {
|
|
44
46
|
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings);
|
|
45
47
|
|
|
46
48
|
settings.__experimentalFetchRichUrlData = fetchUrlData;
|
|
@@ -63,6 +65,24 @@ export function initialize(id, settings) {
|
|
|
63
65
|
onError: reboot
|
|
64
66
|
}), target);
|
|
65
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Initializes the site editor templates list screen.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} id ID of the root element to render the screen in.
|
|
72
|
+
* @param {string} templateType The type of the list. "wp_template" or "wp_template_part".
|
|
73
|
+
* @param {Object} settings Editor settings.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export function initializeList(id, templateType, settings) {
|
|
77
|
+
const target = document.getElementById(id);
|
|
78
|
+
dispatch(editorStore).updateEditorSettings({
|
|
79
|
+
defaultTemplateTypes: settings.defaultTemplateTypes,
|
|
80
|
+
defaultTemplatePartAreas: settings.defaultTemplatePartAreas
|
|
81
|
+
});
|
|
82
|
+
render(createElement(List, {
|
|
83
|
+
templateType: templateType
|
|
84
|
+
}), target);
|
|
85
|
+
}
|
|
66
86
|
export { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';
|
|
67
87
|
export { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';
|
|
68
88
|
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","Editor","reinitializeEditor","target","settings","reboot","bind","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","Editor","List","reinitializeEditor","target","settings","reboot","bind","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","GUTENBERG_PHASE","enableFSEBlocks","initializeList","templateType","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASV,KAAK,IAAIW,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAO,WAAP;AACA,OAAO,SAAP;AACA,OAAO,SAAP;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,IAAP,MAAiB,mBAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtDV,EAAAA,sBAAsB,CAAES,MAAF,CAAtB;AACA,QAAME,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;AACAX,EAAAA,MAAM,CACL,cAAC,MAAD;AAAQ,IAAA,eAAe,EAAGW,QAA1B;AAAqC,IAAA,OAAO,EAAGC;AAA/C,IADK,EAELF,MAFK,CAAN;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,gBAAT,CAA2BC,EAA3B,EAA+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,EAAG4B;AAArB,IAAF,EAA0ClB,MAA1C,CAAN;AACA;AAED,SAASsB,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport './store';\nimport Editor from './components/editor';\nimport List from './components/list';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor templates list screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {string} templateType The type of the list. \"wp_template\" or \"wp_template_part\".\n * @param {Object} settings Editor settings.\n */\nexport function initializeList( id, templateType, settings ) {\n\tconst target = document.getElementById( id );\n\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\trender( <List templateType={ templateType } />, target );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
|
|
@@ -18,17 +18,18 @@ import { download } from '@wordpress/icons';
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
21
|
+
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
21
22
|
registerPlugin('edit-site', {
|
|
22
23
|
render() {
|
|
23
24
|
return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, createElement(MenuItem, {
|
|
24
25
|
role: "menuitem",
|
|
25
26
|
icon: download,
|
|
26
27
|
onClick: () => apiFetch({
|
|
27
|
-
path: '/
|
|
28
|
+
path: '/wp-block-editor/v1/export',
|
|
28
29
|
parse: false
|
|
29
30
|
}).then(res => res.blob()).then(blob => downloadjs(blob, 'edit-site-export.zip', 'application/zip')),
|
|
30
31
|
info: __('Download your templates and template parts.')
|
|
31
|
-
}, __('Export'))));
|
|
32
|
+
}, __('Export')), createElement(WelcomeGuideMenuItem, null)));
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/plugins/index.js"],"names":["downloadjs","MenuItem","__","registerPlugin","apiFetch","download","ToolsMoreMenuGroup","render","path","parse","then","res","blob"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,4CAA/B;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/plugins/index.js"],"names":["downloadjs","MenuItem","__","registerPlugin","apiFetch","download","ToolsMoreMenuGroup","WelcomeGuideMenuItem","render","path","parse","then","res","blob"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,4CAA/B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AAEAJ,cAAc,CAAE,WAAF,EAAe;AAC5BK,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACC,cAAC,QAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGH,QAFR;AAGC,MAAA,OAAO,EAAG,MACTD,QAAQ,CAAE;AACTK,QAAAA,IAAI,EAAE,4BADG;AAETC,QAAAA,KAAK,EAAE;AAFE,OAAF,CAAR,CAIEC,IAJF,CAIUC,GAAF,IAAWA,GAAG,CAACC,IAAJ,EAJnB,EAKEF,IALF,CAKUE,IAAF,IACNb,UAAU,CACTa,IADS,EAET,sBAFS,EAGT,iBAHS,CANZ,CAJF;AAiBC,MAAA,IAAI,EAAGX,EAAE,CACR,6CADQ;AAjBV,OAqBGA,EAAE,CAAE,QAAF,CArBL,CADD,EAwBC,cAAC,oBAAD,OAxBD,CADD,CADD;AA8BA;;AAhC2B,CAAf,CAAd","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-site', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\ticon={ download }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tapiFetch( {\n\t\t\t\t\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\t\t\t\t\tparse: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.then( ( res ) => res.blob() )\n\t\t\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\t\t\tdownloadjs(\n\t\t\t\t\t\t\t\t\t\tblob,\n\t\t\t\t\t\t\t\t\t\t'edit-site-export.zip',\n\t\t\t\t\t\t\t\t\t\t'application/zip'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Download your templates and template parts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Export' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { MenuItem } from '@wordpress/components';
|
|
9
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { store as editSiteStore } from '../store';
|
|
15
|
+
export default function WelcomeGuideMenuItem() {
|
|
16
|
+
const {
|
|
17
|
+
toggleFeature
|
|
18
|
+
} = useDispatch(editSiteStore);
|
|
19
|
+
const isStylesOpen = useSelect(select => {
|
|
20
|
+
const sidebar = select(interfaceStore).getActiveComplementaryArea(editSiteStore.name);
|
|
21
|
+
return sidebar === 'edit-site/global-styles';
|
|
22
|
+
}, []);
|
|
23
|
+
return createElement(MenuItem, {
|
|
24
|
+
onClick: () => toggleFeature(isStylesOpen ? 'welcomeGuideStyles' : 'welcomeGuide')
|
|
25
|
+
}, __('Welcome Guide'));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=welcome-guide-menu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/plugins/welcome-guide-menu-item.js"],"names":["__","useDispatch","useSelect","MenuItem","store","interfaceStore","editSiteStore","WelcomeGuideMenuItem","toggleFeature","isStylesOpen","select","sidebar","getActiveComplementaryArea","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,UAAvC;AAEA,eAAe,SAASC,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAoBP,WAAW,CAAEK,aAAF,CAArC;AACA,QAAMG,YAAY,GAAGP,SAAS,CAAIQ,MAAF,IAAc;AAC7C,UAAMC,OAAO,GAAGD,MAAM,CAAEL,cAAF,CAAN,CAAyBO,0BAAzB,CACfN,aAAa,CAACO,IADC,CAAhB;AAIA,WAAOF,OAAO,KAAK,yBAAnB;AACA,GAN6B,EAM3B,EAN2B,CAA9B;AAQA,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MACTH,aAAa,CACZC,YAAY,GAAG,oBAAH,GAA0B,cAD1B;AAFf,KAOGT,EAAE,CAAE,eAAF,CAPL,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../store';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\tconst isStylesOpen = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\n\t\treturn sidebar === 'edit-site/global-styles';\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () =>\n\t\t\t\ttoggleFeature(\n\t\t\t\t\tisStylesOpen ? 'welcomeGuideStyles' : 'welcomeGuide'\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{ __( 'Welcome Guide' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -99,18 +99,15 @@ export function* addTemplate(template) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* Removes a template
|
|
102
|
+
* Removes a template.
|
|
103
103
|
*
|
|
104
|
-
* @param {
|
|
104
|
+
* @param {Object} template The template object.
|
|
105
105
|
*/
|
|
106
106
|
|
|
107
|
-
export function* removeTemplate(
|
|
108
|
-
yield
|
|
109
|
-
|
|
110
|
-
method: 'DELETE'
|
|
107
|
+
export function* removeTemplate(template) {
|
|
108
|
+
yield controls.dispatch(coreStore, 'deleteEntityRecord', 'postType', template.type, template.id, {
|
|
109
|
+
force: true
|
|
111
110
|
});
|
|
112
|
-
const page = yield controls.select(editSiteStoreName, 'getPage');
|
|
113
|
-
yield controls.dispatch(editSiteStoreName, 'setPage', page);
|
|
114
111
|
}
|
|
115
112
|
/**
|
|
116
113
|
* Returns an action object used to set a template part.
|
|
@@ -346,9 +343,12 @@ export function* revertTemplate(template) {
|
|
|
346
343
|
return;
|
|
347
344
|
}
|
|
348
345
|
|
|
349
|
-
const serializeBlocks =
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
const serializeBlocks = _ref => {
|
|
347
|
+
let {
|
|
348
|
+
blocks: blocksForSerialization = []
|
|
349
|
+
} = _ref;
|
|
350
|
+
return __unstableSerializeAndClean(blocksForSerialization);
|
|
351
|
+
};
|
|
352
352
|
|
|
353
353
|
const edited = yield controls.select(coreStore, 'getEditedEntityRecord', 'postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo
|
|
354
354
|
// the revert in the header toolbar correctly.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["parse","__unstableSerializeAndClean","controls","dispatch","apiFetch","addQueryArgs","getPathAndQueryString","__","store","noticesStore","coreStore","interfaceStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","resolveSelect","slug","page","context","addTemplate","newTemplate","content","id","blocks","undoIgnore","removeTemplate","path","method","select","setTemplatePart","templatePartId","pushTemplatePart","setHomeTemplateId","homeTemplateId","setPage","postId","entity","postType","link","goBack","showHomepage","show_on_front","showOnFront","page_on_front","frontpageId","siteUrl","homeTemplate","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","templateEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","editEntityRecord","actions","label","onClick","error","errorMessage","message","code","openGeneralSidebar","name","closeGeneralSidebar"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,iBAAnC;AACA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,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AYA,UAAMrE,QAAQ,CAACC,QAAT,CACLM,YADK,EAEL,qBAFK,EAGLF,EAAE,CAAE,oBAAF,CAHG,EAIL;AACCU,MAAAA,IAAI,EAAE,UADP;AAEC8D,MAAAA,OAAO,EAAE,CACR;AACCC,QAAAA,KAAK,EAAEzE,EAAE,CAAE,MAAF,CADV;AAEC0E,QAAAA,OAAO,EAAEJ;AAFV,OADQ;AAFV,KAJK,CAAN;AAcA,GAvGD,CAuGE,OAAQK,KAAR,EAAgB;AACjB,UAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG7E,EAAE,CAAE,wCAAF,CAHN;AAIA,UAAML,QAAQ,CAACC,QAAT,CACLM,YADK,EAEL,mBAFK,EAGL0E,YAHK,EAIL;AAAElE,MAAAA,IAAI,EAAE;AAAR,KAJK,CAAN;AAMA;AACD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUqE,kBAAV,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMrF,QAAQ,CAACC,QAAT,CACLQ,cADK,EAEL,yBAFK,EAGLE,iBAHK,EAIL0E,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,mBAAV,GAAgC;AACtC,QAAMtF,QAAQ,CAACC,QAAT,CACLQ,cADK,EAEL,0BAFK,EAGLE,iBAHK,CAAN;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { controls, dispatch } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Returns an action object used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function toggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to set a template.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport function* setTemplate( templateId, templateSlug ) {\n\tconst pageContext = { templateSlug };\n\tif ( ! templateSlug ) {\n\t\tconst template = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\t\tpageContext.templateSlug = template?.slug;\n\t}\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: pageContext },\n\t};\n}\n\n/**\n * Adds a new template, and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport function* addTemplate( template ) {\n\tconst newTemplate = yield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\t'wp_template',\n\t\ttemplate\n\t);\n\n\tif ( template.content ) {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\tnewTemplate.id,\n\t\t\t{ blocks: parse( template.content ) },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t}\n\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t};\n}\n\n/**\n * Removes a template, and updates the current page and template.\n *\n * @param {number} templateId The template ID.\n */\nexport function* removeTemplate( templateId ) {\n\tyield apiFetch( {\n\t\tpath: `/wp/v2/templates/${ templateId }`,\n\t\tmethod: 'DELETE',\n\t} );\n\tconst page = yield controls.select( editSiteStoreName, 'getPage' );\n\tyield controls.dispatch( editSiteStoreName, 'setPage', page );\n}\n\n/**\n * Returns an action object used to set a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Returns an action object used to push a template part to navigation history.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function pushTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'PUSH_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Updates the homeTemplateId state with the templateId of the page resolved\n * from the given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function* setPage( page ) {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\tpage.context.postType || 'post',\n\t\t\tpage.context.postId\n\t\t);\n\n\t\tpage.path = getPathAndQueryString( entity.link );\n\t}\n\tconst { id: templateId, slug: templateSlug } = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'__experimentalGetTemplateForLink',\n\t\tpage.path\n\t);\n\tyield {\n\t\ttype: 'SET_PAGE',\n\t\tpage: ! templateSlug\n\t\t\t? page\n\t\t\t: {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug,\n\t\t\t\t\t},\n\t\t\t },\n\t\ttemplateId,\n\t};\n\treturn templateId;\n}\n\n/**\n * Go back to the current editing page.\n */\nexport function goBack() {\n\treturn {\n\t\ttype: 'GO_BACK',\n\t};\n}\n\n/**\n * Displays the site homepage for editing in the editor.\n */\nexport function* showHomepage() {\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getEntityRecord',\n\t\t'root',\n\t\t'site'\n\t);\n\n\tconst { siteUrl } = yield controls.select(\n\t\teditSiteStoreName,\n\t\t'getSettings'\n\t);\n\n\tconst page = {\n\t\tpath: siteUrl,\n\t\tcontext:\n\t\t\tshowOnFront === 'page'\n\t\t\t\t? {\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: frontpageId,\n\t\t\t\t }\n\t\t\t\t: {},\n\t};\n\n\tconst homeTemplate = yield* setPage( page );\n\tyield setHomeTemplateId( homeTemplate );\n}\n\n/**\n * Returns an action object used to set the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n */\nexport function* revertTemplate( template ) {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t__( 'This template is not revertable.' ),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntity = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntity',\n\t\t\t'postType',\n\t\t\ttemplate.type\n\t\t);\n\t\tif ( ! templateEntity ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntity.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\t\tconst fileTemplate = yield apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t\tconst edited = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEditedEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // required to make the `undo` behave correctly\n\t\t\t\tblocks: edited.blocks, // required to revert the blocks in the editor\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // required to merge this edit with the last undo level\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\tfileTemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t}\n\t\t);\n\n\t\tconst undoRevert = async () => {\n\t\t\tawait dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\tedited.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\tsource: 'custom',\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createSuccessNotice',\n\t\t\t__( 'Template reverted.' ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n *\n * @yield {Object} Action object.\n */\nexport function* openGeneralSidebar( name ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'enableComplementaryArea',\n\t\teditSiteStoreName,\n\t\tname\n\t);\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @yield {Object} Action object.\n */\nexport function* closeGeneralSidebar() {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'disableComplementaryArea',\n\t\teditSiteStoreName\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["parse","__unstableSerializeAndClean","controls","dispatch","apiFetch","addQueryArgs","getPathAndQueryString","__","store","noticesStore","coreStore","interfaceStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","resolveSelect","slug","page","context","addTemplate","newTemplate","content","id","blocks","undoIgnore","removeTemplate","force","setTemplatePart","templatePartId","pushTemplatePart","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","goBack","showHomepage","show_on_front","showOnFront","page_on_front","frontpageId","siteUrl","select","homeTemplate","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","templateEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","editEntityRecord","actions","label","onClick","error","errorMessage","message","code","openGeneralSidebar","name","closeGeneralSidebar"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,iBAAnC;AACA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,OAAxB,EAAkC;AACxC,SAAO;AACNC,IAAAA,IAAI,EAAE,g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,KAAK,EAAEzE,EAAE,CAAE,MAAF,CADV;AAEC0E,QAAAA,OAAO,EAAEJ;AAFV,OADQ;AAFV,KAJK,CAAN;AAcA,GAvGD,CAuGE,OAAQK,KAAR,EAAgB;AACjB,UAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG7E,EAAE,CAAE,wCAAF,CAHN;AAIA,UAAML,QAAQ,CAACC,QAAT,CACLM,YADK,EAEL,mBAFK,EAGL0E,YAHK,EAIL;AAAElE,MAAAA,IAAI,EAAE;AAAR,KAJK,CAAN;AAMA;AACD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUqE,kBAAV,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMrF,QAAQ,CAACC,QAAT,CACLQ,cADK,EAEL,yBAFK,EAGLE,iBAHK,EAIL0E,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,mBAAV,GAAgC;AACtC,QAAMtF,QAAQ,CAACC,QAAT,CACLQ,cADK,EAEL,0BAFK,EAGLE,iBAHK,CAAN;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { controls, dispatch } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Returns an action object used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function toggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to set a template.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport function* setTemplate( templateId, templateSlug ) {\n\tconst pageContext = { templateSlug };\n\tif ( ! templateSlug ) {\n\t\tconst template = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\t\tpageContext.templateSlug = template?.slug;\n\t}\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: pageContext },\n\t};\n}\n\n/**\n * Adds a new template, and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport function* addTemplate( template ) {\n\tconst newTemplate = yield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\t'wp_template',\n\t\ttemplate\n\t);\n\n\tif ( template.content ) {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\tnewTemplate.id,\n\t\t\t{ blocks: parse( template.content ) },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t}\n\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t};\n}\n\n/**\n * Removes a template.\n *\n * @param {Object} template The template object.\n */\nexport function* removeTemplate( template ) {\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'deleteEntityRecord',\n\t\t'postType',\n\t\ttemplate.type,\n\t\ttemplate.id,\n\t\t{ force: true }\n\t);\n}\n\n/**\n * Returns an action object used to set a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Returns an action object used to push a template part to navigation history.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function pushTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'PUSH_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Updates the homeTemplateId state with the templateId of the page resolved\n * from the given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function* setPage( page ) {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\tpage.context.postType || 'post',\n\t\t\tpage.context.postId\n\t\t);\n\n\t\tpage.path = getPathAndQueryString( entity.link );\n\t}\n\tconst { id: templateId, slug: templateSlug } = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'__experimentalGetTemplateForLink',\n\t\tpage.path\n\t);\n\tyield {\n\t\ttype: 'SET_PAGE',\n\t\tpage: ! templateSlug\n\t\t\t? page\n\t\t\t: {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug,\n\t\t\t\t\t},\n\t\t\t },\n\t\ttemplateId,\n\t};\n\treturn templateId;\n}\n\n/**\n * Go back to the current editing page.\n */\nexport function goBack() {\n\treturn {\n\t\ttype: 'GO_BACK',\n\t};\n}\n\n/**\n * Displays the site homepage for editing in the editor.\n */\nexport function* showHomepage() {\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getEntityRecord',\n\t\t'root',\n\t\t'site'\n\t);\n\n\tconst { siteUrl } = yield controls.select(\n\t\teditSiteStoreName,\n\t\t'getSettings'\n\t);\n\n\tconst page = {\n\t\tpath: siteUrl,\n\t\tcontext:\n\t\t\tshowOnFront === 'page'\n\t\t\t\t? {\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: frontpageId,\n\t\t\t\t }\n\t\t\t\t: {},\n\t};\n\n\tconst homeTemplate = yield* setPage( page );\n\tyield setHomeTemplateId( homeTemplate );\n}\n\n/**\n * Returns an action object used to set the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n */\nexport function* revertTemplate( template ) {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t__( 'This template is not revertable.' ),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntity = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntity',\n\t\t\t'postType',\n\t\t\ttemplate.type\n\t\t);\n\t\tif ( ! templateEntity ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntity.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\t\tconst fileTemplate = yield apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t\tconst edited = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEditedEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // required to make the `undo` behave correctly\n\t\t\t\tblocks: edited.blocks, // required to revert the blocks in the editor\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // required to merge this edit with the last undo level\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\tfileTemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t}\n\t\t);\n\n\t\tconst undoRevert = async () => {\n\t\t\tawait dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\tedited.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\tsource: 'custom',\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createSuccessNotice',\n\t\t\t__( 'Template reverted.' ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n *\n * @yield {Object} Action object.\n */\nexport function* openGeneralSidebar( name ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'enableComplementaryArea',\n\t\teditSiteStoreName,\n\t\tname\n\t);\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @yield {Object} Action object.\n */\nexport function* closeGeneralSidebar() {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'disableComplementaryArea',\n\t\teditSiteStoreName\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","features"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,QAAQ,EAAE;AADyB,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tfeatures: {},\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","features","welcomeGuide","welcomeGuideStyles"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,QAAQ,EAAE;AACTC,IAAAA,YAAY,EAAE,IADL;AAETC,IAAAA,kBAAkB,EAAE;AAFX;AADyB,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tfeatures: {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t},\n};\n"]}
|
|
@@ -17,7 +17,10 @@ import { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/con
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
export const preferences = combineReducers({
|
|
20
|
-
features(
|
|
20
|
+
features() {
|
|
21
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS.features;
|
|
22
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
23
|
+
|
|
21
24
|
switch (action.type) {
|
|
22
25
|
case 'TOGGLE_FEATURE':
|
|
23
26
|
{
|
|
@@ -41,7 +44,10 @@ export const preferences = combineReducers({
|
|
|
41
44
|
* @return {Object} Updated state.
|
|
42
45
|
*/
|
|
43
46
|
|
|
44
|
-
export function deviceType(
|
|
47
|
+
export function deviceType() {
|
|
48
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop';
|
|
49
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
50
|
+
|
|
45
51
|
switch (action.type) {
|
|
46
52
|
case 'SET_PREVIEW_DEVICE_TYPE':
|
|
47
53
|
return action.deviceType;
|
|
@@ -58,7 +64,10 @@ export function deviceType(state = 'Desktop', action) {
|
|
|
58
64
|
* @return {Object} Updated state.
|
|
59
65
|
*/
|
|
60
66
|
|
|
61
|
-
export function settings(
|
|
67
|
+
export function settings() {
|
|
68
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
69
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
70
|
+
|
|
62
71
|
switch (action.type) {
|
|
63
72
|
case 'UPDATE_SETTINGS':
|
|
64
73
|
return { ...state,
|
|
@@ -78,7 +87,10 @@ export function settings(state = {}, action) {
|
|
|
78
87
|
* @return {Array} Updated state.
|
|
79
88
|
*/
|
|
80
89
|
|
|
81
|
-
export function editedPost(
|
|
90
|
+
export function editedPost() {
|
|
91
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
92
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
93
|
+
|
|
82
94
|
switch (action.type) {
|
|
83
95
|
case 'SET_TEMPLATE':
|
|
84
96
|
case 'SET_PAGE':
|
|
@@ -134,10 +146,13 @@ export function homeTemplateId(state, action) {
|
|
|
134
146
|
* @param {Object} action Dispatched action.
|
|
135
147
|
*/
|
|
136
148
|
|
|
137
|
-
export function navigationPanel(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
export function navigationPanel() {
|
|
150
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
151
|
+
menu: MENU_ROOT,
|
|
152
|
+
isOpen: false
|
|
153
|
+
};
|
|
154
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
155
|
+
|
|
141
156
|
switch (action.type) {
|
|
142
157
|
case 'SET_NAVIGATION_PANEL_ACTIVE_MENU':
|
|
143
158
|
return { ...state,
|
|
@@ -184,7 +199,10 @@ export function navigationPanel(state = {
|
|
|
184
199
|
* @param {Object} action Dispatched action.
|
|
185
200
|
*/
|
|
186
201
|
|
|
187
|
-
export function blockInserterPanel(
|
|
202
|
+
export function blockInserterPanel() {
|
|
203
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
204
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
205
|
+
|
|
188
206
|
switch (action.type) {
|
|
189
207
|
case 'OPEN_NAVIGATION_PANEL_TO_MENU':
|
|
190
208
|
return false;
|
|
@@ -209,7 +227,10 @@ export function blockInserterPanel(state = false, action) {
|
|
|
209
227
|
* @param {Object} action Dispatched action.
|
|
210
228
|
*/
|
|
211
229
|
|
|
212
|
-
export function listViewPanel(
|
|
230
|
+
export function listViewPanel() {
|
|
231
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
232
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
233
|
+
|
|
213
234
|
switch (action.type) {
|
|
214
235
|
case 'OPEN_NAVIGATION_PANEL_TO_MENU':
|
|
215
236
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["combineReducers","PREFERENCES_DEFAULTS","MENU_ROOT","preferences","features","state","action","type","feature","deviceType","settings","editedPost","id","templateId","page","templatePartId","slice","homeTemplateId","navigationPanel","menu","isOpen","value","blockInserterPanel","listViewPanel"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASC,SAAT,QAA0B,6DAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAGH,eAAe,CAAE;AAC3CI,EAAAA,QAAQ,CAAEC,KAAK,GAAGJ,oBAAoB,CAACG,QAA/B,EAAyCE,MAAzC,EAAkD;AACzD,YAASA,MAAM,CAACC,IAAhB;AACC,WAAK,gBAAL;AAAuB;AACtB,iBAAO,EACN,GAAGF,KADG;AAEN,aAAEC,MAAM,CAACE,OAAT,GAAoB,CAAEH,KAAK,CAAEC,MAAM,CAACE,OAAT;AAFrB,WAAP;AAIA;;AACD;AACC,eAAOH,KAAP;AARF;AAUA;;AAZ0C,CAAF,CAAnC;AAeP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,UAAT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AEd,MAAM,CAACe,KAAP,GAAe,KAAf,GAAuBhB,KAAK,CAACe;AAH/B,OAAP;AAzBF;;AA+BA,SAAOf,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASiB,kBAAT,CAA6BjB,KAAK,GAAG,KAArC,EAA4CC,MAA5C,EAAqD;AAC3D,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACA,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACc,MAAP,GAAgB,KAAhB,GAAwBf,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOC,MAAM,CAACe,KAAd;AAPF;;AASA,SAAOhB,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASkB,aAAT,CAAwBlB,KAAK,GAAG,KAAhC,EAAuCC,MAAvC,EAAgD;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACC,aAAOD,MAAM,CAACc,MAAP,GAAgB,KAAhB,GAAwBf,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOC,MAAM,CAACe,KAAP,GAAe,KAAf,GAAuBhB,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACc,MAAd;AARF;;AAUA,SAAOf,KAAP;AACA;AAED,eAAeL,eAAe,CAAE;AAC/BG,EAAAA,WAD+B;AAE/BM,EAAAA,UAF+B;AAG/BC,EAAAA,QAH+B;AAI/BC,EAAAA,UAJ+B;AAK/BM,EAAAA,cAL+B;AAM/BC,EAAAA,eAN+B;AAO/BI,EAAAA,kBAP+B;AAQ/BC,EAAAA;AAR+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS } from './defaults';\nimport { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/constants';\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n * @return {Object} Updated state.\n */\nexport const preferences = combineReducers( {\n\tfeatures( state = PREFERENCES_DEFAULTS.features, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_FEATURE': {\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ action.feature ]: ! state[ action.feature ],\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn state;\n\t\t}\n\t},\n} );\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Array} state Current state history.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function editedPost( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE':\n\t\tcase 'SET_PAGE':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template',\n\t\t\t\t\tid: action.templateId,\n\t\t\t\t\tpage: action.page,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'SET_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'PUSH_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t...state,\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'GO_BACK':\n\t\t\treturn state.slice( 0, -1 );\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the site's homepage.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function homeTemplateId( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_HOME_TEMPLATE':\n\t\t\treturn action.homeTemplateId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the navigation panel, such as its active menu\n * and whether it should be opened or closed.\n *\n * Note: this reducer interacts with the inserter and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function navigationPanel(\n\tstate = { menu: MENU_ROOT, isOpen: false },\n\taction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_NAVIGATION_PANEL_ACTIVE_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisOpen: true,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: ! action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen ? false : state.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.value ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.value ? false : state.isOpen,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpreferences,\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\thomeTemplateId,\n\tnavigationPanel,\n\tblockInserterPanel,\n\tlistViewPanel,\n} );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["combineReducers","PREFERENCES_DEFAULTS","MENU_ROOT","preferences","features","state","action","type","feature","deviceType","settings","editedPost","id","templateId","page","templatePartId","slice","homeTemplateId","navigationPanel","menu","isOpen","value","blockInserterPanel","listViewPanel"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASC,SAAT,QAA0B,6DAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAGH,eAAe,CAAE;AAC3CI,EAAAA,QAAQ,GAAkD;AAAA,QAAhDC,KAAgD,uEAAxCJ,oBAAoB,CAACG,QAAmB;AAAA,QAATE,MAAS;;AACzD,YAASA,MAAM,CAACC,IAAhB;AACC,WAAK,gBAAL;AAAuB;AACtB,iBAAO,EACN,GAAGF,KADG;AAEN,aAAEC,MAAM,CAACE,OAAT,GAAoB,CAAEH,KAAK,CAAEC,MAAM,CAACE,OAAT;AAFrB,WAAP;AAIA;;AACD;AACC,eAAOH,KAAP;AARF;AAUA;;AAZ0C,CAAF,CAAnC;AAeP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,UAAT,GAAiD;AAAA,MAA5BJ,KAA4B,uEAApB,SAAoB;AAAA,MAATC,MAAS;;AACvD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACG,UAAd;AAFF;;AAKA,SAAOJ,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,QAAT,GAAwC;AAAA,MAArBL,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC9C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAO,EACN,GAAGF,KADG;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AAK,yBAAL;AACC,aAAOD,MAAM,CAACc,MAAP,GAAgB,KAAhB,GAAwBf,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOC,MAAM,CAACe,KAAd;AAPF;;AASA,SAAOhB,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASkB,aAAT,GAAgD;AAAA,MAAxBlB,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACC,aAAOD,MAAM,CAACc,MAAP,GAAgB,KAAhB,GAAwBf,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOC,MAAM,CAACe,KAAP,GAAe,KAAf,GAAuBhB,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACc,MAAd;AARF;;AAUA,SAAOf,KAAP;AACA;AAED,eAAeL,eAAe,CAAE;AAC/BG,EAAAA,WAD+B;AAE/BM,EAAAA,UAF+B;AAG/BC,EAAAA,QAH+B;AAI/BC,EAAAA,UAJ+B;AAK/BM,EAAAA,cAL+B;AAM/BC,EAAAA,eAN+B;AAO/BI,EAAAA,kBAP+B;AAQ/BC,EAAAA;AAR+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS } from './defaults';\nimport { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/constants';\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n * @return {Object} Updated state.\n */\nexport const preferences = combineReducers( {\n\tfeatures( state = PREFERENCES_DEFAULTS.features, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_FEATURE': {\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ action.feature ]: ! state[ action.feature ],\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn state;\n\t\t}\n\t},\n} );\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Array} state Current state history.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function editedPost( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE':\n\t\tcase 'SET_PAGE':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template',\n\t\t\t\t\tid: action.templateId,\n\t\t\t\t\tpage: action.page,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'SET_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'PUSH_TEMPLATE_PART':\n\t\t\treturn [\n\t\t\t\t...state,\n\t\t\t\t{\n\t\t\t\t\ttype: 'wp_template_part',\n\t\t\t\t\tid: action.templatePartId,\n\t\t\t\t},\n\t\t\t];\n\t\tcase 'GO_BACK':\n\t\t\treturn state.slice( 0, -1 );\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the site's homepage.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function homeTemplateId( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_HOME_TEMPLATE':\n\t\t\treturn action.homeTemplateId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the navigation panel, such as its active menu\n * and whether it should be opened or closed.\n *\n * Note: this reducer interacts with the inserter and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function navigationPanel(\n\tstate = { menu: MENU_ROOT, isOpen: false },\n\taction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_NAVIGATION_PANEL_ACTIVE_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisOpen: true,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: ! action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen ? false : state.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.value ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.value ? false : state.isOpen,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpreferences,\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\thomeTemplateId,\n\tnavigationPanel,\n\tblockInserterPanel,\n\tlistViewPanel,\n} );\n"]}
|
|
@@ -75,15 +75,19 @@ export const getSettings = createSelector((state, setIsInserterOpen) => {
|
|
|
75
75
|
return settings;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
settings.mediaUpload =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
settings.mediaUpload = _ref => {
|
|
79
|
+
let {
|
|
80
|
+
onError,
|
|
81
|
+
...rest
|
|
82
|
+
} = _ref;
|
|
82
83
|
uploadMedia({
|
|
83
84
|
wpAllowedMimeTypes: state.settings.allowedMimeTypes,
|
|
84
|
-
onError:
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
onError: _ref2 => {
|
|
86
|
+
let {
|
|
87
|
+
message
|
|
88
|
+
} = _ref2;
|
|
89
|
+
return onError(message);
|
|
90
|
+
},
|
|
87
91
|
...rest
|
|
88
92
|
});
|
|
89
93
|
};
|
|
@@ -290,8 +294,11 @@ export const getCurrentTemplateTemplateParts = createRegistrySelector(select =>
|
|
|
290
294
|
templatePart,
|
|
291
295
|
block
|
|
292
296
|
};
|
|
293
|
-
}).filter(
|
|
294
|
-
|
|
295
|
-
|
|
297
|
+
}).filter(_ref3 => {
|
|
298
|
+
let {
|
|
299
|
+
templatePart
|
|
300
|
+
} = _ref3;
|
|
301
|
+
return !!templatePart;
|
|
302
|
+
});
|
|
296
303
|
});
|
|
297
304
|
//# sourceMappingURL=selectors.js.map
|