@wordpress/edit-site 6.0.1 → 6.1.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 +2 -0
- package/build/components/add-new-page/index.js +2 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/app/index.js +17 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/index.js +3 -10
- package/build/components/editor/index.js.map +1 -1
- 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-revisions/index.js +4 -23
- package/build/components/global-styles/screen-revisions/index.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 +1 -0
- 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/layout/index.js +8 -37
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -0
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/posts-app/index.js +50 -0
- package/build/components/posts-app/index.js.map +1 -0
- 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/hooks/commands/use-set-command-context.js +53 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +15 -2
- package/build/index.js.map +1 -1
- package/build/posts.js +34 -0
- package/build/posts.js.map +1 -0
- 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/app/index.js +17 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/index.js +3 -10
- package/build-module/components/editor/index.js.map +1 -1
- 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-revisions/index.js +4 -23
- package/build-module/components/global-styles/screen-revisions/index.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 +1 -0
- 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/layout/index.js +10 -39
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -0
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/posts-app/index.js +43 -0
- package/build-module/components/posts-app/index.js.map +1 -0
- 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/hooks/commands/use-set-command-context.js +46 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +8 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +27 -0
- package/build-module/posts.js.map +1 -0
- package/build-style/posts-rtl.css +1707 -0
- package/build-style/posts.css +1707 -0
- package/build-style/style-rtl.css +16 -19
- package/build-style/style.css +16 -19
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +2 -1
- package/src/components/app/index.js +17 -1
- package/src/components/editor/index.js +2 -8
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/src/components/global-styles/screen-revisions/index.js +4 -24
- package/src/components/global-styles/shadows-edit-panel.js +1 -0
- package/src/components/global-styles/style.scss +1 -7
- package/src/components/global-styles/variations/variation.js +14 -19
- package/src/components/global-styles/variations/variations-color.js +6 -1
- package/src/components/global-styles/variations/variations-typography.js +5 -1
- package/src/components/global-styles-sidebar/style.scss +0 -1
- package/src/components/layout/index.js +24 -70
- package/src/components/page/header.js +1 -0
- package/src/components/page/style.scss +6 -0
- package/src/components/page-patterns/header.js +8 -2
- package/src/components/page-patterns/style.scss +6 -0
- package/src/components/posts-app/index.js +39 -0
- package/src/components/sidebar/style.scss +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/src/hooks/commands/use-set-command-context.js +37 -0
- package/src/hooks/push-changes-to-global-styles/index.js +2 -2
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
- package/src/index.js +10 -2
- package/src/posts.js +29 -0
- package/src/posts.scss +46 -0
- package/build/components/block-editor/block-inspector-button.js +0 -57
- package/build/components/block-editor/block-inspector-button.js.map +0 -1
- package/build/components/block-editor/inserter-media-categories.js +0 -183
- package/build/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build/components/template-part-converter/convert-to-regular.js +0 -38
- package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build/components/template-part-converter/convert-to-template-part.js +0 -84
- package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build/components/template-part-converter/index.js +0 -67
- package/build/components/template-part-converter/index.js.map +0 -1
- package/build-module/components/block-editor/block-inspector-button.js +0 -50
- package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/block-editor/inserter-media-categories.js +0 -177
- package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
- package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build-module/components/template-part-converter/index.js +0 -59
- package/build-module/components/template-part-converter/index.js.map +0 -1
- package/src/components/block-editor/block-inspector-button.js +0 -60
- package/src/components/block-editor/inserter-media-categories.js +0 -225
- package/src/components/template-part-converter/convert-to-regular.js +0 -32
- package/src/components/template-part-converter/convert-to-template-part.js +0 -78
- package/src/components/template-part-converter/index.js +0 -59
|
@@ -21,91 +21,60 @@ import {
|
|
|
21
21
|
import { __ } from '@wordpress/i18n';
|
|
22
22
|
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
23
23
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
privateApis as commandsPrivateApis,
|
|
27
|
-
} from '@wordpress/commands';
|
|
28
|
-
import { store as preferencesStore } from '@wordpress/preferences';
|
|
29
|
-
import {
|
|
30
|
-
privateApis as blockEditorPrivateApis,
|
|
31
|
-
store as blockEditorStore,
|
|
32
|
-
} from '@wordpress/block-editor';
|
|
33
|
-
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
|
|
24
|
+
import { CommandMenu } from '@wordpress/commands';
|
|
25
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
34
26
|
import {
|
|
35
27
|
EditorSnackbars,
|
|
36
28
|
privateApis as editorPrivateApis,
|
|
37
29
|
} from '@wordpress/editor';
|
|
30
|
+
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
|
|
38
31
|
|
|
39
32
|
/**
|
|
40
33
|
* Internal dependencies
|
|
41
34
|
*/
|
|
42
35
|
import ErrorBoundary from '../error-boundary';
|
|
43
36
|
import { store as editSiteStore } from '../../store';
|
|
44
|
-
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
45
37
|
import SiteHub from '../site-hub';
|
|
46
38
|
import ResizableFrame from '../resizable-frame';
|
|
47
|
-
import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
|
|
48
39
|
import { unlock } from '../../lock-unlock';
|
|
49
40
|
import SavePanel from '../save-panel';
|
|
50
41
|
import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
|
|
51
42
|
import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
|
|
52
|
-
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
|
|
53
|
-
import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
|
|
54
43
|
import { useIsSiteEditorLoading } from './hooks';
|
|
55
|
-
import useLayoutAreas from './router';
|
|
56
44
|
import useMovingAnimation from './animation';
|
|
57
45
|
import SidebarContent from '../sidebar';
|
|
58
46
|
import SaveHub from '../save-hub';
|
|
47
|
+
import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
|
|
59
48
|
|
|
60
49
|
const { useCommands } = unlock( coreCommandsPrivateApis );
|
|
61
|
-
const { useCommandContext } = unlock( commandsPrivateApis );
|
|
62
50
|
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
63
51
|
const { NavigableRegion } = unlock( editorPrivateApis );
|
|
64
52
|
|
|
65
53
|
const ANIMATION_DURATION = 0.3;
|
|
66
54
|
|
|
67
|
-
export default function Layout() {
|
|
68
|
-
// This ensures the edited entity id and type are initialized properly.
|
|
69
|
-
useInitEditedEntityFromURL();
|
|
55
|
+
export default function Layout( { route } ) {
|
|
70
56
|
useSyncCanvasModeWithURL();
|
|
71
57
|
useCommands();
|
|
72
|
-
useEditModeCommands();
|
|
73
|
-
useCommonCommands();
|
|
74
|
-
|
|
75
58
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
76
59
|
const toggleRef = useRef();
|
|
77
|
-
const {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
'core/editor/next-region'
|
|
96
|
-
),
|
|
97
|
-
hasFixedToolbar: select( preferencesStore ).get(
|
|
98
|
-
'core',
|
|
99
|
-
'fixedToolbar'
|
|
100
|
-
),
|
|
101
|
-
isDistractionFree: select( preferencesStore ).get(
|
|
102
|
-
'core',
|
|
103
|
-
'distractionFree'
|
|
104
|
-
),
|
|
105
|
-
hasBlockSelected:
|
|
106
|
-
select( blockEditorStore ).getBlockSelectionStart(),
|
|
107
|
-
};
|
|
108
|
-
}, [] );
|
|
60
|
+
const { canvasMode, previousShortcut, nextShortcut } = useSelect(
|
|
61
|
+
( select ) => {
|
|
62
|
+
const { getAllShortcutKeyCombinations } = select(
|
|
63
|
+
keyboardShortcutsStore
|
|
64
|
+
);
|
|
65
|
+
const { getCanvasMode } = unlock( select( editSiteStore ) );
|
|
66
|
+
return {
|
|
67
|
+
canvasMode: getCanvasMode(),
|
|
68
|
+
previousShortcut: getAllShortcutKeyCombinations(
|
|
69
|
+
'core/editor/previous-region'
|
|
70
|
+
),
|
|
71
|
+
nextShortcut: getAllShortcutKeyCombinations(
|
|
72
|
+
'core/editor/next-region'
|
|
73
|
+
),
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
[]
|
|
77
|
+
);
|
|
109
78
|
const navigateRegionsProps = useNavigateRegions( {
|
|
110
79
|
previous: previousShortcut,
|
|
111
80
|
next: nextShortcut,
|
|
@@ -116,22 +85,11 @@ export default function Layout() {
|
|
|
116
85
|
const isEditorLoading = useIsSiteEditorLoading();
|
|
117
86
|
const [ isResizableFrameOversized, setIsResizableFrameOversized ] =
|
|
118
87
|
useState( false );
|
|
119
|
-
const { key: routeKey, areas, widths } =
|
|
88
|
+
const { key: routeKey, areas, widths } = route;
|
|
120
89
|
const animationRef = useMovingAnimation( {
|
|
121
90
|
triggerAnimationOnChange: canvasMode + '__' + routeKey,
|
|
122
91
|
} );
|
|
123
92
|
|
|
124
|
-
// Sets the right context for the command palette
|
|
125
|
-
let commandContext = 'site-editor';
|
|
126
|
-
|
|
127
|
-
if ( canvasMode === 'edit' ) {
|
|
128
|
-
commandContext = 'entity-edit';
|
|
129
|
-
}
|
|
130
|
-
if ( hasBlockSelected ) {
|
|
131
|
-
commandContext = 'block-selection-edit';
|
|
132
|
-
}
|
|
133
|
-
useCommandContext( commandContext );
|
|
134
|
-
|
|
135
93
|
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
136
94
|
const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
|
|
137
95
|
const previousCanvaMode = usePrevious( canvasMode );
|
|
@@ -163,11 +121,7 @@ export default function Layout() {
|
|
|
163
121
|
'edit-site-layout',
|
|
164
122
|
navigateRegionsProps.className,
|
|
165
123
|
{
|
|
166
|
-
'is-distraction-free':
|
|
167
|
-
isDistractionFree && canvasMode === 'edit',
|
|
168
124
|
'is-full-canvas': canvasMode === 'edit',
|
|
169
|
-
'has-fixed-toolbar': hasFixedToolbar,
|
|
170
|
-
'is-block-toolbar-visible': hasBlockSelected,
|
|
171
125
|
}
|
|
172
126
|
) }
|
|
173
127
|
>
|
|
@@ -58,12 +58,18 @@ export default function PatternsHeader( {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
|
-
<VStack className="edit-site-patterns__section-header" spacing={
|
|
61
|
+
<VStack className="edit-site-patterns__section-header" spacing={ 1 }>
|
|
62
62
|
<HStack
|
|
63
63
|
justify="space-between"
|
|
64
64
|
className="edit-site-patterns__title"
|
|
65
65
|
>
|
|
66
|
-
<Heading
|
|
66
|
+
<Heading
|
|
67
|
+
as="h2"
|
|
68
|
+
level={ 3 }
|
|
69
|
+
id={ titleId }
|
|
70
|
+
weight={ 500 }
|
|
71
|
+
truncate
|
|
72
|
+
>
|
|
67
73
|
{ title }
|
|
68
74
|
</Heading>
|
|
69
75
|
<HStack expanded={ false }>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
UnsavedChangesWarning,
|
|
6
|
+
privateApis as editorPrivateApis,
|
|
7
|
+
} from '@wordpress/editor';
|
|
8
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import Layout from '../layout';
|
|
14
|
+
import Page from '../page';
|
|
15
|
+
import { unlock } from '../../lock-unlock';
|
|
16
|
+
|
|
17
|
+
const { RouterProvider } = unlock( routerPrivateApis );
|
|
18
|
+
const { GlobalStylesProvider } = unlock( editorPrivateApis );
|
|
19
|
+
|
|
20
|
+
const defaultRoute = {
|
|
21
|
+
key: 'index',
|
|
22
|
+
areas: {
|
|
23
|
+
sidebar: 'Empty Sidebar',
|
|
24
|
+
content: <Page>Welcome to Posts</Page>,
|
|
25
|
+
preview: undefined,
|
|
26
|
+
mobile: <Page>Welcome to Posts</Page>,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default function PostsApp() {
|
|
31
|
+
return (
|
|
32
|
+
<GlobalStylesProvider>
|
|
33
|
+
<UnsavedChangesWarning />
|
|
34
|
+
<RouterProvider>
|
|
35
|
+
<Layout route={ defaultRoute } />
|
|
36
|
+
</RouterProvider>
|
|
37
|
+
</GlobalStylesProvider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
@keyframes slide-from-right {
|
|
6
|
+
@keyframes local--slide-from-right {
|
|
7
7
|
from {
|
|
8
8
|
transform: translateX(50px);
|
|
9
9
|
opacity: 0;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
@keyframes slide-from-left {
|
|
17
|
+
@keyframes local--slide-from-left {
|
|
18
18
|
from {
|
|
19
19
|
transform: translateX(-50px);
|
|
20
20
|
opacity: 0;
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
&.slide-from-left {
|
|
50
|
-
animation-name: slide-from-left;
|
|
50
|
+
animation-name: local--slide-from-left;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
&.slide-from-right {
|
|
54
|
-
animation-name: slide-from-right;
|
|
54
|
+
animation-name: local--slide-from-right;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { privateApis as commandsPrivateApis } from '@wordpress/commands';
|
|
6
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { store as editSiteStore } from '../../store';
|
|
12
|
+
import { unlock } from '../../lock-unlock';
|
|
13
|
+
|
|
14
|
+
const { useCommandContext } = unlock( commandsPrivateApis );
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* React hook used to set the correct command context based on the current state.
|
|
18
|
+
*/
|
|
19
|
+
export default function useSetCommandContext() {
|
|
20
|
+
const { hasBlockSelected, canvasMode } = useSelect( ( select ) => {
|
|
21
|
+
const { getCanvasMode } = unlock( select( editSiteStore ) );
|
|
22
|
+
const { getBlockSelectionStart } = select( blockEditorStore );
|
|
23
|
+
return {
|
|
24
|
+
canvasMode: getCanvasMode(),
|
|
25
|
+
hasBlockSelected: getBlockSelectionStart(),
|
|
26
|
+
};
|
|
27
|
+
}, [] );
|
|
28
|
+
// Sets the right context for the command palette
|
|
29
|
+
let commandContext = 'site-editor';
|
|
30
|
+
if ( canvasMode === 'edit' ) {
|
|
31
|
+
commandContext = 'entity-edit';
|
|
32
|
+
}
|
|
33
|
+
if ( hasBlockSelected ) {
|
|
34
|
+
commandContext = 'block-selection-edit';
|
|
35
|
+
}
|
|
36
|
+
useCommandContext( commandContext );
|
|
37
|
+
}
|
|
@@ -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
|
},
|