@wordpress/edit-site 5.0.0 → 5.2.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 +14 -1
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/new-template-part.js +21 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/utils.js +9 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +17 -52
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/editor/index.js +5 -17
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +27 -6
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -5
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +9 -1
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +1 -0
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +16 -11
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +3 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +6 -6
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +2 -6
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-border.js +12 -2
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +3 -4
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +53 -25
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +9 -10
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +12 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +8 -8
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +7 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +4 -4
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +11 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +9 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/ui.js +85 -18
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +119 -33
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +60 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- package/build/components/header-edit-mode/document-actions/index.js +10 -41
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/layout/index.js +129 -87
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/index.js +5 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -31
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -22
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +149 -0
- package/build/components/site-hub/index.js.map +1 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +60 -0
- package/build/components/use-edited-entity-record/index.js.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +144 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +20 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +5 -0
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +19 -50
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/editor/index.js +2 -13
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +26 -6
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -5
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +7 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +1 -0
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +16 -11
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +6 -6
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +2 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +10 -2
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -4
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +51 -25
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +9 -10
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +10 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +8 -8
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +8 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -4
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +9 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +9 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/ui.js +84 -19
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +121 -35
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +56 -3
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -38
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/layout/index.js +129 -88
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +3 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -27
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -23
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +127 -0
- package/build-module/components/site-hub/index.js.map +1 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +48 -0
- package/build-module/components/use-edited-entity-record/index.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +190 -125
- package/build-style/style.css +190 -125
- package/package.json +30 -29
- package/src/components/add-new-template/new-template-part.js +23 -1
- package/src/components/add-new-template/utils.js +14 -0
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +14 -59
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +43 -7
- package/src/components/editor/index.js +2 -17
- package/src/components/global-styles/block-preview-panel.js +37 -10
- package/src/components/global-styles/border-panel.js +8 -5
- package/src/components/global-styles/context-menu.js +6 -0
- package/src/components/global-styles/custom-css.js +1 -0
- package/src/components/global-styles/dimensions-panel.js +32 -15
- package/src/components/global-styles/global-styles-provider.js +11 -5
- package/src/components/global-styles/screen-background-color.js +12 -6
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-block.js +1 -4
- package/src/components/global-styles/screen-border.js +8 -3
- package/src/components/global-styles/screen-button-color.js +2 -4
- package/src/components/global-styles/screen-colors.js +84 -20
- package/src/components/global-styles/screen-heading-color.js +8 -10
- package/src/components/global-styles/screen-layout.js +11 -3
- package/src/components/global-styles/screen-link-color.js +19 -8
- package/src/components/global-styles/screen-root.js +34 -27
- package/src/components/global-styles/screen-text-color.js +7 -4
- package/src/components/global-styles/screen-typography.js +13 -3
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/style.scss +9 -0
- package/src/components/global-styles/test/typography-utils.js +72 -23
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +31 -8
- package/src/components/global-styles/typography-utils.js +24 -4
- package/src/components/global-styles/ui.js +101 -13
- package/src/components/global-styles/use-global-styles-output.js +137 -14
- package/src/components/global-styles/utils.js +56 -3
- package/src/components/global-styles/variations-panel.js +78 -0
- package/src/components/header-edit-mode/document-actions/index.js +18 -37
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/layout/index.js +217 -172
- package/src/components/layout/style.scss +98 -66
- package/src/components/list/style.scss +1 -8
- package/src/components/sidebar/index.js +4 -1
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +4 -0
- package/src/components/sidebar-navigation-screen/style.scss +2 -4
- package/src/components/sidebar-navigation-screen-main/index.js +1 -29
- package/src/components/sidebar-navigation-screen-templates/index.js +9 -27
- package/src/components/site-hub/index.js +161 -0
- package/src/components/site-hub/style.scss +31 -0
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- package/src/components/use-edited-entity-record/index.js +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +162 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/index.js +2 -0
- package/src/store/reducer.js +1 -1
- package/src/style.scss +2 -0
- package/build/components/site-title/index.js +0 -55
- package/build/components/site-title/index.js.map +0 -1
- package/build-module/components/site-title/index.js +0 -43
- package/build-module/components/site-title/index.js.map +0 -1
- package/src/components/site-title/index.js +0 -39
|
@@ -7,7 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import { useCallback, useMemo, useRef
|
|
10
|
+
import { useCallback, useMemo, useRef } from '@wordpress/element';
|
|
11
11
|
import {
|
|
12
12
|
useEntityBlockEditor,
|
|
13
13
|
__experimentalFetchMedia as fetchMedia,
|
|
@@ -19,12 +19,10 @@ import {
|
|
|
19
19
|
__experimentalLinkControl,
|
|
20
20
|
BlockInspector,
|
|
21
21
|
BlockTools,
|
|
22
|
-
|
|
23
|
-
__unstableBlockSettingsMenuFirstItem,
|
|
22
|
+
__unstableUseClipboardHandler as useClipboardHandler,
|
|
24
23
|
__unstableUseTypingObserver as useTypingObserver,
|
|
25
24
|
BlockEditorKeyboardShortcuts,
|
|
26
25
|
store as blockEditorStore,
|
|
27
|
-
__unstableBlockNameContext,
|
|
28
26
|
} from '@wordpress/block-editor';
|
|
29
27
|
import {
|
|
30
28
|
useMergeRefs,
|
|
@@ -32,9 +30,6 @@ import {
|
|
|
32
30
|
useResizeObserver,
|
|
33
31
|
} from '@wordpress/compose';
|
|
34
32
|
import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';
|
|
35
|
-
import { listView } from '@wordpress/icons';
|
|
36
|
-
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
37
|
-
import { __ } from '@wordpress/i18n';
|
|
38
33
|
|
|
39
34
|
/**
|
|
40
35
|
* Internal dependencies
|
|
@@ -43,7 +38,6 @@ import TemplatePartConverter from '../template-part-converter';
|
|
|
43
38
|
import NavigateToLink from '../navigate-to-link';
|
|
44
39
|
import { SidebarInspectorFill } from '../sidebar-edit-mode';
|
|
45
40
|
import { store as editSiteStore } from '../../store';
|
|
46
|
-
import BlockInspectorButton from './block-inspector-button';
|
|
47
41
|
import BackButton from './back-button';
|
|
48
42
|
import ResizableEditor from './resizable-editor';
|
|
49
43
|
import EditorCanvas from './editor-canvas';
|
|
@@ -55,19 +49,20 @@ const LAYOUT = {
|
|
|
55
49
|
alignments: [],
|
|
56
50
|
};
|
|
57
51
|
|
|
58
|
-
export default function BlockEditor(
|
|
52
|
+
export default function BlockEditor() {
|
|
53
|
+
const { setPage, setIsInserterOpened } = useDispatch( editSiteStore );
|
|
59
54
|
const { storedSettings, templateType, canvasMode } = useSelect(
|
|
60
55
|
( select ) => {
|
|
61
56
|
const { getSettings, getEditedPostType, __unstableGetCanvasMode } =
|
|
62
57
|
select( editSiteStore );
|
|
63
58
|
|
|
64
59
|
return {
|
|
65
|
-
storedSettings: getSettings(
|
|
60
|
+
storedSettings: getSettings( setIsInserterOpened ),
|
|
66
61
|
templateType: getEditedPostType(),
|
|
67
62
|
canvasMode: __unstableGetCanvasMode(),
|
|
68
63
|
};
|
|
69
64
|
},
|
|
70
|
-
[
|
|
65
|
+
[ setIsInserterOpened ]
|
|
71
66
|
);
|
|
72
67
|
|
|
73
68
|
const settingsBlockPatterns =
|
|
@@ -137,10 +132,13 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
137
132
|
'postType',
|
|
138
133
|
templateType
|
|
139
134
|
);
|
|
140
|
-
const { setPage } = useDispatch( editSiteStore );
|
|
141
135
|
|
|
142
136
|
const contentRef = useRef();
|
|
143
|
-
const mergedRefs = useMergeRefs( [
|
|
137
|
+
const mergedRefs = useMergeRefs( [
|
|
138
|
+
contentRef,
|
|
139
|
+
useClipboardHandler(),
|
|
140
|
+
useTypingObserver(),
|
|
141
|
+
] );
|
|
144
142
|
const isMobileViewport = useViewportMatch( 'small', '<' );
|
|
145
143
|
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
146
144
|
const [ resizeObserver, sizes ] = useResizeObserver();
|
|
@@ -153,33 +151,8 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
153
151
|
// Disable resizing in mobile viewport.
|
|
154
152
|
! isMobileViewport;
|
|
155
153
|
const isViewMode = canvasMode === 'view';
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const { enableComplementaryArea } = useDispatch( 'core/interface' );
|
|
159
|
-
|
|
160
|
-
const NavMenuSidebarToggle = () => (
|
|
161
|
-
<ToolbarGroup>
|
|
162
|
-
<ToolbarButton
|
|
163
|
-
className="components-toolbar__control"
|
|
164
|
-
label={ __( 'Open navigation list view' ) }
|
|
165
|
-
onClick={ () =>
|
|
166
|
-
enableComplementaryArea(
|
|
167
|
-
'core/edit-site',
|
|
168
|
-
'edit-site/block-inspector'
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
icon={ listView }
|
|
172
|
-
/>
|
|
173
|
-
</ToolbarGroup>
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
let MaybeNavMenuSidebarToggle = Fragment;
|
|
177
|
-
const isOffCanvasNavigationEditorEnabled =
|
|
178
|
-
window?.__experimentalEnableOffCanvasNavigationEditor === true;
|
|
179
|
-
|
|
180
|
-
if ( isOffCanvasNavigationEditorEnabled ) {
|
|
181
|
-
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
182
|
-
}
|
|
154
|
+
const showBlockAppender =
|
|
155
|
+
( isTemplatePart && hasBlocks ) || isViewMode ? false : undefined;
|
|
183
156
|
|
|
184
157
|
return (
|
|
185
158
|
<BlockEditorProvider
|
|
@@ -243,28 +216,10 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
243
216
|
<BlockList
|
|
244
217
|
className="edit-site-block-editor__block-list wp-site-blocks"
|
|
245
218
|
__experimentalLayout={ LAYOUT }
|
|
246
|
-
renderAppender={
|
|
247
|
-
isTemplatePart && hasBlocks
|
|
248
|
-
? false
|
|
249
|
-
: undefined
|
|
250
|
-
}
|
|
219
|
+
renderAppender={ showBlockAppender }
|
|
251
220
|
/>
|
|
252
221
|
</EditorCanvas>
|
|
253
222
|
</ResizableEditor>
|
|
254
|
-
<__unstableBlockSettingsMenuFirstItem>
|
|
255
|
-
{ ( { onClose } ) => (
|
|
256
|
-
<BlockInspectorButton onClick={ onClose } />
|
|
257
|
-
) }
|
|
258
|
-
</__unstableBlockSettingsMenuFirstItem>
|
|
259
|
-
<__unstableBlockToolbarLastItem>
|
|
260
|
-
<__unstableBlockNameContext.Consumer>
|
|
261
|
-
{ ( blockName ) =>
|
|
262
|
-
blockName === 'core/navigation' && (
|
|
263
|
-
<MaybeNavMenuSidebarToggle />
|
|
264
|
-
)
|
|
265
|
-
}
|
|
266
|
-
</__unstableBlockNameContext.Consumer>
|
|
267
|
-
</__unstableBlockToolbarLastItem>
|
|
268
223
|
</BlockTools>
|
|
269
224
|
)
|
|
270
225
|
}
|
|
@@ -7,7 +7,11 @@ import { VisuallyHidden } from '@wordpress/components';
|
|
|
7
7
|
|
|
8
8
|
const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.
|
|
9
9
|
|
|
10
|
-
export default function ResizeHandle( {
|
|
10
|
+
export default function ResizeHandle( {
|
|
11
|
+
variation = 'default',
|
|
12
|
+
direction,
|
|
13
|
+
resizeWidthBy,
|
|
14
|
+
} ) {
|
|
11
15
|
function handleKeyDown( event ) {
|
|
12
16
|
const { keyCode } = event;
|
|
13
17
|
|
|
@@ -27,7 +31,7 @@ export default function ResizeHandle( { direction, resizeWidthBy } ) {
|
|
|
27
31
|
return (
|
|
28
32
|
<>
|
|
29
33
|
<button
|
|
30
|
-
className={ `resizable-editor__drag-handle is-${ direction }` }
|
|
34
|
+
className={ `resizable-editor__drag-handle is-${ direction } is-variation-${ variation }` }
|
|
31
35
|
aria-label={ __( 'Drag to resize' ) }
|
|
32
36
|
aria-describedby={ `resizable-editor__resize-help-${ direction }` }
|
|
33
37
|
onKeyDown={ handleKeyDown }
|
|
@@ -78,21 +78,50 @@
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
.resizable-editor__drag-handle {
|
|
81
|
-
$height: 100px;
|
|
82
81
|
position: absolute;
|
|
83
82
|
top: 0;
|
|
84
83
|
bottom: 0;
|
|
85
84
|
padding: 0;
|
|
86
85
|
margin: auto 0;
|
|
87
|
-
width: $grid-unit-
|
|
88
|
-
height: $height;
|
|
86
|
+
width: $grid-unit-15;
|
|
89
87
|
appearance: none;
|
|
90
88
|
cursor: ew-resize;
|
|
91
89
|
outline: none;
|
|
92
|
-
background:
|
|
93
|
-
border-radius:
|
|
90
|
+
background: none;
|
|
91
|
+
border-radius: $radius-block-ui;
|
|
94
92
|
border: 0;
|
|
95
93
|
|
|
94
|
+
&.is-variation-default {
|
|
95
|
+
height: 100px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.is-variation-separator {
|
|
99
|
+
height: 100%;
|
|
100
|
+
|
|
101
|
+
&::after {
|
|
102
|
+
width: 1px;
|
|
103
|
+
border-radius: 0;
|
|
104
|
+
background: $gray-800;
|
|
105
|
+
left: auto;
|
|
106
|
+
right: 50%;
|
|
107
|
+
transition: all ease 0.2s;
|
|
108
|
+
transition-delay: 0.1s;
|
|
109
|
+
@include reduce-motion;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&::after {
|
|
114
|
+
position: absolute;
|
|
115
|
+
top: 0;
|
|
116
|
+
left: $grid-unit-05;
|
|
117
|
+
right: 0;
|
|
118
|
+
bottom: 0;
|
|
119
|
+
content: "";
|
|
120
|
+
width: $grid-unit-05;
|
|
121
|
+
background: $gray-600;
|
|
122
|
+
border-radius: $radius-block-ui;
|
|
123
|
+
}
|
|
124
|
+
|
|
96
125
|
&.is-left {
|
|
97
126
|
left: -$grid-unit-20;
|
|
98
127
|
}
|
|
@@ -103,10 +132,17 @@
|
|
|
103
132
|
|
|
104
133
|
&:hover,
|
|
105
134
|
&:active {
|
|
106
|
-
|
|
135
|
+
opacity: 1;
|
|
136
|
+
&.is-variation-default::after {
|
|
137
|
+
background: $gray-400;
|
|
138
|
+
}
|
|
139
|
+
&.is-variation-separator::after {
|
|
140
|
+
width: 2px;
|
|
141
|
+
background: var(--wp-admin-theme-color);
|
|
142
|
+
}
|
|
107
143
|
}
|
|
108
144
|
|
|
109
|
-
&:focus {
|
|
145
|
+
&:focus::after {
|
|
110
146
|
box-shadow: 0 0 0 1px $gray-800, 0 0 0 calc(var(--wp-admin-border-width-focus) + 1px) var(--wp-admin-theme-color);
|
|
111
147
|
}
|
|
112
148
|
}
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
EntitiesSavedStates,
|
|
23
23
|
} from '@wordpress/editor';
|
|
24
24
|
import { __ } from '@wordpress/i18n';
|
|
25
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* Internal dependencies
|
|
@@ -64,8 +63,6 @@ export default function Editor() {
|
|
|
64
63
|
isInserterOpen,
|
|
65
64
|
isListViewOpen,
|
|
66
65
|
isSaveViewOpen,
|
|
67
|
-
previousShortcut,
|
|
68
|
-
nextShortcut,
|
|
69
66
|
showIconLabels,
|
|
70
67
|
} = useSelect( ( select ) => {
|
|
71
68
|
const {
|
|
@@ -80,9 +77,6 @@ export default function Editor() {
|
|
|
80
77
|
} = select( editSiteStore );
|
|
81
78
|
const { hasFinishedResolution, getEntityRecord } = select( coreStore );
|
|
82
79
|
const { __unstableGetEditorMode } = select( blockEditorStore );
|
|
83
|
-
const { getAllShortcutKeyCombinations } = select(
|
|
84
|
-
keyboardShortcutsStore
|
|
85
|
-
);
|
|
86
80
|
const { getActiveComplementaryArea } = select( interfaceStore );
|
|
87
81
|
const postType = getEditedPostType();
|
|
88
82
|
const postId = getEditedPostId();
|
|
@@ -112,12 +106,6 @@ export default function Editor() {
|
|
|
112
106
|
isRightSidebarOpen: getActiveComplementaryArea(
|
|
113
107
|
editSiteStore.name
|
|
114
108
|
),
|
|
115
|
-
previousShortcut: getAllShortcutKeyCombinations(
|
|
116
|
-
'core/edit-site/previous-region'
|
|
117
|
-
),
|
|
118
|
-
nextShortcut: getAllShortcutKeyCombinations(
|
|
119
|
-
'core/edit-site/next-region'
|
|
120
|
-
),
|
|
121
109
|
showIconLabels: select( preferencesStore ).get(
|
|
122
110
|
'core/edit-site',
|
|
123
111
|
'showIconLabels'
|
|
@@ -178,6 +166,7 @@ export default function Editor() {
|
|
|
178
166
|
<BlockContextProvider value={ blockContext }>
|
|
179
167
|
<SidebarComplementaryAreaFills />
|
|
180
168
|
<InterfaceSkeleton
|
|
169
|
+
enableRegionNavigation={ false }
|
|
181
170
|
className={
|
|
182
171
|
showIconLabels && 'show-icon-labels'
|
|
183
172
|
}
|
|
@@ -185,7 +174,7 @@ export default function Editor() {
|
|
|
185
174
|
content={
|
|
186
175
|
<>
|
|
187
176
|
<GlobalStylesRenderer />
|
|
188
|
-
<EditorNotices />
|
|
177
|
+
{ isEditMode && <EditorNotices /> }
|
|
189
178
|
{ showVisualEditor && editedPost && (
|
|
190
179
|
<BlockEditor />
|
|
191
180
|
) }
|
|
@@ -258,10 +247,6 @@ export default function Editor() {
|
|
|
258
247
|
/>
|
|
259
248
|
)
|
|
260
249
|
}
|
|
261
|
-
shortcuts={ {
|
|
262
|
-
previous: previousShortcut,
|
|
263
|
-
next: nextShortcut,
|
|
264
|
-
} }
|
|
265
250
|
labels={ {
|
|
266
251
|
...interfaceLabels,
|
|
267
252
|
secondarySidebar: secondarySidebarLabel,
|
|
@@ -4,25 +4,52 @@
|
|
|
4
4
|
import { BlockPreview } from '@wordpress/block-editor';
|
|
5
5
|
import { getBlockType, getBlockFromExample } from '@wordpress/blocks';
|
|
6
6
|
import { useResizeObserver } from '@wordpress/compose';
|
|
7
|
+
import { __experimentalSpacer as Spacer } from '@wordpress/components';
|
|
7
8
|
|
|
8
|
-
const BlockPreviewPanel = ( { name } ) => {
|
|
9
|
-
const blockExample = getBlockType( name )?.example;
|
|
9
|
+
const BlockPreviewPanel = ( { name, variation = '' } ) => {
|
|
10
10
|
const [
|
|
11
11
|
containerResizeListener,
|
|
12
12
|
{ width: containerWidth, height: containerHeight },
|
|
13
13
|
] = useResizeObserver();
|
|
14
|
+
const blockExample = getBlockType( name )?.example;
|
|
15
|
+
const blockExampleWithVariation = {
|
|
16
|
+
...blockExample,
|
|
17
|
+
attributes: {
|
|
18
|
+
...blockExample?.attributes,
|
|
19
|
+
className: variation,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const blocks =
|
|
23
|
+
blockExample &&
|
|
24
|
+
getBlockFromExample(
|
|
25
|
+
name,
|
|
26
|
+
variation ? blockExampleWithVariation : blockExample
|
|
27
|
+
);
|
|
14
28
|
const viewportWidth = blockExample?.viewportWidth || containerWidth;
|
|
29
|
+
const minHeight = containerHeight;
|
|
15
30
|
|
|
16
31
|
return ! blockExample ? null : (
|
|
17
|
-
<
|
|
18
|
-
|
|
32
|
+
<Spacer marginX={ 4 } marginBottom={ 4 }>
|
|
33
|
+
<div className="edit-site-global-styles__block-preview-panel">
|
|
34
|
+
{ containerResizeListener }
|
|
19
35
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
<BlockPreview
|
|
37
|
+
blocks={ blocks }
|
|
38
|
+
viewportWidth={ viewportWidth }
|
|
39
|
+
__experimentalMinHeight={ minHeight }
|
|
40
|
+
__experimentalStyles={ [
|
|
41
|
+
{
|
|
42
|
+
css: `
|
|
43
|
+
body{
|
|
44
|
+
min-height:${ minHeight }px;
|
|
45
|
+
display:flex;align-items:center;justify-content:center;
|
|
46
|
+
}
|
|
47
|
+
`,
|
|
48
|
+
},
|
|
49
|
+
] }
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
</Spacer>
|
|
26
53
|
);
|
|
27
54
|
};
|
|
28
55
|
|
|
@@ -94,11 +94,15 @@ function applyAllFallbackStyles( border ) {
|
|
|
94
94
|
return applyFallbackStyle( border );
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export default function BorderPanel( { name } ) {
|
|
97
|
+
export default function BorderPanel( { name, variationPath = '' } ) {
|
|
98
98
|
// To better reflect if the user has customized a value we need to
|
|
99
99
|
// ensure the style value being checked is from the `user` origin.
|
|
100
|
-
const [ userBorderStyles ] = useStyle(
|
|
101
|
-
|
|
100
|
+
const [ userBorderStyles ] = useStyle(
|
|
101
|
+
`${ variationPath }border`,
|
|
102
|
+
name,
|
|
103
|
+
'user'
|
|
104
|
+
);
|
|
105
|
+
const [ border, setBorder ] = useStyle( `${ variationPath }border`, name );
|
|
102
106
|
const colors = useColorsPerOrigin( name );
|
|
103
107
|
|
|
104
108
|
const showBorderColor = useHasBorderColorControl( name );
|
|
@@ -108,7 +112,7 @@ export default function BorderPanel( { name } ) {
|
|
|
108
112
|
// Border radius.
|
|
109
113
|
const showBorderRadius = useHasBorderRadiusControl( name );
|
|
110
114
|
const [ borderRadiusValues, setBorderRadius ] = useStyle(
|
|
111
|
-
|
|
115
|
+
`${ variationPath }border.radius`,
|
|
112
116
|
name
|
|
113
117
|
);
|
|
114
118
|
const hasBorderRadius = () => {
|
|
@@ -184,7 +188,6 @@ export default function BorderPanel( { name } ) {
|
|
|
184
188
|
popoverOffset={ 40 }
|
|
185
189
|
popoverPlacement="left-start"
|
|
186
190
|
value={ border }
|
|
187
|
-
__experimentalHasMultipleOrigins={ true }
|
|
188
191
|
__experimentalIsRenderedInSidebar={ true }
|
|
189
192
|
size={ '__unstable-large' }
|
|
190
193
|
/>
|
|
@@ -12,7 +12,9 @@ import { useHasBorderPanel } from './border-panel';
|
|
|
12
12
|
import { useHasColorPanel } from './color-utils';
|
|
13
13
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
14
14
|
import { useHasTypographyPanel } from './typography-panel';
|
|
15
|
+
import { useHasVariationsPanel } from './variations-panel';
|
|
15
16
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
17
|
+
import { ScreenVariations } from './screen-variations';
|
|
16
18
|
|
|
17
19
|
function ContextMenu( { name, parentMenu = '' } ) {
|
|
18
20
|
const hasTypographyPanel = useHasTypographyPanel( name );
|
|
@@ -20,6 +22,7 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
20
22
|
const hasBorderPanel = useHasBorderPanel( name );
|
|
21
23
|
const hasDimensionsPanel = useHasDimensionsPanel( name );
|
|
22
24
|
const hasLayoutPanel = hasDimensionsPanel;
|
|
25
|
+
const hasVariationsPanel = useHasVariationsPanel( name, parentMenu );
|
|
23
26
|
|
|
24
27
|
return (
|
|
25
28
|
<ItemGroup>
|
|
@@ -59,6 +62,9 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
59
62
|
{ __( 'Layout' ) }
|
|
60
63
|
</NavigationButtonAsItem>
|
|
61
64
|
) }
|
|
65
|
+
{ hasVariationsPanel && (
|
|
66
|
+
<ScreenVariations name={ name } path={ parentMenu } />
|
|
67
|
+
) }
|
|
62
68
|
</ItemGroup>
|
|
63
69
|
);
|
|
64
70
|
}
|
|
@@ -197,8 +197,11 @@ function useWideSizeProps( name ) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
// Props for managing `spacing.padding`.
|
|
200
|
-
function usePaddingProps( name ) {
|
|
201
|
-
const [ rawPadding, setRawPadding ] = useStyle(
|
|
200
|
+
function usePaddingProps( name, variationPath = '' ) {
|
|
201
|
+
const [ rawPadding, setRawPadding ] = useStyle(
|
|
202
|
+
variationPath + 'spacing.padding',
|
|
203
|
+
name
|
|
204
|
+
);
|
|
202
205
|
const paddingValues = splitStyleValue( rawPadding );
|
|
203
206
|
const paddingSides = useCustomSides( name, 'padding' );
|
|
204
207
|
const isAxialPadding =
|
|
@@ -210,7 +213,11 @@ function usePaddingProps( name ) {
|
|
|
210
213
|
setRawPadding( padding );
|
|
211
214
|
};
|
|
212
215
|
const resetPaddingValue = () => setPaddingValues( {} );
|
|
213
|
-
const [ userSetPaddingValue ] = useStyle(
|
|
216
|
+
const [ userSetPaddingValue ] = useStyle(
|
|
217
|
+
variationPath + 'spacing.padding',
|
|
218
|
+
name,
|
|
219
|
+
'user'
|
|
220
|
+
);
|
|
214
221
|
// The `hasPaddingValue` check does not need a parsed value, as `userSetPaddingValue` will be `undefined` if not set.
|
|
215
222
|
const hasPaddingValue = () => !! userSetPaddingValue;
|
|
216
223
|
|
|
@@ -225,8 +232,11 @@ function usePaddingProps( name ) {
|
|
|
225
232
|
}
|
|
226
233
|
|
|
227
234
|
// Props for managing `spacing.margin`.
|
|
228
|
-
function useMarginProps( name ) {
|
|
229
|
-
const [ rawMargin, setRawMargin ] = useStyle(
|
|
235
|
+
function useMarginProps( name, variationPath = '' ) {
|
|
236
|
+
const [ rawMargin, setRawMargin ] = useStyle(
|
|
237
|
+
variationPath + 'spacing.margin',
|
|
238
|
+
name
|
|
239
|
+
);
|
|
230
240
|
const marginValues = splitStyleValue( rawMargin );
|
|
231
241
|
const marginSides = useCustomSides( name, 'margin' );
|
|
232
242
|
const isAxialMargin =
|
|
@@ -252,14 +262,21 @@ function useMarginProps( name ) {
|
|
|
252
262
|
}
|
|
253
263
|
|
|
254
264
|
// Props for managing `spacing.blockGap`.
|
|
255
|
-
function useBlockGapProps( name ) {
|
|
256
|
-
const [ gapValue, setGapValue ] = useStyle(
|
|
265
|
+
function useBlockGapProps( name, variationPath = '' ) {
|
|
266
|
+
const [ gapValue, setGapValue ] = useStyle(
|
|
267
|
+
variationPath + 'spacing.blockGap',
|
|
268
|
+
name
|
|
269
|
+
);
|
|
257
270
|
const gapValues = splitGapValue( gapValue );
|
|
258
271
|
const gapSides = useCustomSides( name, 'blockGap' );
|
|
259
272
|
const isAxialGap =
|
|
260
273
|
gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );
|
|
261
274
|
const resetGapValue = () => setGapValue( undefined );
|
|
262
|
-
const [ userSetGapValue ] = useStyle(
|
|
275
|
+
const [ userSetGapValue ] = useStyle(
|
|
276
|
+
variationPath + 'spacing.blockGap',
|
|
277
|
+
name,
|
|
278
|
+
'user'
|
|
279
|
+
);
|
|
263
280
|
const hasGapValue = () => !! userSetGapValue;
|
|
264
281
|
const setGapValues = ( nextBoxGapValue ) => {
|
|
265
282
|
if ( ! nextBoxGapValue ) {
|
|
@@ -288,9 +305,9 @@ function useBlockGapProps( name ) {
|
|
|
288
305
|
}
|
|
289
306
|
|
|
290
307
|
// Props for managing `dimensions.minHeight`.
|
|
291
|
-
function useMinHeightProps( name ) {
|
|
308
|
+
function useMinHeightProps( name, variationPath = '' ) {
|
|
292
309
|
const [ minHeightValue, setMinHeightValue ] = useStyle(
|
|
293
|
-
'dimensions.minHeight',
|
|
310
|
+
variationPath + 'dimensions.minHeight',
|
|
294
311
|
name
|
|
295
312
|
);
|
|
296
313
|
const resetMinHeightValue = () => setMinHeightValue( undefined );
|
|
@@ -303,7 +320,7 @@ function useMinHeightProps( name ) {
|
|
|
303
320
|
};
|
|
304
321
|
}
|
|
305
322
|
|
|
306
|
-
export default function DimensionsPanel( { name } ) {
|
|
323
|
+
export default function DimensionsPanel( { name, variationPath = '' } ) {
|
|
307
324
|
const showContentSizeControl = useHasContentSize( name );
|
|
308
325
|
const showWideSizeControl = useHasWideSize( name );
|
|
309
326
|
const showPaddingControl = useHasPadding( name );
|
|
@@ -345,7 +362,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
345
362
|
setPaddingValues,
|
|
346
363
|
resetPaddingValue,
|
|
347
364
|
hasPaddingValue,
|
|
348
|
-
} = usePaddingProps( name );
|
|
365
|
+
} = usePaddingProps( name, variationPath );
|
|
349
366
|
|
|
350
367
|
// Props for managing `spacing.margin`.
|
|
351
368
|
const {
|
|
@@ -355,7 +372,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
355
372
|
setMarginValues,
|
|
356
373
|
resetMarginValue,
|
|
357
374
|
hasMarginValue,
|
|
358
|
-
} = useMarginProps( name );
|
|
375
|
+
} = useMarginProps( name, variationPath );
|
|
359
376
|
|
|
360
377
|
// Props for managing `spacing.blockGap`.
|
|
361
378
|
const {
|
|
@@ -367,7 +384,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
367
384
|
setGapValues,
|
|
368
385
|
resetGapValue,
|
|
369
386
|
hasGapValue,
|
|
370
|
-
} = useBlockGapProps( name );
|
|
387
|
+
} = useBlockGapProps( name, variationPath );
|
|
371
388
|
|
|
372
389
|
// Props for managing `dimensions.minHeight`.
|
|
373
390
|
const {
|
|
@@ -375,7 +392,7 @@ export default function DimensionsPanel( { name } ) {
|
|
|
375
392
|
setMinHeightValue,
|
|
376
393
|
resetMinHeightValue,
|
|
377
394
|
hasMinHeightValue,
|
|
378
|
-
} = useMinHeightProps( name );
|
|
395
|
+
} = useMinHeightProps( name, variationPath );
|
|
379
396
|
|
|
380
397
|
const resetAll = () => {
|
|
381
398
|
resetPaddingValue();
|
|
@@ -94,7 +94,7 @@ function useGlobalStylesUserConfig() {
|
|
|
94
94
|
}, [ settings, styles ] );
|
|
95
95
|
|
|
96
96
|
const setConfig = useCallback(
|
|
97
|
-
( callback ) => {
|
|
97
|
+
( callback, options = {} ) => {
|
|
98
98
|
const record = getEditedEntityRecord(
|
|
99
99
|
'root',
|
|
100
100
|
'globalStyles',
|
|
@@ -105,10 +105,16 @@ function useGlobalStylesUserConfig() {
|
|
|
105
105
|
settings: record?.settings ?? {},
|
|
106
106
|
};
|
|
107
107
|
const updatedConfig = callback( currentConfig );
|
|
108
|
-
editEntityRecord(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
editEntityRecord(
|
|
109
|
+
'root',
|
|
110
|
+
'globalStyles',
|
|
111
|
+
globalStylesId,
|
|
112
|
+
{
|
|
113
|
+
styles: cleanEmptyObject( updatedConfig.styles ) || {},
|
|
114
|
+
settings: cleanEmptyObject( updatedConfig.settings ) || {},
|
|
115
|
+
},
|
|
116
|
+
options
|
|
117
|
+
);
|
|
112
118
|
},
|
|
113
119
|
[ globalStylesId ]
|
|
114
120
|
);
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
useStyle,
|
|
17
17
|
} from './hooks';
|
|
18
18
|
|
|
19
|
-
function ScreenBackgroundColor( { name } ) {
|
|
19
|
+
function ScreenBackgroundColor( { name, variationPath = '' } ) {
|
|
20
20
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
21
21
|
const [ solids ] = useSetting( 'color.palette', name );
|
|
22
22
|
const [ gradients ] = useSetting( 'color.gradients', name );
|
|
@@ -39,16 +39,23 @@ function ScreenBackgroundColor( { name } ) {
|
|
|
39
39
|
supports.includes( 'background' ) &&
|
|
40
40
|
( gradients.length > 0 || areCustomGradientsEnabled );
|
|
41
41
|
const [ backgroundColor, setBackgroundColor ] = useStyle(
|
|
42
|
-
'color.background',
|
|
42
|
+
variationPath + 'color.background',
|
|
43
43
|
name
|
|
44
44
|
);
|
|
45
45
|
const [ userBackgroundColor ] = useStyle(
|
|
46
|
-
'color.background',
|
|
46
|
+
variationPath + 'color.background',
|
|
47
|
+
name,
|
|
48
|
+
'user'
|
|
49
|
+
);
|
|
50
|
+
const [ gradient, setGradient ] = useStyle(
|
|
51
|
+
variationPath + 'color.gradient',
|
|
52
|
+
name
|
|
53
|
+
);
|
|
54
|
+
const [ userGradient ] = useStyle(
|
|
55
|
+
variationPath + 'color.gradient',
|
|
47
56
|
name,
|
|
48
57
|
'user'
|
|
49
58
|
);
|
|
50
|
-
const [ gradient, setGradient ] = useStyle( 'color.gradient', name );
|
|
51
|
-
const [ userGradient ] = useStyle( 'color.gradient', name, 'user' );
|
|
52
59
|
|
|
53
60
|
if ( ! hasBackgroundColor && ! hasGradientColor ) {
|
|
54
61
|
return null;
|
|
@@ -96,7 +103,6 @@ function ScreenBackgroundColor( { name } ) {
|
|
|
96
103
|
gradients={ gradientsPerOrigin }
|
|
97
104
|
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
98
105
|
disableCustomGradients={ ! areCustomGradientsEnabled }
|
|
99
|
-
__experimentalHasMultipleOrigins
|
|
100
106
|
showTitle={ false }
|
|
101
107
|
enableAlpha
|
|
102
108
|
__experimentalIsRenderedInSidebar
|
|
@@ -21,6 +21,7 @@ import { useHasBorderPanel } from './border-panel';
|
|
|
21
21
|
import { useHasColorPanel } from './color-utils';
|
|
22
22
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
23
23
|
import { useHasTypographyPanel } from './typography-panel';
|
|
24
|
+
import { useHasVariationsPanel } from './variations-panel';
|
|
24
25
|
import ScreenHeader from './header';
|
|
25
26
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
26
27
|
|
|
@@ -53,8 +54,12 @@ function BlockMenuItem( { block } ) {
|
|
|
53
54
|
const hasBorderPanel = useHasBorderPanel( block.name );
|
|
54
55
|
const hasDimensionsPanel = useHasDimensionsPanel( block.name );
|
|
55
56
|
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
57
|
+
const hasVariationsPanel = useHasVariationsPanel( block.name );
|
|
56
58
|
const hasBlockMenuItem =
|
|
57
|
-
hasTypographyPanel ||
|
|
59
|
+
hasTypographyPanel ||
|
|
60
|
+
hasColorPanel ||
|
|
61
|
+
hasLayoutPanel ||
|
|
62
|
+
hasVariationsPanel;
|
|
58
63
|
|
|
59
64
|
if ( ! hasBlockMenuItem ) {
|
|
60
65
|
return null;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { getBlockType } from '@wordpress/blocks';
|
|
5
|
-
import { __experimentalSpacer as Spacer } from '@wordpress/components';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
@@ -17,9 +16,7 @@ function ScreenBlock( { name } ) {
|
|
|
17
16
|
return (
|
|
18
17
|
<>
|
|
19
18
|
<ScreenHeader title={ blockType.title } />
|
|
20
|
-
<
|
|
21
|
-
<BlockPreviewPanel name={ name } />
|
|
22
|
-
</Spacer>
|
|
19
|
+
<BlockPreviewPanel name={ name } />
|
|
23
20
|
<ContextMenu
|
|
24
21
|
parentMenu={ '/blocks/' + encodeURIComponent( name ) }
|
|
25
22
|
name={ name }
|