@wordpress/edit-site 6.33.3-next.36001005c.0 → 6.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/dataviews-actions/index.js +8 -6
- package/build/components/dataviews-actions/index.js.map +2 -2
- package/build/components/global-styles-renderer/index.js +4 -2
- package/build/components/global-styles-renderer/index.js.map +3 -3
- package/build/components/page-templates/fields.js +19 -26
- package/build/components/page-templates/fields.js.map +2 -2
- package/build/components/page-templates/index.js +41 -31
- package/build/components/page-templates/index.js.map +2 -2
- package/build/components/revisions/index.js +2 -2
- package/build/components/revisions/index.js.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +6 -7
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
- package/build/components/style-book/index.js +8 -4
- package/build/components/style-book/index.js.map +2 -2
- package/build-module/components/dataviews-actions/index.js +8 -6
- package/build-module/components/dataviews-actions/index.js.map +2 -2
- package/build-module/components/global-styles-renderer/index.js +3 -1
- package/build-module/components/global-styles-renderer/index.js.map +2 -2
- package/build-module/components/page-templates/fields.js +19 -26
- package/build-module/components/page-templates/fields.js.map +2 -2
- package/build-module/components/page-templates/index.js +41 -31
- package/build-module/components/page-templates/index.js.map +2 -2
- package/build-module/components/revisions/index.js +1 -1
- package/build-module/components/revisions/index.js.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +6 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
- package/build-module/components/style-book/index.js +6 -2
- package/build-module/components/style-book/index.js.map +2 -2
- package/build-style/posts-rtl.css +13 -13
- package/build-style/posts.css +13 -13
- package/build-style/style-rtl.css +23 -23
- package/build-style/style.css +23 -23
- package/package.json +44 -45
- package/src/components/dataviews-actions/index.js +12 -10
- package/src/components/global-styles/font-library-modal/style.scss +3 -3
- package/src/components/global-styles/style.scss +1 -1
- package/src/components/global-styles-renderer/index.js +4 -1
- package/src/components/global-styles-sidebar/style.scss +2 -2
- package/src/components/page-templates/fields.js +23 -29
- package/src/components/page-templates/index.js +51 -38
- package/src/components/revisions/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-patterns/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +6 -7
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/index.js +6 -3
- package/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/use-global-styles-output.js +0 -77
- package/build/hooks/use-global-styles-output.js.map +0 -7
- package/build-module/hooks/use-global-styles-output.js +0 -52
- package/build-module/hooks/use-global-styles-output.js.map +0 -7
- package/src/hooks/use-global-styles-output.js +0 -80
|
@@ -93,41 +93,32 @@ export default function PageTemplates() {
|
|
|
93
93
|
combinedTemplates: false,
|
|
94
94
|
} );
|
|
95
95
|
const { records: staticRecords, isResolving: isLoadingStaticData } =
|
|
96
|
-
useEntityRecordsWithPermissions( '
|
|
96
|
+
useEntityRecordsWithPermissions( 'root', 'registeredTemplate', {
|
|
97
|
+
// This should not be needed, the endpoint returns all registered
|
|
98
|
+
// templates, but it's not possible right now to turn off pagination
|
|
99
|
+
// for entity configs.
|
|
97
100
|
per_page: -1,
|
|
98
101
|
} );
|
|
99
102
|
|
|
100
103
|
const activeTemplates = useMemo( () => {
|
|
101
|
-
const _active = [ ...staticRecords ]
|
|
102
|
-
( record ) => ! record.is_custom
|
|
103
|
-
);
|
|
104
|
+
const _active = [ ...staticRecords ];
|
|
104
105
|
if ( activeTemplatesOption ) {
|
|
105
106
|
for ( const activeSlug in activeTemplatesOption ) {
|
|
106
107
|
const activeId = activeTemplatesOption[ activeSlug ];
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
// Replace the template in the array.
|
|
109
|
+
const template = userRecords.find(
|
|
110
|
+
( userRecord ) =>
|
|
111
|
+
userRecord.id === activeId &&
|
|
112
|
+
userRecord.theme === activeTheme.stylesheet
|
|
113
|
+
);
|
|
114
|
+
if ( template ) {
|
|
109
115
|
const index = _active.findIndex(
|
|
110
|
-
(
|
|
116
|
+
( { slug } ) => slug === template.slug
|
|
111
117
|
);
|
|
112
118
|
if ( index !== -1 ) {
|
|
113
|
-
_active
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Replace the template in the array.
|
|
117
|
-
const template = userRecords.find(
|
|
118
|
-
( userRecord ) =>
|
|
119
|
-
userRecord.id === activeId &&
|
|
120
|
-
userRecord.theme === activeTheme.stylesheet
|
|
121
|
-
);
|
|
122
|
-
if ( template ) {
|
|
123
|
-
const index = _active.findIndex(
|
|
124
|
-
( { slug } ) => slug === template.slug
|
|
125
|
-
);
|
|
126
|
-
if ( index !== -1 ) {
|
|
127
|
-
_active[ index ] = template;
|
|
128
|
-
} else {
|
|
129
|
-
_active.push( template );
|
|
130
|
-
}
|
|
119
|
+
_active[ index ] = template;
|
|
120
|
+
} else {
|
|
121
|
+
_active.push( template );
|
|
131
122
|
}
|
|
132
123
|
}
|
|
133
124
|
}
|
|
@@ -135,33 +126,55 @@ export default function PageTemplates() {
|
|
|
135
126
|
return _active;
|
|
136
127
|
}, [ userRecords, staticRecords, activeTemplatesOption, activeTheme ] );
|
|
137
128
|
|
|
138
|
-
let _records;
|
|
139
129
|
let isLoadingData;
|
|
140
130
|
if ( activeView === 'active' ) {
|
|
141
|
-
_records = activeTemplates;
|
|
142
131
|
isLoadingData = isLoadingUserRecords || isLoadingStaticData;
|
|
143
132
|
} else if ( activeView === 'user' ) {
|
|
144
|
-
_records = userRecords;
|
|
145
133
|
isLoadingData = isLoadingUserRecords;
|
|
146
134
|
} else {
|
|
147
|
-
_records = staticRecords;
|
|
148
135
|
isLoadingData = isLoadingStaticData;
|
|
149
136
|
}
|
|
150
137
|
|
|
151
138
|
const records = useMemo( () => {
|
|
139
|
+
function isCustom( record ) {
|
|
140
|
+
// For registered templates, the is_custom field is defined.
|
|
141
|
+
return (
|
|
142
|
+
record.is_custom ??
|
|
143
|
+
// For user templates it's custom if the is_wp_suggestion meta
|
|
144
|
+
// field is not set and the slug is not found in the default
|
|
145
|
+
// template types.
|
|
146
|
+
( ! record.meta?.is_wp_suggestion &&
|
|
147
|
+
! defaultTemplateTypes.some(
|
|
148
|
+
( type ) => type.slug === record.slug
|
|
149
|
+
) )
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
let _records;
|
|
154
|
+
if ( activeView === 'active' ) {
|
|
155
|
+
// Don't show active custom templates in the active view.
|
|
156
|
+
_records = activeTemplates.filter(
|
|
157
|
+
( record ) => ! isCustom( record )
|
|
158
|
+
);
|
|
159
|
+
} else if ( activeView === 'user' ) {
|
|
160
|
+
_records = userRecords;
|
|
161
|
+
} else {
|
|
162
|
+
_records = staticRecords;
|
|
163
|
+
}
|
|
152
164
|
return _records.map( ( record ) => ( {
|
|
153
165
|
...record,
|
|
154
|
-
_isActive: activeTemplates.
|
|
166
|
+
_isActive: activeTemplates.some(
|
|
155
167
|
( template ) => template.id === record.id
|
|
156
168
|
),
|
|
157
|
-
_isCustom:
|
|
158
|
-
record.is_custom ||
|
|
159
|
-
( ! record.meta?.is_wp_suggestion &&
|
|
160
|
-
! defaultTemplateTypes.find(
|
|
161
|
-
( type ) => type.slug === record.slug
|
|
162
|
-
) ),
|
|
169
|
+
_isCustom: isCustom( record ),
|
|
163
170
|
} ) );
|
|
164
|
-
}, [
|
|
171
|
+
}, [
|
|
172
|
+
activeTemplates,
|
|
173
|
+
defaultTemplateTypes,
|
|
174
|
+
userRecords,
|
|
175
|
+
staticRecords,
|
|
176
|
+
activeView,
|
|
177
|
+
] );
|
|
165
178
|
|
|
166
179
|
const users = useSelect(
|
|
167
180
|
( select ) => {
|
|
@@ -325,7 +338,7 @@ export default function PageTemplates() {
|
|
|
325
338
|
onChangeSelection={ onChangeSelection }
|
|
326
339
|
isItemClickable={ () => true }
|
|
327
340
|
onClickItem={ ( item ) => {
|
|
328
|
-
if ( item.
|
|
341
|
+
if ( typeof item.id === 'string' ) {
|
|
329
342
|
setSelectedRegisteredTemplate( item );
|
|
330
343
|
} else {
|
|
331
344
|
history.navigate(
|
|
@@ -20,11 +20,11 @@ import { useContext, useMemo } from '@wordpress/element';
|
|
|
20
20
|
|
|
21
21
|
import { unlock } from '../../lock-unlock';
|
|
22
22
|
import EditorCanvasContainer from '../editor-canvas-container';
|
|
23
|
-
import { useGlobalStylesOutputWithConfig } from '../../hooks/use-global-styles-output';
|
|
24
23
|
|
|
25
24
|
const {
|
|
26
25
|
ExperimentalBlockEditorProvider,
|
|
27
26
|
GlobalStylesContext,
|
|
27
|
+
useGlobalStylesOutputWithConfig,
|
|
28
28
|
__unstableBlockStyleVariationOverridesWithConfig,
|
|
29
29
|
} = unlock( blockEditorPrivateApis );
|
|
30
30
|
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
@@ -38,13 +38,12 @@ export default function DataviewsTemplatesSidebarContent() {
|
|
|
38
38
|
const {
|
|
39
39
|
query: { activeView = 'active' },
|
|
40
40
|
} = useLocation();
|
|
41
|
-
const { records } = useEntityRecords(
|
|
42
|
-
|
|
43
|
-
'
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
);
|
|
41
|
+
const { records } = useEntityRecords( 'root', 'registeredTemplate', {
|
|
42
|
+
// This should not be needed, the endpoint returns all registered
|
|
43
|
+
// templates, but it's not possible right now to turn off pagination for
|
|
44
|
+
// entity configs.
|
|
45
|
+
per_page: -1,
|
|
46
|
+
} );
|
|
48
47
|
const firstItemPerAuthorText = useMemo( () => {
|
|
49
48
|
const firstItemPerAuthor = records?.reduce( ( acc, template ) => {
|
|
50
49
|
const author = template.author_text;
|
|
@@ -56,10 +56,13 @@ import {
|
|
|
56
56
|
STYLE_BOOK_COLOR_GROUPS,
|
|
57
57
|
STYLE_BOOK_PREVIEW_CATEGORIES,
|
|
58
58
|
} from '../style-book/constants';
|
|
59
|
-
import { useGlobalStylesOutputWithConfig } from '../../hooks/use-global-styles-output';
|
|
60
59
|
|
|
61
|
-
const {
|
|
62
|
-
|
|
60
|
+
const {
|
|
61
|
+
ExperimentalBlockEditorProvider,
|
|
62
|
+
useGlobalStyle,
|
|
63
|
+
GlobalStylesContext,
|
|
64
|
+
useGlobalStylesOutputWithConfig,
|
|
65
|
+
} = unlock( blockEditorPrivateApis );
|
|
63
66
|
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
64
67
|
|
|
65
68
|
const { Tabs } = unlock( componentsPrivateApis );
|