@wordpress/edit-site 3.0.1-next.253d9b6e21.0 → 3.0.3
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/README.md +1 -1
- package/build/components/block-editor/back-button.js +60 -0
- package/build/components/block-editor/back-button.js.map +1 -0
- package/build/components/block-editor/index.js +20 -5
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +63 -0
- package/build/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build/components/editor/global-styles-provider.js +15 -2
- package/build/components/editor/global-styles-provider.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +8 -8
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/editor/index.js +7 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/utils.js +4 -9
- package/build/components/editor/utils.js.map +1 -1
- package/build/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-panel.js +24 -21
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/context-menu.js +58 -0
- package/build/components/global-styles/context-menu.js.map +1 -0
- package/build/components/{sidebar → global-styles}/dimensions-panel.js +58 -8
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +1 -0
- package/build/components/global-styles/index.js +89 -0
- package/build/components/global-styles/index.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +43 -0
- package/build/components/global-styles/navigation-button.js.map +1 -0
- package/build/components/global-styles/palette.js +57 -0
- package/build/components/global-styles/palette.js.map +1 -0
- package/build/components/global-styles/preview.js +59 -0
- package/build/components/global-styles/preview.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +76 -0
- package/build/components/global-styles/screen-block-list.js.map +1 -0
- package/build/components/global-styles/screen-block.js +45 -0
- package/build/components/global-styles/screen-block.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +48 -0
- package/build/components/global-styles/screen-color-palette.js.map +1 -0
- package/build/components/global-styles/screen-colors.js +51 -0
- package/build/components/global-styles/screen-colors.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +60 -0
- package/build/components/global-styles/screen-layout.js.map +1 -0
- package/build/components/global-styles/screen-root.js +44 -0
- package/build/components/global-styles/screen-root.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +50 -0
- package/build/components/global-styles/screen-typography.js.map +1 -0
- package/build/components/global-styles/subtitle.js +25 -0
- package/build/components/global-styles/subtitle.js.map +1 -0
- package/build/components/{sidebar → global-styles}/typography-panel.js +1 -3
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/header/document-actions/index.js +1 -1
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +82 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +75 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/header/undo-redo/redo.js +1 -1
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +1 -1
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -10
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +1 -1
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +10 -10
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -3
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build/components/save-button/index.js +1 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +11 -161
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +1 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +95 -0
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build/components/template-details/index.js +12 -6
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +73 -0
- package/build/components/template-details/template-areas.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +3 -3
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/index.js +1 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -1
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +24 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +60 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +19 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +16 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +91 -9
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +48 -0
- package/build-module/components/block-editor/back-button.js.map +1 -0
- package/build-module/components/block-editor/index.js +17 -5
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +49 -0
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build-module/components/editor/global-styles-provider.js +16 -3
- package/build-module/components/editor/global-styles-provider.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +8 -8
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/editor/index.js +4 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/utils.js +2 -7
- package/build-module/components/editor/utils.js.map +1 -1
- package/build-module/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-panel.js +25 -22
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/context-menu.js +41 -0
- package/build-module/components/global-styles/context-menu.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/dimensions-panel.js +58 -9
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +1 -0
- package/build-module/components/global-styles/index.js +70 -0
- package/build-module/components/global-styles/index.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +31 -0
- package/build-module/components/global-styles/navigation-button.js.map +1 -0
- package/build-module/components/global-styles/palette.js +43 -0
- package/build-module/components/global-styles/palette.js.map +1 -0
- package/build-module/components/global-styles/preview.js +50 -0
- package/build-module/components/global-styles/preview.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +58 -0
- package/build-module/components/global-styles/screen-block-list.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +32 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +35 -0
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -0
- package/build-module/components/global-styles/screen-colors.js +38 -0
- package/build-module/components/global-styles/screen-colors.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +44 -0
- package/build-module/components/global-styles/screen-layout.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +29 -0
- package/build-module/components/global-styles/screen-root.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +37 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -0
- package/build-module/components/global-styles/subtitle.js +17 -0
- package/build-module/components/global-styles/subtitle.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/header/document-actions/index.js +1 -1
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +70 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/undo-redo/redo.js +1 -1
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +1 -1
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +3 -11
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +1 -1
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +5 -3
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -3
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +13 -159
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -7
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +84 -0
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/template-details/index.js +13 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +60 -0
- package/build-module/components/template-details/template-areas.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +3 -3
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +1 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +1 -1
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +51 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +13 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +16 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +85 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +158 -19
- package/build-style/style.css +158 -19
- package/package.json +26 -26
- package/src/components/block-editor/back-button.js +44 -0
- package/src/components/block-editor/index.js +18 -2
- package/src/components/block-editor/style.scss +26 -0
- package/src/components/edit-template-part-menu-button/index.js +57 -0
- package/src/components/editor/global-styles-provider.js +19 -3
- package/src/components/editor/global-styles-renderer.js +8 -5
- package/src/components/editor/index.js +5 -8
- package/src/components/editor/test/global-styles-provider.js +131 -0
- package/src/components/editor/test/global-styles-renderer.js +1 -1
- package/src/components/editor/test/utils.js +146 -0
- package/src/components/editor/utils.js +2 -7
- package/src/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/src/components/{sidebar → global-styles}/color-palette-panel.js +13 -11
- package/src/components/{sidebar → global-styles}/color-panel.js +43 -28
- package/src/components/global-styles/context-menu.js +54 -0
- package/src/components/{sidebar → global-styles}/dimensions-panel.js +60 -9
- package/src/components/global-styles/header.js +50 -0
- package/src/components/global-styles/index.js +81 -0
- package/src/components/global-styles/navigation-button.js +35 -0
- package/src/components/global-styles/palette.js +67 -0
- package/src/components/global-styles/preview.js +41 -0
- package/src/components/global-styles/screen-block-list.js +59 -0
- package/src/components/global-styles/screen-block.js +28 -0
- package/src/components/global-styles/screen-color-palette.js +33 -0
- package/src/components/global-styles/screen-colors.js +36 -0
- package/src/components/global-styles/screen-layout.js +45 -0
- package/src/components/global-styles/screen-root.js +43 -0
- package/src/components/global-styles/screen-typography.js +33 -0
- package/src/components/global-styles/style.scss +35 -0
- package/src/components/global-styles/subtitle.js +10 -0
- package/src/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/src/components/header/document-actions/index.js +1 -1
- package/src/components/header/plugin-more-menu-item/index.js +71 -0
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/header/undo-redo/redo.js +4 -1
- package/src/components/header/undo-redo/undo.js +4 -1
- package/src/components/keyboard-shortcuts/index.js +25 -40
- package/src/components/navigation-sidebar/index.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +9 -4
- package/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/style.scss +1 -0
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +3 -2
- package/src/components/save-button/index.js +1 -1
- package/src/components/secondary-sidebar/inserter-sidebar.js +1 -0
- package/src/components/sidebar/global-styles-sidebar.js +14 -187
- package/src/components/sidebar/index.js +2 -7
- package/src/components/sidebar/plugin-sidebar/index.js +80 -0
- package/src/components/sidebar/style.scss +40 -0
- package/src/components/template-details/index.js +17 -7
- package/src/components/template-details/style.scss +36 -27
- package/src/components/template-details/template-areas.js +66 -0
- package/src/components/template-part-converter/convert-to-regular.js +2 -8
- package/src/components/template-part-converter/index.js +1 -1
- package/src/components/url-query-controller/index.js +1 -1
- package/src/index.js +3 -0
- package/src/store/actions.js +59 -7
- package/src/store/constants.js +15 -0
- package/src/store/reducer.js +26 -12
- package/src/store/selectors.js +96 -9
- package/src/store/test/reducer.js +40 -23
- package/src/store/test/selectors.js +34 -3
- package/src/style.scss +1 -0
- package/build/components/sidebar/border-panel.js.map +0 -1
- package/build/components/sidebar/color-palette-panel.js.map +0 -1
- package/build/components/sidebar/color-panel.js.map +0 -1
- package/build/components/sidebar/dimensions-panel.js.map +0 -1
- package/build/components/sidebar/typography-panel.js.map +0 -1
- package/build-module/components/sidebar/border-panel.js.map +0 -1
- package/build-module/components/sidebar/color-palette-panel.js.map +0 -1
- package/build-module/components/sidebar/color-panel.js.map +0 -1
- package/build-module/components/sidebar/dimensions-panel.js.map +0 -1
- package/build-module/components/sidebar/typography-panel.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { createSlotFill, PanelBody } from '@wordpress/components';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { cog
|
|
6
|
+
import { cog } from '@wordpress/icons';
|
|
7
7
|
import { useEffect } from '@wordpress/element';
|
|
8
8
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
9
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
@@ -76,12 +76,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
76
76
|
<InspectorSlot bubblesVirtually />
|
|
77
77
|
) }
|
|
78
78
|
</DefaultSidebar>
|
|
79
|
-
<GlobalStylesSidebar
|
|
80
|
-
identifier="edit-site/global-styles"
|
|
81
|
-
title={ __( 'Global Styles' ) }
|
|
82
|
-
closeLabel={ __( 'Close global styles sidebar' ) }
|
|
83
|
-
icon={ typography }
|
|
84
|
-
/>
|
|
79
|
+
<GlobalStylesSidebar />
|
|
85
80
|
</>
|
|
86
81
|
);
|
|
87
82
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { ComplementaryArea } from '@wordpress/interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
8
|
+
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
9
|
+
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @see PluginSidebarMoreMenuItem
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} props Element props.
|
|
18
|
+
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
|
|
19
|
+
* @param {string} [props.className] An optional class name added to the sidebar body.
|
|
20
|
+
* @param {string} props.title Title displayed at the top of the sidebar.
|
|
21
|
+
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
|
|
22
|
+
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```js
|
|
26
|
+
* // Using ES5 syntax
|
|
27
|
+
* var __ = wp.i18n.__;
|
|
28
|
+
* var el = wp.element.createElement;
|
|
29
|
+
* var PanelBody = wp.components.PanelBody;
|
|
30
|
+
* var PluginSidebar = wp.editSite.PluginSidebar;
|
|
31
|
+
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
|
|
32
|
+
*
|
|
33
|
+
* function MyPluginSidebar() {
|
|
34
|
+
* return el(
|
|
35
|
+
* PluginSidebar,
|
|
36
|
+
* {
|
|
37
|
+
* name: 'my-sidebar',
|
|
38
|
+
* title: 'My sidebar title',
|
|
39
|
+
* icon: moreIcon,
|
|
40
|
+
* },
|
|
41
|
+
* el(
|
|
42
|
+
* PanelBody,
|
|
43
|
+
* {},
|
|
44
|
+
* __( 'My sidebar content' )
|
|
45
|
+
* )
|
|
46
|
+
* );
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```jsx
|
|
52
|
+
* // Using ESNext syntax
|
|
53
|
+
* import { __ } from '@wordpress/i18n';
|
|
54
|
+
* import { PanelBody } from '@wordpress/components';
|
|
55
|
+
* import { PluginSidebar } from '@wordpress/edit-site';
|
|
56
|
+
* import { more } from '@wordpress/icons';
|
|
57
|
+
*
|
|
58
|
+
* const MyPluginSidebar = () => (
|
|
59
|
+
* <PluginSidebar
|
|
60
|
+
* name="my-sidebar"
|
|
61
|
+
* title="My sidebar title"
|
|
62
|
+
* icon={ more }
|
|
63
|
+
* >
|
|
64
|
+
* <PanelBody>
|
|
65
|
+
* { __( 'My sidebar content' ) }
|
|
66
|
+
* </PanelBody>
|
|
67
|
+
* </PluginSidebar>
|
|
68
|
+
* );
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export default function PluginSidebarEditSite( { className, ...props } ) {
|
|
72
|
+
return (
|
|
73
|
+
<ComplementaryArea
|
|
74
|
+
panelClassName={ className }
|
|
75
|
+
className="edit-site-sidebar"
|
|
76
|
+
scope="core/edit-site"
|
|
77
|
+
{ ...props }
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -38,3 +38,43 @@
|
|
|
38
38
|
margin-bottom: 0;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
.edit-site-global-styles-sidebar .components-navigation__menu-title-heading {
|
|
43
|
+
font-size: $default-font-size * 1.2;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.edit-site-global-styles-sidebar .components-navigation__item > button span {
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.edit-site-typography-panel,
|
|
52
|
+
.edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings {
|
|
53
|
+
border: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.edit-site-global-styles-sidebar__blocks-group {
|
|
57
|
+
padding-top: $grid-unit-30;
|
|
58
|
+
border-top: $border-width solid $gray-200;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.edit-site-global-styles-sidebar__blocks-group-help {
|
|
62
|
+
padding: 0 $grid-unit-20;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.edit-site-global-styles-color-palette-panel {
|
|
66
|
+
padding: $grid-unit-20;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.edit-site-global-styles-sidebar__beta {
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
margin-left: $grid-unit-10;
|
|
72
|
+
padding: 0 $grid-unit-10;
|
|
73
|
+
height: $grid-unit-30;
|
|
74
|
+
border-radius: $radius-block-ui;
|
|
75
|
+
background-color: $black;
|
|
76
|
+
color: $white;
|
|
77
|
+
align-items: center;
|
|
78
|
+
font-size: $helptext-font-size;
|
|
79
|
+
line-height: 1;
|
|
80
|
+
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
Button,
|
|
7
|
+
MenuGroup,
|
|
7
8
|
MenuItem,
|
|
9
|
+
__experimentalHeading as Heading,
|
|
8
10
|
__experimentalText as Text,
|
|
9
11
|
} from '@wordpress/components';
|
|
10
12
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
@@ -16,6 +18,7 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
16
18
|
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
17
19
|
import { MENU_TEMPLATES } from '../navigation-sidebar/navigation-panel/constants';
|
|
18
20
|
import { store as editSiteStore } from '../../store';
|
|
21
|
+
import TemplateAreas from './template-areas';
|
|
19
22
|
|
|
20
23
|
export default function TemplateDetails( { template, onClose } ) {
|
|
21
24
|
const { title, description } = useSelect(
|
|
@@ -42,11 +45,15 @@ export default function TemplateDetails( { template, onClose } ) {
|
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
return (
|
|
45
|
-
|
|
46
|
-
<div className="edit-site-template-
|
|
47
|
-
<
|
|
48
|
+
<div className="edit-site-template-details">
|
|
49
|
+
<div className="edit-site-template-details__group">
|
|
50
|
+
<Heading
|
|
51
|
+
level={ 4 }
|
|
52
|
+
weight={ 600 }
|
|
53
|
+
className="edit-site-template-details__title"
|
|
54
|
+
>
|
|
48
55
|
{ title }
|
|
49
|
-
</
|
|
56
|
+
</Heading>
|
|
50
57
|
|
|
51
58
|
{ description && (
|
|
52
59
|
<Text
|
|
@@ -58,15 +65,18 @@ export default function TemplateDetails( { template, onClose } ) {
|
|
|
58
65
|
) }
|
|
59
66
|
</div>
|
|
60
67
|
|
|
68
|
+
<TemplateAreas />
|
|
69
|
+
|
|
61
70
|
{ isTemplateRevertable( template ) && (
|
|
62
|
-
<
|
|
71
|
+
<MenuGroup className="edit-site-template-details__group">
|
|
63
72
|
<MenuItem
|
|
73
|
+
className="edit-site-template-details__revert-button"
|
|
64
74
|
info={ __( 'Restore template to theme default' ) }
|
|
65
75
|
onClick={ revert }
|
|
66
76
|
>
|
|
67
77
|
{ __( 'Clear customizations' ) }
|
|
68
78
|
</MenuItem>
|
|
69
|
-
</
|
|
79
|
+
</MenuGroup>
|
|
70
80
|
) }
|
|
71
81
|
|
|
72
82
|
<Button
|
|
@@ -78,6 +88,6 @@ export default function TemplateDetails( { template, onClose } ) {
|
|
|
78
88
|
>
|
|
79
89
|
{ __( 'Browse all templates' ) }
|
|
80
90
|
</Button>
|
|
81
|
-
|
|
91
|
+
</div>
|
|
82
92
|
);
|
|
83
93
|
}
|
|
@@ -1,46 +1,55 @@
|
|
|
1
1
|
.edit-site-template-details {
|
|
2
|
-
|
|
2
|
+
.edit-site-template-details__group {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: $grid-unit-20;
|
|
5
|
+
}
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
.edit-site-template-details__group + .edit-site-template-details__group {
|
|
8
|
+
border-top: $border-width solid $gray-400;
|
|
6
9
|
}
|
|
7
|
-
}
|
|
8
10
|
|
|
9
|
-
.edit-site-template-
|
|
10
|
-
|
|
11
|
-
}
|
|
11
|
+
.edit-site-template-details__title {
|
|
12
|
+
margin: 0 0 $grid-unit-15;
|
|
13
|
+
}
|
|
12
14
|
|
|
13
|
-
.edit-site-template-
|
|
14
|
-
|
|
15
|
+
.edit-site-template-details__description {
|
|
16
|
+
margin: 0 0 $grid-unit-15;
|
|
17
|
+
color: $gray-700;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// The group already has a 8px padding inside, so overriding the parent padding.
|
|
21
|
+
.edit-site-template-details__group.edit-site-template-details__template-areas {
|
|
22
|
+
padding: $grid-unit-10;
|
|
23
|
+
}
|
|
15
24
|
|
|
16
|
-
.
|
|
25
|
+
.edit-site-template-details__revert-button {
|
|
17
26
|
height: auto;
|
|
18
|
-
padding:
|
|
27
|
+
padding: 0;
|
|
19
28
|
text-align: left;
|
|
20
29
|
|
|
21
30
|
&:focus:not(:disabled) {
|
|
22
31
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px $white;
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
|
-
}
|
|
26
34
|
|
|
27
|
-
.edit-site-template-details__show-all-button.components-button {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
color: $white;
|
|
31
|
-
width: 100%;
|
|
32
|
-
height: ($button-size + $grid-unit-10);
|
|
33
|
-
border-radius: 0;
|
|
34
|
-
|
|
35
|
-
&:hover {
|
|
35
|
+
.edit-site-template-details__show-all-button.components-button {
|
|
36
|
+
display: block;
|
|
37
|
+
background: $gray-900;
|
|
36
38
|
color: $white;
|
|
37
|
-
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: ($button-size + $grid-unit-10);
|
|
41
|
+
border-radius: 0;
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
&:hover {
|
|
44
|
+
color: $white;
|
|
45
|
+
}
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
&:active {
|
|
48
|
+
color: $gray-400;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:focus:not(:disabled) {
|
|
52
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px $white;
|
|
53
|
+
}
|
|
45
54
|
}
|
|
46
55
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { MenuGroup, MenuItem } from '@wordpress/components';
|
|
6
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
+
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
8
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { store as editSiteStore } from '../../store';
|
|
14
|
+
import { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';
|
|
15
|
+
|
|
16
|
+
function TemplatePartItem( { area, clientId } ) {
|
|
17
|
+
const { selectBlock, toggleBlockHighlight } = useDispatch(
|
|
18
|
+
blockEditorStore
|
|
19
|
+
);
|
|
20
|
+
const highlightBlock = () => toggleBlockHighlight( clientId, true );
|
|
21
|
+
const cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<MenuItem
|
|
25
|
+
icon={ getTemplatePartIcon( area ) }
|
|
26
|
+
iconPosition="left"
|
|
27
|
+
onClick={ () => {
|
|
28
|
+
selectBlock( clientId );
|
|
29
|
+
} }
|
|
30
|
+
onMouseOver={ highlightBlock }
|
|
31
|
+
onMouseLeave={ cancelHighlightBlock }
|
|
32
|
+
onFocus={ highlightBlock }
|
|
33
|
+
onBlur={ cancelHighlightBlock }
|
|
34
|
+
>
|
|
35
|
+
{ TEMPLATE_PART_AREA_TO_NAME[ area ] }
|
|
36
|
+
</MenuItem>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default function TemplateAreas() {
|
|
41
|
+
const templateAreaBlocks = useSelect(
|
|
42
|
+
( select ) => select( editSiteStore ).getTemplateAreaBlocks(),
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if ( ! Object.keys( templateAreaBlocks ).length ) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<MenuGroup
|
|
52
|
+
label={ __( 'Template areas' ) }
|
|
53
|
+
className="edit-site-template-details__group edit-site-template-details__template-areas"
|
|
54
|
+
>
|
|
55
|
+
{ Object.entries( templateAreaBlocks ).map(
|
|
56
|
+
( [ area, templateAreaBlock ] ) => (
|
|
57
|
+
<TemplatePartItem
|
|
58
|
+
key={ area }
|
|
59
|
+
area={ area }
|
|
60
|
+
clientId={ templateAreaBlock.clientId }
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
) }
|
|
64
|
+
</MenuGroup>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -10,13 +10,7 @@ import { MenuItem } from '@wordpress/components';
|
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
export default function ConvertToRegularBlocks( { clientId } ) {
|
|
13
|
-
const {
|
|
14
|
-
( select ) =>
|
|
15
|
-
select( blockEditorStore ).__unstableGetBlockWithBlockTree(
|
|
16
|
-
clientId
|
|
17
|
-
),
|
|
18
|
-
[ clientId ]
|
|
19
|
-
);
|
|
13
|
+
const { getBlocks } = useSelect( blockEditorStore );
|
|
20
14
|
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
21
15
|
|
|
22
16
|
return (
|
|
@@ -24,7 +18,7 @@ export default function ConvertToRegularBlocks( { clientId } ) {
|
|
|
24
18
|
{ ( { onClose } ) => (
|
|
25
19
|
<MenuItem
|
|
26
20
|
onClick={ () => {
|
|
27
|
-
replaceBlocks( clientId,
|
|
21
|
+
replaceBlocks( clientId, getBlocks( clientId ) );
|
|
28
22
|
onClose();
|
|
29
23
|
} }
|
|
30
24
|
>
|
|
@@ -20,7 +20,7 @@ export default function TemplatePartConverter() {
|
|
|
20
20
|
clientIds: selectedBlockClientIds,
|
|
21
21
|
blocks: getBlocksByClientId( selectedBlockClientIds ),
|
|
22
22
|
};
|
|
23
|
-
} );
|
|
23
|
+
}, [] );
|
|
24
24
|
|
|
25
25
|
// Allow converting a single template part to standard blocks.
|
|
26
26
|
if ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {
|
package/src/index.js
CHANGED
|
@@ -62,3 +62,6 @@ export function initialize( id, settings ) {
|
|
|
62
62
|
|
|
63
63
|
export { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';
|
|
64
64
|
export { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';
|
|
65
|
+
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
|
|
66
|
+
export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
|
|
67
|
+
export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
package/src/store/actions.js
CHANGED
|
@@ -8,6 +8,7 @@ import { addQueryArgs, getPathAndQueryString } from '@wordpress/url';
|
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
9
|
import { store as noticesStore } from '@wordpress/notices';
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -54,7 +55,7 @@ export function* setTemplate( templateId, templateSlug ) {
|
|
|
54
55
|
const pageContext = { templateSlug };
|
|
55
56
|
if ( ! templateSlug ) {
|
|
56
57
|
const template = yield controls.resolveSelect(
|
|
57
|
-
coreStore
|
|
58
|
+
coreStore,
|
|
58
59
|
'getEntityRecord',
|
|
59
60
|
'postType',
|
|
60
61
|
'wp_template',
|
|
@@ -78,7 +79,7 @@ export function* setTemplate( templateId, templateSlug ) {
|
|
|
78
79
|
*/
|
|
79
80
|
export function* addTemplate( template ) {
|
|
80
81
|
const newTemplate = yield controls.dispatch(
|
|
81
|
-
coreStore
|
|
82
|
+
coreStore,
|
|
82
83
|
'saveEntityRecord',
|
|
83
84
|
'postType',
|
|
84
85
|
'wp_template',
|
|
@@ -87,7 +88,7 @@ export function* addTemplate( template ) {
|
|
|
87
88
|
|
|
88
89
|
if ( template.content ) {
|
|
89
90
|
yield controls.dispatch(
|
|
90
|
-
coreStore
|
|
91
|
+
coreStore,
|
|
91
92
|
'editEntityRecord',
|
|
92
93
|
'postType',
|
|
93
94
|
'wp_template',
|
|
@@ -121,7 +122,7 @@ export function* removeTemplate( templateId ) {
|
|
|
121
122
|
/**
|
|
122
123
|
* Returns an action object used to set a template part.
|
|
123
124
|
*
|
|
124
|
-
* @param {
|
|
125
|
+
* @param {string} templatePartId The template part ID.
|
|
125
126
|
*
|
|
126
127
|
* @return {Object} Action object.
|
|
127
128
|
*/
|
|
@@ -132,6 +133,20 @@ export function setTemplatePart( templatePartId ) {
|
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Returns an action object used to push a template part to navigation history.
|
|
138
|
+
*
|
|
139
|
+
* @param {string} templatePartId The template part ID.
|
|
140
|
+
*
|
|
141
|
+
* @return {Object} Action object.
|
|
142
|
+
*/
|
|
143
|
+
export function pushTemplatePart( templatePartId ) {
|
|
144
|
+
return {
|
|
145
|
+
type: 'PUSH_TEMPLATE_PART',
|
|
146
|
+
templatePartId,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
135
150
|
/**
|
|
136
151
|
* Updates the homeTemplateId state with the templateId of the page resolved
|
|
137
152
|
* from the given path.
|
|
@@ -160,7 +175,7 @@ export function setHomeTemplateId( homeTemplateId ) {
|
|
|
160
175
|
export function* setPage( page ) {
|
|
161
176
|
if ( ! page.path && page.context?.postId ) {
|
|
162
177
|
const entity = yield controls.resolveSelect(
|
|
163
|
-
coreStore
|
|
178
|
+
coreStore,
|
|
164
179
|
'getEntityRecord',
|
|
165
180
|
'postType',
|
|
166
181
|
page.context.postType || 'post',
|
|
@@ -170,7 +185,7 @@ export function* setPage( page ) {
|
|
|
170
185
|
page.path = getPathAndQueryString( entity.link );
|
|
171
186
|
}
|
|
172
187
|
const { id: templateId, slug: templateSlug } = yield controls.resolveSelect(
|
|
173
|
-
coreStore
|
|
188
|
+
coreStore,
|
|
174
189
|
'__experimentalGetTemplateForLink',
|
|
175
190
|
page.path
|
|
176
191
|
);
|
|
@@ -190,6 +205,15 @@ export function* setPage( page ) {
|
|
|
190
205
|
return templateId;
|
|
191
206
|
}
|
|
192
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Go back to the current editing page.
|
|
210
|
+
*/
|
|
211
|
+
export function goBack() {
|
|
212
|
+
return {
|
|
213
|
+
type: 'GO_BACK',
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
193
217
|
/**
|
|
194
218
|
* Displays the site homepage for editing in the editor.
|
|
195
219
|
*/
|
|
@@ -198,7 +222,7 @@ export function* showHomepage() {
|
|
|
198
222
|
show_on_front: showOnFront,
|
|
199
223
|
page_on_front: frontpageId,
|
|
200
224
|
} = yield controls.resolveSelect(
|
|
201
|
-
coreStore
|
|
225
|
+
coreStore,
|
|
202
226
|
'getEntityRecord',
|
|
203
227
|
'root',
|
|
204
228
|
'site'
|
|
@@ -441,3 +465,31 @@ export function* revertTemplate( template ) {
|
|
|
441
465
|
);
|
|
442
466
|
}
|
|
443
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Returns an action object used in signalling that the user opened an editor sidebar.
|
|
470
|
+
*
|
|
471
|
+
* @param {?string} name Sidebar name to be opened.
|
|
472
|
+
*
|
|
473
|
+
* @yield {Object} Action object.
|
|
474
|
+
*/
|
|
475
|
+
export function* openGeneralSidebar( name ) {
|
|
476
|
+
yield controls.dispatch(
|
|
477
|
+
interfaceStore,
|
|
478
|
+
'enableComplementaryArea',
|
|
479
|
+
editSiteStoreName,
|
|
480
|
+
name
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Returns an action object signalling that the user closed the sidebar.
|
|
486
|
+
*
|
|
487
|
+
* @yield {Object} Action object.
|
|
488
|
+
*/
|
|
489
|
+
export function* closeGeneralSidebar() {
|
|
490
|
+
yield controls.dispatch(
|
|
491
|
+
interfaceStore,
|
|
492
|
+
'disableComplementaryArea',
|
|
493
|
+
editSiteStoreName
|
|
494
|
+
);
|
|
495
|
+
}
|
package/src/store/constants.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* The identifier for the data store.
|
|
3
8
|
*
|
|
4
9
|
* @type {string}
|
|
5
10
|
*/
|
|
6
11
|
export const STORE_NAME = 'core/edit-site';
|
|
12
|
+
|
|
13
|
+
export const TEMPLATE_PART_AREA_HEADER = 'header';
|
|
14
|
+
export const TEMPLATE_PART_AREA_FOOTER = 'footer';
|
|
15
|
+
export const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar';
|
|
16
|
+
|
|
17
|
+
export const TEMPLATE_PART_AREA_TO_NAME = {
|
|
18
|
+
[ TEMPLATE_PART_AREA_HEADER ]: __( 'Header' ),
|
|
19
|
+
[ TEMPLATE_PART_AREA_FOOTER ]: __( 'Footer' ),
|
|
20
|
+
[ TEMPLATE_PART_AREA_SIDEBAR ]: __( 'Sidebar' ),
|
|
21
|
+
};
|
package/src/store/reducer.js
CHANGED
|
@@ -72,25 +72,39 @@ export function settings( state = {}, action ) {
|
|
|
72
72
|
* Reducer keeping track of the currently edited Post Type,
|
|
73
73
|
* Post Id and the context provided to fill the content of the block editor.
|
|
74
74
|
*
|
|
75
|
-
* @param {
|
|
75
|
+
* @param {Array} state Current state history.
|
|
76
76
|
* @param {Object} action Dispatched action.
|
|
77
77
|
*
|
|
78
|
-
* @return {
|
|
78
|
+
* @return {Array} Updated state.
|
|
79
79
|
*/
|
|
80
|
-
export function editedPost( state =
|
|
80
|
+
export function editedPost( state = [], action ) {
|
|
81
81
|
switch ( action.type ) {
|
|
82
82
|
case 'SET_TEMPLATE':
|
|
83
83
|
case 'SET_PAGE':
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
return [
|
|
85
|
+
{
|
|
86
|
+
type: 'wp_template',
|
|
87
|
+
id: action.templateId,
|
|
88
|
+
page: action.page,
|
|
89
|
+
},
|
|
90
|
+
];
|
|
89
91
|
case 'SET_TEMPLATE_PART':
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
return [
|
|
93
|
+
{
|
|
94
|
+
type: 'wp_template_part',
|
|
95
|
+
id: action.templatePartId,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
case 'PUSH_TEMPLATE_PART':
|
|
99
|
+
return [
|
|
100
|
+
...state,
|
|
101
|
+
{
|
|
102
|
+
type: 'wp_template_part',
|
|
103
|
+
id: action.templatePartId,
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
case 'GO_BACK':
|
|
107
|
+
return state.slice( 0, -1 );
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
return state;
|