@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 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"names":["useInitEditedEntityFromURL","setTemplate","setTemplatePart","setPage","editSiteStore","params","postId","postType","context"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,0BAAT,GAAsC;AACpD,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MACL,uBAAaC,YAAb,CADD;AAEA,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEF,0BAFJ,CAHoD,CAOpD;;AACA,0BAAW,MAAM;AAChB;AACA;AACA,QAAK,WAAWA,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDJ,MAAAA,OAAO,CAAE;AAAEK,QAAAA,OAAO,EAAE;AAAED,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCN,MAAAA,WAAW,CAAEK,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CL,MAAAA,eAAe,CAAEI,MAAF,CAAf;AACA;AACD,GAVD,EAUG,CAAEA,MAAF,EAAUC,QAAV,CAVH;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { setTemplate, setTemplatePart, setPage } =\n\t\tuseDispatch( editSiteStore );\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\n\t\t// This URL scheme mean we can't open a template part with the context of a given post.\n\t\t// Potentially posts and pages could be moved to a \"context\" query string instead.\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t}\n\t}, [ postId, postType ] );\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useSyncSidebarPathWithURL;
|
|
7
|
+
|
|
8
|
+
var _components = require("@wordpress/components");
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _routes = require("../routes");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
function useSyncSidebarPathWithURL() {
|
|
22
|
+
const history = (0, _routes.useHistory)();
|
|
23
|
+
const {
|
|
24
|
+
params
|
|
25
|
+
} = (0, _routes.useLocation)();
|
|
26
|
+
const {
|
|
27
|
+
sidebar = '/'
|
|
28
|
+
} = params;
|
|
29
|
+
const {
|
|
30
|
+
location,
|
|
31
|
+
goTo
|
|
32
|
+
} = (0, _components.__experimentalUseNavigator)();
|
|
33
|
+
const currentSidebar = (0, _element.useRef)(sidebar);
|
|
34
|
+
const currentNavigatorLocation = (0, _element.useRef)(location.path);
|
|
35
|
+
(0, _element.useEffect)(() => {
|
|
36
|
+
currentSidebar.current = sidebar;
|
|
37
|
+
|
|
38
|
+
if (sidebar !== currentNavigatorLocation.current) {
|
|
39
|
+
goTo(sidebar);
|
|
40
|
+
}
|
|
41
|
+
}, [sidebar]);
|
|
42
|
+
(0, _element.useEffect)(() => {
|
|
43
|
+
currentNavigatorLocation.current = location.path;
|
|
44
|
+
|
|
45
|
+
if (location.path !== currentSidebar.current) {
|
|
46
|
+
history.push({ ...params,
|
|
47
|
+
sidebar: location.path
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}, [location.path, history]);
|
|
51
|
+
return sidebar;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=use-sync-sidebar-path-with-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js"],"names":["useSyncSidebarPathWithURL","history","params","sidebar","location","goTo","currentSidebar","currentNavigatorLocation","path","current","push"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,yBAAT,GAAqC;AACnD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAM;AAAEC,IAAAA,OAAO,GAAG;AAAZ,MAAoBD,MAA1B;AACA,QAAM;AAAEE,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqB,6CAA3B;AACA,QAAMC,cAAc,GAAG,qBAAQH,OAAR,CAAvB;AACA,QAAMI,wBAAwB,GAAG,qBAAQH,QAAQ,CAACI,IAAjB,CAAjC;AACA,0BAAW,MAAM;AAChBF,IAAAA,cAAc,CAACG,OAAf,GAAyBN,OAAzB;;AACA,QAAKA,OAAO,KAAKI,wBAAwB,CAACE,OAA1C,EAAoD;AACnDJ,MAAAA,IAAI,CAAEF,OAAF,CAAJ;AACA;AACD,GALD,EAKG,CAAEA,OAAF,CALH;AAMA,0BAAW,MAAM;AAChBI,IAAAA,wBAAwB,CAACE,OAAzB,GAAmCL,QAAQ,CAACI,IAA5C;;AACA,QAAKJ,QAAQ,CAACI,IAAT,KAAkBF,cAAc,CAACG,OAAtC,EAAgD;AAC/CR,MAAAA,OAAO,CAACS,IAAR,CAAc,EACb,GAAGR,MADU;AAEbC,QAAAA,OAAO,EAAEC,QAAQ,CAACI;AAFL,OAAd;AAIA;AACD,GARD,EAQG,CAAEJ,QAAQ,CAACI,IAAX,EAAiBP,OAAjB,CARH;AAUA,SAAOE,OAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\n\nexport default function useSyncSidebarPathWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { sidebar = '/' } = params;\n\tconst { location, goTo } = useNavigator();\n\tconst currentSidebar = useRef( sidebar );\n\tconst currentNavigatorLocation = useRef( location.path );\n\tuseEffect( () => {\n\t\tcurrentSidebar.current = sidebar;\n\t\tif ( sidebar !== currentNavigatorLocation.current ) {\n\t\t\tgoTo( sidebar );\n\t\t}\n\t}, [ sidebar ] );\n\tuseEffect( () => {\n\t\tcurrentNavigatorLocation.current = location.path;\n\t\tif ( location.path !== currentSidebar.current ) {\n\t\t\thistory.push( {\n\t\t\t\t...params,\n\t\t\t\tsidebar: location.path,\n\t\t\t} );\n\t\t}\n\t}, [ location.path, history ] );\n\n\treturn sidebar;\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useEditedEntityRecord;
|
|
7
|
+
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
|
|
10
|
+
var _coreData = require("@wordpress/core-data");
|
|
11
|
+
|
|
12
|
+
var _editor = require("@wordpress/editor");
|
|
13
|
+
|
|
14
|
+
var _htmlEntities = require("@wordpress/html-entities");
|
|
15
|
+
|
|
16
|
+
var _store = require("../../store");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
function useEditedEntityRecord() {
|
|
26
|
+
const {
|
|
27
|
+
record,
|
|
28
|
+
title,
|
|
29
|
+
isLoaded
|
|
30
|
+
} = (0, _data.useSelect)(select => {
|
|
31
|
+
const {
|
|
32
|
+
getEditedPostType,
|
|
33
|
+
getEditedPostId
|
|
34
|
+
} = select(_store.store);
|
|
35
|
+
const {
|
|
36
|
+
getEditedEntityRecord
|
|
37
|
+
} = select(_coreData.store);
|
|
38
|
+
const {
|
|
39
|
+
__experimentalGetTemplateInfo: getTemplateInfo
|
|
40
|
+
} = select(_editor.store);
|
|
41
|
+
const postType = getEditedPostType();
|
|
42
|
+
const postId = getEditedPostId();
|
|
43
|
+
|
|
44
|
+
const _record = getEditedEntityRecord('postType', postType, postId);
|
|
45
|
+
|
|
46
|
+
const _isLoaded = !!postId;
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
record: _record,
|
|
50
|
+
title: getTemplateInfo(_record).title,
|
|
51
|
+
isLoaded: _isLoaded
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
return {
|
|
55
|
+
isLoaded,
|
|
56
|
+
record,
|
|
57
|
+
getTitle: () => title ? (0, _htmlEntities.decodeEntities)(title) : null
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"names":["useEditedEntityRecord","record","title","isLoaded","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","postType","postId","_record","_isLoaded","getTitle"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,qBAAT,GAAiC;AAC/C,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,KAAV;AAAiBC,IAAAA;AAAjB,MAA8B,qBAAaC,MAAF,IAAc;AAC5D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAAyCF,MAAM,CAAEG,YAAF,CAArD;AACA,UAAM;AAAEC,MAAAA;AAAF,QAA4BJ,MAAM,CAAEK,eAAF,CAAxC;AACA,UAAM;AAAEC,MAAAA,6BAA6B,EAAEC;AAAjC,QACLP,MAAM,CAAEQ,aAAF,CADP;AAEA,UAAMC,QAAQ,GAAGR,iBAAiB,EAAlC;AACA,UAAMS,MAAM,GAAGR,eAAe,EAA9B;;AACA,UAAMS,OAAO,GAAGP,qBAAqB,CAAE,UAAF,EAAcK,QAAd,EAAwBC,MAAxB,CAArC;;AACA,UAAME,SAAS,GAAG,CAAC,CAAEF,MAArB;;AAEA,WAAO;AACNb,MAAAA,MAAM,EAAEc,OADF;AAENb,MAAAA,KAAK,EAAES,eAAe,CAAEI,OAAF,CAAf,CAA2Bb,KAF5B;AAGNC,MAAAA,QAAQ,EAAEa;AAHJ,KAAP;AAKA,GAfmC,EAejC,EAfiC,CAApC;AAiBA,SAAO;AACNb,IAAAA,QADM;AAENF,IAAAA,MAFM;AAGNgB,IAAAA,QAAQ,EAAE,MAAQf,KAAK,GAAG,kCAAgBA,KAAhB,CAAH,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"]}
|
package/build/hooks/index.js
CHANGED
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/hooks/index.js"],"names":[],"mappings":";;AAGA;;AACA","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":";;AAGA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './push-changes-to-global-styles';\nimport './template-part-edit';\n"]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _element = require("@wordpress/element");
|
|
4
|
+
|
|
5
|
+
var _lodash = require("lodash");
|
|
6
|
+
|
|
7
|
+
var _hooks = require("@wordpress/hooks");
|
|
8
|
+
|
|
9
|
+
var _compose = require("@wordpress/compose");
|
|
10
|
+
|
|
11
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
12
|
+
|
|
13
|
+
var _components = require("@wordpress/components");
|
|
14
|
+
|
|
15
|
+
var _i18n = require("@wordpress/i18n");
|
|
16
|
+
|
|
17
|
+
var _blocks = require("@wordpress/blocks");
|
|
18
|
+
|
|
19
|
+
var _data = require("@wordpress/data");
|
|
20
|
+
|
|
21
|
+
var _notices = require("@wordpress/notices");
|
|
22
|
+
|
|
23
|
+
var _hooks2 = require("../../components/global-styles/hooks");
|
|
24
|
+
|
|
25
|
+
var _context = require("../../components/global-styles/context");
|
|
26
|
+
|
|
27
|
+
var _utils = require("../../components/global-styles/utils");
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* External dependencies
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* WordPress dependencies
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Internal dependencies
|
|
39
|
+
*/
|
|
40
|
+
function getChangesToPush(name, attributes) {
|
|
41
|
+
return (0, _hooks2.getSupportedGlobalStylesPanels)(name).flatMap(key => {
|
|
42
|
+
if (!_blocks.__EXPERIMENTAL_STYLE_PROPERTY[key]) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
value: path
|
|
48
|
+
} = _blocks.__EXPERIMENTAL_STYLE_PROPERTY[key];
|
|
49
|
+
const presetAttributeKey = path.join('.');
|
|
50
|
+
const presetAttributeValue = attributes[_utils.STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]];
|
|
51
|
+
const value = presetAttributeValue ? `var:preset|${_utils.STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : (0, _lodash.get)(attributes.style, path);
|
|
52
|
+
return value ? [{
|
|
53
|
+
path,
|
|
54
|
+
value
|
|
55
|
+
}] : [];
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function cloneDeep(object) {
|
|
60
|
+
return !object ? {} : JSON.parse(JSON.stringify(object));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function PushChangesToGlobalStylesControl(_ref) {
|
|
64
|
+
let {
|
|
65
|
+
name,
|
|
66
|
+
attributes,
|
|
67
|
+
setAttributes
|
|
68
|
+
} = _ref;
|
|
69
|
+
const changes = (0, _element.useMemo)(() => getChangesToPush(name, attributes), [name, attributes]);
|
|
70
|
+
const {
|
|
71
|
+
user: userConfig,
|
|
72
|
+
setUserConfig
|
|
73
|
+
} = (0, _element.useContext)(_context.GlobalStylesContext);
|
|
74
|
+
const {
|
|
75
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
76
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
77
|
+
const {
|
|
78
|
+
createSuccessNotice
|
|
79
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
80
|
+
const pushChanges = (0, _element.useCallback)(() => {
|
|
81
|
+
if (changes.length === 0) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const {
|
|
86
|
+
style: blockStyles
|
|
87
|
+
} = attributes;
|
|
88
|
+
const newBlockStyles = cloneDeep(blockStyles);
|
|
89
|
+
const newUserConfig = cloneDeep(userConfig);
|
|
90
|
+
|
|
91
|
+
for (const {
|
|
92
|
+
path,
|
|
93
|
+
value
|
|
94
|
+
} of changes) {
|
|
95
|
+
(0, _lodash.set)(newBlockStyles, path, undefined);
|
|
96
|
+
(0, _lodash.set)(newUserConfig, ['styles', 'blocks', name, ...path], value);
|
|
97
|
+
} // @wordpress/core-data doesn't support editing multiple entity types in
|
|
98
|
+
// a single undo level. So for now, we disable @wordpress/core-data undo
|
|
99
|
+
// tracking and implement our own Undo button in the snackbar
|
|
100
|
+
// notification.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
104
|
+
|
|
105
|
+
setAttributes({
|
|
106
|
+
style: newBlockStyles
|
|
107
|
+
});
|
|
108
|
+
setUserConfig(() => newUserConfig, {
|
|
109
|
+
undoIgnore: true
|
|
110
|
+
});
|
|
111
|
+
createSuccessNotice((0, _i18n.sprintf)( // translators: %s: Title of the block e.g. 'Heading'.
|
|
112
|
+
(0, _i18n.__)('Pushed styles to all %s blocks.'), (0, _blocks.getBlockType)(name).title), {
|
|
113
|
+
type: 'snackbar',
|
|
114
|
+
actions: [{
|
|
115
|
+
label: (0, _i18n.__)('Undo'),
|
|
116
|
+
|
|
117
|
+
onClick() {
|
|
118
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
119
|
+
|
|
120
|
+
setAttributes({
|
|
121
|
+
style: blockStyles
|
|
122
|
+
});
|
|
123
|
+
setUserConfig(() => userConfig, {
|
|
124
|
+
undoIgnore: true
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}]
|
|
129
|
+
});
|
|
130
|
+
}, [changes, attributes, userConfig, name]);
|
|
131
|
+
return (0, _element.createElement)(_components.BaseControl, {
|
|
132
|
+
className: "edit-site-push-changes-to-global-styles-control",
|
|
133
|
+
help: (0, _i18n.sprintf)( // translators: %s: Title of the block e.g. 'Heading'.
|
|
134
|
+
(0, _i18n.__)('Move this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), (0, _blocks.getBlockType)(name).title)
|
|
135
|
+
}, (0, _element.createElement)(_components.BaseControl.VisualLabel, null, (0, _i18n.__)('Styles')), (0, _element.createElement)(_components.Button, {
|
|
136
|
+
variant: "primary",
|
|
137
|
+
disabled: changes.length === 0,
|
|
138
|
+
onClick: pushChanges
|
|
139
|
+
}, (0, _i18n.__)('Push changes to Global Styles')));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const withPushChangesToGlobalStyles = (0, _compose.createHigherOrderComponent)(BlockEdit => props => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, props), (0, _element.createElement)(_blockEditor.InspectorAdvancedControls, null, (0, _element.createElement)(PushChangesToGlobalStylesControl, props))));
|
|
143
|
+
(0, _hooks.addFilter)('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles);
|
|
144
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["getChangesToPush","name","attributes","flatMap","key","STYLE_PROPERTY","value","path","presetAttributeKey","join","presetAttributeValue","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","STYLE_PATH_TO_CSS_VAR_INFIX","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","GlobalStylesContext","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props"],"mappings":"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","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/index.js
CHANGED
|
@@ -23,12 +23,6 @@ Object.defineProperty(exports, "PluginSidebarMoreMenuItem", {
|
|
|
23
23
|
return _pluginSidebarMoreMenuItem.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "__experimentalNavigationToggle", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return _navigationToggle.default;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
26
|
exports.initializeEditor = initializeEditor;
|
|
33
27
|
exports.reinitializeEditor = reinitializeEditor;
|
|
34
28
|
|
|
@@ -48,26 +42,16 @@ var _interface = require("@wordpress/interface");
|
|
|
48
42
|
|
|
49
43
|
var _preferences = require("@wordpress/preferences");
|
|
50
44
|
|
|
51
|
-
var _i18n = require("@wordpress/i18n");
|
|
52
|
-
|
|
53
|
-
var _viewport = require("@wordpress/viewport");
|
|
54
|
-
|
|
55
|
-
var _url = require("@wordpress/url");
|
|
56
|
-
|
|
57
45
|
var _hooks = require("@wordpress/hooks");
|
|
58
46
|
|
|
47
|
+
var _widgets = require("@wordpress/widgets");
|
|
48
|
+
|
|
59
49
|
require("./hooks");
|
|
60
50
|
|
|
61
51
|
var _store = require("./store");
|
|
62
52
|
|
|
63
53
|
var _app = _interopRequireDefault(require("./components/app"));
|
|
64
54
|
|
|
65
|
-
var _getIsListPage = _interopRequireDefault(require("./utils/get-is-list-page"));
|
|
66
|
-
|
|
67
|
-
var _warning = _interopRequireDefault(require("./components/error-boundary/warning"));
|
|
68
|
-
|
|
69
|
-
var _navigationToggle = _interopRequireDefault(require("./components/navigation-sidebar/navigation-toggle"));
|
|
70
|
-
|
|
71
55
|
var _pluginSidebar = _interopRequireDefault(require("./components/sidebar-edit-mode/plugin-sidebar"));
|
|
72
56
|
|
|
73
57
|
var _pluginSidebarMoreMenuItem = _interopRequireDefault(require("./components/header-edit-mode/plugin-sidebar-more-menu-item"));
|
|
@@ -91,16 +75,6 @@ var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header-ed
|
|
|
91
75
|
* @param {?Object} settings Editor settings object.
|
|
92
76
|
*/
|
|
93
77
|
function reinitializeEditor(target, settings) {
|
|
94
|
-
// Display warning if editor wasn't able to resolve homepage template.
|
|
95
|
-
if (!settings.__unstableHomeTemplate) {
|
|
96
|
-
var _settings$__experimen;
|
|
97
|
-
|
|
98
|
-
(0, _element.render)((0, _element.createElement)(_warning.default, {
|
|
99
|
-
message: (0, _i18n.__)('The editor is unable to find a block template for the homepage.'),
|
|
100
|
-
dashboardLink: (_settings$__experimen = settings.__experimentalDashboardLink) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : 'index.php'
|
|
101
|
-
}), target);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
78
|
/*
|
|
105
79
|
* Prevent adding the Clasic block in the site editor.
|
|
106
80
|
* Only add the filter when the site editor is initialized, not imported.
|
|
@@ -110,8 +84,6 @@ function reinitializeEditor(target, settings) {
|
|
|
110
84
|
* This usage here is inspired by previous usage of the filter in the post editor:
|
|
111
85
|
* https://github.com/WordPress/gutenberg/pull/37157
|
|
112
86
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
87
|
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeClassicBlockFromInserter', (canInsert, blockType) => {
|
|
116
88
|
if (blockType.name === 'core/freeform') {
|
|
117
89
|
return false;
|
|
@@ -133,12 +105,7 @@ function reinitializeEditor(target, settings) {
|
|
|
133
105
|
welcomeGuide: true,
|
|
134
106
|
welcomeGuideStyles: true,
|
|
135
107
|
showListViewByDefault: false
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
if ((0, _data.select)(_preferences.store).get('core/edit-site', 'showListViewByDefault')) {
|
|
139
|
-
(0, _data.dispatch)(_store.store).setIsListViewOpened(true);
|
|
140
|
-
}
|
|
141
|
-
|
|
108
|
+
});
|
|
142
109
|
(0, _data.dispatch)(_interface.store).setDefaultComplementaryArea('core/edit-site', 'edit-site/template');
|
|
143
110
|
(0, _data.dispatch)(_store.store).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
|
|
144
111
|
// so that they can be selected with core/editor selectors in any editor.
|
|
@@ -149,20 +116,12 @@ function reinitializeEditor(target, settings) {
|
|
|
149
116
|
defaultTemplateTypes: settings.defaultTemplateTypes,
|
|
150
117
|
defaultTemplatePartAreas: settings.defaultTemplatePartAreas
|
|
151
118
|
});
|
|
152
|
-
const isLandingOnListPage = (0, _getIsListPage.default)((0, _url.getQueryArgs)(window.location.href));
|
|
153
|
-
|
|
154
|
-
if (isLandingOnListPage) {
|
|
155
|
-
// Default the navigation panel to be opened when we're in a bigger
|
|
156
|
-
// screen and land in the list screen.
|
|
157
|
-
(0, _data.dispatch)(_store.store).setIsNavigationPanelOpened((0, _data.select)(_viewport.store).isViewportMatch('medium'));
|
|
158
|
-
}
|
|
159
119
|
} // Prevent the default browser action for files dropped outside of dropzones.
|
|
160
120
|
|
|
161
121
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
162
122
|
window.addEventListener('drop', e => e.preventDefault(), false);
|
|
163
123
|
(0, _element.render)((0, _element.createElement)(_app.default, {
|
|
164
|
-
reboot: reboot
|
|
165
|
-
homeTemplate: settings.__unstableHomeTemplate
|
|
124
|
+
reboot: reboot
|
|
166
125
|
}), target);
|
|
167
126
|
}
|
|
168
127
|
/**
|
|
@@ -182,6 +141,9 @@ function initializeEditor(id, settings) {
|
|
|
182
141
|
(0, _data.dispatch)(_blocks.store).__experimentalReapplyBlockTypeFilters();
|
|
183
142
|
|
|
184
143
|
(0, _blockLibrary.registerCoreBlocks)();
|
|
144
|
+
(0, _widgets.registerLegacyWidgetBlock)({
|
|
145
|
+
inserter: false
|
|
146
|
+
});
|
|
185
147
|
|
|
186
148
|
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
187
149
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","canInsert","blockType","name","reboot","bind","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","interfaceStore","setDefaultComplementaryArea","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","initializeEditor","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAiGA;;AACA;;AACA;;AA5HA;AACA;AACA;;AAkBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,wBACC,0CADD,EAEC,gCAFD,EAGC,CAAEC,SAAF,EAAaC,SAAb,KAA4B;AAC3B,QAAKA,SAAS,CAACC,IAAV,KAAmB,eAAxB,EAA0C;AACzC,aAAO,KAAP;AACA;;AACD,WAAOF,SAAP;AACA,GARF,EAVsD,CAqBtD;;AACA,uCAAwBF,MAAxB;AACA,QAAMK,MAAM,GAAGN,kBAAkB,CAACO,IAAnB,CAAyB,IAAzB,EAA+BN,MAA/B,EAAuCC,QAAvC,CAAf,CAvBsD,CAyBtD;AACA;;AACA;AACC,wBAAUM,kBAAV,EAA6BC,WAA7B,CAA0C,gBAA1C,EAA4D;AAC3DC,MAAAA,UAAU,EAAE,QAD+C;AAE3DC,MAAAA,YAAY,EAAE,KAF6C;AAG3DC,MAAAA,SAAS,EAAE,KAHgD;AAI3DC,MAAAA,oBAAoB,EAAE,KAJqC;AAK3DC,MAAAA,YAAY,EAAE,IAL6C;AAM3DC,MAAAA,kBAAkB,EAAE,IANuC;AAO3DC,MAAAA,qBAAqB,EAAE;AAPoC,KAA5D;AAUA,wBAAUC,gBAAV,EAA2BC,2BAA3B,CACC,gBADD,EAEC,oBAFD;AAKA,wBAAUC,YAAV,EAA0BC,cAA1B,CAA0ClB,QAA1C,EAhBD,CAkBC;AACA;AACA;AACA;;AACA,wBAAUmB,aAAV,EAAwBC,oBAAxB,CAA8C;AAC7CC,MAAAA,oBAAoB,EAAErB,QAAQ,CAACqB,oBADc;AAE7CC,MAAAA,wBAAwB,EAAEtB,QAAQ,CAACsB;AAFU,KAA9C;AAIA,GArDqD,CAuDtD;;AACAC,EAAAA,MAAM,CAACC,gBAAP,CAAyB,UAAzB,EAAuCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAH,EAAAA,MAAM,CAACC,gBAAP,CAAyB,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEA,uBAAQ,4BAAC,YAAD;AAAK,IAAA,MAAM,EAAGtB;AAAd,IAAR,EAAmCL,MAAnC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS4B,gBAAT,CAA2BC,EAA3B,EAA+B5B,QAA/B,EAA0C;AAChDA,EAAAA,QAAQ,CAAC6B,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6C/B,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACgC,8BAAT,GAA0CC,oCAA1C;AAEA,QAAMlC,MAAM,GAAGmC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;;AAEA,sBAAUQ,aAAV,EAAwBC,qCAAxB;;AACA;AACA,0CAA2B;AAAEC,IAAAA,QAAQ,EAAE;AAAZ,GAA3B;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAE;AAD4B,KAA9C;AAGA;;AAED5C,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA","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"]}
|