@wordpress/edit-site 6.0.0 → 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 +55 -69
- 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 +23 -95
- 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/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/posts-app/index.js +50 -0
- package/build/components/posts-app/index.js.map +1 -0
- 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/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 +3 -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/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/app/index.js +17 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/index.js +55 -69
- 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 +27 -99
- 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/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/posts-app/index.js +43 -0
- package/build-module/components/posts-app/index.js.map +1 -0
- 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/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 +3 -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-module/store/private-actions.js +33 -18
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +1707 -0
- package/build-style/posts.css +1707 -0
- package/build-style/style-rtl.css +59 -104
- package/build-style/style.css +59 -104
- 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/block-editor/style.scss +11 -0
- package/src/components/editor/index.js +69 -103
- 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/style.scss +1 -7
- 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/global-styles-sidebar/style.scss +0 -1
- package/src/components/layout/index.js +41 -137
- package/src/components/layout/style.scss +18 -58
- 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/index.js +15 -12
- package/src/components/page-patterns/style.scss +6 -0
- package/src/components/pagination/index.js +21 -16
- package/src/components/posts-app/index.js +39 -0
- package/src/components/sidebar/style.scss +4 -4
- 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/hooks/commands/use-set-command-context.js +37 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -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/src/store/private-actions.js +58 -30
- 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 -227
- 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
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
10
|
+
import { Button } from '@wordpress/components';
|
|
11
11
|
import { useInstanceId } from '@wordpress/compose';
|
|
12
12
|
import {
|
|
13
13
|
EditorKeyboardShortcutsRegister,
|
|
@@ -21,6 +21,7 @@ import { useCallback, useMemo } from '@wordpress/element';
|
|
|
21
21
|
import { store as noticesStore } from '@wordpress/notices';
|
|
22
22
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
23
23
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
24
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Internal dependencies
|
|
@@ -28,12 +29,8 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
28
29
|
import WelcomeGuide from '../welcome-guide';
|
|
29
30
|
import { store as editSiteStore } from '../../store';
|
|
30
31
|
import { GlobalStylesRenderer } from '../global-styles-renderer';
|
|
31
|
-
import useTitle from '../routes/use-title';
|
|
32
32
|
import CanvasLoader from '../canvas-loader';
|
|
33
33
|
import { unlock } from '../../lock-unlock';
|
|
34
|
-
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
35
|
-
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
36
|
-
import TemplatePartConverter from '../template-part-converter';
|
|
37
34
|
import { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';
|
|
38
35
|
import PluginTemplateSettingPanel from '../plugin-template-setting-panel';
|
|
39
36
|
import GlobalStylesSidebar from '../global-styles-sidebar';
|
|
@@ -44,27 +41,20 @@ import {
|
|
|
44
41
|
} from '../editor-canvas-container';
|
|
45
42
|
import SaveButton from '../save-button';
|
|
46
43
|
import SiteEditorMoreMenu from '../more-menu';
|
|
44
|
+
import SiteIcon from '../site-icon';
|
|
47
45
|
import useEditorIframeProps from '../block-editor/use-editor-iframe-props';
|
|
46
|
+
import useEditorTitle from './use-editor-title';
|
|
48
47
|
|
|
49
|
-
const {
|
|
50
|
-
EditorInterface,
|
|
51
|
-
ExperimentalEditorProvider: EditorProvider,
|
|
52
|
-
Sidebar,
|
|
53
|
-
} = unlock( editorPrivateApis );
|
|
48
|
+
const { Editor, BackButton } = unlock( editorPrivateApis );
|
|
54
49
|
const { useHistory } = unlock( routerPrivateApis );
|
|
55
50
|
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
|
|
56
51
|
|
|
57
|
-
export default function
|
|
52
|
+
export default function EditSiteEditor( { isLoading } ) {
|
|
58
53
|
const {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const { type: editedPostType } = editedPost;
|
|
64
|
-
const {
|
|
65
|
-
context,
|
|
66
|
-
contextPost,
|
|
67
|
-
editorMode,
|
|
54
|
+
editedPostType,
|
|
55
|
+
editedPostId,
|
|
56
|
+
contextPostType,
|
|
57
|
+
contextPostId,
|
|
68
58
|
canvasMode,
|
|
69
59
|
isEditingPage,
|
|
70
60
|
supportsGlobalStyles,
|
|
@@ -72,26 +62,24 @@ export default function Editor( { isLoading } ) {
|
|
|
72
62
|
editorCanvasView,
|
|
73
63
|
currentPostIsTrashed,
|
|
74
64
|
} = useSelect( ( select ) => {
|
|
75
|
-
const {
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
const {
|
|
66
|
+
getEditedPostContext,
|
|
67
|
+
getCanvasMode,
|
|
68
|
+
isPage,
|
|
69
|
+
getEditedPostType,
|
|
70
|
+
getEditedPostId,
|
|
71
|
+
} = unlock( select( editSiteStore ) );
|
|
78
72
|
const { get } = select( preferencesStore );
|
|
79
|
-
const {
|
|
80
|
-
const { getEditorMode } = select( editorStore );
|
|
73
|
+
const { getCurrentTheme } = select( coreDataStore );
|
|
81
74
|
const _context = getEditedPostContext();
|
|
82
75
|
|
|
83
76
|
// The currently selected entity to display.
|
|
84
77
|
// Typically template or template part in the site editor.
|
|
85
78
|
return {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
_context.postType,
|
|
91
|
-
_context.postId
|
|
92
|
-
)
|
|
93
|
-
: undefined,
|
|
94
|
-
editorMode: getEditorMode(),
|
|
79
|
+
editedPostType: getEditedPostType(),
|
|
80
|
+
editedPostId: getEditedPostId(),
|
|
81
|
+
contextPostType: _context?.postId ? _context.postType : undefined,
|
|
82
|
+
contextPostId: _context?.postId ? _context.postId : undefined,
|
|
95
83
|
canvasMode: getCanvasMode(),
|
|
96
84
|
isEditingPage: isPage(),
|
|
97
85
|
supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
|
|
@@ -104,30 +92,12 @@ export default function Editor( { isLoading } ) {
|
|
|
104
92
|
'trash',
|
|
105
93
|
};
|
|
106
94
|
}, [] );
|
|
95
|
+
useEditorTitle();
|
|
107
96
|
const _isPreviewingTheme = isPreviewingTheme();
|
|
108
97
|
const hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();
|
|
109
98
|
const iframeProps = useEditorIframeProps();
|
|
110
|
-
|
|
111
|
-
const isViewMode = canvasMode === 'view';
|
|
112
99
|
const isEditMode = canvasMode === 'edit';
|
|
113
|
-
const
|
|
114
|
-
const postWithTemplate = !! context?.postId;
|
|
115
|
-
|
|
116
|
-
let title;
|
|
117
|
-
if ( hasLoadedPost ) {
|
|
118
|
-
title = sprintf(
|
|
119
|
-
// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
|
|
120
|
-
__( '%1$s ‹ %2$s' ),
|
|
121
|
-
getTitle(),
|
|
122
|
-
POST_TYPE_LABELS[ editedPostType ] ??
|
|
123
|
-
POST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Only announce the title once the editor is ready to prevent "Replace"
|
|
128
|
-
// action in <URLQueryController> from double-announcing.
|
|
129
|
-
useTitle( hasLoadedPost && title );
|
|
130
|
-
|
|
100
|
+
const postWithTemplate = !! contextPostId;
|
|
131
101
|
const loadingProgressId = useInstanceId(
|
|
132
102
|
CanvasLoader,
|
|
133
103
|
'edit-site-editor__loading-progress'
|
|
@@ -152,6 +122,7 @@ export default function Editor( { isLoading } ) {
|
|
|
152
122
|
],
|
|
153
123
|
[ settings.styles, canvasMode, currentPostIsTrashed ]
|
|
154
124
|
);
|
|
125
|
+
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
155
126
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
156
127
|
const history = useHistory();
|
|
157
128
|
const onActionPerformed = useCallback(
|
|
@@ -176,7 +147,7 @@ export default function Editor( { isLoading } ) {
|
|
|
176
147
|
sprintf(
|
|
177
148
|
// translators: %s: Title of the created post e.g: "Post 1".
|
|
178
149
|
__( '"%s" successfully created.' ),
|
|
179
|
-
_title
|
|
150
|
+
decodeEntities( _title )
|
|
180
151
|
),
|
|
181
152
|
{
|
|
182
153
|
type: 'snackbar',
|
|
@@ -202,68 +173,63 @@ export default function Editor( { isLoading } ) {
|
|
|
202
173
|
[ history, createSuccessNotice ]
|
|
203
174
|
);
|
|
204
175
|
|
|
205
|
-
const isReady =
|
|
206
|
-
! isLoading &&
|
|
207
|
-
( ( postWithTemplate && !! contextPost && !! editedPost ) ||
|
|
208
|
-
( ! postWithTemplate && !! editedPost ) );
|
|
176
|
+
const isReady = ! isLoading;
|
|
209
177
|
|
|
210
178
|
return (
|
|
211
179
|
<>
|
|
212
180
|
<GlobalStylesRenderer />
|
|
213
181
|
<EditorKeyboardShortcutsRegister />
|
|
214
182
|
{ isEditMode && <BlockKeyboardShortcuts /> }
|
|
215
|
-
{ showVisualEditor && <TemplatePartConverter /> }
|
|
216
183
|
{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }
|
|
217
184
|
{ isEditMode && <WelcomeGuide /> }
|
|
218
|
-
{ hasLoadedPost && ! editedPost && (
|
|
219
|
-
<Notice status="warning" isDismissible={ false }>
|
|
220
|
-
{ __(
|
|
221
|
-
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
|
|
222
|
-
) }
|
|
223
|
-
</Notice>
|
|
224
|
-
) }
|
|
225
185
|
{ isReady && (
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
postWithTemplate ? editedPost : undefined
|
|
186
|
+
<Editor
|
|
187
|
+
postType={
|
|
188
|
+
postWithTemplate ? contextPostType : editedPostType
|
|
230
189
|
}
|
|
190
|
+
postId={ postWithTemplate ? contextPostId : editedPostId }
|
|
191
|
+
templateId={ postWithTemplate ? editedPostId : undefined }
|
|
231
192
|
settings={ settings }
|
|
232
|
-
|
|
193
|
+
className={ clsx( 'edit-site-editor__editor-interface', {
|
|
194
|
+
'show-icon-labels': showIconLabels,
|
|
195
|
+
} ) }
|
|
196
|
+
styles={ styles }
|
|
197
|
+
enableRegionNavigation={ false }
|
|
198
|
+
customSaveButton={
|
|
199
|
+
_isPreviewingTheme && <SaveButton size="compact" />
|
|
200
|
+
}
|
|
201
|
+
forceDisableBlockTools={ ! hasDefaultEditorCanvasView }
|
|
202
|
+
title={
|
|
203
|
+
! hasDefaultEditorCanvasView
|
|
204
|
+
? getEditorCanvasContainerTitle( editorCanvasView )
|
|
205
|
+
: undefined
|
|
206
|
+
}
|
|
207
|
+
iframeProps={ iframeProps }
|
|
208
|
+
onActionPerformed={ onActionPerformed }
|
|
209
|
+
extraSidebarPanels={
|
|
210
|
+
! isEditingPage && <PluginTemplateSettingPanel.Slot />
|
|
211
|
+
}
|
|
233
212
|
>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
213
|
+
{ isEditMode && (
|
|
214
|
+
<BackButton>
|
|
215
|
+
{ ( { length } ) =>
|
|
216
|
+
length <= 1 && (
|
|
217
|
+
<Button
|
|
218
|
+
label={ __( 'Open Navigation' ) }
|
|
219
|
+
className="edit-site-layout__view-mode-toggle"
|
|
220
|
+
onClick={ () =>
|
|
221
|
+
setCanvasMode( 'view' )
|
|
222
|
+
}
|
|
223
|
+
>
|
|
224
|
+
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
225
|
+
</Button>
|
|
226
|
+
)
|
|
240
227
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
customSaveButton={
|
|
245
|
-
_isPreviewingTheme && <SaveButton size="compact" />
|
|
246
|
-
}
|
|
247
|
-
forceDisableBlockTools={ ! hasDefaultEditorCanvasView }
|
|
248
|
-
title={
|
|
249
|
-
! hasDefaultEditorCanvasView
|
|
250
|
-
? getEditorCanvasContainerTitle(
|
|
251
|
-
editorCanvasView
|
|
252
|
-
)
|
|
253
|
-
: undefined
|
|
254
|
-
}
|
|
255
|
-
iframeProps={ iframeProps }
|
|
256
|
-
/>
|
|
257
|
-
<Sidebar
|
|
258
|
-
onActionPerformed={ onActionPerformed }
|
|
259
|
-
extraPanels={
|
|
260
|
-
! isEditingPage && (
|
|
261
|
-
<PluginTemplateSettingPanel.Slot />
|
|
262
|
-
)
|
|
263
|
-
}
|
|
264
|
-
/>
|
|
228
|
+
</BackButton>
|
|
229
|
+
) }
|
|
230
|
+
<SiteEditorMoreMenu />
|
|
265
231
|
{ supportsGlobalStyles && <GlobalStylesSidebar /> }
|
|
266
|
-
</
|
|
232
|
+
</Editor>
|
|
267
233
|
) }
|
|
268
234
|
</>
|
|
269
235
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.edit-site-
|
|
1
|
+
.edit-site-editor__editor-interface {
|
|
2
2
|
opacity: 1;
|
|
3
3
|
transition: opacity 0.1s ease-out;
|
|
4
4
|
@include reduce-motion("transition");
|
|
@@ -17,7 +17,3 @@
|
|
|
17
17
|
display: flex;
|
|
18
18
|
justify-content: center;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
.editor-header {
|
|
22
|
-
padding-left: $header-height;
|
|
23
|
-
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
10
|
+
import useTitle from '../routes/use-title';
|
|
11
|
+
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
12
|
+
|
|
13
|
+
function useEditorTitle() {
|
|
14
|
+
const {
|
|
15
|
+
record: editedPost,
|
|
16
|
+
getTitle,
|
|
17
|
+
isLoaded: hasLoadedPost,
|
|
18
|
+
} = useEditedEntityRecord();
|
|
19
|
+
let title;
|
|
20
|
+
if ( hasLoadedPost ) {
|
|
21
|
+
title = sprintf(
|
|
22
|
+
// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
|
|
23
|
+
__( '%1$s ‹ %2$s' ),
|
|
24
|
+
getTitle(),
|
|
25
|
+
POST_TYPE_LABELS[ editedPost.type ] ??
|
|
26
|
+
POST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Only announce the title once the editor is ready to prevent "Replace"
|
|
31
|
+
// action in <URLQueryController> from double-announcing.
|
|
32
|
+
useTitle( hasLoadedPost && title );
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default useEditorTitle;
|
|
@@ -34,7 +34,7 @@ function ScreenCSS() {
|
|
|
34
34
|
<>
|
|
35
35
|
{ description }
|
|
36
36
|
<ExternalLink
|
|
37
|
-
href="https://wordpress.org/
|
|
37
|
+
href="https://developer.wordpress.org/advanced-administration/wordpress/css/"
|
|
38
38
|
className="edit-site-global-styles-screen-css-help-link"
|
|
39
39
|
>
|
|
40
40
|
{ __( 'Learn more about CSS' ) }
|
|
@@ -81,28 +81,11 @@ function ScreenRevisions() {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
const restoreRevision = ( revision ) => {
|
|
84
|
-
setUserConfig( () =>
|
|
85
|
-
styles: revision?.styles,
|
|
86
|
-
settings: revision?.settings,
|
|
87
|
-
_links: revision?._links,
|
|
88
|
-
} ) );
|
|
84
|
+
setUserConfig( () => revision );
|
|
89
85
|
setIsLoadingRevisionWithUnsavedChanges( false );
|
|
90
86
|
onCloseRevisions();
|
|
91
87
|
};
|
|
92
88
|
|
|
93
|
-
const selectRevision = ( revision ) => {
|
|
94
|
-
setCurrentlySelectedRevision( {
|
|
95
|
-
/*
|
|
96
|
-
* The default must be an empty object so that
|
|
97
|
-
* `mergeBaseAndUserConfigs()` can merge them correctly.
|
|
98
|
-
*/
|
|
99
|
-
styles: revision?.styles || {},
|
|
100
|
-
settings: revision?.settings || {},
|
|
101
|
-
_links: revision?._links || {},
|
|
102
|
-
id: revision?.id,
|
|
103
|
-
} );
|
|
104
|
-
};
|
|
105
|
-
|
|
106
89
|
useEffect( () => {
|
|
107
90
|
if (
|
|
108
91
|
! editorCanvasContainerView ||
|
|
@@ -134,11 +117,7 @@ function ScreenRevisions() {
|
|
|
134
117
|
* See: https://github.com/WordPress/gutenberg/issues/55866
|
|
135
118
|
*/
|
|
136
119
|
if ( shouldSelectFirstItem ) {
|
|
137
|
-
setCurrentlySelectedRevision(
|
|
138
|
-
styles: firstRevision?.styles || {},
|
|
139
|
-
settings: firstRevision?.settings || {},
|
|
140
|
-
id: firstRevision?.id,
|
|
141
|
-
} );
|
|
120
|
+
setCurrentlySelectedRevision( firstRevision );
|
|
142
121
|
}
|
|
143
122
|
}, [ shouldSelectFirstItem, firstRevision ] );
|
|
144
123
|
|
|
@@ -186,7 +165,7 @@ function ScreenRevisions() {
|
|
|
186
165
|
/>
|
|
187
166
|
) ) }
|
|
188
167
|
<RevisionsButtons
|
|
189
|
-
onChange={
|
|
168
|
+
onChange={ setCurrentlySelectedRevision }
|
|
190
169
|
selectedRevisionId={ currentlySelectedRevisionId }
|
|
191
170
|
userRevisions={ currentRevisions }
|
|
192
171
|
canApplyRevision={ isLoadButtonEnabled }
|
|
@@ -219,6 +198,7 @@ function ScreenRevisions() {
|
|
|
219
198
|
onCancel={ () =>
|
|
220
199
|
setIsLoadingRevisionWithUnsavedChanges( false )
|
|
221
200
|
}
|
|
201
|
+
size="medium"
|
|
222
202
|
>
|
|
223
203
|
{ __(
|
|
224
204
|
'Are you sure you want to apply this revision? Any unsaved changes will be lost.'
|
|
@@ -163,6 +163,7 @@ function RevisionsButtons( {
|
|
|
163
163
|
>
|
|
164
164
|
<Button
|
|
165
165
|
className="edit-site-global-styles-screen-revisions__revision-button"
|
|
166
|
+
__experimentalIsFocusable
|
|
166
167
|
disabled={ isSelected }
|
|
167
168
|
onClick={ () => {
|
|
168
169
|
onChange( revision );
|
|
@@ -219,7 +220,6 @@ function RevisionsButtons( {
|
|
|
219
220
|
</p>
|
|
220
221
|
) : (
|
|
221
222
|
<Button
|
|
222
|
-
disabled={ areStylesEqual }
|
|
223
223
|
size="compact"
|
|
224
224
|
variant="primary"
|
|
225
225
|
className="edit-site-global-styles-screen-revisions__apply-button"
|
|
@@ -173,19 +173,15 @@
|
|
|
173
173
|
// Safari from rendering the page / total text.
|
|
174
174
|
will-change: opacity;
|
|
175
175
|
}
|
|
176
|
+
|
|
176
177
|
.components-button.is-tertiary {
|
|
177
|
-
font-size: 28px;
|
|
178
|
-
font-weight: 200;
|
|
179
178
|
color: $gray-900;
|
|
180
|
-
margin-bottom: $grid-unit-05;
|
|
181
|
-
line-height: 1.2;
|
|
182
179
|
}
|
|
183
|
-
|
|
180
|
+
|
|
181
|
+
.components-button.is-tertiary:disabled,
|
|
182
|
+
.components-button.is-tertiary[aria-disabled="true"] {
|
|
184
183
|
color: $gray-600;
|
|
185
184
|
}
|
|
186
|
-
.components-button.is-tertiary:hover {
|
|
187
|
-
background: transparent;
|
|
188
|
-
}
|
|
189
185
|
}
|
|
190
186
|
|
|
191
187
|
.edit-site-global-styles-screen-revisions__footer {
|
|
@@ -23,11 +23,6 @@
|
|
|
23
23
|
overflow: hidden;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.edit-site-typography-panel__full-width-control {
|
|
27
|
-
grid-column: 1 / -1;
|
|
28
|
-
max-width: 100%;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
26
|
.edit-site-global-styles-screen {
|
|
32
27
|
margin: $grid-unit-15 $grid-unit-20 $grid-unit-20;
|
|
33
28
|
}
|
|
@@ -84,8 +79,7 @@
|
|
|
84
79
|
color: $gray-800;
|
|
85
80
|
font-weight: 600;
|
|
86
81
|
line-height: 1.2;
|
|
87
|
-
padding: $grid-unit-20;
|
|
88
|
-
padding-bottom: 0;
|
|
82
|
+
padding: $grid-unit-20 $grid-unit-20 0;
|
|
89
83
|
margin: 0;
|
|
90
84
|
}
|
|
91
85
|
|
|
@@ -15,6 +15,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
+
import { filterObjectByProperty } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
18
19
|
import { unlock } from '../../../lock-unlock';
|
|
19
20
|
|
|
20
21
|
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
@@ -22,30 +23,24 @@ const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
|
|
|
22
23
|
blockEditorPrivateApis
|
|
23
24
|
);
|
|
24
25
|
|
|
25
|
-
export default function Variation( { variation, children, isPill } ) {
|
|
26
|
+
export default function Variation( { variation, children, isPill, property } ) {
|
|
26
27
|
const [ isFocused, setIsFocused ] = useState( false );
|
|
27
28
|
const { base, user, setUserConfig } = useContext( GlobalStylesContext );
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
|
|
30
|
+
const context = useMemo( () => {
|
|
31
|
+
let merged = mergeBaseAndUserConfigs( base, variation );
|
|
32
|
+
if ( property ) {
|
|
33
|
+
merged = filterObjectByProperty( merged, property );
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
user: variation,
|
|
35
37
|
base,
|
|
36
|
-
merged
|
|
38
|
+
merged,
|
|
37
39
|
setUserConfig: () => {},
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
);
|
|
40
|
+
};
|
|
41
|
+
}, [ variation, base, property ] );
|
|
41
42
|
|
|
42
|
-
const selectVariation = () =>
|
|
43
|
-
setUserConfig( () => ( {
|
|
44
|
-
settings: variation.settings,
|
|
45
|
-
styles: variation.styles,
|
|
46
|
-
_links: variation._links,
|
|
47
|
-
} ) );
|
|
48
|
-
};
|
|
43
|
+
const selectVariation = () => setUserConfig( variation );
|
|
49
44
|
|
|
50
45
|
const selectOnEnter = ( event ) => {
|
|
51
46
|
if ( event.keyCode === ENTER ) {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
__experimentalVStack as VStack,
|
|
6
|
+
__experimentalGrid as Grid,
|
|
7
|
+
} from '@wordpress/components';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Internal dependencies
|
|
@@ -22,13 +25,18 @@ export default function ColorVariations( { title, gap = 2 } ) {
|
|
|
22
25
|
return (
|
|
23
26
|
<VStack spacing={ 3 }>
|
|
24
27
|
{ title && <Subtitle level={ 3 }>{ title }</Subtitle> }
|
|
25
|
-
<
|
|
28
|
+
<Grid spacing={ gap }>
|
|
26
29
|
{ colorVariations.map( ( variation, index ) => (
|
|
27
|
-
<Variation
|
|
30
|
+
<Variation
|
|
31
|
+
key={ index }
|
|
32
|
+
variation={ variation }
|
|
33
|
+
isPill
|
|
34
|
+
property="color"
|
|
35
|
+
>
|
|
28
36
|
{ () => <StylesPreviewColors /> }
|
|
29
37
|
</Variation>
|
|
30
38
|
) ) }
|
|
31
|
-
</
|
|
39
|
+
</Grid>
|
|
32
40
|
</VStack>
|
|
33
41
|
);
|
|
34
42
|
}
|
|
@@ -35,7 +35,11 @@ export default function TypographyVariations( { title, gap = 2 } ) {
|
|
|
35
35
|
{ typographyVariations &&
|
|
36
36
|
typographyVariations.length &&
|
|
37
37
|
typographyVariations.map( ( variation, index ) => (
|
|
38
|
-
<Variation
|
|
38
|
+
<Variation
|
|
39
|
+
key={ index }
|
|
40
|
+
variation={ variation }
|
|
41
|
+
property="typography"
|
|
42
|
+
>
|
|
39
43
|
{ ( isFocused ) => (
|
|
40
44
|
<PreviewIframe
|
|
41
45
|
label={ variation?.title }
|
|
@@ -152,6 +152,7 @@ export default function GlobalStylesSidebar() {
|
|
|
152
152
|
isPressed={
|
|
153
153
|
isStyleBookOpened || isRevisionsStyleBookOpened
|
|
154
154
|
}
|
|
155
|
+
__experimentalIsFocusable
|
|
155
156
|
disabled={ shouldClearCanvasContainerView }
|
|
156
157
|
onClick={ toggleStyleBook }
|
|
157
158
|
size="compact"
|
|
@@ -162,6 +163,7 @@ export default function GlobalStylesSidebar() {
|
|
|
162
163
|
label={ __( 'Revisions' ) }
|
|
163
164
|
icon={ backup }
|
|
164
165
|
onClick={ toggleRevisions }
|
|
166
|
+
__experimentalIsFocusable
|
|
165
167
|
disabled={ ! hasRevisions }
|
|
166
168
|
isPressed={
|
|
167
169
|
isRevisionsOpened || isRevisionsStyleBookOpened
|