@wordpress/editor 12.14.0 → 12.14.1-next.d6164808d3.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/build/components/post-taxonomies/flat-term-selector.js +7 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-title/index.js +15 -1
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +8 -5
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/store/actions.js +1 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +17 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +36 -16
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +8 -2
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-title/index.js +16 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +9 -6
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/store/actions.js +1 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +17 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +36 -15
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +28 -28
- package/src/components/post-author/test/check.js +7 -7
- package/src/components/post-last-revision/test/check.js +7 -7
- package/src/components/post-pending-status/test/check.js +5 -5
- package/src/components/post-schedule/test/check.js +5 -5
- package/src/components/post-slug/test/check.js +3 -3
- package/src/components/post-sticky/test/index.js +11 -7
- package/src/components/post-taxonomies/flat-term-selector.js +10 -2
- package/src/components/post-title/index.js +16 -2
- package/src/components/post-visibility/test/check.js +16 -8
- package/src/components/provider/use-block-editor-settings.js +1 -0
- package/src/hooks/custom-sources-backwards-compatibility.js +14 -12
- package/src/store/actions.js +1 -6
- package/src/store/reducer.js +16 -10
- package/src/store/selectors.js +29 -28
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -10,18 +10,18 @@ import { PostScheduleCheck } from '../check';
|
|
|
10
10
|
|
|
11
11
|
describe( 'PostScheduleCheck', () => {
|
|
12
12
|
it( "should not render anything if the user doesn't have the right capabilities", () => {
|
|
13
|
-
|
|
13
|
+
render(
|
|
14
14
|
<PostScheduleCheck hasPublishAction={ false }>
|
|
15
15
|
yes
|
|
16
16
|
</PostScheduleCheck>
|
|
17
17
|
);
|
|
18
|
-
expect(
|
|
18
|
+
expect( screen.queryByText( 'yes' ) ).not.toBeInTheDocument();
|
|
19
19
|
} );
|
|
20
20
|
|
|
21
21
|
it( 'should render if the user has the correct capability', () => {
|
|
22
|
-
|
|
22
|
+
render(
|
|
23
23
|
<PostScheduleCheck hasPublishAction={ true }>yes</PostScheduleCheck>
|
|
24
24
|
);
|
|
25
|
-
expect(
|
|
25
|
+
expect( screen.getByText( 'yes' ) ).toBeVisible();
|
|
26
26
|
} );
|
|
27
27
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -10,8 +10,8 @@ import PostSlugCheck from '../check';
|
|
|
10
10
|
|
|
11
11
|
describe( 'PostSlugCheck', () => {
|
|
12
12
|
it( 'should render control', () => {
|
|
13
|
-
|
|
13
|
+
render( <PostSlugCheck>slug</PostSlugCheck> );
|
|
14
14
|
|
|
15
|
-
expect(
|
|
15
|
+
expect( screen.getByText( 'slug' ) ).toBeVisible();
|
|
16
16
|
} );
|
|
17
17
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -10,29 +10,33 @@ import { PostStickyCheck } from '../check';
|
|
|
10
10
|
|
|
11
11
|
describe( 'PostSticky', () => {
|
|
12
12
|
it( 'should not render anything if the post type is not "post"', () => {
|
|
13
|
-
|
|
13
|
+
render(
|
|
14
14
|
<PostStickyCheck postType="page" hasStickyAction={ true }>
|
|
15
15
|
Can Toggle Sticky
|
|
16
16
|
</PostStickyCheck>
|
|
17
17
|
);
|
|
18
|
-
expect(
|
|
18
|
+
expect(
|
|
19
|
+
screen.queryByText( 'Can Toggle Sticky' )
|
|
20
|
+
).not.toBeInTheDocument();
|
|
19
21
|
} );
|
|
20
22
|
|
|
21
23
|
it( "should not render anything if post doesn't support stickying", () => {
|
|
22
|
-
|
|
24
|
+
render(
|
|
23
25
|
<PostStickyCheck postType="post" hasStickyAction={ false }>
|
|
24
26
|
Can Toggle Sticky
|
|
25
27
|
</PostStickyCheck>
|
|
26
28
|
);
|
|
27
|
-
expect(
|
|
29
|
+
expect(
|
|
30
|
+
screen.queryByText( 'Can Toggle Sticky' )
|
|
31
|
+
).not.toBeInTheDocument();
|
|
28
32
|
} );
|
|
29
33
|
|
|
30
34
|
it( 'should render if the post supports stickying', () => {
|
|
31
|
-
|
|
35
|
+
render(
|
|
32
36
|
<PostStickyCheck postType="post" hasStickyAction={ true }>
|
|
33
37
|
Can Toggle Sticky
|
|
34
38
|
</PostStickyCheck>
|
|
35
39
|
);
|
|
36
|
-
expect(
|
|
40
|
+
expect( screen.getByText( 'Can Toggle Sticky' ) ).toBeVisible();
|
|
37
41
|
} );
|
|
38
42
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { escape as escapeString, find, get
|
|
4
|
+
import { escape as escapeString, find, get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -202,7 +202,15 @@ export function FlatTermSelector( { slug } ) {
|
|
|
202
202
|
...( terms ?? [] ),
|
|
203
203
|
...( searchResults ?? [] ),
|
|
204
204
|
];
|
|
205
|
-
const uniqueTerms =
|
|
205
|
+
const uniqueTerms = termNames.reduce( ( acc, name ) => {
|
|
206
|
+
if (
|
|
207
|
+
! acc.some( ( n ) => n.toLowerCase() === name.toLowerCase() )
|
|
208
|
+
) {
|
|
209
|
+
acc.push( name );
|
|
210
|
+
}
|
|
211
|
+
return acc;
|
|
212
|
+
}, [] );
|
|
213
|
+
|
|
206
214
|
const newTermNames = uniqueTerms.filter(
|
|
207
215
|
( termName ) =>
|
|
208
216
|
! find( availableTerms, ( term ) =>
|
|
@@ -19,7 +19,12 @@ import { ENTER } from '@wordpress/keycodes';
|
|
|
19
19
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
20
20
|
import { pasteHandler } from '@wordpress/blocks';
|
|
21
21
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
__unstableUseRichText as useRichText,
|
|
24
|
+
create,
|
|
25
|
+
toHTMLString,
|
|
26
|
+
insert,
|
|
27
|
+
} from '@wordpress/rich-text';
|
|
23
28
|
import { useMergeRefs } from '@wordpress/compose';
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -169,7 +174,16 @@ function PostTitle( _, forwardedRef ) {
|
|
|
169
174
|
onInsertBlockAfter( content );
|
|
170
175
|
}
|
|
171
176
|
} else {
|
|
172
|
-
|
|
177
|
+
const value = {
|
|
178
|
+
...create( { html: title } ),
|
|
179
|
+
...selection,
|
|
180
|
+
};
|
|
181
|
+
const newValue = insert( value, create( { html: content } ) );
|
|
182
|
+
onUpdate( toHTMLString( { value: newValue } ) );
|
|
183
|
+
setSelection( {
|
|
184
|
+
start: newValue.start,
|
|
185
|
+
end: newValue.end,
|
|
186
|
+
} );
|
|
173
187
|
}
|
|
174
188
|
}
|
|
175
189
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -9,19 +9,27 @@ import { shallow } from 'enzyme';
|
|
|
9
9
|
import { PostVisibilityCheck } from '../check';
|
|
10
10
|
|
|
11
11
|
describe( 'PostVisibilityCheck', () => {
|
|
12
|
-
const
|
|
12
|
+
const renderProp = ( { canEdit } ) => ( canEdit ? 'yes' : 'no' );
|
|
13
13
|
|
|
14
14
|
it( "should not render the edit link if the user doesn't have the right capability", () => {
|
|
15
|
-
|
|
16
|
-
<PostVisibilityCheck
|
|
15
|
+
render(
|
|
16
|
+
<PostVisibilityCheck
|
|
17
|
+
hasPublishAction={ false }
|
|
18
|
+
render={ renderProp }
|
|
19
|
+
/>
|
|
17
20
|
);
|
|
18
|
-
expect(
|
|
21
|
+
expect( screen.queryByText( 'yes' ) ).not.toBeInTheDocument();
|
|
22
|
+
expect( screen.getByText( 'no' ) ).toBeVisible();
|
|
19
23
|
} );
|
|
20
24
|
|
|
21
25
|
it( 'should render if the user has the correct capability', () => {
|
|
22
|
-
|
|
23
|
-
<PostVisibilityCheck
|
|
26
|
+
render(
|
|
27
|
+
<PostVisibilityCheck
|
|
28
|
+
hasPublishAction={ true }
|
|
29
|
+
render={ renderProp }
|
|
30
|
+
/>
|
|
24
31
|
);
|
|
25
|
-
expect(
|
|
32
|
+
expect( screen.queryByText( 'no' ) ).not.toBeInTheDocument();
|
|
33
|
+
expect( screen.getByText( 'yes' ) ).toBeVisible();
|
|
26
34
|
} );
|
|
27
35
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { pickBy, mapValues, isEmpty
|
|
4
|
+
import { pickBy, mapValues, isEmpty } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -69,17 +69,19 @@ const createWithMetaAttributeSource = ( metaAttributes ) =>
|
|
|
69
69
|
<BlockEdit
|
|
70
70
|
attributes={ mergedAttributes }
|
|
71
71
|
setAttributes={ ( nextAttributes ) => {
|
|
72
|
-
const nextMeta =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
metaAttributes[ attributeKey ]
|
|
72
|
+
const nextMeta = Object.fromEntries(
|
|
73
|
+
Object.entries(
|
|
74
|
+
// Filter to intersection of keys between the updated
|
|
75
|
+
// attributes and those with an associated meta key.
|
|
76
|
+
pickBy(
|
|
77
|
+
nextAttributes,
|
|
78
|
+
( value, key ) => metaAttributes[ key ]
|
|
79
|
+
)
|
|
80
|
+
).map( ( [ attributeKey, value ] ) => [
|
|
81
|
+
// Rename the keys to the expected meta key name.
|
|
82
|
+
metaAttributes[ attributeKey ],
|
|
83
|
+
value,
|
|
84
|
+
] )
|
|
83
85
|
);
|
|
84
86
|
|
|
85
87
|
if ( ! isEmpty( nextMeta ) ) {
|
package/src/store/actions.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { has } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -48,7 +43,7 @@ export const setupEditor =
|
|
|
48
43
|
// included as part of editor setup action. Assume edited content as
|
|
49
44
|
// canonical if provided, falling back to post.
|
|
50
45
|
let content;
|
|
51
|
-
if (
|
|
46
|
+
if ( 'content' in edits ) {
|
|
52
47
|
content = edits.content;
|
|
53
48
|
} else {
|
|
54
49
|
content = post.content.raw;
|
package/src/store/reducer.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { omit, isEqual } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -39,7 +34,12 @@ export function getPostRawValue( value ) {
|
|
|
39
34
|
* @return {boolean} Whether the two objects have the same keys.
|
|
40
35
|
*/
|
|
41
36
|
export function hasSameKeys( a, b ) {
|
|
42
|
-
|
|
37
|
+
const keysA = Object.keys( a ).sort();
|
|
38
|
+
const keysB = Object.keys( b ).sort();
|
|
39
|
+
return (
|
|
40
|
+
keysA.length === keysB.length &&
|
|
41
|
+
keysA.every( ( key, index ) => keysB[ index ] === key )
|
|
42
|
+
);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -184,8 +184,11 @@ export function postSavingLock( state = {}, action ) {
|
|
|
184
184
|
case 'LOCK_POST_SAVING':
|
|
185
185
|
return { ...state, [ action.lockName ]: true };
|
|
186
186
|
|
|
187
|
-
case 'UNLOCK_POST_SAVING':
|
|
188
|
-
|
|
187
|
+
case 'UNLOCK_POST_SAVING': {
|
|
188
|
+
const { [ action.lockName ]: removedLockName, ...restState } =
|
|
189
|
+
state;
|
|
190
|
+
return restState;
|
|
191
|
+
}
|
|
189
192
|
}
|
|
190
193
|
return state;
|
|
191
194
|
}
|
|
@@ -205,8 +208,11 @@ export function postAutosavingLock( state = {}, action ) {
|
|
|
205
208
|
case 'LOCK_POST_AUTOSAVING':
|
|
206
209
|
return { ...state, [ action.lockName ]: true };
|
|
207
210
|
|
|
208
|
-
case 'UNLOCK_POST_AUTOSAVING':
|
|
209
|
-
|
|
211
|
+
case 'UNLOCK_POST_AUTOSAVING': {
|
|
212
|
+
const { [ action.lockName ]: removedLockName, ...restState } =
|
|
213
|
+
state;
|
|
214
|
+
return restState;
|
|
215
|
+
}
|
|
210
216
|
}
|
|
211
217
|
return state;
|
|
212
218
|
}
|
package/src/store/selectors.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find, get, has, includes, some } from 'lodash';
|
|
5
4
|
import createSelector from 'rememo';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -149,8 +148,7 @@ export const hasNonPostEntityChanges = createRegistrySelector(
|
|
|
149
148
|
const dirtyEntityRecords =
|
|
150
149
|
select( coreStore ).__experimentalGetDirtyEntityRecords();
|
|
151
150
|
const { type, id } = getCurrentPost( state );
|
|
152
|
-
return some(
|
|
153
|
-
dirtyEntityRecords,
|
|
151
|
+
return dirtyEntityRecords.some(
|
|
154
152
|
( entityRecord ) =>
|
|
155
153
|
entityRecord.kind !== 'postType' ||
|
|
156
154
|
entityRecord.name !== type ||
|
|
@@ -232,10 +230,8 @@ export function getCurrentPostId( state ) {
|
|
|
232
230
|
* @return {number} Number of revisions.
|
|
233
231
|
*/
|
|
234
232
|
export function getCurrentPostRevisionsCount( state ) {
|
|
235
|
-
return
|
|
236
|
-
getCurrentPost( state )
|
|
237
|
-
[ '_links', 'version-history', 0, 'count' ],
|
|
238
|
-
0
|
|
233
|
+
return (
|
|
234
|
+
getCurrentPost( state )._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0
|
|
239
235
|
);
|
|
240
236
|
}
|
|
241
237
|
|
|
@@ -248,9 +244,8 @@ export function getCurrentPostRevisionsCount( state ) {
|
|
|
248
244
|
* @return {?number} ID of the last revision.
|
|
249
245
|
*/
|
|
250
246
|
export function getCurrentPostLastRevisionId( state ) {
|
|
251
|
-
return
|
|
252
|
-
getCurrentPost( state )
|
|
253
|
-
[ '_links', 'predecessor-version', 0, 'id' ],
|
|
247
|
+
return (
|
|
248
|
+
getCurrentPost( state )._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ??
|
|
254
249
|
null
|
|
255
250
|
);
|
|
256
251
|
}
|
|
@@ -371,7 +366,7 @@ export function getEditedPostAttribute( state, attributeName ) {
|
|
|
371
366
|
export const getAutosaveAttribute = createRegistrySelector(
|
|
372
367
|
( select ) => ( state, attributeName ) => {
|
|
373
368
|
if (
|
|
374
|
-
! includes(
|
|
369
|
+
! AUTOSAVE_PROPERTIES.includes( attributeName ) &&
|
|
375
370
|
attributeName !== 'preview_link'
|
|
376
371
|
) {
|
|
377
372
|
return;
|
|
@@ -379,9 +374,7 @@ export const getAutosaveAttribute = createRegistrySelector(
|
|
|
379
374
|
|
|
380
375
|
const postType = getCurrentPostType( state );
|
|
381
376
|
const postId = getCurrentPostId( state );
|
|
382
|
-
const currentUserId =
|
|
383
|
-
'id',
|
|
384
|
-
] );
|
|
377
|
+
const currentUserId = select( coreStore ).getCurrentUser()?.id;
|
|
385
378
|
const autosave = select( coreStore ).getAutosave(
|
|
386
379
|
postType,
|
|
387
380
|
postId,
|
|
@@ -589,9 +582,7 @@ export const isEditedPostAutosaveable = createRegistrySelector(
|
|
|
589
582
|
postType,
|
|
590
583
|
postId
|
|
591
584
|
);
|
|
592
|
-
const currentUserId =
|
|
593
|
-
'id',
|
|
594
|
-
] );
|
|
585
|
+
const currentUserId = select( coreStore ).getCurrentUser()?.id;
|
|
595
586
|
|
|
596
587
|
// Disable reason - this line causes the side-effect of fetching the autosave
|
|
597
588
|
// via a resolver, moving below the return would result in the autosave never
|
|
@@ -710,8 +701,7 @@ export const isSavingNonPostEntityChanges = createRegistrySelector(
|
|
|
710
701
|
const entitiesBeingSaved =
|
|
711
702
|
select( coreStore ).__experimentalGetEntitiesBeingSaved();
|
|
712
703
|
const { type, id } = getCurrentPost( state );
|
|
713
|
-
return some(
|
|
714
|
-
entitiesBeingSaved,
|
|
704
|
+
return entitiesBeingSaved.some(
|
|
715
705
|
( entityRecord ) =>
|
|
716
706
|
entityRecord.kind !== 'postType' ||
|
|
717
707
|
entityRecord.name !== type ||
|
|
@@ -771,7 +761,7 @@ export function isAutosavingPost( state ) {
|
|
|
771
761
|
if ( ! isSavingPost( state ) ) {
|
|
772
762
|
return false;
|
|
773
763
|
}
|
|
774
|
-
return
|
|
764
|
+
return Boolean( state.saving.options?.isAutosave );
|
|
775
765
|
}
|
|
776
766
|
|
|
777
767
|
/**
|
|
@@ -785,7 +775,7 @@ export function isPreviewingPost( state ) {
|
|
|
785
775
|
if ( ! isSavingPost( state ) ) {
|
|
786
776
|
return false;
|
|
787
777
|
}
|
|
788
|
-
return
|
|
778
|
+
return Boolean( state.saving.options?.isPreview );
|
|
789
779
|
}
|
|
790
780
|
|
|
791
781
|
/**
|
|
@@ -1081,10 +1071,11 @@ export function getActivePostLock( state ) {
|
|
|
1081
1071
|
* @return {boolean} Whether the user can or can't post unfiltered HTML.
|
|
1082
1072
|
*/
|
|
1083
1073
|
export function canUserUseUnfilteredHTML( state ) {
|
|
1084
|
-
return
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1074
|
+
return Boolean(
|
|
1075
|
+
getCurrentPost( state )._links?.hasOwnProperty(
|
|
1076
|
+
'wp:action-unfiltered-html'
|
|
1077
|
+
)
|
|
1078
|
+
);
|
|
1088
1079
|
}
|
|
1089
1080
|
|
|
1090
1081
|
/**
|
|
@@ -1583,8 +1574,18 @@ export const __experimentalGetDefaultTemplatePartAreas = createSelector(
|
|
|
1583
1574
|
* @return {Object} The template type.
|
|
1584
1575
|
*/
|
|
1585
1576
|
export const __experimentalGetDefaultTemplateType = createSelector(
|
|
1586
|
-
( state, slug ) =>
|
|
1587
|
-
|
|
1577
|
+
( state, slug ) => {
|
|
1578
|
+
const templateTypes = __experimentalGetDefaultTemplateTypes( state );
|
|
1579
|
+
if ( ! templateTypes ) {
|
|
1580
|
+
return EMPTY_OBJECT;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
return (
|
|
1584
|
+
Object.values( templateTypes ).find(
|
|
1585
|
+
( type ) => type.slug === slug
|
|
1586
|
+
) ?? EMPTY_OBJECT
|
|
1587
|
+
);
|
|
1588
|
+
},
|
|
1588
1589
|
( state, slug ) => [ __experimentalGetDefaultTemplateTypes( state ), slug ]
|
|
1589
1590
|
);
|
|
1590
1591
|
|
|
@@ -1598,7 +1599,7 @@ export const __experimentalGetDefaultTemplateType = createSelector(
|
|
|
1598
1599
|
*/
|
|
1599
1600
|
export function __experimentalGetTemplateInfo( state, template ) {
|
|
1600
1601
|
if ( ! template ) {
|
|
1601
|
-
return
|
|
1602
|
+
return EMPTY_OBJECT;
|
|
1602
1603
|
}
|
|
1603
1604
|
|
|
1604
1605
|
const { description, slug, title, area } = template;
|