@wordpress/edit-site 4.13.1-next.957ca95e4c.0 → 4.14.1
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 +2 -0
- package/build/components/block-editor/index.js +20 -10
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +8 -1
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/index.js +9 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +6 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +40 -4
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +41 -29
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/document-actions/index.js +11 -8
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/index.js +41 -5
- package/build/components/header/index.js.map +1 -1
- package/build/components/list/header.js +15 -2
- package/build/components/list/header.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +10 -4
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +8 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +16 -0
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/index.js +4 -1
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/index.js +20 -9
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +9 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/index.js +10 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +6 -2
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +6 -4
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +41 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +42 -30
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +12 -9
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/index.js +42 -7
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/list/header.js +14 -2
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +11 -5
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +7 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +16 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +28 -16
- package/build-style/style.css +28 -16
- package/package.json +29 -29
- package/src/components/block-editor/index.js +34 -16
- package/src/components/block-editor/resizable-editor.js +10 -3
- package/src/components/code-editor/style.scss +2 -3
- package/src/components/editor/index.js +12 -5
- package/src/components/global-styles/gradients-palette-panel.js +25 -12
- package/src/components/global-styles/hooks.js +5 -4
- package/src/components/global-styles/typography-panel.js +40 -6
- package/src/components/global-styles/use-global-styles-output.js +66 -57
- package/src/components/header/document-actions/index.js +16 -9
- package/src/components/header/index.js +61 -21
- package/src/components/header/style.scss +9 -0
- package/src/components/list/header.js +15 -5
- package/src/components/navigation-sidebar/navigation-panel/index.js +30 -24
- package/src/components/sidebar/index.js +23 -20
- package/src/components/template-part-converter/convert-to-template-part.js +14 -1
- package/src/index.js +4 -0
- package/src/style.scss +1 -0
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
@@ -7,11 +12,12 @@ import {
|
|
|
7
12
|
ToolSelector,
|
|
8
13
|
__experimentalPreviewOptions as PreviewOptions,
|
|
9
14
|
NavigableToolbar,
|
|
15
|
+
store as blockEditorStore,
|
|
10
16
|
} from '@wordpress/block-editor';
|
|
11
17
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
18
|
import { PinnedItems } from '@wordpress/interface';
|
|
13
19
|
import { _x, __ } from '@wordpress/i18n';
|
|
14
|
-
import { listView, plus, external } from '@wordpress/icons';
|
|
20
|
+
import { listView, plus, external, chevronUpDown } from '@wordpress/icons';
|
|
15
21
|
import {
|
|
16
22
|
Button,
|
|
17
23
|
ToolbarItem,
|
|
@@ -55,6 +61,7 @@ export default function Header( {
|
|
|
55
61
|
isLoaded,
|
|
56
62
|
isVisualMode,
|
|
57
63
|
settings,
|
|
64
|
+
blockEditorMode,
|
|
58
65
|
} = useSelect( ( select ) => {
|
|
59
66
|
const {
|
|
60
67
|
__experimentalGetPreviewDeviceType,
|
|
@@ -69,6 +76,7 @@ export default function Header( {
|
|
|
69
76
|
const { __experimentalGetTemplateInfo: getTemplateInfo } =
|
|
70
77
|
select( editorStore );
|
|
71
78
|
const { getShortcutRepresentation } = select( keyboardShortcutsStore );
|
|
79
|
+
const { __unstableGetEditorMode } = select( blockEditorStore );
|
|
72
80
|
|
|
73
81
|
const postType = getEditedPostType();
|
|
74
82
|
const postId = getEditedPostId();
|
|
@@ -88,6 +96,7 @@ export default function Header( {
|
|
|
88
96
|
),
|
|
89
97
|
isVisualMode: getEditorMode() === 'visual',
|
|
90
98
|
settings: getSettings(),
|
|
99
|
+
blockEditorMode: __unstableGetEditorMode(),
|
|
91
100
|
};
|
|
92
101
|
}, [] );
|
|
93
102
|
|
|
@@ -96,6 +105,7 @@ export default function Header( {
|
|
|
96
105
|
setIsInserterOpened,
|
|
97
106
|
setIsListViewOpened,
|
|
98
107
|
} = useDispatch( editSiteStore );
|
|
108
|
+
const { __unstableSetEditorMode } = useDispatch( blockEditorStore );
|
|
99
109
|
|
|
100
110
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
101
111
|
|
|
@@ -122,6 +132,10 @@ export default function Header( {
|
|
|
122
132
|
);
|
|
123
133
|
const shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );
|
|
124
134
|
|
|
135
|
+
const isZoomedOutViewExperimentEnabled =
|
|
136
|
+
window?.__experimentalEnableZoomedOutView && isVisualMode;
|
|
137
|
+
const isZoomedOutView = blockEditorMode === 'zoom-out';
|
|
138
|
+
|
|
125
139
|
return (
|
|
126
140
|
<div className="edit-site-header">
|
|
127
141
|
<NavigableToolbar
|
|
@@ -169,8 +183,8 @@ export default function Header( {
|
|
|
169
183
|
<ToolbarItem
|
|
170
184
|
as={ Button }
|
|
171
185
|
className="edit-site-header-toolbar__list-view-toggle"
|
|
186
|
+
disabled={ ! isVisualMode && isZoomedOutView }
|
|
172
187
|
icon={ listView }
|
|
173
|
-
disabled={ ! isVisualMode }
|
|
174
188
|
isPressed={ isListViewOpen }
|
|
175
189
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
176
190
|
label={ __( 'List View' ) }
|
|
@@ -181,6 +195,25 @@ export default function Header( {
|
|
|
181
195
|
showIconLabels ? 'tertiary' : undefined
|
|
182
196
|
}
|
|
183
197
|
/>
|
|
198
|
+
{ isZoomedOutViewExperimentEnabled && (
|
|
199
|
+
<ToolbarItem
|
|
200
|
+
as={ Button }
|
|
201
|
+
className="edit-site-header-toolbar__zoom-out-view-toggle"
|
|
202
|
+
icon={ chevronUpDown }
|
|
203
|
+
isPressed={ isZoomedOutView }
|
|
204
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
205
|
+
label={ __( 'Zoom-out View' ) }
|
|
206
|
+
onClick={ () => {
|
|
207
|
+
setPreviewDeviceType( 'desktop' );
|
|
208
|
+
setIsListViewOpened( false );
|
|
209
|
+
__unstableSetEditorMode(
|
|
210
|
+
isZoomedOutView
|
|
211
|
+
? 'edit'
|
|
212
|
+
: 'zoom-out'
|
|
213
|
+
);
|
|
214
|
+
} }
|
|
215
|
+
/>
|
|
216
|
+
) }
|
|
184
217
|
</>
|
|
185
218
|
) }
|
|
186
219
|
</div>
|
|
@@ -209,26 +242,33 @@ export default function Header( {
|
|
|
209
242
|
<div className="edit-site-header_end">
|
|
210
243
|
<div className="edit-site-header__actions">
|
|
211
244
|
{ ! isFocusMode && (
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
245
|
+
<div
|
|
246
|
+
className={ classnames(
|
|
247
|
+
'edit-site-header__actions__preview-options',
|
|
248
|
+
{ 'is-zoomed-out': isZoomedOutView }
|
|
249
|
+
) }
|
|
215
250
|
>
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
251
|
+
<PreviewOptions
|
|
252
|
+
deviceType={ deviceType }
|
|
253
|
+
setDeviceType={ setPreviewDeviceType }
|
|
254
|
+
>
|
|
255
|
+
<MenuGroup>
|
|
256
|
+
<MenuItem
|
|
257
|
+
href={ settings?.siteUrl }
|
|
258
|
+
target="_blank"
|
|
259
|
+
icon={ external }
|
|
260
|
+
>
|
|
261
|
+
{ __( 'View site' ) }
|
|
262
|
+
<VisuallyHidden as="span">
|
|
263
|
+
{
|
|
264
|
+
/* translators: accessibility text */
|
|
265
|
+
__( '(opens in a new tab)' )
|
|
266
|
+
}
|
|
267
|
+
</VisuallyHidden>
|
|
268
|
+
</MenuItem>
|
|
269
|
+
</MenuGroup>
|
|
270
|
+
</PreviewOptions>
|
|
271
|
+
</div>
|
|
232
272
|
) }
|
|
233
273
|
<SaveButton
|
|
234
274
|
openEntitiesSavedStates={ openEntitiesSavedStates }
|
|
@@ -135,6 +135,15 @@ body.is-navigation-sidebar-open {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
.edit-site-header__actions__preview-options {
|
|
139
|
+
opacity: 1;
|
|
140
|
+
transition: opacity 0.3s;
|
|
141
|
+
|
|
142
|
+
&.is-zoomed-out {
|
|
143
|
+
opacity: 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
138
147
|
.edit-site-header__actions-more-menu {
|
|
139
148
|
margin-left: -4px;
|
|
140
149
|
|
|
@@ -9,10 +9,18 @@ import { __experimentalHeading as Heading } from '@wordpress/components';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import AddNewTemplate from '../add-new-template';
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
12
13
|
|
|
13
14
|
export default function Header( { templateType } ) {
|
|
14
|
-
const postType = useSelect(
|
|
15
|
-
( select ) =>
|
|
15
|
+
const { canCreate, postType } = useSelect(
|
|
16
|
+
( select ) => {
|
|
17
|
+
const { supportsTemplatePartsMode } =
|
|
18
|
+
select( editSiteStore ).getSettings();
|
|
19
|
+
return {
|
|
20
|
+
postType: select( coreStore ).getPostType( templateType ),
|
|
21
|
+
canCreate: ! supportsTemplatePartsMode,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
16
24
|
[ templateType ]
|
|
17
25
|
);
|
|
18
26
|
|
|
@@ -26,9 +34,11 @@ export default function Header( { templateType } ) {
|
|
|
26
34
|
{ postType.labels?.name }
|
|
27
35
|
</Heading>
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
37
|
+
{ canCreate && (
|
|
38
|
+
<div className="edit-site-list-header__right">
|
|
39
|
+
<AddNewTemplate templateType={ templateType } />
|
|
40
|
+
</div>
|
|
41
|
+
) }
|
|
32
42
|
</header>
|
|
33
43
|
);
|
|
34
44
|
}
|
|
@@ -40,22 +40,23 @@ function NavLink( { params, replace, ...props } ) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
43
|
-
const { homeTemplate, isNavigationOpen, siteTitle } =
|
|
44
|
-
( select ) => {
|
|
43
|
+
const { homeTemplate, isNavigationOpen, isTemplatePartsMode, siteTitle } =
|
|
44
|
+
useSelect( ( select ) => {
|
|
45
45
|
const { getEntityRecord } = select( coreDataStore );
|
|
46
46
|
const { getSettings, isNavigationOpened } = select( editSiteStore );
|
|
47
47
|
|
|
48
48
|
const siteData =
|
|
49
49
|
getEntityRecord( 'root', '__unstableBase', undefined ) || {};
|
|
50
|
+
const { supportsTemplatePartsMode, __unstableHomeTemplate } =
|
|
51
|
+
getSettings();
|
|
50
52
|
|
|
51
53
|
return {
|
|
52
54
|
siteTitle: siteData.name,
|
|
53
|
-
homeTemplate:
|
|
55
|
+
homeTemplate: __unstableHomeTemplate,
|
|
54
56
|
isNavigationOpen: isNavigationOpened(),
|
|
57
|
+
isTemplatePartsMode: !! supportsTemplatePartsMode,
|
|
55
58
|
};
|
|
56
|
-
},
|
|
57
|
-
[]
|
|
58
|
-
);
|
|
59
|
+
}, [] );
|
|
59
60
|
const { setIsNavigationPanelOpened } = useDispatch( editSiteStore );
|
|
60
61
|
|
|
61
62
|
const closeOnEscape = ( event ) => {
|
|
@@ -91,24 +92,29 @@ const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
|
91
92
|
|
|
92
93
|
<NavigationMenu>
|
|
93
94
|
<NavigationGroup title={ __( 'Editor' ) }>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
{ ! isTemplatePartsMode && (
|
|
96
|
+
<>
|
|
97
|
+
<NavLink
|
|
98
|
+
icon={ siteIcon }
|
|
99
|
+
title={ __( 'Site' ) }
|
|
100
|
+
item={ SITE_EDITOR_KEY }
|
|
101
|
+
params={ {
|
|
102
|
+
postId: homeTemplate?.postId,
|
|
103
|
+
postType:
|
|
104
|
+
homeTemplate?.postType,
|
|
105
|
+
} }
|
|
106
|
+
/>
|
|
107
|
+
<NavLink
|
|
108
|
+
icon={ templateIcon }
|
|
109
|
+
title={ __( 'Templates' ) }
|
|
110
|
+
item="wp_template"
|
|
111
|
+
params={ {
|
|
112
|
+
postId: undefined,
|
|
113
|
+
postType: 'wp_template',
|
|
114
|
+
} }
|
|
115
|
+
/>
|
|
116
|
+
</>
|
|
117
|
+
) }
|
|
112
118
|
<NavLink
|
|
113
119
|
icon={ templatePartIcon }
|
|
114
120
|
title={ __( 'Template Parts' ) }
|
|
@@ -19,6 +19,7 @@ import { STORE_NAME } from '../../store/constants';
|
|
|
19
19
|
import SettingsHeader from './settings-header';
|
|
20
20
|
import TemplateCard from './template-card';
|
|
21
21
|
import { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';
|
|
22
|
+
import { store as editSiteStore } from '../../store';
|
|
22
23
|
|
|
23
24
|
const { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(
|
|
24
25
|
'EditSiteSidebarInspector'
|
|
@@ -26,25 +27,27 @@ const { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(
|
|
|
26
27
|
export const SidebarInspectorFill = InspectorFill;
|
|
27
28
|
|
|
28
29
|
export function SidebarComplementaryAreaFills() {
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
const {
|
|
31
|
+
sidebar,
|
|
32
|
+
isEditorSidebarOpened,
|
|
33
|
+
hasBlockSelection,
|
|
34
|
+
supportsGlobalStyles,
|
|
35
|
+
} = useSelect( ( select ) => {
|
|
36
|
+
const _sidebar =
|
|
37
|
+
select( interfaceStore ).getActiveComplementaryArea( STORE_NAME );
|
|
38
|
+
const _isEditorSidebarOpened = [
|
|
39
|
+
SIDEBAR_BLOCK,
|
|
40
|
+
SIDEBAR_TEMPLATE,
|
|
41
|
+
].includes( _sidebar );
|
|
42
|
+
const settings = select( editSiteStore ).getSettings();
|
|
43
|
+
return {
|
|
44
|
+
sidebar: _sidebar,
|
|
45
|
+
isEditorSidebarOpened: _isEditorSidebarOpened,
|
|
46
|
+
hasBlockSelection:
|
|
47
|
+
!! select( blockEditorStore ).getBlockSelectionStart(),
|
|
48
|
+
supportsGlobalStyles: ! settings?.supportsTemplatePartsMode,
|
|
49
|
+
};
|
|
50
|
+
}, [] );
|
|
48
51
|
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
49
52
|
|
|
50
53
|
useEffect( () => {
|
|
@@ -89,7 +92,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
89
92
|
<InspectorSlot bubblesVirtually />
|
|
90
93
|
) }
|
|
91
94
|
</DefaultSidebar>
|
|
92
|
-
<GlobalStylesSidebar />
|
|
95
|
+
{ supportsGlobalStyles && <GlobalStylesSidebar /> }
|
|
93
96
|
<MaybeNavigationMenuSidebar />
|
|
94
97
|
</>
|
|
95
98
|
);
|
|
@@ -6,7 +6,7 @@ import { kebabCase } from 'lodash';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useDispatch } from '@wordpress/data';
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
10
|
import {
|
|
11
11
|
BlockSettingsMenuControls,
|
|
12
12
|
store as blockEditorStore,
|
|
@@ -23,6 +23,7 @@ import { symbolFilled } from '@wordpress/icons';
|
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
25
|
import CreateTemplatePartModal from '../create-template-part-modal';
|
|
26
|
+
import { store as editSiteStore } from '../../store';
|
|
26
27
|
|
|
27
28
|
export default function ConvertToTemplatePart( { clientIds, blocks } ) {
|
|
28
29
|
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
@@ -30,6 +31,18 @@ export default function ConvertToTemplatePart( { clientIds, blocks } ) {
|
|
|
30
31
|
const { saveEntityRecord } = useDispatch( coreStore );
|
|
31
32
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
32
33
|
|
|
34
|
+
const { canCreate } = useSelect( ( select ) => {
|
|
35
|
+
const { supportsTemplatePartsMode } =
|
|
36
|
+
select( editSiteStore ).getSettings();
|
|
37
|
+
return {
|
|
38
|
+
canCreate: ! supportsTemplatePartsMode,
|
|
39
|
+
};
|
|
40
|
+
}, [] );
|
|
41
|
+
|
|
42
|
+
if ( ! canCreate ) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
33
46
|
const onConvert = async ( { title, area } ) => {
|
|
34
47
|
// Currently template parts only allow latin chars.
|
|
35
48
|
// Fallback slug will receive suffix by default.
|
package/src/index.js
CHANGED
|
@@ -107,6 +107,10 @@ export function reinitializeEditor( target, settings ) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// Prevent the default browser action for files dropped outside of dropzones.
|
|
111
|
+
window.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );
|
|
112
|
+
window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );
|
|
113
|
+
|
|
110
114
|
render( <EditSiteApp reboot={ reboot } />, target );
|
|
111
115
|
}
|
|
112
116
|
|