@wordpress/edit-site 6.0.0 → 6.0.2
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/build/components/add-new-page/index.js +2 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +1 -1
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/editor/index.js +54 -60
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +39 -0
- package/build/components/editor/use-editor-title.js.map +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +4 -23
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -0
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +11 -16
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +2 -1
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -0
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -59
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/index.js +5 -5
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/pagination/index.js +17 -8
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +1 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/site-hub/index.js +38 -128
- package/build/components/site-hub/index.js.map +1 -1
- package/build/deprecated.js +11 -0
- package/build/deprecated.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/private-actions.js +33 -18
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-page/index.js +2 -1
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/editor/index.js +54 -60
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +31 -0
- package/build-module/components/editor/use-editor-title.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +4 -23
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +11 -16
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +3 -2
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -0
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +18 -61
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/pagination/index.js +17 -8
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +40 -130
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/deprecated.js +11 -0
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/private-actions.js +33 -18
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +43 -85
- package/build-style/style.css +43 -85
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +2 -1
- package/src/components/block-editor/inserter-media-categories.js +1 -3
- package/src/components/block-editor/style.scss +11 -0
- package/src/components/editor/index.js +69 -96
- package/src/components/editor/style.scss +1 -5
- package/src/components/editor/use-editor-title.js +35 -0
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-revisions/index.js +4 -24
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-revisions/style.scss +4 -8
- package/src/components/global-styles/shadows-edit-panel.js +1 -0
- package/src/components/global-styles/variations/variation.js +14 -19
- package/src/components/global-styles/variations/variations-color.js +12 -4
- package/src/components/global-styles/variations/variations-typography.js +5 -1
- package/src/components/global-styles-sidebar/index.js +2 -0
- package/src/components/layout/index.js +17 -67
- package/src/components/layout/style.scss +18 -58
- package/src/components/page-patterns/index.js +15 -12
- package/src/components/pagination/index.js +21 -16
- package/src/components/sidebar-dataviews/dataview-item.js +6 -2
- package/src/components/sidebar-navigation-screen/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
- package/src/components/site-hub/index.js +55 -146
- package/src/components/site-hub/style.scss +1 -4
- package/src/components/site-icon/style.scss +0 -4
- package/src/deprecated.js +14 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -2
- package/src/lock-unlock.js +1 -1
- package/src/store/private-actions.js +58 -30
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
position: sticky;
|
|
60
60
|
top: 0;
|
|
61
61
|
background: $gray-900;
|
|
62
|
-
padding-top: $grid-unit-60
|
|
62
|
+
padding-top: $grid-unit-60;
|
|
63
63
|
margin-bottom: $grid-unit-10;
|
|
64
64
|
padding-bottom: $grid-unit-10;
|
|
65
65
|
z-index: z-index(".edit-site-sidebar-navigation-screen__title-icon");
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
|
|
68
68
|
.edit-site-sidebar-navigation-screen__title {
|
|
69
69
|
flex-grow: 1;
|
|
70
|
-
padding: $grid-unit-15 * 0.5 0 0 0;
|
|
71
70
|
overflow-wrap: break-word;
|
|
71
|
+
padding: $grid-unit-05 * 0.5 0 0 0;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.edit-site-sidebar-navigation-screen__actions {
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
5
5
|
import { useLink } from '../routes/link';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
TEMPLATE_PART_POST_TYPE,
|
|
8
|
+
TEMPLATE_PART_ALL_AREAS_CATEGORY,
|
|
9
|
+
PATTERN_DEFAULT_CATEGORY,
|
|
10
|
+
PATTERN_TYPES,
|
|
11
|
+
} from '../../utils/constants';
|
|
7
12
|
|
|
8
13
|
export default function CategoryItem( {
|
|
9
14
|
count,
|
|
@@ -14,7 +19,11 @@ export default function CategoryItem( {
|
|
|
14
19
|
type,
|
|
15
20
|
} ) {
|
|
16
21
|
const linkInfo = useLink( {
|
|
17
|
-
categoryId:
|
|
22
|
+
categoryId:
|
|
23
|
+
id !== TEMPLATE_PART_ALL_AREAS_CATEGORY &&
|
|
24
|
+
id !== PATTERN_DEFAULT_CATEGORY
|
|
25
|
+
? id
|
|
26
|
+
: undefined,
|
|
18
27
|
postType:
|
|
19
28
|
type === TEMPLATE_PART_POST_TYPE
|
|
20
29
|
? TEMPLATE_PART_POST_TYPE
|
|
@@ -106,8 +106,12 @@ export default function SidebarNavigationScreenPatterns( { backPath } ) {
|
|
|
106
106
|
const {
|
|
107
107
|
params: { postType, categoryId },
|
|
108
108
|
} = useLocation();
|
|
109
|
-
const currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;
|
|
110
109
|
const currentType = postType || PATTERN_TYPES.user;
|
|
110
|
+
const currentCategory =
|
|
111
|
+
categoryId ||
|
|
112
|
+
( currentType === PATTERN_TYPES.user
|
|
113
|
+
? PATTERN_DEFAULT_CATEGORY
|
|
114
|
+
: TEMPLATE_PART_ALL_AREAS_CATEGORY );
|
|
111
115
|
|
|
112
116
|
const { templatePartAreas, hasTemplateParts, isLoading } =
|
|
113
117
|
useTemplatePartAreas();
|
|
@@ -7,19 +7,11 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import {
|
|
11
|
-
Button,
|
|
12
|
-
__unstableMotion as motion,
|
|
13
|
-
__unstableAnimatePresence as AnimatePresence,
|
|
14
|
-
__experimentalHStack as HStack,
|
|
15
|
-
} from '@wordpress/components';
|
|
16
|
-
import { useReducedMotion } from '@wordpress/compose';
|
|
10
|
+
import { Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
17
11
|
import { __ } from '@wordpress/i18n';
|
|
18
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
19
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
21
13
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
22
|
-
import { memo } from '@wordpress/element';
|
|
14
|
+
import { memo, forwardRef } from '@wordpress/element';
|
|
23
15
|
import { search } from '@wordpress/icons';
|
|
24
16
|
import { store as commandsStore } from '@wordpress/commands';
|
|
25
17
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
@@ -32,14 +24,10 @@ import { store as editSiteStore } from '../../store';
|
|
|
32
24
|
import SiteIcon from '../site-icon';
|
|
33
25
|
import { unlock } from '../../lock-unlock';
|
|
34
26
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
( select ) => {
|
|
40
|
-
const { getCanvasMode, getSettings } = unlock(
|
|
41
|
-
select( editSiteStore )
|
|
42
|
-
);
|
|
27
|
+
const SiteHub = memo(
|
|
28
|
+
forwardRef( ( { isTransparent }, ref ) => {
|
|
29
|
+
const { dashboardLink, homeUrl, siteTitle } = useSelect( ( select ) => {
|
|
30
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
43
31
|
|
|
44
32
|
const {
|
|
45
33
|
getSite,
|
|
@@ -47,7 +35,6 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
|
|
|
47
35
|
} = select( coreStore );
|
|
48
36
|
const _site = getSite();
|
|
49
37
|
return {
|
|
50
|
-
canvasMode: getCanvasMode(),
|
|
51
38
|
dashboardLink:
|
|
52
39
|
getSettings().__experimentalDashboardLink || 'index.php',
|
|
53
40
|
homeUrl: getUnstableBase()?.home,
|
|
@@ -56,141 +43,63 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
|
|
|
56
43
|
? filterURLForDisplay( _site?.url )
|
|
57
44
|
: _site?.title,
|
|
58
45
|
};
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
63
|
-
|
|
64
|
-
const disableMotion = useReducedMotion();
|
|
65
|
-
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
66
|
-
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
67
|
-
const { setDeviceType } = useDispatch( editorStore );
|
|
68
|
-
const isBackToDashboardButton = canvasMode === 'view';
|
|
69
|
-
const siteIconButtonProps = isBackToDashboardButton
|
|
70
|
-
? {
|
|
71
|
-
href: dashboardLink,
|
|
72
|
-
label: __( 'Go to the Dashboard' ),
|
|
73
|
-
}
|
|
74
|
-
: {
|
|
75
|
-
href: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
|
|
76
|
-
role: 'button',
|
|
77
|
-
label: __( 'Open Navigation' ),
|
|
78
|
-
onClick: ( event ) => {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
if ( canvasMode === 'edit' ) {
|
|
81
|
-
clearSelectedBlock();
|
|
82
|
-
setDeviceType( 'Desktop' );
|
|
83
|
-
setCanvasMode( 'view' );
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
};
|
|
46
|
+
}, [] );
|
|
47
|
+
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
87
48
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
transition={ {
|
|
99
|
-
type: 'tween',
|
|
100
|
-
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
101
|
-
ease: 'easeOut',
|
|
102
|
-
} }
|
|
103
|
-
>
|
|
104
|
-
<HStack justify="flex-start" spacing="0">
|
|
105
|
-
<motion.div
|
|
106
|
-
className={ clsx(
|
|
107
|
-
'edit-site-site-hub__view-mode-toggle-container',
|
|
108
|
-
{
|
|
109
|
-
'has-transparent-background': isTransparent,
|
|
110
|
-
}
|
|
111
|
-
) }
|
|
112
|
-
layout
|
|
113
|
-
transition={ {
|
|
114
|
-
type: 'tween',
|
|
115
|
-
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
116
|
-
ease: 'easeOut',
|
|
117
|
-
} }
|
|
118
|
-
>
|
|
119
|
-
<Button
|
|
120
|
-
{ ...siteIconButtonProps }
|
|
121
|
-
className="edit-site-layout__view-mode-toggle"
|
|
49
|
+
return (
|
|
50
|
+
<div className="edit-site-site-hub">
|
|
51
|
+
<HStack justify="flex-start" spacing="0">
|
|
52
|
+
<div
|
|
53
|
+
className={ clsx(
|
|
54
|
+
'edit-site-site-hub__view-mode-toggle-container',
|
|
55
|
+
{
|
|
56
|
+
'has-transparent-background': isTransparent,
|
|
57
|
+
}
|
|
58
|
+
) }
|
|
122
59
|
>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
transition={ {
|
|
132
|
-
type: 'tween',
|
|
133
|
-
duration: disableMotion
|
|
134
|
-
? 0
|
|
135
|
-
: HUB_ANIMATION_DURATION,
|
|
136
|
-
ease: 'easeOut',
|
|
60
|
+
<Button
|
|
61
|
+
ref={ ref }
|
|
62
|
+
href={ dashboardLink }
|
|
63
|
+
label={ __( 'Go to the Dashboard' ) }
|
|
64
|
+
className="edit-site-layout__view-mode-toggle"
|
|
65
|
+
style={ {
|
|
66
|
+
transform: 'scale(0.5)',
|
|
67
|
+
borderRadius: 4,
|
|
137
68
|
} }
|
|
138
69
|
>
|
|
139
70
|
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
140
|
-
</
|
|
141
|
-
</
|
|
142
|
-
</motion.div>
|
|
71
|
+
</Button>
|
|
72
|
+
</div>
|
|
143
73
|
|
|
144
|
-
|
|
145
|
-
|
|
74
|
+
<HStack>
|
|
75
|
+
<div className="edit-site-site-hub__title">
|
|
76
|
+
<Button
|
|
77
|
+
variant="link"
|
|
78
|
+
href={ homeUrl }
|
|
79
|
+
target="_blank"
|
|
80
|
+
label={ __( 'View site (opens in a new tab)' ) }
|
|
81
|
+
>
|
|
82
|
+
{ decodeEntities( siteTitle ) }
|
|
83
|
+
</Button>
|
|
84
|
+
</div>
|
|
146
85
|
<HStack
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
opacity: isTransparent ? 0 : 1,
|
|
151
|
-
} }
|
|
152
|
-
exit={ { opacity: 0 } }
|
|
153
|
-
transition={ {
|
|
154
|
-
type: 'tween',
|
|
155
|
-
duration: disableMotion ? 0 : 0.2,
|
|
156
|
-
ease: 'easeOut',
|
|
157
|
-
delay: canvasMode === 'view' ? 0.1 : 0,
|
|
158
|
-
} }
|
|
86
|
+
spacing={ 0 }
|
|
87
|
+
expanded={ false }
|
|
88
|
+
className="edit-site-site-hub__actions"
|
|
159
89
|
>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
) }
|
|
168
|
-
aria-label={ __(
|
|
169
|
-
'View site (opens in a new tab)'
|
|
170
|
-
) }
|
|
171
|
-
>
|
|
172
|
-
{ decodeEntities( siteTitle ) }
|
|
173
|
-
</Button>
|
|
174
|
-
</div>
|
|
175
|
-
<HStack
|
|
176
|
-
spacing={ 0 }
|
|
177
|
-
expanded={ false }
|
|
178
|
-
className="edit-site-site-hub__actions"
|
|
179
|
-
>
|
|
180
|
-
<Button
|
|
181
|
-
className="edit-site-site-hub_toggle-command-center"
|
|
182
|
-
icon={ search }
|
|
183
|
-
onClick={ () => openCommandCenter() }
|
|
184
|
-
label={ __( 'Open command palette' ) }
|
|
185
|
-
shortcut={ displayShortcut.primary( 'k' ) }
|
|
186
|
-
/>
|
|
187
|
-
</HStack>
|
|
90
|
+
<Button
|
|
91
|
+
className="edit-site-site-hub_toggle-command-center"
|
|
92
|
+
icon={ search }
|
|
93
|
+
onClick={ () => openCommandCenter() }
|
|
94
|
+
label={ __( 'Open command palette' ) }
|
|
95
|
+
shortcut={ displayShortcut.primary( 'k' ) }
|
|
96
|
+
/>
|
|
188
97
|
</HStack>
|
|
189
|
-
|
|
190
|
-
</
|
|
191
|
-
</
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
|
|
98
|
+
</HStack>
|
|
99
|
+
</HStack>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
} )
|
|
103
|
+
);
|
|
195
104
|
|
|
196
105
|
export default SiteHub;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
gap: $grid-unit-10;
|
|
6
|
+
margin-right: $grid-unit-15;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.edit-site-site-hub__actions {
|
|
@@ -14,10 +15,6 @@
|
|
|
14
15
|
width: $header-height;
|
|
15
16
|
flex-shrink: 0;
|
|
16
17
|
|
|
17
|
-
.edit-site-layout__view-mode-toggle-icon {
|
|
18
|
-
background: $gray-900;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
18
|
&.has-transparent-background .edit-site-layout__view-mode-toggle-icon {
|
|
22
19
|
background: transparent;
|
|
23
20
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
.edit-site-site-icon__icon {
|
|
2
2
|
fill: currentColor;
|
|
3
|
-
// Matches SiteIcon motion, smoothing out the transition.
|
|
4
|
-
transition: padding 0.3s ease-out;
|
|
5
|
-
@include reduce-motion("transition");
|
|
6
3
|
|
|
7
4
|
.edit-site-layout.is-full-canvas & {
|
|
8
5
|
// Make the WordPress icon not so big in full canvas.
|
|
@@ -13,7 +10,6 @@
|
|
|
13
10
|
.edit-site-site-icon__image {
|
|
14
11
|
width: 100%;
|
|
15
12
|
height: 100%;
|
|
16
|
-
border-radius: $radius-block-ui * 2;
|
|
17
13
|
object-fit: cover;
|
|
18
14
|
background: #333;
|
|
19
15
|
|
package/src/deprecated.js
CHANGED
|
@@ -6,8 +6,13 @@ import {
|
|
|
6
6
|
PluginSidebar as EditorPluginSidebar,
|
|
7
7
|
PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
|
|
8
8
|
} from '@wordpress/editor';
|
|
9
|
+
import { getPath } from '@wordpress/url';
|
|
9
10
|
import deprecated from '@wordpress/deprecated';
|
|
10
11
|
|
|
12
|
+
const isSiteEditor = getPath( window.location.href )?.includes(
|
|
13
|
+
'site-editor.php'
|
|
14
|
+
);
|
|
15
|
+
|
|
11
16
|
const deprecateSlot = ( name ) => {
|
|
12
17
|
deprecated( `wp.editPost.${ name }`, {
|
|
13
18
|
since: '6.6',
|
|
@@ -20,6 +25,9 @@ const deprecateSlot = ( name ) => {
|
|
|
20
25
|
* @see PluginMoreMenuItem in @wordpress/editor package.
|
|
21
26
|
*/
|
|
22
27
|
export function PluginMoreMenuItem( props ) {
|
|
28
|
+
if ( ! isSiteEditor ) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
23
31
|
deprecateSlot( 'PluginMoreMenuItem' );
|
|
24
32
|
return <EditorPluginMoreMenuItem { ...props } />;
|
|
25
33
|
}
|
|
@@ -28,6 +36,9 @@ export function PluginMoreMenuItem( props ) {
|
|
|
28
36
|
* @see PluginSidebar in @wordpress/editor package.
|
|
29
37
|
*/
|
|
30
38
|
export function PluginSidebar( props ) {
|
|
39
|
+
if ( ! isSiteEditor ) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
31
42
|
deprecateSlot( 'PluginSidebar' );
|
|
32
43
|
return <EditorPluginSidebar { ...props } />;
|
|
33
44
|
}
|
|
@@ -36,6 +47,9 @@ export function PluginSidebar( props ) {
|
|
|
36
47
|
* @see PluginSidebarMoreMenuItem in @wordpress/editor package.
|
|
37
48
|
*/
|
|
38
49
|
export function PluginSidebarMoreMenuItem( props ) {
|
|
50
|
+
if ( ! isSiteEditor ) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
39
53
|
deprecateSlot( 'PluginSidebarMoreMenuItem' );
|
|
40
54
|
return <EditorPluginSidebarMoreMenuItem { ...props } />;
|
|
41
55
|
}
|
|
@@ -287,7 +287,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
287
287
|
// notification.
|
|
288
288
|
__unstableMarkNextChangeAsNotPersistent();
|
|
289
289
|
setAttributes( newBlockAttributes );
|
|
290
|
-
setUserConfig(
|
|
290
|
+
setUserConfig( newUserConfig, { undoIgnore: true } );
|
|
291
291
|
createSuccessNotice(
|
|
292
292
|
sprintf(
|
|
293
293
|
// translators: %s: Title of the block e.g. 'Heading'.
|
|
@@ -302,7 +302,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
302
302
|
onClick() {
|
|
303
303
|
__unstableMarkNextChangeAsNotPersistent();
|
|
304
304
|
setAttributes( attributes );
|
|
305
|
-
setUserConfig(
|
|
305
|
+
setUserConfig( userConfig, {
|
|
306
306
|
undoIgnore: true,
|
|
307
307
|
} );
|
|
308
308
|
},
|
|
@@ -339,6 +339,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
339
339
|
<Button
|
|
340
340
|
__next40pxDefaultSize
|
|
341
341
|
variant="secondary"
|
|
342
|
+
__experimentalIsFocusable
|
|
342
343
|
disabled={ changes.length === 0 }
|
|
343
344
|
onClick={ pushChanges }
|
|
344
345
|
>
|
package/src/lock-unlock.js
CHANGED
|
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
|
|
|
5
5
|
|
|
6
6
|
export const { lock, unlock } =
|
|
7
7
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
8
|
-
'I
|
|
8
|
+
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
|
|
9
9
|
'@wordpress/edit-site'
|
|
10
10
|
);
|
|
@@ -13,39 +13,67 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
13
13
|
export const setCanvasMode =
|
|
14
14
|
( mode ) =>
|
|
15
15
|
( { registry, dispatch } ) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
const switchCanvasMode = () => {
|
|
17
|
+
registry.batch( () => {
|
|
18
|
+
const isMediumOrBigger =
|
|
19
|
+
window.matchMedia( '(min-width: 782px)' ).matches;
|
|
20
|
+
registry.dispatch( blockEditorStore ).clearSelectedBlock();
|
|
21
|
+
registry.dispatch( editorStore ).setDeviceType( 'Desktop' );
|
|
22
|
+
registry
|
|
23
|
+
.dispatch( blockEditorStore )
|
|
24
|
+
.__unstableSetEditorMode( 'edit' );
|
|
25
|
+
const isPublishSidebarOpened = registry
|
|
26
|
+
.select( editorStore )
|
|
27
|
+
.isPublishSidebarOpened();
|
|
28
|
+
dispatch( {
|
|
29
|
+
type: 'SET_CANVAS_MODE',
|
|
30
|
+
mode,
|
|
31
|
+
} );
|
|
32
|
+
const isEditMode = mode === 'edit';
|
|
33
|
+
if ( isPublishSidebarOpened && ! isEditMode ) {
|
|
34
|
+
registry.dispatch( editorStore ).closePublishSidebar();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Check if the block list view should be open by default.
|
|
38
|
+
// If `distractionFree` mode is enabled, the block list view should not be open.
|
|
39
|
+
// This behavior is disabled for small viewports.
|
|
40
|
+
if (
|
|
41
|
+
isMediumOrBigger &&
|
|
42
|
+
isEditMode &&
|
|
43
|
+
registry
|
|
44
|
+
.select( preferencesStore )
|
|
45
|
+
.get( 'core', 'showListViewByDefault' ) &&
|
|
46
|
+
! registry
|
|
47
|
+
.select( preferencesStore )
|
|
48
|
+
.get( 'core', 'distractionFree' )
|
|
49
|
+
) {
|
|
50
|
+
registry
|
|
51
|
+
.dispatch( editorStore )
|
|
52
|
+
.setIsListViewOpened( true );
|
|
53
|
+
} else {
|
|
54
|
+
registry
|
|
55
|
+
.dispatch( editorStore )
|
|
56
|
+
.setIsListViewOpened( false );
|
|
57
|
+
}
|
|
58
|
+
registry.dispatch( editorStore ).setIsInserterOpened( false );
|
|
59
|
+
} );
|
|
60
|
+
};
|
|
30
61
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// This behavior is disabled for small viewports.
|
|
34
|
-
if (
|
|
35
|
-
isMediumOrBigger &&
|
|
36
|
-
isEditMode &&
|
|
37
|
-
registry
|
|
38
|
-
.select( preferencesStore )
|
|
39
|
-
.get( 'core', 'showListViewByDefault' ) &&
|
|
40
|
-
! registry
|
|
41
|
-
.select( preferencesStore )
|
|
42
|
-
.get( 'core', 'distractionFree' )
|
|
43
|
-
) {
|
|
44
|
-
registry.dispatch( editorStore ).setIsListViewOpened( true );
|
|
62
|
+
if ( ! document.startViewTransition ) {
|
|
63
|
+
switchCanvasMode();
|
|
45
64
|
} else {
|
|
46
|
-
|
|
65
|
+
document.documentElement.classList.add(
|
|
66
|
+
`canvas-mode-${ mode }-transition`
|
|
67
|
+
);
|
|
68
|
+
const transition = document.startViewTransition( () =>
|
|
69
|
+
switchCanvasMode()
|
|
70
|
+
);
|
|
71
|
+
transition.finished.finally( () => {
|
|
72
|
+
document.documentElement.classList.remove(
|
|
73
|
+
`canvas-mode-${ mode }-transition`
|
|
74
|
+
);
|
|
75
|
+
} );
|
|
47
76
|
}
|
|
48
|
-
registry.dispatch( editorStore ).setIsInserterOpened( false );
|
|
49
77
|
};
|
|
50
78
|
|
|
51
79
|
/**
|