@wordpress/edit-site 5.3.2 → 5.4.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 +3 -0
- package/build/components/add-new-template/new-template-part.js +8 -5
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +9 -25
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +4 -3
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +3 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +28 -24
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +6 -6
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +7 -4
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/color-utils.js +1 -1
- package/build/components/global-styles/color-utils.js.map +1 -1
- package/build/components/global-styles/context-menu.js +16 -3
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +3 -3
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +10 -9
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +2 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +10 -5
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +4 -2
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +16 -53
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +1 -1
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +5 -3
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +2 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +5 -4
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +14 -3
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +9 -7
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +10 -8
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +5 -5
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +10 -8
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +5 -4
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -2
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +5 -4
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +4 -5
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/subtitle.js +3 -2
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +24 -301
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +2 -2
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +3 -10
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +2 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -3
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js +10 -23
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +1 -1
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/table.js +1 -0
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/index.js +0 -29
- package/build/components/navigation-inspector/index.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +6 -4
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-panel/index.js +4 -3
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +18 -23
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
- package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
- package/build/components/sidebar-navigation-screen/index.js +28 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +72 -0
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +70 -0
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +32 -82
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +43 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build/components/site-hub/index.js +14 -49
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +175 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/style-book/index.js +10 -3
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -20
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -3
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +12 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +6 -2
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +7 -6
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/{experiments.js → private-apis.js} +3 -3
- package/build/private-apis.js.map +1 -0
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/utils/get-is-list-page.js +5 -6
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +7 -4
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +8 -22
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +2 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +3 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +27 -25
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +8 -8
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +8 -5
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/color-utils.js +2 -2
- package/build-module/components/global-styles/color-utils.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +13 -2
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +4 -4
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +12 -11
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -3
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +11 -6
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +5 -3
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +15 -52
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +2 -2
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +6 -4
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +7 -6
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +12 -3
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +11 -9
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +12 -10
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +5 -5
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +12 -10
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +7 -6
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +3 -3
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +7 -6
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +6 -4
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -7
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +3 -2
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +29 -302
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +3 -3
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -11
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +3 -3
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -3
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +10 -23
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +1 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/table.js +1 -0
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/index.js +0 -27
- package/build-module/components/navigation-inspector/index.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +7 -5
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-panel/index.js +3 -2
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +15 -21
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen/index.js +27 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +55 -0
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +53 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +34 -81
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +14 -46
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +156 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/style-book/index.js +11 -4
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -21
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +11 -11
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +6 -2
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +9 -8
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/{experiments.js → private-apis.js} +2 -2
- package/build-module/private-apis.js.map +1 -0
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +5 -6
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +91 -41
- package/build-style/style.css +91 -41
- package/package.json +31 -31
- package/src/components/add-new-template/new-template-part.js +7 -4
- package/src/components/add-new-template/new-template.js +9 -22
- package/src/components/app/index.js +0 -1
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/block-editor/index.js +3 -3
- package/src/components/editor/index.js +31 -28
- package/src/components/global-styles/border-panel.js +8 -8
- package/src/components/global-styles/color-palette-panel.js +6 -3
- package/src/components/global-styles/color-utils.js +2 -3
- package/src/components/global-styles/context-menu.js +17 -2
- package/src/components/global-styles/custom-css.js +4 -4
- package/src/components/global-styles/dimensions-panel.js +15 -11
- package/src/components/global-styles/global-styles-provider.js +3 -3
- package/src/components/global-styles/gradients-palette-panel.js +7 -4
- package/src/components/global-styles/header.js +9 -3
- package/src/components/global-styles/hooks.js +20 -93
- package/src/components/global-styles/navigation-button.js +4 -2
- package/src/components/global-styles/palette.js +4 -4
- package/src/components/global-styles/preview.js +3 -3
- package/src/components/global-styles/screen-background-color.js +6 -5
- package/src/components/global-styles/screen-block-list.js +19 -3
- package/src/components/global-styles/screen-button-color.js +11 -9
- package/src/components/global-styles/screen-colors.js +10 -10
- package/src/components/global-styles/screen-css.js +14 -7
- package/src/components/global-styles/screen-heading-color.js +12 -10
- package/src/components/global-styles/screen-link-color.js +6 -5
- package/src/components/global-styles/screen-root.js +3 -3
- package/src/components/global-styles/screen-style-variations.js +3 -3
- package/src/components/global-styles/screen-text-color.js +6 -5
- package/src/components/global-styles/screen-typography.js +4 -4
- package/src/components/global-styles/shadow-panel.js +9 -6
- package/src/components/global-styles/style.scss +7 -1
- package/src/components/global-styles/subtitle.js +5 -2
- package/src/components/global-styles/typography-panel.js +31 -395
- package/src/components/global-styles/typography-preview.js +3 -3
- package/src/components/global-styles/ui.js +3 -8
- package/src/components/global-styles-renderer/index.js +3 -3
- package/src/components/header-edit-mode/index.js +6 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/src/components/layout/index.js +35 -48
- package/src/components/layout/style.scss +11 -23
- package/src/components/list/actions/rename-menu-item.js +1 -1
- package/src/components/list/table.js +4 -0
- package/src/components/navigation-inspector/index.js +0 -32
- package/src/components/navigation-inspector/navigation-menu.js +10 -4
- package/src/components/save-panel/index.js +4 -1
- package/src/components/sidebar/index.js +14 -19
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
- package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
- package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
- package/src/components/sidebar-navigation-screen/index.js +27 -11
- package/src/components/sidebar-navigation-screen/style.scss +4 -6
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +52 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-template/index.js +52 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +49 -83
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/src/components/site-hub/index.js +67 -122
- package/src/components/site-hub/style.scss +1 -11
- package/src/components/start-template-options/index.js +171 -0
- package/src/components/start-template-options/style.scss +76 -0
- package/src/components/style-book/index.js +11 -7
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +48 -14
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/src/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +10 -10
- package/src/components/use-edited-entity-record/index.js +6 -2
- package/src/hooks/push-changes-to-global-styles/index.js +29 -24
- package/src/{experiments.js → private-apis.js} +1 -1
- package/src/store/index.js +1 -1
- package/src/style.scss +1 -0
- package/src/utils/get-is-list-page.js +5 -5
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build/experiments.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build-module/experiments.js.map +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { useMemo } from '@wordpress/element';
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
6
|
import { Notice } from '@wordpress/components';
|
|
7
|
-
import { EntityProvider
|
|
7
|
+
import { EntityProvider } from '@wordpress/core-data';
|
|
8
8
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
9
|
import {
|
|
10
10
|
BlockContextProvider,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
store as interfaceStore,
|
|
18
18
|
} from '@wordpress/interface';
|
|
19
19
|
import { EditorNotices, EditorSnackbars } from '@wordpress/editor';
|
|
20
|
-
import { __ } from '@wordpress/i18n';
|
|
20
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
@@ -29,12 +29,14 @@ import KeyboardShortcuts from '../keyboard-shortcuts';
|
|
|
29
29
|
import InserterSidebar from '../secondary-sidebar/inserter-sidebar';
|
|
30
30
|
import ListViewSidebar from '../secondary-sidebar/list-view-sidebar';
|
|
31
31
|
import WelcomeGuide from '../welcome-guide';
|
|
32
|
+
import StartTemplateOptions from '../start-template-options';
|
|
32
33
|
import { store as editSiteStore } from '../../store';
|
|
33
34
|
import { GlobalStylesRenderer } from '../global-styles-renderer';
|
|
34
35
|
import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
|
|
35
36
|
import useTitle from '../routes/use-title';
|
|
36
37
|
import CanvasSpinner from '../canvas-spinner';
|
|
37
|
-
import { unlock } from '../../
|
|
38
|
+
import { unlock } from '../../private-apis';
|
|
39
|
+
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
38
40
|
|
|
39
41
|
const interfaceLabels = {
|
|
40
42
|
/* translators: accessibility text for the editor content landmark region. */
|
|
@@ -49,11 +51,15 @@ const interfaceLabels = {
|
|
|
49
51
|
|
|
50
52
|
export default function Editor() {
|
|
51
53
|
const {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
record: editedPost,
|
|
55
|
+
getTitle,
|
|
56
|
+
isLoaded: hasLoadedPost,
|
|
57
|
+
} = useEditedEntityRecord();
|
|
58
|
+
|
|
59
|
+
const { id: editedPostId, type: editedPostType } = editedPost;
|
|
60
|
+
|
|
61
|
+
const {
|
|
55
62
|
context,
|
|
56
|
-
hasLoadedPost,
|
|
57
63
|
editorMode,
|
|
58
64
|
canvasMode,
|
|
59
65
|
blockEditorMode,
|
|
@@ -63,36 +69,19 @@ export default function Editor() {
|
|
|
63
69
|
showIconLabels,
|
|
64
70
|
} = useSelect( ( select ) => {
|
|
65
71
|
const {
|
|
66
|
-
getEditedPostType,
|
|
67
|
-
getEditedPostId,
|
|
68
72
|
getEditedPostContext,
|
|
69
73
|
getEditorMode,
|
|
70
74
|
getCanvasMode,
|
|
71
75
|
isInserterOpened,
|
|
72
76
|
isListViewOpened,
|
|
73
77
|
} = unlock( select( editSiteStore ) );
|
|
74
|
-
const { hasFinishedResolution, getEntityRecord } = select( coreStore );
|
|
75
78
|
const { __unstableGetEditorMode } = select( blockEditorStore );
|
|
76
79
|
const { getActiveComplementaryArea } = select( interfaceStore );
|
|
77
|
-
const postType = getEditedPostType();
|
|
78
|
-
const postId = getEditedPostId();
|
|
79
80
|
|
|
80
81
|
// The currently selected entity to display.
|
|
81
82
|
// Typically template or template part in the site editor.
|
|
82
83
|
return {
|
|
83
|
-
editedPostId: postId,
|
|
84
|
-
editedPostType: postType,
|
|
85
|
-
editedPost: postId
|
|
86
|
-
? getEntityRecord( 'postType', postType, postId )
|
|
87
|
-
: null,
|
|
88
84
|
context: getEditedPostContext(),
|
|
89
|
-
hasLoadedPost: postId
|
|
90
|
-
? hasFinishedResolution( 'getEntityRecord', [
|
|
91
|
-
'postType',
|
|
92
|
-
postType,
|
|
93
|
-
postId,
|
|
94
|
-
] )
|
|
95
|
-
: false,
|
|
96
85
|
editorMode: getEditorMode(),
|
|
97
86
|
canvasMode: getCanvasMode(),
|
|
98
87
|
blockEditorMode: __unstableGetEditorMode(),
|
|
@@ -134,15 +123,28 @@ export default function Editor() {
|
|
|
134
123
|
} ),
|
|
135
124
|
],
|
|
136
125
|
} ),
|
|
137
|
-
[ context ]
|
|
126
|
+
[ context, setEditedPostContext ]
|
|
138
127
|
);
|
|
139
|
-
|
|
128
|
+
|
|
129
|
+
let title;
|
|
130
|
+
if ( hasLoadedPost ) {
|
|
131
|
+
const type =
|
|
132
|
+
editedPostType === 'wp_template'
|
|
133
|
+
? __( 'Template' )
|
|
134
|
+
: __( 'Template Part' );
|
|
135
|
+
title = sprintf(
|
|
136
|
+
// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
|
|
137
|
+
__( '%1$s ‹ %2$s ‹ Editor' ),
|
|
138
|
+
getTitle(),
|
|
139
|
+
type
|
|
140
|
+
);
|
|
141
|
+
}
|
|
140
142
|
|
|
141
143
|
// Only announce the title once the editor is ready to prevent "Replace"
|
|
142
144
|
// action in <URlQueryController> from double-announcing.
|
|
143
|
-
useTitle(
|
|
145
|
+
useTitle( hasLoadedPost && title );
|
|
144
146
|
|
|
145
|
-
if ( !
|
|
147
|
+
if ( ! hasLoadedPost ) {
|
|
146
148
|
return <CanvasSpinner />;
|
|
147
149
|
}
|
|
148
150
|
|
|
@@ -159,6 +161,7 @@ export default function Editor() {
|
|
|
159
161
|
<GlobalStylesProvider>
|
|
160
162
|
<BlockContextProvider value={ blockContext }>
|
|
161
163
|
<SidebarComplementaryAreaFills />
|
|
164
|
+
{ isEditMode && <StartTemplateOptions /> }
|
|
162
165
|
<InterfaceSkeleton
|
|
163
166
|
enableRegionNavigation={ false }
|
|
164
167
|
className={
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
__experimentalBorderRadiusControl as BorderRadiusControl,
|
|
6
|
-
|
|
6
|
+
privateApis as blockEditorPrivateApis,
|
|
7
7
|
} from '@wordpress/block-editor';
|
|
8
8
|
import {
|
|
9
9
|
__experimentalBorderBoxControl as BorderBoxControl,
|
|
@@ -18,10 +18,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
18
18
|
/**
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
|
-
import {
|
|
22
|
-
import { unlock } from '../../
|
|
21
|
+
import { useSupportedStyles, useColorsPerOrigin } from './hooks';
|
|
22
|
+
import { unlock } from '../../private-apis';
|
|
23
23
|
|
|
24
|
-
const { useGlobalSetting, useGlobalStyle } = unlock(
|
|
24
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
25
25
|
|
|
26
26
|
export function useHasBorderPanel( name ) {
|
|
27
27
|
const controls = [
|
|
@@ -35,7 +35,7 @@ export function useHasBorderPanel( name ) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function useHasBorderColorControl( name ) {
|
|
38
|
-
const supports =
|
|
38
|
+
const supports = useSupportedStyles( name );
|
|
39
39
|
return (
|
|
40
40
|
useGlobalSetting( 'border.color', name )[ 0 ] &&
|
|
41
41
|
supports.includes( 'borderColor' )
|
|
@@ -43,7 +43,7 @@ function useHasBorderColorControl( name ) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function useHasBorderRadiusControl( name ) {
|
|
46
|
-
const supports =
|
|
46
|
+
const supports = useSupportedStyles( name );
|
|
47
47
|
return (
|
|
48
48
|
useGlobalSetting( 'border.radius', name )[ 0 ] &&
|
|
49
49
|
supports.includes( 'borderRadius' )
|
|
@@ -51,7 +51,7 @@ function useHasBorderRadiusControl( name ) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function useHasBorderStyleControl( name ) {
|
|
54
|
-
const supports =
|
|
54
|
+
const supports = useSupportedStyles( name );
|
|
55
55
|
return (
|
|
56
56
|
useGlobalSetting( 'border.style', name )[ 0 ] &&
|
|
57
57
|
supports.includes( 'borderStyle' )
|
|
@@ -59,7 +59,7 @@ function useHasBorderStyleControl( name ) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function useHasBorderWidthControl( name ) {
|
|
62
|
-
const supports =
|
|
62
|
+
const supports = useSupportedStyles( name );
|
|
63
63
|
return (
|
|
64
64
|
useGlobalSetting( 'border.width', name )[ 0 ] &&
|
|
65
65
|
supports.includes( 'borderWidth' )
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
__experimentalVStack as VStack,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import {
|
|
9
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { unlock } from '../../
|
|
14
|
+
import { unlock } from '../../private-apis';
|
|
15
15
|
|
|
16
|
-
const { useGlobalSetting } = unlock(
|
|
16
|
+
const { useGlobalSetting } = unlock( blockEditorPrivateApis );
|
|
17
17
|
|
|
18
18
|
export default function ColorPalettePanel( { name } ) {
|
|
19
19
|
const [ themeColors, setThemeColors ] = useGlobalSetting(
|
|
@@ -55,6 +55,7 @@ export default function ColorPalettePanel( { name } ) {
|
|
|
55
55
|
colors={ themeColors }
|
|
56
56
|
onChange={ setThemeColors }
|
|
57
57
|
paletteLabel={ __( 'Theme' ) }
|
|
58
|
+
paletteLabelHeadingLevel={ 3 }
|
|
58
59
|
/>
|
|
59
60
|
) }
|
|
60
61
|
{ !! defaultColors &&
|
|
@@ -66,12 +67,14 @@ export default function ColorPalettePanel( { name } ) {
|
|
|
66
67
|
colors={ defaultColors }
|
|
67
68
|
onChange={ setDefaultColors }
|
|
68
69
|
paletteLabel={ __( 'Default' ) }
|
|
70
|
+
paletteLabelHeadingLevel={ 3 }
|
|
69
71
|
/>
|
|
70
72
|
) }
|
|
71
73
|
<PaletteEdit
|
|
72
74
|
colors={ customColors }
|
|
73
75
|
onChange={ setCustomColors }
|
|
74
76
|
paletteLabel={ __( 'Custom' ) }
|
|
77
|
+
paletteLabelHeadingLevel={ 3 }
|
|
75
78
|
emptyMessage={ __(
|
|
76
79
|
'Custom colors are empty! Add some colors to create your own color palette.'
|
|
77
80
|
) }
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
import { getSupportedGlobalStylesPanels } from './hooks';
|
|
4
|
+
import { useSupportedStyles } from './hooks';
|
|
6
5
|
|
|
7
6
|
export function useHasColorPanel( name ) {
|
|
8
|
-
const supports =
|
|
7
|
+
const supports = useSupportedStyles( name );
|
|
9
8
|
return (
|
|
10
9
|
supports.includes( 'color' ) ||
|
|
11
10
|
supports.includes( 'backgroundColor' ) ||
|
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
22
22
|
import { useSelect } from '@wordpress/data';
|
|
23
23
|
import { store as coreStore } from '@wordpress/core-data';
|
|
24
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
25
|
+
import { useMemo } from '@wordpress/element';
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Internal dependencies
|
|
@@ -28,15 +30,28 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
28
30
|
import { useHasBorderPanel } from './border-panel';
|
|
29
31
|
import { useHasColorPanel } from './color-utils';
|
|
30
32
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
31
|
-
import { useHasTypographyPanel } from './typography-panel';
|
|
32
33
|
import { useHasVariationsPanel } from './variations-panel';
|
|
33
34
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
34
35
|
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
35
36
|
import { ScreenVariations } from './screen-variations';
|
|
36
37
|
import { useHasShadowControl } from './shadow-panel';
|
|
38
|
+
import { unlock } from '../../private-apis';
|
|
39
|
+
import { useSupportedStyles } from './hooks';
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
useHasTypographyPanel,
|
|
43
|
+
useGlobalSetting,
|
|
44
|
+
overrideSettingsWithSupports,
|
|
45
|
+
} = unlock( blockEditorPrivateApis );
|
|
37
46
|
|
|
38
47
|
function ContextMenu( { name, parentMenu = '' } ) {
|
|
39
|
-
const
|
|
48
|
+
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
49
|
+
const supports = useSupportedStyles( name );
|
|
50
|
+
const settings = useMemo(
|
|
51
|
+
() => overrideSettingsWithSupports( rawSettings, supports ),
|
|
52
|
+
[ rawSettings, supports ]
|
|
53
|
+
);
|
|
54
|
+
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
40
55
|
const hasColorPanel = useHasColorPanel( name );
|
|
41
56
|
const hasBorderPanel = useHasBorderPanel( name );
|
|
42
57
|
const hasEffectsPanel = useHasShadowControl( name );
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@wordpress/components';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import {
|
|
15
|
-
|
|
15
|
+
privateApis as blockEditorPrivateApis,
|
|
16
16
|
transformStyles,
|
|
17
17
|
} from '@wordpress/block-editor';
|
|
18
18
|
import { info } from '@wordpress/icons';
|
|
@@ -20,10 +20,10 @@ import { info } from '@wordpress/icons';
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
|
-
import { unlock } from '../../
|
|
23
|
+
import { unlock } from '../../private-apis';
|
|
24
24
|
import Subtitle from './subtitle';
|
|
25
25
|
|
|
26
|
-
const { useGlobalStyle } = unlock(
|
|
26
|
+
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
27
27
|
function CustomCSSControl( { blockName } ) {
|
|
28
28
|
// If blockName is defined, we are customizing CSS at the block level:
|
|
29
29
|
// styles.blocks.blockName.css
|
|
@@ -101,7 +101,7 @@ function CustomCSSControl( { blockName } ) {
|
|
|
101
101
|
</Panel>
|
|
102
102
|
) }
|
|
103
103
|
<VStack spacing={ 3 }>
|
|
104
|
-
<Subtitle>{ __( '
|
|
104
|
+
<Subtitle>{ __( 'Additional CSS' ) }</Subtitle>
|
|
105
105
|
<TextareaControl
|
|
106
106
|
__nextHasNoMarginBottom
|
|
107
107
|
value={
|
|
@@ -20,17 +20,17 @@ import {
|
|
|
20
20
|
__experimentalUseCustomSides as useCustomSides,
|
|
21
21
|
HeightControl,
|
|
22
22
|
__experimentalSpacingSizesControl as SpacingSizesControl,
|
|
23
|
-
|
|
23
|
+
privateApis as blockEditorPrivateApis,
|
|
24
24
|
} from '@wordpress/block-editor';
|
|
25
25
|
import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
|
-
import {
|
|
31
|
-
import { unlock } from '../../
|
|
30
|
+
import { useSupportedStyles } from './hooks';
|
|
31
|
+
import { unlock } from '../../private-apis';
|
|
32
32
|
|
|
33
|
-
const { useGlobalSetting, useGlobalStyle } = unlock(
|
|
33
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
34
34
|
|
|
35
35
|
const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
|
|
36
36
|
|
|
@@ -53,42 +53,42 @@ export function useHasDimensionsPanel( name ) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function useHasContentSize( name ) {
|
|
56
|
-
const supports =
|
|
56
|
+
const supports = useSupportedStyles( name );
|
|
57
57
|
const [ settings ] = useGlobalSetting( 'layout.contentSize', name );
|
|
58
58
|
|
|
59
59
|
return settings && supports.includes( 'contentSize' );
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function useHasWideSize( name ) {
|
|
63
|
-
const supports =
|
|
63
|
+
const supports = useSupportedStyles( name );
|
|
64
64
|
const [ settings ] = useGlobalSetting( 'layout.wideSize', name );
|
|
65
65
|
|
|
66
66
|
return settings && supports.includes( 'wideSize' );
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function useHasPadding( name ) {
|
|
70
|
-
const supports =
|
|
70
|
+
const supports = useSupportedStyles( name );
|
|
71
71
|
const [ settings ] = useGlobalSetting( 'spacing.padding', name );
|
|
72
72
|
|
|
73
73
|
return settings && supports.includes( 'padding' );
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function useHasMargin( name ) {
|
|
77
|
-
const supports =
|
|
77
|
+
const supports = useSupportedStyles( name );
|
|
78
78
|
const [ settings ] = useGlobalSetting( 'spacing.margin', name );
|
|
79
79
|
|
|
80
80
|
return settings && supports.includes( 'margin' );
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
function useHasGap( name ) {
|
|
84
|
-
const supports =
|
|
84
|
+
const supports = useSupportedStyles( name );
|
|
85
85
|
const [ settings ] = useGlobalSetting( 'spacing.blockGap', name );
|
|
86
86
|
|
|
87
87
|
return settings && supports.includes( 'blockGap' );
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function useHasMinHeight( name ) {
|
|
91
|
-
const supports =
|
|
91
|
+
const supports = useSupportedStyles( name );
|
|
92
92
|
const [ settings ] = useGlobalSetting( 'dimensions.minHeight', name );
|
|
93
93
|
|
|
94
94
|
return settings && supports.includes( 'minHeight' );
|
|
@@ -413,7 +413,11 @@ export default function DimensionsPanel( { name, variation = '' } ) {
|
|
|
413
413
|
};
|
|
414
414
|
|
|
415
415
|
return (
|
|
416
|
-
<ToolsPanel
|
|
416
|
+
<ToolsPanel
|
|
417
|
+
label={ __( 'Dimensions' ) }
|
|
418
|
+
resetAll={ resetAll }
|
|
419
|
+
headingLevel={ 3 }
|
|
420
|
+
>
|
|
417
421
|
{ ( showContentSizeControl || showWideSizeControl ) && (
|
|
418
422
|
<span className="span-columns">
|
|
419
423
|
{ __( 'Set the width of the main content area.' ) }
|
|
@@ -9,15 +9,15 @@ import { mergeWith, isEmpty, mapValues } from 'lodash';
|
|
|
9
9
|
import { useMemo, useCallback } from '@wordpress/element';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
-
import {
|
|
12
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
import CanvasSpinner from '../canvas-spinner';
|
|
18
|
-
import { unlock } from '../../
|
|
18
|
+
import { unlock } from '../../private-apis';
|
|
19
19
|
|
|
20
|
-
const { GlobalStylesContext } = unlock(
|
|
20
|
+
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
21
21
|
|
|
22
22
|
function mergeTreesCustomizer( _, srcValue ) {
|
|
23
23
|
// We only pass as arrays the presets,
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
DuotonePicker,
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import {
|
|
11
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import Subtitle from './subtitle';
|
|
17
|
-
import { unlock } from '../../
|
|
17
|
+
import { unlock } from '../../private-apis';
|
|
18
18
|
|
|
19
|
-
const { useGlobalSetting } = unlock(
|
|
19
|
+
const { useGlobalSetting } = unlock( blockEditorPrivateApis );
|
|
20
20
|
|
|
21
21
|
const noop = () => {};
|
|
22
22
|
|
|
@@ -75,6 +75,7 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
75
75
|
gradients={ themeGradients }
|
|
76
76
|
onChange={ setThemeGradients }
|
|
77
77
|
paletteLabel={ __( 'Theme' ) }
|
|
78
|
+
paletteLabelHeadingLevel={ 3 }
|
|
78
79
|
/>
|
|
79
80
|
) }
|
|
80
81
|
{ !! defaultGradients &&
|
|
@@ -86,12 +87,14 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
86
87
|
gradients={ defaultGradients }
|
|
87
88
|
onChange={ setDefaultGradients }
|
|
88
89
|
paletteLabel={ __( 'Default' ) }
|
|
90
|
+
paletteLabelLevel={ 3 }
|
|
89
91
|
/>
|
|
90
92
|
) }
|
|
91
93
|
<PaletteEdit
|
|
92
94
|
gradients={ customGradients }
|
|
93
95
|
onChange={ setCustomGradients }
|
|
94
96
|
paletteLabel={ __( 'Custom' ) }
|
|
97
|
+
paletteLabelLevel={ 3 }
|
|
95
98
|
emptyMessage={ __(
|
|
96
99
|
'Custom gradients are empty! Add some gradients to create your own palette.'
|
|
97
100
|
) }
|
|
@@ -99,7 +102,7 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
99
102
|
/>
|
|
100
103
|
{ !! duotonePalette && !! duotonePalette.length && (
|
|
101
104
|
<div>
|
|
102
|
-
<Subtitle>{ __( 'Duotone' ) }</Subtitle>
|
|
105
|
+
<Subtitle level={ 3 }>{ __( 'Duotone' ) }</Subtitle>
|
|
103
106
|
<Spacer margin={ 3 } />
|
|
104
107
|
<DuotonePicker
|
|
105
108
|
duotonePalette={ duotonePalette }
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
__experimentalSpacer as Spacer,
|
|
8
8
|
__experimentalHeading as Heading,
|
|
9
9
|
__experimentalView as View,
|
|
10
|
-
|
|
10
|
+
__experimentalNavigatorToParentButton as NavigatorToParentButton,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
13
13
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
@@ -18,7 +18,7 @@ function ScreenHeader( { title, description } ) {
|
|
|
18
18
|
<View>
|
|
19
19
|
<Spacer marginBottom={ 0 } paddingX={ 4 } paddingY={ 3 }>
|
|
20
20
|
<HStack spacing={ 2 }>
|
|
21
|
-
<
|
|
21
|
+
<NavigatorToParentButton
|
|
22
22
|
style={
|
|
23
23
|
// TODO: This style override is also used in ToolsPanelHeader.
|
|
24
24
|
// It should be supported out-of-the-box by Button.
|
|
@@ -29,7 +29,13 @@ function ScreenHeader( { title, description } ) {
|
|
|
29
29
|
aria-label={ __( 'Navigate to the previous view' ) }
|
|
30
30
|
/>
|
|
31
31
|
<Spacer>
|
|
32
|
-
<Heading
|
|
32
|
+
<Heading
|
|
33
|
+
className="edit-site-global-styles-header"
|
|
34
|
+
level={ 2 }
|
|
35
|
+
size={ 13 }
|
|
36
|
+
>
|
|
37
|
+
{ title }
|
|
38
|
+
</Heading>
|
|
33
39
|
</Spacer>
|
|
34
40
|
</HStack>
|
|
35
41
|
</Spacer>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import { colord, extend } from 'colord';
|
|
6
5
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
7
6
|
|
|
@@ -10,107 +9,20 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
10
9
|
*/
|
|
11
10
|
import { _x } from '@wordpress/i18n';
|
|
12
11
|
import { useMemo } from '@wordpress/element';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
|
|
16
|
-
} from '@wordpress/blocks';
|
|
17
|
-
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
12
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
13
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
18
14
|
|
|
19
15
|
/**
|
|
20
16
|
* Internal dependencies
|
|
21
17
|
*/
|
|
22
|
-
import { unlock } from '../../
|
|
18
|
+
import { unlock } from '../../private-apis';
|
|
19
|
+
import { useSelect } from '@wordpress/data';
|
|
23
20
|
|
|
24
|
-
const { useGlobalSetting } = unlock(
|
|
21
|
+
const { useGlobalSetting } = unlock( blockEditorPrivateApis );
|
|
25
22
|
|
|
26
23
|
// Enable colord's a11y plugin.
|
|
27
24
|
extend( [ a11yPlugin ] );
|
|
28
25
|
|
|
29
|
-
const ROOT_BLOCK_SUPPORTS = [
|
|
30
|
-
'background',
|
|
31
|
-
'backgroundColor',
|
|
32
|
-
'color',
|
|
33
|
-
'linkColor',
|
|
34
|
-
'buttonColor',
|
|
35
|
-
'fontFamily',
|
|
36
|
-
'fontSize',
|
|
37
|
-
'fontStyle',
|
|
38
|
-
'fontWeight',
|
|
39
|
-
'lineHeight',
|
|
40
|
-
'textDecoration',
|
|
41
|
-
'padding',
|
|
42
|
-
'contentSize',
|
|
43
|
-
'wideSize',
|
|
44
|
-
'blockGap',
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
export function getSupportedGlobalStylesPanels( name ) {
|
|
48
|
-
if ( ! name ) {
|
|
49
|
-
return ROOT_BLOCK_SUPPORTS;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const blockType = getBlockType( name );
|
|
53
|
-
|
|
54
|
-
if ( ! blockType ) {
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const supportKeys = [];
|
|
59
|
-
|
|
60
|
-
// Check for blockGap support.
|
|
61
|
-
// Block spacing support doesn't map directly to a single style property, so needs to be handled separately.
|
|
62
|
-
// Also, only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
|
|
63
|
-
if (
|
|
64
|
-
blockType?.supports?.spacing?.blockGap &&
|
|
65
|
-
blockType?.supports?.spacing?.__experimentalSkipSerialization !==
|
|
66
|
-
true &&
|
|
67
|
-
! blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
|
|
68
|
-
( spacingType ) => spacingType === 'blockGap'
|
|
69
|
-
)
|
|
70
|
-
) {
|
|
71
|
-
supportKeys.push( 'blockGap' );
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// check for shadow support
|
|
75
|
-
if ( blockType?.supports?.shadow ) {
|
|
76
|
-
supportKeys.push( 'shadow' );
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
Object.keys( STYLE_PROPERTY ).forEach( ( styleName ) => {
|
|
80
|
-
if ( ! STYLE_PROPERTY[ styleName ].support ) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Opting out means that, for certain support keys like background color,
|
|
85
|
-
// blocks have to explicitly set the support value false. If the key is
|
|
86
|
-
// unset, we still enable it.
|
|
87
|
-
if ( STYLE_PROPERTY[ styleName ].requiresOptOut ) {
|
|
88
|
-
if (
|
|
89
|
-
STYLE_PROPERTY[ styleName ].support[ 0 ] in
|
|
90
|
-
blockType.supports &&
|
|
91
|
-
get(
|
|
92
|
-
blockType.supports,
|
|
93
|
-
STYLE_PROPERTY[ styleName ].support
|
|
94
|
-
) !== false
|
|
95
|
-
) {
|
|
96
|
-
return supportKeys.push( styleName );
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
get(
|
|
102
|
-
blockType.supports,
|
|
103
|
-
STYLE_PROPERTY[ styleName ].support,
|
|
104
|
-
false
|
|
105
|
-
)
|
|
106
|
-
) {
|
|
107
|
-
return supportKeys.push( styleName );
|
|
108
|
-
}
|
|
109
|
-
} );
|
|
110
|
-
|
|
111
|
-
return supportKeys;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
26
|
export function useColorsPerOrigin( name ) {
|
|
115
27
|
const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
|
|
116
28
|
const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
|
|
@@ -240,3 +152,18 @@ export function useColorRandomizer( name ) {
|
|
|
240
152
|
? [ randomizeColors ]
|
|
241
153
|
: [];
|
|
242
154
|
}
|
|
155
|
+
|
|
156
|
+
export function useSupportedStyles( name, element ) {
|
|
157
|
+
const { supportedPanels } = useSelect(
|
|
158
|
+
( select ) => {
|
|
159
|
+
return {
|
|
160
|
+
supportedPanels: unlock(
|
|
161
|
+
select( blocksStore )
|
|
162
|
+
).getSupportedStyles( name, element ),
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
[ name, element ]
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
return supportedPanels;
|
|
169
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
__experimentalNavigatorButton as NavigatorButton,
|
|
6
|
-
|
|
6
|
+
__experimentalNavigatorToParentButton as NavigatorToParentButton,
|
|
7
7
|
__experimentalItem as Item,
|
|
8
8
|
FlexItem,
|
|
9
9
|
__experimentalHStack as HStack,
|
|
@@ -33,7 +33,9 @@ function NavigationButtonAsItem( props ) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function NavigationBackButtonAsItem( props ) {
|
|
36
|
-
return
|
|
36
|
+
return (
|
|
37
|
+
<NavigatorToParentButton as={ GenericNavigationButton } { ...props } />
|
|
38
|
+
);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export { NavigationButtonAsItem, NavigationBackButtonAsItem };
|