@wordpress/edit-site 3.0.2 → 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 +18 -4
- 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 +1 -1
- package/build/components/editor/global-styles-provider.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 +1 -1
- package/build/components/editor/utils.js.map +1 -1
- package/build/components/{sidebar → global-styles}/border-panel.js +0 -0
- 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 +7 -11
- 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 +6 -7
- 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/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/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/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 +54 -1
- 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 +15 -4
- 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 +1 -1
- package/build-module/components/editor/global-styles-provider.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 +1 -1
- package/build-module/components/editor/utils.js.map +1 -1
- package/build-module/components/{sidebar → global-styles}/border-panel.js +0 -0
- 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 +8 -12
- 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 +6 -7
- 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/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/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/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 +45 -1
- 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 +122 -17
- package/build-style/style.css +122 -17
- package/package.json +26 -26
- package/src/components/block-editor/back-button.js +44 -0
- package/src/components/block-editor/index.js +16 -1
- 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 +1 -1
- package/src/components/editor/index.js +5 -8
- package/src/components/editor/utils.js +1 -0
- package/src/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/src/components/{sidebar → global-styles}/color-palette-panel.js +13 -11
- package/src/components/{sidebar → global-styles}/color-panel.js +12 -17
- package/src/components/global-styles/context-menu.js +54 -0
- package/src/components/{sidebar → global-styles}/dimensions-panel.js +6 -10
- 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/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/style.scss +1 -0
- 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/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 +53 -1
- 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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useGlobalStylesContext } from '../editor/global-styles-provider';
|
|
10
|
+
import BorderPanel, { useHasBorderPanel } from './border-panel';
|
|
11
|
+
import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
|
|
12
|
+
import ScreenHeader from './header';
|
|
13
|
+
|
|
14
|
+
function ScreenLayout( { name } ) {
|
|
15
|
+
const { root, blocks, getStyle, setStyle } = useGlobalStylesContext();
|
|
16
|
+
const context = name === undefined ? root : blocks[ name ];
|
|
17
|
+
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
18
|
+
const hasBorderPanel = useHasBorderPanel( context );
|
|
19
|
+
const hasDimensionsPanel = useHasDimensionsPanel( context );
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<ScreenHeader
|
|
24
|
+
back={ parentMenu ? parentMenu : '/' }
|
|
25
|
+
title={ __( 'Layout' ) }
|
|
26
|
+
/>
|
|
27
|
+
{ hasDimensionsPanel && (
|
|
28
|
+
<DimensionsPanel
|
|
29
|
+
context={ context }
|
|
30
|
+
getStyle={ getStyle }
|
|
31
|
+
setStyle={ setStyle }
|
|
32
|
+
/>
|
|
33
|
+
) }
|
|
34
|
+
{ hasBorderPanel && (
|
|
35
|
+
<BorderPanel
|
|
36
|
+
context={ context }
|
|
37
|
+
getStyle={ getStyle }
|
|
38
|
+
setStyle={ setStyle }
|
|
39
|
+
/>
|
|
40
|
+
) }
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default ScreenLayout;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalItemGroup as ItemGroup,
|
|
6
|
+
__experimentalItem as Item,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import StylesPreview from './preview';
|
|
14
|
+
import NavigationButton from './navigation-button';
|
|
15
|
+
import { useGlobalStylesContext } from '../editor/global-styles-provider';
|
|
16
|
+
import ContextMenu from './context-menu';
|
|
17
|
+
|
|
18
|
+
function ScreenRoot() {
|
|
19
|
+
const { root } = useGlobalStylesContext();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<StylesPreview />
|
|
24
|
+
|
|
25
|
+
<ContextMenu context={ root } />
|
|
26
|
+
|
|
27
|
+
<ItemGroup>
|
|
28
|
+
<Item>
|
|
29
|
+
<p>
|
|
30
|
+
{ __(
|
|
31
|
+
'Customize the appearance of specific blocks for the whole site.'
|
|
32
|
+
) }
|
|
33
|
+
</p>
|
|
34
|
+
</Item>
|
|
35
|
+
<NavigationButton path="/blocks">
|
|
36
|
+
{ __( 'Blocks' ) }
|
|
37
|
+
</NavigationButton>
|
|
38
|
+
</ItemGroup>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default ScreenRoot;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useGlobalStylesContext } from '../editor/global-styles-provider';
|
|
10
|
+
import TypographyPanel from './typography-panel';
|
|
11
|
+
import ScreenHeader from './header';
|
|
12
|
+
|
|
13
|
+
function ScreenTypography( { name } ) {
|
|
14
|
+
const { root, blocks, getStyle, setStyle } = useGlobalStylesContext();
|
|
15
|
+
const context = name === undefined ? root : blocks[ name ];
|
|
16
|
+
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<ScreenHeader
|
|
21
|
+
back={ parentMenu ? parentMenu : '/' }
|
|
22
|
+
title={ __( 'Typography' ) }
|
|
23
|
+
/>
|
|
24
|
+
<TypographyPanel
|
|
25
|
+
context={ context }
|
|
26
|
+
getStyle={ getStyle }
|
|
27
|
+
setStyle={ setStyle }
|
|
28
|
+
/>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default ScreenTypography;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.edit-site-global-styles-preview {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
min-height: 152px;
|
|
6
|
+
margin: $grid-unit-20;
|
|
7
|
+
line-height: 1;
|
|
8
|
+
|
|
9
|
+
.component-color-indicator {
|
|
10
|
+
border-radius: 50%;
|
|
11
|
+
border: 0;
|
|
12
|
+
height: 36px;
|
|
13
|
+
width: 36px;
|
|
14
|
+
margin-left: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.edit-site-global-style-palette {
|
|
20
|
+
margin: $grid-unit-20;
|
|
21
|
+
|
|
22
|
+
.component-color-indicator {
|
|
23
|
+
display: block;
|
|
24
|
+
border-radius: 50%;
|
|
25
|
+
border: 0;
|
|
26
|
+
height: 24px;
|
|
27
|
+
width: 24px;
|
|
28
|
+
margin-left: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.edit-site-global-styles-header__description {
|
|
34
|
+
padding: 0 $grid-unit-20;
|
|
35
|
+
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
__experimentalLetterSpacingControl as LetterSpacingControl,
|
|
9
9
|
} from '@wordpress/block-editor';
|
|
10
10
|
import { PanelBody, FontSizePicker } from '@wordpress/components';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Internal dependencies
|
|
@@ -76,7 +75,7 @@ export default function TypographyPanel( {
|
|
|
76
75
|
} );
|
|
77
76
|
|
|
78
77
|
return (
|
|
79
|
-
<PanelBody
|
|
78
|
+
<PanelBody className="edit-site-typography-panel" initialOpen={ true }>
|
|
80
79
|
{ supports.includes( 'fontFamily' ) && (
|
|
81
80
|
<FontFamilyControl
|
|
82
81
|
fontFamilies={ fontFamilies }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { ActionItem } from '@wordpress/interface';
|
|
5
|
+
import { compose } from '@wordpress/compose';
|
|
6
|
+
import { withPluginContext } from '@wordpress/plugins';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
|
|
10
|
+
* The text within the component appears as the menu item label.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props Component properties.
|
|
13
|
+
* @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
|
|
14
|
+
* @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 to the left of the menu item label.
|
|
15
|
+
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
|
|
16
|
+
* @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```js
|
|
20
|
+
* // Using ES5 syntax
|
|
21
|
+
* var __ = wp.i18n.__;
|
|
22
|
+
* var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem;
|
|
23
|
+
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
|
|
24
|
+
*
|
|
25
|
+
* function onButtonClick() {
|
|
26
|
+
* alert( 'Button clicked.' );
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* function MyButtonMoreMenuItem() {
|
|
30
|
+
* return wp.element.createElement(
|
|
31
|
+
* PluginMoreMenuItem,
|
|
32
|
+
* {
|
|
33
|
+
* icon: moreIcon,
|
|
34
|
+
* onClick: onButtonClick,
|
|
35
|
+
* },
|
|
36
|
+
* __( 'My button title' )
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```jsx
|
|
43
|
+
* // Using ESNext syntax
|
|
44
|
+
* import { __ } from '@wordpress/i18n';
|
|
45
|
+
* import { PluginMoreMenuItem } from '@wordpress/edit-site';
|
|
46
|
+
* import { more } from '@wordpress/icons';
|
|
47
|
+
*
|
|
48
|
+
* function onButtonClick() {
|
|
49
|
+
* alert( 'Button clicked.' );
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* const MyButtonMoreMenuItem = () => (
|
|
53
|
+
* <PluginMoreMenuItem
|
|
54
|
+
* icon={ more }
|
|
55
|
+
* onClick={ onButtonClick }
|
|
56
|
+
* >
|
|
57
|
+
* { __( 'My button title' ) }
|
|
58
|
+
* </PluginMoreMenuItem>
|
|
59
|
+
* );
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @return {WPComponent} The component to be rendered.
|
|
63
|
+
*/
|
|
64
|
+
export default compose(
|
|
65
|
+
withPluginContext( ( context, ownProps ) => {
|
|
66
|
+
return {
|
|
67
|
+
icon: ownProps.icon || context.icon,
|
|
68
|
+
name: 'core/edit-site/plugin-more-menu',
|
|
69
|
+
};
|
|
70
|
+
} )
|
|
71
|
+
)( ActionItem );
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { ComplementaryAreaMoreMenuItem } from '@wordpress/interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders a menu item in `Plugins` group in `More Menu` drop down,
|
|
8
|
+
* and can be used to activate the corresponding `PluginSidebar` component.
|
|
9
|
+
* The text within the component appears as the menu item label.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props Component props.
|
|
12
|
+
* @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
|
|
13
|
+
* @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 to the left of the menu item label.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```js
|
|
17
|
+
* // Using ES5 syntax
|
|
18
|
+
* var __ = wp.i18n.__;
|
|
19
|
+
* var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem;
|
|
20
|
+
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
|
|
21
|
+
*
|
|
22
|
+
* function MySidebarMoreMenuItem() {
|
|
23
|
+
* return wp.element.createElement(
|
|
24
|
+
* PluginSidebarMoreMenuItem,
|
|
25
|
+
* {
|
|
26
|
+
* target: 'my-sidebar',
|
|
27
|
+
* icon: moreIcon,
|
|
28
|
+
* },
|
|
29
|
+
* __( 'My sidebar title' )
|
|
30
|
+
* )
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```jsx
|
|
36
|
+
* // Using ESNext syntax
|
|
37
|
+
* import { __ } from '@wordpress/i18n';
|
|
38
|
+
* import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site';
|
|
39
|
+
* import { more } from '@wordpress/icons';
|
|
40
|
+
*
|
|
41
|
+
* const MySidebarMoreMenuItem = () => (
|
|
42
|
+
* <PluginSidebarMoreMenuItem
|
|
43
|
+
* target="my-sidebar"
|
|
44
|
+
* icon={ more }
|
|
45
|
+
* >
|
|
46
|
+
* { __( 'My sidebar title' ) }
|
|
47
|
+
* </PluginSidebarMoreMenuItem>
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @return {WPComponent} The component to be rendered.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export default function PluginSidebarMoreMenuItem( props ) {
|
|
55
|
+
return (
|
|
56
|
+
<ComplementaryAreaMoreMenuItem
|
|
57
|
+
// Menu item is marked with unstable prop for backward compatibility.
|
|
58
|
+
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
59
|
+
__unstableExplicitMenuItem
|
|
60
|
+
scope="core/edit-site"
|
|
61
|
+
{ ...props }
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -9,7 +9,10 @@ import { displayShortcut } from '@wordpress/keycodes';
|
|
|
9
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
10
10
|
|
|
11
11
|
export default function RedoButton() {
|
|
12
|
-
const hasRedo = useSelect(
|
|
12
|
+
const hasRedo = useSelect(
|
|
13
|
+
( select ) => select( coreStore ).hasRedo(),
|
|
14
|
+
[]
|
|
15
|
+
);
|
|
13
16
|
const { redo } = useDispatch( coreStore );
|
|
14
17
|
return (
|
|
15
18
|
<Button
|
|
@@ -9,7 +9,10 @@ import { displayShortcut } from '@wordpress/keycodes';
|
|
|
9
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
10
10
|
|
|
11
11
|
export default function UndoButton() {
|
|
12
|
-
const hasUndo = useSelect(
|
|
12
|
+
const hasUndo = useSelect(
|
|
13
|
+
( select ) => select( coreStore ).hasUndo(),
|
|
14
|
+
[]
|
|
15
|
+
);
|
|
13
16
|
const { undo } = useDispatch( coreStore );
|
|
14
17
|
return (
|
|
15
18
|
<Button
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useEffect } from '@wordpress/element';
|
|
5
5
|
import {
|
|
6
6
|
useShortcut,
|
|
7
7
|
store as keyboardShortcutsStore,
|
|
@@ -19,8 +19,9 @@ import { SIDEBAR_BLOCK } from '../sidebar/constants';
|
|
|
19
19
|
import { STORE_NAME } from '../../store/constants';
|
|
20
20
|
|
|
21
21
|
function KeyboardShortcuts() {
|
|
22
|
-
const isListViewOpen = useSelect(
|
|
23
|
-
select( editSiteStore ).isListViewOpened()
|
|
22
|
+
const isListViewOpen = useSelect(
|
|
23
|
+
( select ) => select( editSiteStore ).isListViewOpened(),
|
|
24
|
+
[]
|
|
24
25
|
);
|
|
25
26
|
const isBlockInspectorOpen = useSelect(
|
|
26
27
|
( select ) =>
|
|
@@ -35,47 +36,31 @@ function KeyboardShortcuts() {
|
|
|
35
36
|
interfaceStore
|
|
36
37
|
);
|
|
37
38
|
|
|
38
|
-
useShortcut(
|
|
39
|
-
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
-
event.preventDefault();
|
|
43
|
-
},
|
|
44
|
-
{ bindGlobal: true }
|
|
45
|
-
);
|
|
39
|
+
useShortcut( 'core/edit-site/undo', ( event ) => {
|
|
40
|
+
undo();
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
} );
|
|
46
43
|
|
|
47
|
-
useShortcut(
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
},
|
|
53
|
-
{ bindGlobal: true }
|
|
54
|
-
);
|
|
44
|
+
useShortcut( 'core/edit-site/redo', ( event ) => {
|
|
45
|
+
redo();
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
} );
|
|
55
48
|
|
|
56
|
-
useShortcut(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setIsListViewOpened( ! isListViewOpen );
|
|
60
|
-
}, [ isListViewOpen, setIsListViewOpened ] ),
|
|
61
|
-
{ bindGlobal: true }
|
|
62
|
-
);
|
|
49
|
+
useShortcut( 'core/edit-site/toggle-list-view', () => {
|
|
50
|
+
setIsListViewOpened( ! isListViewOpen );
|
|
51
|
+
} );
|
|
63
52
|
|
|
64
|
-
useShortcut(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// obscure shortcuts from triggering.
|
|
69
|
-
event.preventDefault();
|
|
53
|
+
useShortcut( 'core/edit-site/toggle-block-settings-sidebar', ( event ) => {
|
|
54
|
+
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
55
|
+
// obscure shortcuts from triggering.
|
|
56
|
+
event.preventDefault();
|
|
70
57
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{ bindGlobal: true }
|
|
78
|
-
);
|
|
58
|
+
if ( isBlockInspectorOpen ) {
|
|
59
|
+
disableComplementaryArea( STORE_NAME );
|
|
60
|
+
} else {
|
|
61
|
+
enableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );
|
|
62
|
+
}
|
|
63
|
+
} );
|
|
79
64
|
|
|
80
65
|
return null;
|
|
81
66
|
}
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
TEMPLATE_PART_AREA_HEADER,
|
|
11
|
+
TEMPLATE_PART_AREA_FOOTER,
|
|
12
|
+
TEMPLATE_PART_AREA_SIDEBAR,
|
|
13
|
+
} from '../../../store/constants';
|
|
14
|
+
|
|
6
15
|
export const TEMPLATES_PRIMARY = [
|
|
7
16
|
'index',
|
|
8
17
|
'singular',
|
|
@@ -75,10 +84,6 @@ export const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
|
|
|
75
84
|
export const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';
|
|
76
85
|
export const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';
|
|
77
86
|
|
|
78
|
-
export const TEMPLATE_PART_AREA_HEADER = 'header';
|
|
79
|
-
export const TEMPLATE_PART_AREA_FOOTER = 'footer';
|
|
80
|
-
export const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar';
|
|
81
|
-
|
|
82
87
|
export const TEMPLATE_PARTS_SUB_MENUS = [
|
|
83
88
|
{
|
|
84
89
|
area: TEMPLATE_PART_AREA_HEADER,
|