@wordpress/edit-site 6.2.0 → 6.3.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 → add-new-post}/index.js +21 -17
- package/build/components/add-new-post/index.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +5 -3
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +21 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +0 -5
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -40
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +47 -0
- package/build/components/global-styles/preview-typography.js.map +1 -0
- package/build/components/global-styles/screen-block.js +14 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +5 -1
- package/build/components/global-styles/screen-layout.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 -2
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -5
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +0 -2
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +4 -4
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +4 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +14 -28
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -2
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +20 -41
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/index.js +43 -39
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +29 -4
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +22 -55
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +18 -19
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +4 -4
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +11 -17
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/{page-pages/index.js → posts-app/posts-list.js} +135 -40
- package/build/components/posts-app/posts-list.js.map +1 -0
- package/build/components/posts-app/router.js +85 -0
- package/build/components/posts-app/router.js.map +1 -0
- package/build/components/revisions/index.js +10 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +1 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +98 -84
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/site-hub/index.js +81 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -1
- 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 +65 -42
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +57 -2
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +7 -2
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/{add-new-page → add-new-post}/index.js +21 -17
- package/build-module/components/add-new-post/index.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +21 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +0 -5
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -38
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +39 -0
- package/build-module/components/global-styles/preview-typography.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +15 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +5 -1
- package/build-module/components/global-styles/screen-layout.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 -2
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +6 -6
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +0 -2
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +5 -5
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +4 -3
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +16 -29
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +14 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +20 -41
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/index.js +44 -40
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +28 -4
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -56
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +18 -19
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +4 -4
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +11 -17
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +134 -39
- package/build-module/components/posts-app/posts-list.js.map +1 -0
- package/build-module/components/posts-app/router.js +77 -0
- package/build-module/components/posts-app/router.js.map +1 -0
- package/build-module/components/revisions/index.js +10 -7
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +1 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +96 -83
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +5 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/site-hub/index.js +81 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
- 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 +61 -38
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +7 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +57 -2
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +7 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +108 -28
- package/build-style/posts.css +108 -28
- package/build-style/style-rtl.css +112 -144
- package/build-style/style.css +112 -144
- package/package.json +41 -41
- package/src/components/{add-new-page → add-new-post}/index.js +28 -22
- package/src/components/block-editor/use-site-editor-settings.js +33 -28
- package/src/components/editor/index.js +21 -5
- package/src/components/global-styles/background-panel.js +0 -8
- package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
- package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/src/components/global-styles/font-library-modal/style.scss +17 -10
- package/src/components/global-styles/hooks.js +0 -41
- package/src/components/global-styles/preview-typography.js +39 -0
- package/src/components/global-styles/screen-block.js +22 -0
- package/src/components/global-styles/screen-layout.js +5 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/shadows-edit-panel.js +1 -2
- package/src/components/global-styles/style-variations-container.js +10 -7
- package/src/components/global-styles/typography-elements.js +0 -4
- package/src/components/global-styles/variations/variation.js +5 -5
- package/src/components/global-styles/variations/variations-color.js +5 -3
- package/src/components/global-styles/variations/variations-typography.js +15 -32
- package/src/components/global-styles-sidebar/index.js +2 -2
- package/src/components/layout/index.js +13 -4
- package/src/components/layout/router.js +20 -36
- package/src/components/layout/style.scss +12 -0
- package/src/components/page-patterns/index.js +47 -56
- package/src/components/page-patterns/search-items.js +37 -3
- package/src/components/page-patterns/style.scss +1 -8
- package/src/components/page-patterns/use-patterns.js +43 -82
- package/src/components/page-templates/index.js +17 -19
- package/src/components/page-templates/style.scss +1 -6
- package/src/components/pagination/index.js +4 -4
- package/src/components/posts-app/index.js +9 -11
- package/src/components/{page-pages/index.js → posts-app/posts-list.js} +126 -39
- package/src/components/posts-app/router.js +69 -0
- package/src/components/{page-pages → posts-app}/style.scss +22 -8
- package/src/components/revisions/index.js +9 -1
- package/src/components/save-panel/index.js +1 -1
- package/src/components/sidebar/style.scss +6 -0
- package/src/components/sidebar-dataviews/add-new-view.js +2 -1
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/src/components/sidebar-dataviews/default-views.js +110 -97
- package/src/components/sidebar-dataviews/index.js +3 -3
- package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
- package/src/components/site-hub/index.js +84 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
- package/src/hooks/push-changes-to-global-styles/index.js +1 -1
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
- package/src/index.js +8 -1
- package/src/posts.js +63 -2
- package/src/posts.scss +9 -0
- package/src/store/private-actions.js +7 -3
- package/src/style.scss +1 -2
- package/build/components/add-new-page/index.js.map +0 -1
- package/build/components/page-pages/index.js.map +0 -1
- package/build/components/table/index.js +0 -35
- package/build/components/table/index.js.map +0 -1
- package/build-module/components/add-new-page/index.js.map +0 -1
- package/build-module/components/page-pages/index.js.map +0 -1
- package/build-module/components/table/index.js +0 -30
- package/build-module/components/table/index.js.map +0 -1
- package/src/components/table/index.js +0 -33
- package/src/components/table/style.scss +0 -38
|
@@ -114,35 +114,40 @@ function useNavigateToPreviousEntityRecord() {
|
|
|
114
114
|
|
|
115
115
|
export function useSpecificEditorSettings() {
|
|
116
116
|
const onNavigateToEntityRecord = useNavigateToEntityRecord();
|
|
117
|
-
const {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
117
|
+
const {
|
|
118
|
+
templateSlug,
|
|
119
|
+
canvasMode,
|
|
120
|
+
settings,
|
|
121
|
+
shouldUseTemplateAsDefaultRenderingMode,
|
|
122
|
+
} = useSelect( ( select ) => {
|
|
123
|
+
const {
|
|
124
|
+
getEditedPostType,
|
|
125
|
+
getEditedPostId,
|
|
126
|
+
getEditedPostContext,
|
|
127
|
+
getCanvasMode,
|
|
128
|
+
getSettings,
|
|
129
|
+
} = unlock( select( editSiteStore ) );
|
|
130
|
+
const { getEditedEntityRecord } = select( coreStore );
|
|
131
|
+
const usedPostType = getEditedPostType();
|
|
132
|
+
const usedPostId = getEditedPostId();
|
|
133
|
+
const _record = getEditedEntityRecord(
|
|
134
|
+
'postType',
|
|
135
|
+
usedPostType,
|
|
136
|
+
usedPostId
|
|
137
|
+
);
|
|
138
|
+
const _context = getEditedPostContext();
|
|
139
|
+
return {
|
|
140
|
+
templateSlug: _record.slug,
|
|
141
|
+
canvasMode: getCanvasMode(),
|
|
142
|
+
settings: getSettings(),
|
|
143
|
+
// TODO: The `postType` check should be removed when the default rendering mode per post type is merged.
|
|
144
|
+
// @see https://github.com/WordPress/gutenberg/pull/62304/
|
|
145
|
+
shouldUseTemplateAsDefaultRenderingMode:
|
|
146
|
+
_context?.postId && _context?.postType !== 'post',
|
|
147
|
+
};
|
|
148
|
+
}, [] );
|
|
144
149
|
const archiveLabels = useArchiveLabel( templateSlug );
|
|
145
|
-
const defaultRenderingMode =
|
|
150
|
+
const defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode
|
|
146
151
|
? 'template-locked'
|
|
147
152
|
: 'post-only';
|
|
148
153
|
const onNavigateToPreviousEntityRecord =
|
|
@@ -40,16 +40,20 @@ import {
|
|
|
40
40
|
useHasEditorCanvasContainer,
|
|
41
41
|
} from '../editor-canvas-container';
|
|
42
42
|
import SaveButton from '../save-button';
|
|
43
|
+
import SavePanel from '../save-panel';
|
|
43
44
|
import SiteEditorMoreMenu from '../more-menu';
|
|
44
45
|
import SiteIcon from '../site-icon';
|
|
45
46
|
import useEditorIframeProps from '../block-editor/use-editor-iframe-props';
|
|
46
47
|
import useEditorTitle from './use-editor-title';
|
|
48
|
+
import { useIsSiteEditorLoading } from '../layout/hooks';
|
|
47
49
|
|
|
48
50
|
const { Editor, BackButton } = unlock( editorPrivateApis );
|
|
49
|
-
const { useHistory } = unlock( routerPrivateApis );
|
|
51
|
+
const { useHistory, useLocation } = unlock( routerPrivateApis );
|
|
50
52
|
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
|
|
51
53
|
|
|
52
|
-
export default function EditSiteEditor( {
|
|
54
|
+
export default function EditSiteEditor( { isPostsList = false } ) {
|
|
55
|
+
const { params } = useLocation();
|
|
56
|
+
const isLoading = useIsSiteEditorLoading();
|
|
53
57
|
const {
|
|
54
58
|
editedPostType,
|
|
55
59
|
editedPostId,
|
|
@@ -199,6 +203,7 @@ export default function EditSiteEditor( { isLoading } ) {
|
|
|
199
203
|
customSaveButton={
|
|
200
204
|
_isPreviewingTheme && <SaveButton size="compact" />
|
|
201
205
|
}
|
|
206
|
+
customSavePanel={ _isPreviewingTheme && <SavePanel /> }
|
|
202
207
|
forceDisableBlockTools={ ! hasDefaultEditorCanvasView }
|
|
203
208
|
title={ title }
|
|
204
209
|
icon={ icon }
|
|
@@ -215,9 +220,20 @@ export default function EditSiteEditor( { isLoading } ) {
|
|
|
215
220
|
<Button
|
|
216
221
|
label={ __( 'Open Navigation' ) }
|
|
217
222
|
className="edit-site-layout__view-mode-toggle"
|
|
218
|
-
onClick={ () =>
|
|
219
|
-
setCanvasMode( 'view' )
|
|
220
|
-
|
|
223
|
+
onClick={ () => {
|
|
224
|
+
setCanvasMode( 'view' );
|
|
225
|
+
// TODO: this is a temporary solution to navigate to the posts list if we are
|
|
226
|
+
// come here through `posts list` and are in focus mode editing a template, template part etc..
|
|
227
|
+
if (
|
|
228
|
+
isPostsList &&
|
|
229
|
+
params?.focusMode
|
|
230
|
+
) {
|
|
231
|
+
history.push( {
|
|
232
|
+
page: 'gutenberg-posts-dashboard',
|
|
233
|
+
postType: 'post',
|
|
234
|
+
} );
|
|
235
|
+
}
|
|
236
|
+
} }
|
|
221
237
|
>
|
|
222
238
|
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
223
239
|
</Button>
|
|
@@ -45,13 +45,6 @@ export default function BackgroundPanel() {
|
|
|
45
45
|
const _links = useGlobalStyleLinks();
|
|
46
46
|
const [ settings ] = useGlobalSetting( '' );
|
|
47
47
|
|
|
48
|
-
const defaultControls = {
|
|
49
|
-
backgroundImage: true,
|
|
50
|
-
backgroundSize:
|
|
51
|
-
hasBackgroundImageValue( style ) ||
|
|
52
|
-
hasBackgroundImageValue( inheritedStyle ),
|
|
53
|
-
};
|
|
54
|
-
|
|
55
48
|
return (
|
|
56
49
|
<StylesBackgroundPanel
|
|
57
50
|
inheritedValue={ inheritedStyle }
|
|
@@ -59,7 +52,6 @@ export default function BackgroundPanel() {
|
|
|
59
52
|
onChange={ setStyle }
|
|
60
53
|
settings={ settings }
|
|
61
54
|
defaultValues={ BACKGROUND_DEFAULT_VALUES }
|
|
62
|
-
defaultControls={ defaultControls }
|
|
63
55
|
themeFileURIs={ _links?.[ 'wp:theme-file' ] }
|
|
64
56
|
/>
|
|
65
57
|
);
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '@wordpress/components';
|
|
29
29
|
import { debounce } from '@wordpress/compose';
|
|
30
30
|
import { sprintf, __, _x } from '@wordpress/i18n';
|
|
31
|
-
import { moreVertical, chevronLeft } from '@wordpress/icons';
|
|
31
|
+
import { moreVertical, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Internal dependencies
|
|
@@ -429,7 +429,7 @@ function FontCollection( { slug } ) {
|
|
|
429
429
|
{ selectedFont && (
|
|
430
430
|
<Flex
|
|
431
431
|
justify="flex-end"
|
|
432
|
-
className="font-library-
|
|
432
|
+
className="font-library-modal__footer"
|
|
433
433
|
>
|
|
434
434
|
<Button
|
|
435
435
|
variant="primary"
|
|
@@ -438,7 +438,7 @@ function FontCollection( { slug } ) {
|
|
|
438
438
|
disabled={
|
|
439
439
|
fontsToInstall.length === 0 || isInstalling
|
|
440
440
|
}
|
|
441
|
-
|
|
441
|
+
accessibleWhenDisabled
|
|
442
442
|
>
|
|
443
443
|
{ __( 'Install' ) }
|
|
444
444
|
</Button>
|
|
@@ -446,32 +446,26 @@ function FontCollection( { slug } ) {
|
|
|
446
446
|
) }
|
|
447
447
|
|
|
448
448
|
{ ! selectedFont && (
|
|
449
|
-
<
|
|
449
|
+
<HStack
|
|
450
|
+
spacing={ 4 }
|
|
450
451
|
justify="center"
|
|
451
|
-
className="font-library-
|
|
452
|
+
className="font-library-modal__footer"
|
|
452
453
|
>
|
|
453
|
-
<Button
|
|
454
|
-
label={ __( 'First page' ) }
|
|
455
|
-
size="compact"
|
|
456
|
-
onClick={ () => setPage( 1 ) }
|
|
457
|
-
disabled={ page === 1 }
|
|
458
|
-
__experimentalIsFocusable
|
|
459
|
-
>
|
|
460
|
-
<span>«</span>
|
|
461
|
-
</Button>
|
|
462
454
|
<Button
|
|
463
455
|
label={ __( 'Previous page' ) }
|
|
464
456
|
size="compact"
|
|
465
457
|
onClick={ () => setPage( page - 1 ) }
|
|
466
458
|
disabled={ page === 1 }
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
459
|
+
showTooltip
|
|
460
|
+
accessibleWhenDisabled
|
|
461
|
+
icon={ chevronLeft }
|
|
462
|
+
tooltipPosition="top"
|
|
463
|
+
/>
|
|
471
464
|
<HStack
|
|
472
465
|
justify="flex-start"
|
|
473
466
|
expanded={ false }
|
|
474
467
|
spacing={ 2 }
|
|
468
|
+
className="font-library-modal__page-selection"
|
|
475
469
|
>
|
|
476
470
|
{ createInterpolateElement(
|
|
477
471
|
sprintf(
|
|
@@ -514,20 +508,11 @@ function FontCollection( { slug } ) {
|
|
|
514
508
|
size="compact"
|
|
515
509
|
onClick={ () => setPage( page + 1 ) }
|
|
516
510
|
disabled={ page === totalPages }
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
label={ __( 'Last page' ) }
|
|
523
|
-
size="compact"
|
|
524
|
-
onClick={ () => setPage( totalPages ) }
|
|
525
|
-
disabled={ page === totalPages }
|
|
526
|
-
__experimentalIsFocusable
|
|
527
|
-
>
|
|
528
|
-
<span>»</span>
|
|
529
|
-
</Button>
|
|
530
|
-
</Flex>
|
|
511
|
+
accessibleWhenDisabled
|
|
512
|
+
icon={ chevronRight }
|
|
513
|
+
tooltipPosition="top"
|
|
514
|
+
/>
|
|
515
|
+
</HStack>
|
|
531
516
|
) }
|
|
532
517
|
</>
|
|
533
518
|
) }
|
|
@@ -311,7 +311,7 @@ function InstalledFonts() {
|
|
|
311
311
|
|
|
312
312
|
<HStack
|
|
313
313
|
justify="flex-end"
|
|
314
|
-
className="font-library-
|
|
314
|
+
className="font-library-modal__footer"
|
|
315
315
|
>
|
|
316
316
|
{ isInstalling && <ProgressBar /> }
|
|
317
317
|
{ shouldDisplayDeleteButton && (
|
|
@@ -329,7 +329,7 @@ function InstalledFonts() {
|
|
|
329
329
|
saveFontFamilies( fontFamilies );
|
|
330
330
|
} }
|
|
331
331
|
disabled={ ! fontFamiliesHasChanges }
|
|
332
|
-
|
|
332
|
+
accessibleWhenDisabled
|
|
333
333
|
>
|
|
334
334
|
{ __( 'Update' ) }
|
|
335
335
|
</Button>
|
|
@@ -49,17 +49,24 @@ $footer-height: 70px;
|
|
|
49
49
|
// It should be 120px (72px modal header height + 48px tab height)
|
|
50
50
|
padding-top: $header-height + $grid-unit-15 + $grid-unit-60;
|
|
51
51
|
}
|
|
52
|
+
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
.font-library-modal__footer {
|
|
55
|
+
border-top: 1px solid $gray-300;
|
|
56
|
+
margin: 0 #{$grid-unit-40 * -1} #{$grid-unit-40 * -1};
|
|
57
|
+
padding: $grid-unit-20 $grid-unit-40;
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: $grid-unit-40;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: $footer-height;
|
|
62
|
+
background-color: $white;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.font-library-modal__page-selection {
|
|
66
|
+
font-size: 11px;
|
|
67
|
+
text-transform: uppercase;
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
color: $gray-900;
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
.font-library-modal__tabpanel-layout .components-base-control__field {
|
|
@@ -9,12 +9,10 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
11
11
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Internal dependencies
|
|
16
15
|
*/
|
|
17
|
-
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
18
16
|
import { unlock } from '../../lock-unlock';
|
|
19
17
|
import { useSelect } from '@wordpress/data';
|
|
20
18
|
|
|
@@ -111,42 +109,3 @@ export function useSupportedStyles( name, element ) {
|
|
|
111
109
|
|
|
112
110
|
return supportedPanels;
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
export function useColorVariations() {
|
|
116
|
-
const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
117
|
-
property: 'color',
|
|
118
|
-
} );
|
|
119
|
-
/*
|
|
120
|
-
* Filter out variations with no settings or styles.
|
|
121
|
-
*/
|
|
122
|
-
return colorVariations?.length
|
|
123
|
-
? colorVariations.filter( ( variation ) => {
|
|
124
|
-
const { settings, styles, title } = variation;
|
|
125
|
-
return (
|
|
126
|
-
title === __( 'Default' ) || // Always preseve the default variation.
|
|
127
|
-
Object.keys( settings ).length > 0 ||
|
|
128
|
-
Object.keys( styles ).length > 0
|
|
129
|
-
);
|
|
130
|
-
} )
|
|
131
|
-
: [];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export function useTypographyVariations() {
|
|
135
|
-
const typographyVariations =
|
|
136
|
-
useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
137
|
-
property: 'typography',
|
|
138
|
-
} );
|
|
139
|
-
/*
|
|
140
|
-
* Filter out variations with no settings or styles.
|
|
141
|
-
*/
|
|
142
|
-
return typographyVariations?.length
|
|
143
|
-
? typographyVariations.filter( ( variation ) => {
|
|
144
|
-
const { settings, styles, title } = variation;
|
|
145
|
-
return (
|
|
146
|
-
title === __( 'Default' ) || // Always preseve the default variation.
|
|
147
|
-
Object.keys( settings ).length > 0 ||
|
|
148
|
-
Object.keys( styles ).length > 0
|
|
149
|
-
);
|
|
150
|
-
} )
|
|
151
|
-
: [];
|
|
152
|
-
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __experimentalHStack as HStack } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import TypographyExample from './typography-example';
|
|
10
|
+
import PreviewIframe from './preview-iframe';
|
|
11
|
+
|
|
12
|
+
const StylesPreviewTypography = ( { variation, isFocused, withHoverView } ) => {
|
|
13
|
+
return (
|
|
14
|
+
<PreviewIframe
|
|
15
|
+
label={ variation.title }
|
|
16
|
+
isFocused={ isFocused }
|
|
17
|
+
withHoverView={ withHoverView }
|
|
18
|
+
>
|
|
19
|
+
{ ( { ratio, key } ) => (
|
|
20
|
+
<HStack
|
|
21
|
+
key={ key }
|
|
22
|
+
spacing={ 10 * ratio }
|
|
23
|
+
justify="center"
|
|
24
|
+
style={ {
|
|
25
|
+
height: '100%',
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
} }
|
|
28
|
+
>
|
|
29
|
+
<TypographyExample
|
|
30
|
+
variation={ variation }
|
|
31
|
+
fontSize={ 85 * ratio }
|
|
32
|
+
/>
|
|
33
|
+
</HStack>
|
|
34
|
+
) }
|
|
35
|
+
</PreviewIframe>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default StylesPreviewTypography;
|
|
@@ -25,6 +25,11 @@ import {
|
|
|
25
25
|
VariationsPanel,
|
|
26
26
|
} from './variations/variations-panel';
|
|
27
27
|
|
|
28
|
+
// Initial control values where no block style is set.
|
|
29
|
+
const BACKGROUND_BLOCK_DEFAULT_VALUES = {
|
|
30
|
+
backgroundSize: 'cover',
|
|
31
|
+
};
|
|
32
|
+
|
|
28
33
|
function applyFallbackStyle( border ) {
|
|
29
34
|
if ( ! border ) {
|
|
30
35
|
return border;
|
|
@@ -70,6 +75,8 @@ const {
|
|
|
70
75
|
useHasFiltersPanel,
|
|
71
76
|
useHasImageSettingsPanel,
|
|
72
77
|
useGlobalStyle,
|
|
78
|
+
useHasBackgroundPanel,
|
|
79
|
+
BackgroundPanel: StylesBackgroundPanel,
|
|
73
80
|
BorderPanel: StylesBorderPanel,
|
|
74
81
|
ColorPanel: StylesColorPanel,
|
|
75
82
|
TypographyPanel: StylesTypographyPanel,
|
|
@@ -121,6 +128,7 @@ function ScreenBlock( { name, variation } ) {
|
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
const blockVariations = useBlockVariations( name );
|
|
131
|
+
const hasBackgroundPanel = useHasBackgroundPanel( settings );
|
|
124
132
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
125
133
|
const hasColorPanel = useHasColorPanel( settings );
|
|
126
134
|
const hasBorderPanel = useHasBorderPanel( settings );
|
|
@@ -296,6 +304,20 @@ function ScreenBlock( { name, variation } ) {
|
|
|
296
304
|
/>
|
|
297
305
|
) }
|
|
298
306
|
|
|
307
|
+
{ hasBackgroundPanel && (
|
|
308
|
+
<StylesBackgroundPanel
|
|
309
|
+
inheritedValue={ inheritedStyle }
|
|
310
|
+
value={ style }
|
|
311
|
+
onChange={ setStyle }
|
|
312
|
+
settings={ settings }
|
|
313
|
+
defaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }
|
|
314
|
+
defaultControls={
|
|
315
|
+
blockType?.supports?.background
|
|
316
|
+
?.__experimentalDefaultControls
|
|
317
|
+
}
|
|
318
|
+
/>
|
|
319
|
+
) }
|
|
320
|
+
|
|
299
321
|
{ canEditCSS && (
|
|
300
322
|
<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>
|
|
301
323
|
<p>
|
|
@@ -23,7 +23,11 @@ function ScreenLayout() {
|
|
|
23
23
|
const [ rawSettings ] = useGlobalSetting( '' );
|
|
24
24
|
const settings = useSettingsForBlockElement( rawSettings );
|
|
25
25
|
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
26
|
-
|
|
26
|
+
/*
|
|
27
|
+
* Use the raw settings to determine if the background panel should be displayed,
|
|
28
|
+
* as the background panel is not dependent on the block element settings.
|
|
29
|
+
*/
|
|
30
|
+
const hasBackgroundPanel = useHasBackgroundPanel( rawSettings );
|
|
27
31
|
return (
|
|
28
32
|
<>
|
|
29
33
|
<ScreenHeader title={ __( 'Layout' ) } />
|
|
@@ -163,7 +163,7 @@ function RevisionsButtons( {
|
|
|
163
163
|
>
|
|
164
164
|
<Button
|
|
165
165
|
className="edit-site-global-styles-screen-revisions__revision-button"
|
|
166
|
-
|
|
166
|
+
accessibleWhenDisabled
|
|
167
167
|
disabled={ isSelected }
|
|
168
168
|
onClick={ () => {
|
|
169
169
|
onChange( revision );
|
|
@@ -371,8 +371,7 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) {
|
|
|
371
371
|
'edit-site-global-styles__shadow-editor__remove-button',
|
|
372
372
|
{ 'is-open': isOpen }
|
|
373
373
|
),
|
|
374
|
-
|
|
375
|
-
tooltip: __( 'Remove shadow' ),
|
|
374
|
+
label: __( 'Remove shadow' ),
|
|
376
375
|
};
|
|
377
376
|
|
|
378
377
|
return (
|
|
@@ -13,7 +13,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
13
13
|
*/
|
|
14
14
|
import PreviewStyles from './preview-styles';
|
|
15
15
|
import Variation from './variations/variation';
|
|
16
|
-
import {
|
|
16
|
+
import { isVariationWithProperties } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
17
17
|
import { unlock } from '../../lock-unlock';
|
|
18
18
|
|
|
19
19
|
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
@@ -33,11 +33,14 @@ export default function StyleVariationsContainer( { gap = 2 } ) {
|
|
|
33
33
|
).__experimentalGetCurrentThemeGlobalStylesVariations();
|
|
34
34
|
}, [] );
|
|
35
35
|
|
|
36
|
-
// Filter out variations that are
|
|
37
|
-
const
|
|
36
|
+
// Filter out variations that are color or typography variations.
|
|
37
|
+
const fullStyleVariations = variations?.filter( ( variation ) => {
|
|
38
38
|
return (
|
|
39
|
-
!
|
|
40
|
-
!
|
|
39
|
+
! isVariationWithProperties( variation, [ 'color' ] ) &&
|
|
40
|
+
! isVariationWithProperties( variation, [
|
|
41
|
+
'typography',
|
|
42
|
+
'spacing',
|
|
43
|
+
] )
|
|
41
44
|
);
|
|
42
45
|
} );
|
|
43
46
|
|
|
@@ -48,7 +51,7 @@ export default function StyleVariationsContainer( { gap = 2 } ) {
|
|
|
48
51
|
settings: {},
|
|
49
52
|
styles: {},
|
|
50
53
|
},
|
|
51
|
-
...(
|
|
54
|
+
...( fullStyleVariations ?? [] ),
|
|
52
55
|
];
|
|
53
56
|
return [
|
|
54
57
|
...withEmptyVariation.map( ( variation ) => {
|
|
@@ -105,7 +108,7 @@ export default function StyleVariationsContainer( { gap = 2 } ) {
|
|
|
105
108
|
};
|
|
106
109
|
} ),
|
|
107
110
|
];
|
|
108
|
-
}, [
|
|
111
|
+
}, [ fullStyleVariations, userStyles?.blocks, userStyles?.css ] );
|
|
109
112
|
|
|
110
113
|
return (
|
|
111
114
|
<Grid
|
|
@@ -31,9 +31,6 @@ function ElementItem( { parentMenu, element, label } ) {
|
|
|
31
31
|
const [ fontFamily ] = useGlobalStyle( prefix + 'typography.fontFamily' );
|
|
32
32
|
const [ fontStyle ] = useGlobalStyle( prefix + 'typography.fontStyle' );
|
|
33
33
|
const [ fontWeight ] = useGlobalStyle( prefix + 'typography.fontWeight' );
|
|
34
|
-
const [ letterSpacing ] = useGlobalStyle(
|
|
35
|
-
prefix + 'typography.letterSpacing'
|
|
36
|
-
);
|
|
37
34
|
const [ backgroundColor ] = useGlobalStyle( prefix + 'color.background' );
|
|
38
35
|
const [ fallbackBackgroundColor ] = useGlobalStyle( 'color.background' );
|
|
39
36
|
const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient' );
|
|
@@ -62,7 +59,6 @@ function ElementItem( { parentMenu, element, label } ) {
|
|
|
62
59
|
color,
|
|
63
60
|
fontStyle,
|
|
64
61
|
fontWeight,
|
|
65
|
-
letterSpacing,
|
|
66
62
|
...extraStyles,
|
|
67
63
|
} }
|
|
68
64
|
>
|
|
@@ -16,7 +16,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { filterObjectByProperties } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
20
20
|
import { unlock } from '../../../lock-unlock';
|
|
21
21
|
|
|
22
22
|
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
@@ -28,7 +28,7 @@ export default function Variation( {
|
|
|
28
28
|
variation,
|
|
29
29
|
children,
|
|
30
30
|
isPill,
|
|
31
|
-
|
|
31
|
+
properties,
|
|
32
32
|
showTooltip,
|
|
33
33
|
} ) {
|
|
34
34
|
const [ isFocused, setIsFocused ] = useState( false );
|
|
@@ -36,8 +36,8 @@ export default function Variation( {
|
|
|
36
36
|
|
|
37
37
|
const context = useMemo( () => {
|
|
38
38
|
let merged = mergeBaseAndUserConfigs( base, variation );
|
|
39
|
-
if (
|
|
40
|
-
merged =
|
|
39
|
+
if ( properties ) {
|
|
40
|
+
merged = filterObjectByProperties( merged, properties );
|
|
41
41
|
}
|
|
42
42
|
return {
|
|
43
43
|
user: variation,
|
|
@@ -45,7 +45,7 @@ export default function Variation( {
|
|
|
45
45
|
merged,
|
|
46
46
|
setUserConfig: () => {},
|
|
47
47
|
};
|
|
48
|
-
}, [ variation, base,
|
|
48
|
+
}, [ variation, base, properties ] );
|
|
49
49
|
|
|
50
50
|
const selectVariation = () => setUserConfig( variation );
|
|
51
51
|
|
|
@@ -10,12 +10,14 @@ import {
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import StylesPreviewColors from '../preview-colors';
|
|
13
|
-
import {
|
|
13
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
14
14
|
import Subtitle from '../subtitle';
|
|
15
15
|
import Variation from './variation';
|
|
16
16
|
|
|
17
17
|
export default function ColorVariations( { title, gap = 2 } ) {
|
|
18
|
-
const
|
|
18
|
+
const propertiesToFilter = [ 'color' ];
|
|
19
|
+
const colorVariations =
|
|
20
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig( propertiesToFilter );
|
|
19
21
|
|
|
20
22
|
// Return null if there is only one variation (the default).
|
|
21
23
|
if ( colorVariations?.length <= 1 ) {
|
|
@@ -31,7 +33,7 @@ export default function ColorVariations( { title, gap = 2 } ) {
|
|
|
31
33
|
key={ index }
|
|
32
34
|
variation={ variation }
|
|
33
35
|
isPill
|
|
34
|
-
|
|
36
|
+
properties={ propertiesToFilter }
|
|
35
37
|
showTooltip
|
|
36
38
|
>
|
|
37
39
|
{ () => <StylesPreviewColors /> }
|