@wordpress/edit-site 4.19.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/build/components/add-new-template/add-custom-template-modal.js +1 -0
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/index.js +8 -5
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +21 -6
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +12 -8
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +15 -30
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +64 -0
- package/build/components/block-editor/editor-canvas.js.map +1 -0
- package/build/components/block-editor/index.js +62 -59
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +10 -44
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/index.js +76 -135
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +57 -0
- package/build/components/global-styles/block-preview-panel.js.map +1 -0
- package/build/components/global-styles/border-panel.js +0 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +6 -2
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +62 -0
- package/build/components/global-styles/custom-css.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +2 -6
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +18 -4
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +0 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +5 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-border.js +47 -0
- package/build/components/global-styles/screen-border.js.map +1 -0
- package/build/components/global-styles/screen-button-color.js +0 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -1
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +42 -0
- package/build/components/global-styles/screen-css.js.map +1 -0
- package/build/components/global-styles/screen-heading-color.js +1 -3
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +0 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +20 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +3 -3
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +0 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/ui.js +50 -4
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +5 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +14 -4
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -8
- package/build/components/global-styles-renderer/index.js.map +1 -0
- package/build/components/header-edit-mode/document-actions/index.js +21 -45
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +19 -12
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +11 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +200 -0
- package/build/components/layout/index.js.map +1 -0
- package/build/components/list/header.js +5 -1
- package/build/components/list/header.js.map +1 -1
- package/build/components/list/index.js +4 -22
- package/build/components/list/index.js.map +1 -1
- package/build/components/navigate-to-link/index.js +1 -3
- package/build/components/navigate-to-link/index.js.map +1 -1
- package/build/components/routes/index.js +1 -1
- package/build/components/routes/index.js.map +1 -1
- package/build/components/sidebar/index.js +46 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +24 -4
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +4 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +53 -0
- package/build/components/sidebar-navigation-item/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen/index.js +49 -0
- package/build/components/sidebar-navigation-screen/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js +46 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +169 -0
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -0
- package/build/components/site-hub/index.js +149 -0
- package/build/components/site-hub/index.js.map +1 -0
- package/build/components/site-icon/index.js +70 -0
- package/build/components/site-icon/index.js.map +1 -0
- package/build/components/style-book/index.js +173 -0
- package/build/components/style-book/index.js.map +1 -0
- package/build/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +5 -4
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +53 -0
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +60 -0
- package/build/components/use-edited-entity-record/index.js.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +144 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build/index.js +7 -45
- package/build/index.js.map +1 -1
- package/build/store/actions.js +93 -43
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +35 -107
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +69 -78
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +1 -0
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/index.js +7 -5
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +18 -6
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +13 -9
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +15 -28
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +51 -0
- package/build-module/components/block-editor/editor-canvas.js.map +1 -0
- package/build-module/components/block-editor/index.js +62 -60
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +11 -40
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/index.js +75 -129
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +46 -0
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -0
- package/build-module/components/global-styles/border-panel.js +0 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +7 -3
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +52 -0
- package/build-module/components/global-styles/custom-css.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +3 -7
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +18 -4
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +2 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +4 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +30 -0
- package/build-module/components/global-styles/screen-border.js.map +1 -0
- package/build-module/components/global-styles/screen-button-color.js +0 -2
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +4 -1
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +28 -0
- package/build-module/components/global-styles/screen-css.js.map +1 -0
- package/build-module/components/global-styles/screen-heading-color.js +1 -3
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +3 -4
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +21 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -2
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/ui.js +48 -5
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +5 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +13 -5
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -7
- package/build-module/components/global-styles-renderer/index.js.map +1 -0
- package/build-module/components/header-edit-mode/document-actions/index.js +22 -43
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +16 -11
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +10 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +173 -0
- package/build-module/components/layout/index.js.map +1 -0
- package/build-module/components/list/header.js +5 -1
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/list/index.js +4 -19
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/navigate-to-link/index.js +1 -3
- package/build-module/components/navigate-to-link/index.js.map +1 -1
- package/build-module/components/routes/index.js +1 -1
- package/build-module/components/routes/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +33 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +27 -7
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +6 -4
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +40 -0
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen/index.js +39 -0
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js +32 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +147 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +126 -0
- package/build-module/components/site-hub/index.js.map +1 -0
- package/build-module/components/site-icon/index.js +55 -0
- package/build-module/components/site-icon/index.js.map +1 -0
- package/build-module/components/style-book/index.js +156 -0
- package/build-module/components/style-book/index.js.map +1 -0
- package/build-module/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +4 -3
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +48 -0
- package/build-module/components/use-edited-entity-record/index.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build-module/index.js +9 -36
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +87 -42
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +35 -102
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +60 -72
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +549 -352
- package/build-style/style.css +549 -352
- package/package.json +33 -31
- package/src/components/add-new-template/add-custom-template-modal.js +1 -0
- package/src/components/add-new-template/index.js +6 -3
- package/src/components/add-new-template/new-template-part.js +15 -3
- package/src/components/add-new-template/new-template.js +14 -7
- package/src/components/add-new-template/style.scss +0 -4
- package/src/components/app/index.js +14 -43
- package/src/components/block-editor/editor-canvas.js +69 -0
- package/src/components/block-editor/index.js +100 -87
- package/src/components/block-editor/resizable-editor.js +9 -64
- package/src/components/block-editor/style.scss +25 -1
- package/src/components/code-editor/style.scss +1 -1
- package/src/components/editor/index.js +157 -238
- package/src/components/editor/style.scss +0 -22
- package/src/components/global-styles/block-preview-panel.js +44 -0
- package/src/components/global-styles/border-panel.js +0 -1
- package/src/components/global-styles/context-menu.js +11 -2
- package/src/components/global-styles/custom-css.js +74 -0
- package/src/components/global-styles/dimensions-panel.js +2 -5
- package/src/components/global-styles/global-styles-provider.js +50 -22
- package/src/components/global-styles/hooks.js +8 -3
- package/src/components/global-styles/palette.js +1 -1
- package/src/components/global-styles/screen-background-color.js +0 -1
- package/src/components/global-styles/screen-block-list.js +2 -1
- package/src/components/global-styles/screen-block.js +6 -1
- package/src/components/global-styles/screen-border.js +25 -0
- package/src/components/global-styles/screen-button-color.js +0 -2
- package/src/components/global-styles/screen-colors.js +5 -1
- package/src/components/global-styles/screen-css.js +33 -0
- package/src/components/global-styles/screen-heading-color.js +1 -3
- package/src/components/global-styles/screen-layout.js +2 -3
- package/src/components/global-styles/screen-link-color.js +0 -1
- package/src/components/global-styles/screen-root.js +37 -1
- package/src/components/global-styles/screen-style-variations.js +5 -2
- package/src/components/global-styles/screen-text-color.js +0 -1
- package/src/components/global-styles/screen-typography.js +3 -0
- package/src/components/global-styles/style.scss +31 -2
- package/src/components/global-styles/test/typography-utils.js +72 -23
- package/src/components/global-styles/typography-utils.js +24 -4
- package/src/components/global-styles/ui.js +47 -4
- package/src/components/global-styles/use-global-styles-output.js +5 -0
- package/src/components/global-styles/utils.js +18 -6
- package/src/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +3 -9
- package/src/components/header-edit-mode/document-actions/index.js +31 -45
- package/src/components/header-edit-mode/document-actions/style.scss +8 -1
- package/src/components/header-edit-mode/index.js +96 -78
- package/src/components/header-edit-mode/style.scss +6 -33
- package/src/components/keyboard-shortcuts/index.js +13 -0
- package/src/components/layout/index.js +235 -0
- package/src/components/layout/style.scss +183 -0
- package/src/components/list/header.js +5 -1
- package/src/components/list/index.js +12 -31
- package/src/components/list/style.scss +3 -4
- package/src/components/navigate-to-link/index.js +2 -8
- package/src/components/routes/index.js +1 -1
- package/src/components/sidebar/index.js +37 -0
- package/src/components/sidebar/style.scss +8 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -7
- package/src/components/sidebar-edit-mode/index.js +4 -4
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +21 -3
- package/src/components/sidebar-edit-mode/settings-header/style.scss +47 -34
- package/src/components/sidebar-edit-mode/style.scss +0 -13
- package/src/components/sidebar-navigation-item/index.js +51 -0
- package/src/components/sidebar-navigation-item/style.scss +17 -0
- package/src/components/sidebar-navigation-screen/index.js +55 -0
- package/src/components/sidebar-navigation-screen/style.scss +39 -0
- package/src/components/sidebar-navigation-screen-main/index.js +44 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +163 -0
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/site-hub/index.js +150 -0
- package/src/components/site-hub/style.scss +31 -0
- package/src/components/site-icon/index.js +56 -0
- package/src/components/site-icon/style.scss +10 -0
- package/src/components/style-book/index.js +193 -0
- package/src/components/style-book/style.scss +78 -0
- package/src/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +3 -3
- package/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +36 -0
- package/src/components/template-details/style.scss +4 -0
- package/src/components/use-edited-entity-record/index.js +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +162 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/index.js +5 -53
- package/src/store/actions.js +93 -48
- package/src/store/reducer.js +29 -91
- package/src/store/selectors.js +61 -101
- package/src/store/test/actions.js +3 -15
- package/src/store/test/reducer.js +8 -192
- package/src/store/test/selectors.js +3 -42
- package/src/style.scss +21 -3
- package/build/components/editor/global-styles-renderer.js.map +0 -1
- package/build/components/navigation-sidebar/index.js +0 -62
- package/build/components/navigation-sidebar/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +0 -77
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +0 -152
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +0 -124
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
- package/build/components/url-query-controller/index.js.map +0 -1
- package/build-module/components/editor/global-styles-renderer.js.map +0 -1
- package/build-module/components/navigation-sidebar/index.js +0 -45
- package/build-module/components/navigation-sidebar/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -49
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +0 -131
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -66
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +0 -108
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
- package/build-module/components/url-query-controller/index.js.map +0 -1
- package/src/components/navigation-sidebar/index.js +0 -46
- package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -94
- package/src/components/navigation-sidebar/navigation-panel/index.js +0 -142
- package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -152
- package/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
- package/src/components/navigation-sidebar/navigation-toggle/index.js +0 -114
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +0 -71
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +0 -65
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
13
|
+
export default function useEditedEntityRecord() {
|
|
14
|
+
const {
|
|
15
|
+
record,
|
|
16
|
+
title,
|
|
17
|
+
isLoaded
|
|
18
|
+
} = useSelect(select => {
|
|
19
|
+
const {
|
|
20
|
+
getEditedPostType,
|
|
21
|
+
getEditedPostId
|
|
22
|
+
} = select(editSiteStore);
|
|
23
|
+
const {
|
|
24
|
+
getEditedEntityRecord
|
|
25
|
+
} = select(coreStore);
|
|
26
|
+
const {
|
|
27
|
+
__experimentalGetTemplateInfo: getTemplateInfo
|
|
28
|
+
} = select(editorStore);
|
|
29
|
+
const postType = getEditedPostType();
|
|
30
|
+
const postId = getEditedPostId();
|
|
31
|
+
|
|
32
|
+
const _record = getEditedEntityRecord('postType', postType, postId);
|
|
33
|
+
|
|
34
|
+
const _isLoaded = !!postId;
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
record: _record,
|
|
38
|
+
title: getTemplateInfo(_record).title,
|
|
39
|
+
isLoaded: _isLoaded
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
return {
|
|
43
|
+
isLoaded,
|
|
44
|
+
record,
|
|
45
|
+
getTitle: () => title ? decodeEntities(title) : null
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"names":["useSelect","store","coreStore","editorStore","decodeEntities","editSiteStore","useEditedEntityRecord","record","title","isLoaded","select","getEditedPostType","getEditedPostId","getEditedEntityRecord","__experimentalGetTemplateInfo","getTemplateInfo","postType","postId","_record","_isLoaded","getTitle"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,KAAV;AAAiBC,IAAAA;AAAjB,MAA8BT,SAAS,CAAIU,MAAF,IAAc;AAC5D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAAyCF,MAAM,CAAEL,aAAF,CAArD;AACA,UAAM;AAAEQ,MAAAA;AAAF,QAA4BH,MAAM,CAAER,SAAF,CAAxC;AACA,UAAM;AAAEY,MAAAA,6BAA6B,EAAEC;AAAjC,QACLL,MAAM,CAAEP,WAAF,CADP;AAEA,UAAMa,QAAQ,GAAGL,iBAAiB,EAAlC;AACA,UAAMM,MAAM,GAAGL,eAAe,EAA9B;;AACA,UAAMM,OAAO,GAAGL,qBAAqB,CAAE,UAAF,EAAcG,QAAd,EAAwBC,MAAxB,CAArC;;AACA,UAAME,SAAS,GAAG,CAAC,CAAEF,MAArB;;AAEA,WAAO;AACNV,MAAAA,MAAM,EAAEW,OADF;AAENV,MAAAA,KAAK,EAAEO,eAAe,CAAEG,OAAF,CAAf,CAA2BV,KAF5B;AAGNC,MAAAA,QAAQ,EAAEU;AAHJ,KAAP;AAKA,GAf4C,EAe1C,EAf0C,CAA7C;AAiBA,SAAO;AACNV,IAAAA,QADM;AAENF,IAAAA,MAFM;AAGNa,IAAAA,QAAQ,EAAE,MAAQZ,KAAK,GAAGJ,cAAc,CAAEI,KAAF,CAAjB,GAA6B;AAH9C,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function useEditedEntityRecord() {\n\tconst { record, title, isLoaded } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\t\tconst _record = getEditedEntityRecord( 'postType', postType, postId );\n\t\tconst _isLoaded = !! postId;\n\n\t\treturn {\n\t\t\trecord: _record,\n\t\t\ttitle: getTemplateInfo( _record ).title,\n\t\t\tisLoaded: _isLoaded,\n\t\t};\n\t}, [] );\n\n\treturn {\n\t\tisLoaded,\n\t\trecord,\n\t\tgetTitle: () => ( title ? decodeEntities( title ) : null ),\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/hooks/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA,OAAO,cAAP;AACA,OAAO,sBAAP","sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './template-part-edit';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA,OAAO,cAAP;AACA,OAAO,iCAAP;AACA,OAAO,sBAAP","sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './push-changes-to-global-styles';\nimport './template-part-edit';\n"]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { get, set } from 'lodash';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { addFilter } from '@wordpress/hooks';
|
|
12
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
13
|
+
import { InspectorAdvancedControls, store as blockEditorStore } from '@wordpress/block-editor';
|
|
14
|
+
import { BaseControl, Button } from '@wordpress/components';
|
|
15
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
16
|
+
import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, getBlockType } from '@wordpress/blocks';
|
|
17
|
+
import { useContext, useMemo, useCallback } from '@wordpress/element';
|
|
18
|
+
import { useDispatch } from '@wordpress/data';
|
|
19
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
20
|
+
/**
|
|
21
|
+
* Internal dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';
|
|
25
|
+
import { GlobalStylesContext } from '../../components/global-styles/context';
|
|
26
|
+
import { STYLE_PATH_TO_CSS_VAR_INFIX, STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE } from '../../components/global-styles/utils';
|
|
27
|
+
|
|
28
|
+
function getChangesToPush(name, attributes) {
|
|
29
|
+
return getSupportedGlobalStylesPanels(name).flatMap(key => {
|
|
30
|
+
if (!STYLE_PROPERTY[key]) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
value: path
|
|
36
|
+
} = STYLE_PROPERTY[key];
|
|
37
|
+
const presetAttributeKey = path.join('.');
|
|
38
|
+
const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]];
|
|
39
|
+
const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : get(attributes.style, path);
|
|
40
|
+
return value ? [{
|
|
41
|
+
path,
|
|
42
|
+
value
|
|
43
|
+
}] : [];
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function cloneDeep(object) {
|
|
48
|
+
return !object ? {} : JSON.parse(JSON.stringify(object));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function PushChangesToGlobalStylesControl(_ref) {
|
|
52
|
+
let {
|
|
53
|
+
name,
|
|
54
|
+
attributes,
|
|
55
|
+
setAttributes
|
|
56
|
+
} = _ref;
|
|
57
|
+
const changes = useMemo(() => getChangesToPush(name, attributes), [name, attributes]);
|
|
58
|
+
const {
|
|
59
|
+
user: userConfig,
|
|
60
|
+
setUserConfig
|
|
61
|
+
} = useContext(GlobalStylesContext);
|
|
62
|
+
const {
|
|
63
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
64
|
+
} = useDispatch(blockEditorStore);
|
|
65
|
+
const {
|
|
66
|
+
createSuccessNotice
|
|
67
|
+
} = useDispatch(noticesStore);
|
|
68
|
+
const pushChanges = useCallback(() => {
|
|
69
|
+
if (changes.length === 0) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const {
|
|
74
|
+
style: blockStyles
|
|
75
|
+
} = attributes;
|
|
76
|
+
const newBlockStyles = cloneDeep(blockStyles);
|
|
77
|
+
const newUserConfig = cloneDeep(userConfig);
|
|
78
|
+
|
|
79
|
+
for (const {
|
|
80
|
+
path,
|
|
81
|
+
value
|
|
82
|
+
} of changes) {
|
|
83
|
+
set(newBlockStyles, path, undefined);
|
|
84
|
+
set(newUserConfig, ['styles', 'blocks', name, ...path], value);
|
|
85
|
+
} // @wordpress/core-data doesn't support editing multiple entity types in
|
|
86
|
+
// a single undo level. So for now, we disable @wordpress/core-data undo
|
|
87
|
+
// tracking and implement our own Undo button in the snackbar
|
|
88
|
+
// notification.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
92
|
+
|
|
93
|
+
setAttributes({
|
|
94
|
+
style: newBlockStyles
|
|
95
|
+
});
|
|
96
|
+
setUserConfig(() => newUserConfig, {
|
|
97
|
+
undoIgnore: true
|
|
98
|
+
});
|
|
99
|
+
createSuccessNotice(sprintf( // translators: %s: Title of the block e.g. 'Heading'.
|
|
100
|
+
__('Pushed styles to all %s blocks.'), getBlockType(name).title), {
|
|
101
|
+
type: 'snackbar',
|
|
102
|
+
actions: [{
|
|
103
|
+
label: __('Undo'),
|
|
104
|
+
|
|
105
|
+
onClick() {
|
|
106
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
107
|
+
|
|
108
|
+
setAttributes({
|
|
109
|
+
style: blockStyles
|
|
110
|
+
});
|
|
111
|
+
setUserConfig(() => userConfig, {
|
|
112
|
+
undoIgnore: true
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}]
|
|
117
|
+
});
|
|
118
|
+
}, [changes, attributes, userConfig, name]);
|
|
119
|
+
return createElement(BaseControl, {
|
|
120
|
+
className: "edit-site-push-changes-to-global-styles-control",
|
|
121
|
+
help: sprintf( // translators: %s: Title of the block e.g. 'Heading'.
|
|
122
|
+
__('Move this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), getBlockType(name).title)
|
|
123
|
+
}, createElement(BaseControl.VisualLabel, null, __('Styles')), createElement(Button, {
|
|
124
|
+
variant: "primary",
|
|
125
|
+
disabled: changes.length === 0,
|
|
126
|
+
onClick: pushChanges
|
|
127
|
+
}, __('Push changes to Global Styles')));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const withPushChangesToGlobalStyles = createHigherOrderComponent(BlockEdit => props => createElement(Fragment, null, createElement(BlockEdit, props), createElement(InspectorAdvancedControls, null, createElement(PushChangesToGlobalStylesControl, props))));
|
|
131
|
+
addFilter('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles);
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","useContext","useMemo","useCallback","useDispatch","noticesStore","getSupportedGlobalStylesPanels","GlobalStylesContext","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","getChangesToPush","name","attributes","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,QAGO,mBAHP;AAIA,SAASC,UAAT,EAAqBC,OAArB,EA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D,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';\nimport { GlobalStylesContext } from '../../components/global-styles/context';\nimport {\n\tSTYLE_PATH_TO_CSS_VAR_INFIX,\n\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE,\n} from '../../components/global-styles/utils';\n\nfunction getChangesToPush( name, attributes ) {\n\treturn getSupportedGlobalStylesPanels( name ).flatMap( ( key ) => {\n\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\tconst presetAttributeKey = path.join( '.' );\n\t\tconst presetAttributeValue =\n\t\t\tattributes[\n\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t];\n\t\tconst value = presetAttributeValue\n\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t: get( attributes.style, path );\n\t\treturn value ? [ { path, value } ] : [];\n\t} );\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useMemo(\n\t\t() => getChangesToPush( name, attributes ),\n\t\t[ name, attributes ]\n\t);\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( 'Pushed styles to all %s blocks.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\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() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\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}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Move this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Push changes to Global Styles' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) =>\n\t\t(\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t</InspectorAdvancedControls>\n\t\t\t</>\n\t\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -5,25 +5,21 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
7
7
|
import { registerCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
|
|
8
|
-
import { dispatch
|
|
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
11
|
import { store as editorStore } from '@wordpress/editor';
|
|
12
12
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
13
13
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
14
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
-
import { store as viewportStore } from '@wordpress/viewport';
|
|
16
|
-
import { getQueryArgs } from '@wordpress/url';
|
|
17
14
|
import { addFilter } from '@wordpress/hooks';
|
|
15
|
+
import { registerLegacyWidgetBlock } from '@wordpress/widgets';
|
|
18
16
|
/**
|
|
19
17
|
* Internal dependencies
|
|
20
18
|
*/
|
|
21
19
|
|
|
22
20
|
import './hooks';
|
|
23
21
|
import { store as editSiteStore } from './store';
|
|
24
|
-
import
|
|
25
|
-
import getIsListPage from './utils/get-is-list-page';
|
|
26
|
-
import ErrorBoundaryWarning from './components/error-boundary/warning';
|
|
22
|
+
import App from './components/app';
|
|
27
23
|
/**
|
|
28
24
|
* Reinitializes the editor after the user chooses to reboot the editor after
|
|
29
25
|
* an unhandled error occurs, replacing previously mounted editor element using
|
|
@@ -34,16 +30,6 @@ import ErrorBoundaryWarning from './components/error-boundary/warning';
|
|
|
34
30
|
*/
|
|
35
31
|
|
|
36
32
|
export function reinitializeEditor(target, settings) {
|
|
37
|
-
// Display warning if editor wasn't able to resolve homepage template.
|
|
38
|
-
if (!settings.__unstableHomeTemplate) {
|
|
39
|
-
var _settings$__experimen;
|
|
40
|
-
|
|
41
|
-
render(createElement(ErrorBoundaryWarning, {
|
|
42
|
-
message: __('The editor is unable to find a block template for the homepage.'),
|
|
43
|
-
dashboardLink: (_settings$__experimen = settings.__experimentalDashboardLink) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : 'index.php'
|
|
44
|
-
}), target);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
33
|
/*
|
|
48
34
|
* Prevent adding the Clasic block in the site editor.
|
|
49
35
|
* Only add the filter when the site editor is initialized, not imported.
|
|
@@ -53,8 +39,6 @@ export function reinitializeEditor(target, settings) {
|
|
|
53
39
|
* This usage here is inspired by previous usage of the filter in the post editor:
|
|
54
40
|
* https://github.com/WordPress/gutenberg/pull/37157
|
|
55
41
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
42
|
addFilter('blockEditor.__unstableCanInsertBlockType', 'removeClassicBlockFromInserter', (canInsert, blockType) => {
|
|
59
43
|
if (blockType.name === 'core/freeform') {
|
|
60
44
|
return false;
|
|
@@ -76,12 +60,7 @@ export function reinitializeEditor(target, settings) {
|
|
|
76
60
|
welcomeGuide: true,
|
|
77
61
|
welcomeGuideStyles: true,
|
|
78
62
|
showListViewByDefault: false
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
if (select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
|
|
82
|
-
dispatch(editSiteStore).setIsListViewOpened(true);
|
|
83
|
-
}
|
|
84
|
-
|
|
63
|
+
});
|
|
85
64
|
dispatch(interfaceStore).setDefaultComplementaryArea('core/edit-site', 'edit-site/template');
|
|
86
65
|
dispatch(editSiteStore).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
|
|
87
66
|
// so that they can be selected with core/editor selectors in any editor.
|
|
@@ -92,20 +71,12 @@ export function reinitializeEditor(target, settings) {
|
|
|
92
71
|
defaultTemplateTypes: settings.defaultTemplateTypes,
|
|
93
72
|
defaultTemplatePartAreas: settings.defaultTemplatePartAreas
|
|
94
73
|
});
|
|
95
|
-
const isLandingOnListPage = getIsListPage(getQueryArgs(window.location.href));
|
|
96
|
-
|
|
97
|
-
if (isLandingOnListPage) {
|
|
98
|
-
// Default the navigation panel to be opened when we're in a bigger
|
|
99
|
-
// screen and land in the list screen.
|
|
100
|
-
dispatch(editSiteStore).setIsNavigationPanelOpened(select(viewportStore).isViewportMatch('medium'));
|
|
101
|
-
}
|
|
102
74
|
} // Prevent the default browser action for files dropped outside of dropzones.
|
|
103
75
|
|
|
104
76
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
105
77
|
window.addEventListener('drop', e => e.preventDefault(), false);
|
|
106
|
-
render(createElement(
|
|
107
|
-
reboot: reboot
|
|
108
|
-
homeTemplate: settings.__unstableHomeTemplate
|
|
78
|
+
render(createElement(App, {
|
|
79
|
+
reboot: reboot
|
|
109
80
|
}), target);
|
|
110
81
|
}
|
|
111
82
|
/**
|
|
@@ -124,6 +95,9 @@ export function initializeEditor(id, settings) {
|
|
|
124
95
|
dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
|
|
125
96
|
|
|
126
97
|
registerCoreBlocks();
|
|
98
|
+
registerLegacyWidgetBlock({
|
|
99
|
+
inserter: false
|
|
100
|
+
});
|
|
127
101
|
|
|
128
102
|
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
129
103
|
__experimentalRegisterExperimentalCoreBlocks({
|
|
@@ -133,7 +107,6 @@ export function initializeEditor(id, settings) {
|
|
|
133
107
|
|
|
134
108
|
reinitializeEditor(target, settings);
|
|
135
109
|
}
|
|
136
|
-
export { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';
|
|
137
110
|
export { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';
|
|
138
111
|
export { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';
|
|
139
112
|
export { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","__","viewportStore","getQueryArgs","addFilter","editSiteStore","EditSiteApp","getIsListPage","ErrorBoundaryWarning","reinitializeEditor","target","settings","__unstableHomeTemplate","__experimentalDashboardLink","canInsert","blockType","name","reboot","bind","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","get","setIsListViewOpened","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","addEventListener","e","preventDefault","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","default","__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,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,cAAlB,QAAwC,sBAAxC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASf,KAAK,IAAIgB,aAAlB,QAAuC,qBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAASlB,KAAK,IAAImB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,WAAP,MAAwB,kBAAxB;AACA,OAAOC,aAAP,MAA0B,0BAA1B;AACA,OAAOC,oBAAP,MAAiC,qCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,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zB,CADrB;;AAEAA,EAAAA,QAAQ,CAACoC,8BAAT,GAA0ClD,YAA1C;AAEA,QAAMa,MAAM,GAAGsC,QAAQ,CAACC,cAAT,CAAyBL,EAAzB,CAAf;;AAEAtD,EAAAA,QAAQ,CAAEH,WAAF,CAAR,CAAwB+D,qCAAxB;;AACA9D,EAAAA,kBAAkB;;AAClB,MAAK+D,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtChE,IAAAA,4CAA4C,CAAE;AAC7CiE,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAED7C,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA;AAED,SAAS4C,OAAO,IAAIC,8BAApB,QAA0D,mDAA1D;AACA,SAASD,OAAO,IAAIE,aAApB,QAAyC,+CAAzC;AACA,SAASF,OAAO,IAAIG,yBAApB,QAAqD,6DAArD;AACA,SAASH,OAAO,IAAII,kBAApB,QAA8C,qDAA9C","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, select } 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';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\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\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink={\n\t\t\t\t\tsettings.__experimentalDashboardLink ?? 'index.php'\n\t\t\t\t}\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t/*\n\t * Prevent adding the Clasic block in the site editor.\n\t * Only add the filter when the site editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t *\n\t * This usage here is inspired by previous usage of the filter in the post editor:\n\t * https://github.com/WordPress/gutenberg/pull/37157\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeClassicBlockFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif ( blockType.name === 'core/freeform' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\trender(\n\t\t<EditSiteApp\n\t\t\treboot={ reboot }\n\t\t\thomeTemplate={ settings.__unstableHomeTemplate }\n\t\t/>,\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\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","addFilter","registerLegacyWidgetBlock","editSiteStore","App","reinitializeEditor","target","settings","canInsert","blockType","name","reboot","bind","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","document","getElementById","__experimentalReapplyBlockTypeFilters","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","default","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,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Ba,EAAAA,yBAAyB,CAAE;AAAEoC,IAAAA,QAAQ,EAAE;AAAZ,GAAF,CAAzB;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtCnD,IAAAA,4CAA4C,CAAE;AAC7CoD,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAEDrC,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA;AAED,SAASoC,OAAO,IAAIC,aAApB,QAAyC,+CAAzC;AACA,SAASD,OAAO,IAAIE,yBAApB,QAAqD,6DAArD;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,qDAA9C","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';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { addFilter } from '@wordpress/hooks';\nimport { registerLegacyWidgetBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\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\t/*\n\t * Prevent adding the Clasic block in the site editor.\n\t * Only add the filter when the site editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t *\n\t * This usage here is inspired by previous usage of the filter in the post editor:\n\t * https://github.com/WordPress/gutenberg/pull/37157\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeClassicBlockFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif ( blockType.name === 'core/freeform' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\trender( <App reboot={ reboot } />, target );\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\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
|
|
@@ -65,17 +65,18 @@ export const setTemplate = (templateId, templateSlug) => async _ref2 => {
|
|
|
65
65
|
} = _ref2;
|
|
66
66
|
|
|
67
67
|
if (!templateSlug) {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
try {
|
|
69
|
+
const template = await registry.resolveSelect(coreStore).getEntityRecord('postType', 'wp_template', templateId);
|
|
70
|
+
templateSlug = template === null || template === void 0 ? void 0 : template.slug;
|
|
71
|
+
} catch (error) {}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
dispatch({
|
|
73
|
-
type: '
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
75
|
+
type: 'SET_EDITED_POST',
|
|
76
|
+
postType: 'wp_template',
|
|
77
|
+
id: templateId,
|
|
78
|
+
context: {
|
|
79
|
+
templateSlug
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
82
|
};
|
|
@@ -103,12 +104,11 @@ export const addTemplate = template => async _ref3 => {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
dispatch({
|
|
106
|
-
type: '
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
107
|
+
type: 'SET_EDITED_POST',
|
|
108
|
+
postType: 'wp_template',
|
|
109
|
+
id: newTemplate.id,
|
|
110
|
+
context: {
|
|
111
|
+
templateSlug: newTemplate.slug
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
};
|
|
@@ -155,21 +155,36 @@ export const removeTemplate = template => async _ref4 => {
|
|
|
155
155
|
|
|
156
156
|
export function setTemplatePart(templatePartId) {
|
|
157
157
|
return {
|
|
158
|
-
type: '
|
|
159
|
-
|
|
158
|
+
type: 'SET_EDITED_POST',
|
|
159
|
+
postType: 'wp_template_part',
|
|
160
|
+
id: templatePartId
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
163
|
/**
|
|
163
|
-
*
|
|
164
|
-
|
|
164
|
+
* @deprecated
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
export function setHomeTemplateId() {
|
|
168
|
+
deprecated("dispatch( 'core/edit-site' ).setHomeTemplateId", {
|
|
169
|
+
since: '6.2',
|
|
170
|
+
version: '6.4'
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
type: 'NOTHING'
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Set's the current block editor context.
|
|
165
178
|
*
|
|
166
|
-
* @param {
|
|
179
|
+
* @param {Object} context The context object.
|
|
180
|
+
*
|
|
181
|
+
* @return {number} The resolved template ID for the page route.
|
|
167
182
|
*/
|
|
168
183
|
|
|
169
|
-
export function
|
|
184
|
+
export function setEditedPostContext(context) {
|
|
170
185
|
return {
|
|
171
|
-
type: '
|
|
172
|
-
|
|
186
|
+
type: 'SET_EDITED_POST_CONTEXT',
|
|
187
|
+
context
|
|
173
188
|
};
|
|
174
189
|
}
|
|
175
190
|
/**
|
|
@@ -206,53 +221,60 @@ export const setPage = page => async _ref5 => {
|
|
|
206
221
|
}
|
|
207
222
|
|
|
208
223
|
dispatch({
|
|
209
|
-
type: '
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
templateId: template.id
|
|
224
|
+
type: 'SET_EDITED_POST',
|
|
225
|
+
postType: 'wp_template',
|
|
226
|
+
id: template.id,
|
|
227
|
+
context: { ...page.context,
|
|
228
|
+
templateSlug: template.slug
|
|
229
|
+
}
|
|
216
230
|
});
|
|
217
231
|
return template.id;
|
|
218
232
|
};
|
|
219
233
|
/**
|
|
220
234
|
* Action that sets the active navigation panel menu.
|
|
221
235
|
*
|
|
222
|
-
* @
|
|
236
|
+
* @deprecated
|
|
223
237
|
*
|
|
224
238
|
* @return {Object} Action object.
|
|
225
239
|
*/
|
|
226
240
|
|
|
227
|
-
export function setNavigationPanelActiveMenu(
|
|
241
|
+
export function setNavigationPanelActiveMenu() {
|
|
242
|
+
deprecated("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", {
|
|
243
|
+
since: '6.2',
|
|
244
|
+
version: '6.4'
|
|
245
|
+
});
|
|
228
246
|
return {
|
|
229
|
-
type: '
|
|
230
|
-
menu
|
|
247
|
+
type: 'NOTHING'
|
|
231
248
|
};
|
|
232
249
|
}
|
|
233
250
|
/**
|
|
234
251
|
* Opens the navigation panel and sets its active menu at the same time.
|
|
235
252
|
*
|
|
236
|
-
* @
|
|
253
|
+
* @deprecated
|
|
237
254
|
*/
|
|
238
255
|
|
|
239
|
-
export function openNavigationPanelToMenu(
|
|
256
|
+
export function openNavigationPanelToMenu() {
|
|
257
|
+
deprecated("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", {
|
|
258
|
+
since: '6.2',
|
|
259
|
+
version: '6.4'
|
|
260
|
+
});
|
|
240
261
|
return {
|
|
241
|
-
type: '
|
|
242
|
-
menu
|
|
262
|
+
type: 'NOTHING'
|
|
243
263
|
};
|
|
244
264
|
}
|
|
245
265
|
/**
|
|
246
266
|
* Sets whether the navigation panel should be open.
|
|
247
267
|
*
|
|
248
|
-
* @
|
|
249
|
-
* does not toggle the state, but sets it directly.
|
|
268
|
+
* @deprecated
|
|
250
269
|
*/
|
|
251
270
|
|
|
252
|
-
export function setIsNavigationPanelOpened(
|
|
271
|
+
export function setIsNavigationPanelOpened() {
|
|
272
|
+
deprecated("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", {
|
|
273
|
+
since: '6.2',
|
|
274
|
+
version: '6.4'
|
|
275
|
+
});
|
|
253
276
|
return {
|
|
254
|
-
type: '
|
|
255
|
-
isOpen
|
|
277
|
+
type: 'NOTHING'
|
|
256
278
|
};
|
|
257
279
|
}
|
|
258
280
|
/**
|
|
@@ -459,4 +481,27 @@ export const switchEditorMode = mode => _ref10 => {
|
|
|
459
481
|
speak(__('Mosaic view selected'), 'assertive');
|
|
460
482
|
}
|
|
461
483
|
};
|
|
484
|
+
/**
|
|
485
|
+
* Action that switches the canvas mode.
|
|
486
|
+
*
|
|
487
|
+
* @param {?string} mode Canvas mode.
|
|
488
|
+
*/
|
|
489
|
+
|
|
490
|
+
export const __unstableSetCanvasMode = mode => _ref11 => {
|
|
491
|
+
let {
|
|
492
|
+
registry,
|
|
493
|
+
dispatch
|
|
494
|
+
} = _ref11;
|
|
495
|
+
|
|
496
|
+
registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
|
|
497
|
+
|
|
498
|
+
dispatch({
|
|
499
|
+
type: 'SET_CANVAS_MODE',
|
|
500
|
+
mode
|
|
501
|
+
}); // Check if the block list view should be open by default.
|
|
502
|
+
|
|
503
|
+
if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
|
|
504
|
+
dispatch.setIsListViewOpened(true);
|
|
505
|
+
}
|
|
506
|
+
};
|
|
462
507
|
//# sourceMappingURL=actions.js.map
|