@wordpress/editor 12.14.1-next.d6164808d3.0 → 12.16.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 +8 -0
- package/build/components/post-featured-image/index.js +6 -4
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +6 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-schedule/index.js +1 -1
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +2 -2
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +6 -15
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-trash/index.js +5 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-url/label.js +1 -1
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +13 -5
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/store/actions.js +7 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +26 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +14 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +7 -5
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +7 -2
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +2 -4
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +3 -4
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +7 -15
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-trash/index.js +5 -1
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-url/label.js +1 -1
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +14 -6
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/store/actions.js +7 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +24 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -0
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +28 -28
- package/src/components/document-outline/test/__snapshots__/index.js.snap +92 -48
- package/src/components/document-outline/test/index.js +27 -44
- package/src/components/page-attributes/test/order.js +57 -64
- package/src/components/post-featured-image/index.js +3 -3
- package/src/components/post-publish-button/test/index.js +88 -71
- package/src/components/post-publish-panel/index.js +7 -6
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +670 -130
- package/src/components/post-publish-panel/test/index.js +30 -13
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +33 -24
- package/src/components/post-saved-state/test/index.js +31 -14
- package/src/components/post-schedule/index.js +2 -2
- package/src/components/post-schedule/label.js +3 -3
- package/src/components/post-schedule/test/label.js +7 -7
- package/src/components/post-slug/test/index.js +12 -25
- package/src/components/post-taxonomies/flat-term-selector.js +7 -18
- package/src/components/post-taxonomies/test/index.js +112 -44
- package/src/components/post-trash/index.js +5 -2
- package/src/components/post-url/label.js +1 -1
- package/src/components/provider/use-block-editor-settings.js +28 -8
- package/src/components/theme-support-check/test/index.js +13 -15
- package/src/store/actions.js +2 -0
- package/src/store/reducer.js +21 -0
- package/src/store/selectors.js +11 -0
- package/src/store/test/actions.js +42 -0
|
@@ -1,67 +1,111 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`DocumentOutline header blocks present should match snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
4
|
+
<ul>
|
|
5
|
+
<li
|
|
6
|
+
class="document-outline__item is-h2"
|
|
7
|
+
>
|
|
8
|
+
<a
|
|
9
|
+
class="document-outline__button"
|
|
9
10
|
href="#block-clientId_0"
|
|
10
|
-
isValid={true}
|
|
11
|
-
key="0"
|
|
12
|
-
level="H2"
|
|
13
11
|
>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
<span
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
class="document-outline__emdash"
|
|
15
|
+
/>
|
|
16
|
+
<strong
|
|
17
|
+
class="document-outline__level"
|
|
18
|
+
>
|
|
19
|
+
H2
|
|
20
|
+
</strong>
|
|
21
|
+
<span
|
|
22
|
+
class="document-outline__item-content"
|
|
23
|
+
>
|
|
24
|
+
Heading 2
|
|
25
|
+
</span>
|
|
26
|
+
</a>
|
|
27
|
+
</li>
|
|
28
|
+
<li
|
|
29
|
+
class="document-outline__item is-h3"
|
|
30
|
+
>
|
|
31
|
+
<a
|
|
32
|
+
class="document-outline__button"
|
|
17
33
|
href="#block-clientId_1"
|
|
18
|
-
isValid={true}
|
|
19
|
-
key="1"
|
|
20
|
-
level="H3"
|
|
21
34
|
>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
<span
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
class="document-outline__emdash"
|
|
38
|
+
/>
|
|
39
|
+
<strong
|
|
40
|
+
class="document-outline__level"
|
|
41
|
+
>
|
|
42
|
+
H3
|
|
43
|
+
</strong>
|
|
44
|
+
<span
|
|
45
|
+
class="document-outline__item-content"
|
|
46
|
+
>
|
|
47
|
+
Heading 3
|
|
48
|
+
</span>
|
|
49
|
+
</a>
|
|
50
|
+
</li>
|
|
51
|
+
</ul>
|
|
26
52
|
`;
|
|
27
53
|
|
|
28
54
|
exports[`DocumentOutline header blocks present should render warnings for multiple h1 headings 1`] = `
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
55
|
+
<ul>
|
|
56
|
+
<li
|
|
57
|
+
class="document-outline__item is-h1 is-invalid"
|
|
58
|
+
>
|
|
59
|
+
<a
|
|
60
|
+
class="document-outline__button"
|
|
34
61
|
href="#block-clientId_0"
|
|
35
|
-
isValid={false}
|
|
36
|
-
key="0"
|
|
37
|
-
level="H1"
|
|
38
62
|
>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
63
|
+
<span
|
|
64
|
+
aria-hidden="true"
|
|
65
|
+
class="document-outline__emdash"
|
|
42
66
|
/>
|
|
43
|
-
<
|
|
44
|
-
|
|
67
|
+
<strong
|
|
68
|
+
class="document-outline__level"
|
|
45
69
|
>
|
|
46
|
-
|
|
47
|
-
</
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
H1
|
|
71
|
+
</strong>
|
|
72
|
+
<span
|
|
73
|
+
class="document-outline__item-content"
|
|
74
|
+
>
|
|
75
|
+
Heading 1
|
|
76
|
+
<br />
|
|
77
|
+
<em>
|
|
78
|
+
(Multiple H1 headings are not recommended)
|
|
79
|
+
</em>
|
|
80
|
+
</span>
|
|
81
|
+
</a>
|
|
82
|
+
</li>
|
|
83
|
+
<li
|
|
84
|
+
class="document-outline__item is-h1 is-invalid"
|
|
85
|
+
>
|
|
86
|
+
<a
|
|
87
|
+
class="document-outline__button"
|
|
50
88
|
href="#block-clientId_2"
|
|
51
|
-
isValid={false}
|
|
52
|
-
key="1"
|
|
53
|
-
level="H1"
|
|
54
89
|
>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
90
|
+
<span
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
class="document-outline__emdash"
|
|
58
93
|
/>
|
|
59
|
-
<
|
|
60
|
-
|
|
94
|
+
<strong
|
|
95
|
+
class="document-outline__level"
|
|
96
|
+
>
|
|
97
|
+
H1
|
|
98
|
+
</strong>
|
|
99
|
+
<span
|
|
100
|
+
class="document-outline__item-content"
|
|
61
101
|
>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</
|
|
102
|
+
Heading 1
|
|
103
|
+
<br />
|
|
104
|
+
<em>
|
|
105
|
+
(Multiple H1 headings are not recommended)
|
|
106
|
+
</em>
|
|
107
|
+
</span>
|
|
108
|
+
</a>
|
|
109
|
+
</li>
|
|
110
|
+
</ul>
|
|
67
111
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen, within } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -77,9 +77,9 @@ describe( 'DocumentOutline', () => {
|
|
|
77
77
|
|
|
78
78
|
describe( 'no header blocks present', () => {
|
|
79
79
|
it( 'should not render when no blocks provided', () => {
|
|
80
|
-
|
|
80
|
+
render( <DocumentOutline /> );
|
|
81
81
|
|
|
82
|
-
expect(
|
|
82
|
+
expect( screen.queryByRole( 'list' ) ).not.toBeInTheDocument();
|
|
83
83
|
} );
|
|
84
84
|
|
|
85
85
|
it( 'should not render when no heading blocks provided', () => {
|
|
@@ -87,9 +87,9 @@ describe( 'DocumentOutline', () => {
|
|
|
87
87
|
// Set client IDs to a predictable value.
|
|
88
88
|
return { ...block, clientId: `clientId_${ index }` };
|
|
89
89
|
} );
|
|
90
|
-
|
|
90
|
+
render( <DocumentOutline blocks={ blocks } /> );
|
|
91
91
|
|
|
92
|
-
expect(
|
|
92
|
+
expect( screen.queryByRole( 'list' ) ).not.toBeInTheDocument();
|
|
93
93
|
} );
|
|
94
94
|
} );
|
|
95
95
|
|
|
@@ -99,16 +99,20 @@ describe( 'DocumentOutline', () => {
|
|
|
99
99
|
// Set client IDs to a predictable value.
|
|
100
100
|
return { ...block, clientId: `clientId_${ index }` };
|
|
101
101
|
} );
|
|
102
|
-
|
|
102
|
+
render( <DocumentOutline blocks={ blocks } /> );
|
|
103
103
|
|
|
104
|
-
expect(
|
|
104
|
+
expect( screen.getByRole( 'list' ) ).toMatchSnapshot();
|
|
105
105
|
} );
|
|
106
106
|
|
|
107
107
|
it( 'should render an item when only one heading provided', () => {
|
|
108
108
|
const blocks = [ headingH2 ];
|
|
109
|
-
|
|
109
|
+
render( <DocumentOutline blocks={ blocks } /> );
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
const tableOfContentItems = within(
|
|
112
|
+
screen.getByRole( 'list' )
|
|
113
|
+
).getAllByRole( 'listitem' );
|
|
114
|
+
expect( tableOfContentItems ).toHaveLength( 1 );
|
|
115
|
+
expect( tableOfContentItems[ 0 ] ).toHaveTextContent( 'Heading 2' );
|
|
112
116
|
} );
|
|
113
117
|
|
|
114
118
|
it( 'should render two items when two headings and some paragraphs provided', () => {
|
|
@@ -119,9 +123,11 @@ describe( 'DocumentOutline', () => {
|
|
|
119
123
|
headingH3,
|
|
120
124
|
paragraph,
|
|
121
125
|
];
|
|
122
|
-
|
|
126
|
+
render( <DocumentOutline blocks={ blocks } /> );
|
|
123
127
|
|
|
124
|
-
expect(
|
|
128
|
+
expect(
|
|
129
|
+
within( screen.getByRole( 'list' ) ).getAllByRole( 'listitem' )
|
|
130
|
+
).toHaveLength( 2 );
|
|
125
131
|
} );
|
|
126
132
|
|
|
127
133
|
it( 'should render warnings for multiple h1 headings', () => {
|
|
@@ -131,53 +137,30 @@ describe( 'DocumentOutline', () => {
|
|
|
131
137
|
return { ...block, clientId: `clientId_${ index }` };
|
|
132
138
|
}
|
|
133
139
|
);
|
|
134
|
-
|
|
140
|
+
render( <DocumentOutline blocks={ blocks } /> );
|
|
135
141
|
|
|
136
|
-
expect(
|
|
142
|
+
expect( screen.getByRole( 'list' ) ).toMatchSnapshot();
|
|
137
143
|
} );
|
|
138
144
|
} );
|
|
139
145
|
|
|
140
146
|
describe( 'nested headings', () => {
|
|
141
147
|
it( 'should render even if the heading is nested', () => {
|
|
142
|
-
const tableOfContentItemsSelector = 'TableOfContentsItem';
|
|
143
|
-
const outlineLevelsSelector = '.document-outline__level';
|
|
144
|
-
const outlineItemContentSelector =
|
|
145
|
-
'.document-outline__item-content';
|
|
146
|
-
|
|
147
148
|
const blocks = [ headingH2, nestedHeading ];
|
|
148
|
-
|
|
149
|
+
render( <DocumentOutline blocks={ blocks } /> );
|
|
149
150
|
|
|
150
151
|
// Unnested heading and nested heading should appear as items.
|
|
151
|
-
const tableOfContentItems =
|
|
152
|
-
|
|
153
|
-
);
|
|
152
|
+
const tableOfContentItems = within(
|
|
153
|
+
screen.getByRole( 'list' )
|
|
154
|
+
).getAllByRole( 'listitem' );
|
|
154
155
|
expect( tableOfContentItems ).toHaveLength( 2 );
|
|
155
156
|
|
|
156
157
|
// Unnested heading test.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
.find( outlineLevelsSelector );
|
|
160
|
-
expect( firstItemLevels ).toHaveLength( 1 );
|
|
161
|
-
expect( firstItemLevels.at( 0 ).text() ).toEqual( 'H2' );
|
|
162
|
-
expect(
|
|
163
|
-
tableOfContentItems
|
|
164
|
-
.at( 0 )
|
|
165
|
-
.find( outlineItemContentSelector )
|
|
166
|
-
.text()
|
|
167
|
-
).toEqual( 'Heading 2' );
|
|
158
|
+
expect( tableOfContentItems[ 0 ] ).toHaveTextContent( 'H2' );
|
|
159
|
+
expect( tableOfContentItems[ 0 ] ).toHaveTextContent( 'Heading 2' );
|
|
168
160
|
|
|
169
161
|
// Nested heading test.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
.find( outlineLevelsSelector );
|
|
173
|
-
expect( secondItemLevels ).toHaveLength( 1 );
|
|
174
|
-
expect( secondItemLevels.at( 0 ).text() ).toEqual( 'H3' );
|
|
175
|
-
expect(
|
|
176
|
-
tableOfContentItems
|
|
177
|
-
.at( 1 )
|
|
178
|
-
.find( outlineItemContentSelector )
|
|
179
|
-
.text()
|
|
180
|
-
).toEqual( 'Heading 3' );
|
|
162
|
+
expect( tableOfContentItems[ 1 ] ).toHaveTextContent( 'H3' );
|
|
163
|
+
expect( tableOfContentItems[ 1 ] ).toHaveTextContent( 'Heading 3' );
|
|
181
164
|
} );
|
|
182
165
|
} );
|
|
183
166
|
} );
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
@@ -9,92 +10,84 @@ import { mount } from 'enzyme';
|
|
|
9
10
|
import { PageAttributesOrder } from '../order';
|
|
10
11
|
|
|
11
12
|
describe( 'PageAttributesOrder', () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
wrapper.find( 'input' ).simulate( 'change', {
|
|
25
|
-
target: {
|
|
26
|
-
value: '----+++',
|
|
27
|
-
},
|
|
28
|
-
} );
|
|
29
|
-
|
|
30
|
-
wrapper.find( 'input' ).simulate( 'change', {
|
|
31
|
-
target: {
|
|
32
|
-
value: '-',
|
|
33
|
-
},
|
|
13
|
+
/**
|
|
14
|
+
* When starting to type inside the spinbutton, select the current value
|
|
15
|
+
* in order to override it with the new value afterwards.
|
|
16
|
+
*/
|
|
17
|
+
const typeOptions = {
|
|
18
|
+
initialSelectionStart: 0,
|
|
19
|
+
initialSelectionEnd: 1,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
it( 'should reject invalid input', async () => {
|
|
23
|
+
const user = userEvent.setup( {
|
|
24
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
34
25
|
} );
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
target: {
|
|
38
|
-
value: '+',
|
|
39
|
-
},
|
|
40
|
-
} );
|
|
27
|
+
const onUpdateOrder = jest.fn();
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
target: {
|
|
44
|
-
value: '',
|
|
45
|
-
},
|
|
46
|
-
} );
|
|
29
|
+
render( <PageAttributesOrder onUpdateOrder={ onUpdateOrder } /> );
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
const input = screen.getByRole( 'spinbutton', { name: 'Order' } );
|
|
32
|
+
await user.type( input, 'bad', typeOptions );
|
|
33
|
+
await user.type( input, '----+++', typeOptions );
|
|
34
|
+
await user.type( input, '-', typeOptions );
|
|
35
|
+
await user.type( input, '+', typeOptions );
|
|
36
|
+
await user.type( input, ' ', typeOptions );
|
|
53
37
|
|
|
54
38
|
expect( onUpdateOrder ).not.toHaveBeenCalled();
|
|
55
39
|
} );
|
|
56
40
|
|
|
57
|
-
it( 'should update with zero input', () => {
|
|
41
|
+
it( 'should update with zero input', async () => {
|
|
42
|
+
const user = userEvent.setup( {
|
|
43
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
44
|
+
} );
|
|
45
|
+
|
|
58
46
|
const onUpdateOrder = jest.fn();
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
|
|
48
|
+
render(
|
|
49
|
+
<PageAttributesOrder order={ 4 } onUpdateOrder={ onUpdateOrder } />
|
|
61
50
|
);
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
} );
|
|
52
|
+
const input = screen.getByRole( 'spinbutton', { name: 'Order' } );
|
|
53
|
+
|
|
54
|
+
await user.type( input, '0', typeOptions );
|
|
68
55
|
|
|
69
56
|
expect( onUpdateOrder ).toHaveBeenCalledWith( 0 );
|
|
70
57
|
} );
|
|
71
58
|
|
|
72
|
-
it( 'should update with valid positive input', () => {
|
|
59
|
+
it( 'should update with valid positive input', async () => {
|
|
60
|
+
const user = userEvent.setup( {
|
|
61
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
62
|
+
} );
|
|
63
|
+
|
|
73
64
|
const onUpdateOrder = jest.fn();
|
|
74
|
-
const wrapper = mount(
|
|
75
|
-
<PageAttributesOrder onUpdateOrder={ onUpdateOrder } />
|
|
76
|
-
);
|
|
77
65
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
|
|
66
|
+
render( <PageAttributesOrder onUpdateOrder={ onUpdateOrder } /> );
|
|
67
|
+
|
|
68
|
+
await user.type(
|
|
69
|
+
screen.getByRole( 'spinbutton', { name: 'Order' } ),
|
|
70
|
+
'4',
|
|
71
|
+
typeOptions
|
|
72
|
+
);
|
|
83
73
|
|
|
84
74
|
expect( onUpdateOrder ).toHaveBeenCalledWith( 4 );
|
|
85
75
|
} );
|
|
86
76
|
|
|
87
|
-
it( 'should update with valid negative input', () => {
|
|
77
|
+
it( 'should update with valid negative input', async () => {
|
|
78
|
+
const user = userEvent.setup( {
|
|
79
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
80
|
+
} );
|
|
81
|
+
|
|
88
82
|
const onUpdateOrder = jest.fn();
|
|
89
|
-
const wrapper = mount(
|
|
90
|
-
<PageAttributesOrder onUpdateOrder={ onUpdateOrder } />
|
|
91
|
-
);
|
|
92
83
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
|
|
84
|
+
render( <PageAttributesOrder onUpdateOrder={ onUpdateOrder } /> );
|
|
85
|
+
|
|
86
|
+
await user.type(
|
|
87
|
+
screen.getByRole( 'spinbutton', { name: 'Order' } ),
|
|
88
|
+
'-1',
|
|
89
|
+
typeOptions
|
|
90
|
+
);
|
|
98
91
|
|
|
99
92
|
expect( onUpdateOrder ).toHaveBeenCalledWith( -1 );
|
|
100
93
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -59,7 +59,7 @@ function getMediaDetails( media, postId ) {
|
|
|
59
59
|
media.id,
|
|
60
60
|
postId
|
|
61
61
|
);
|
|
62
|
-
if (
|
|
62
|
+
if ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {
|
|
63
63
|
return {
|
|
64
64
|
mediaWidth: media.media_details.sizes[ defaultSize ].width,
|
|
65
65
|
mediaHeight: media.media_details.sizes[ defaultSize ].height,
|
|
@@ -74,7 +74,7 @@ function getMediaDetails( media, postId ) {
|
|
|
74
74
|
media.id,
|
|
75
75
|
postId
|
|
76
76
|
);
|
|
77
|
-
if (
|
|
77
|
+
if ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {
|
|
78
78
|
return {
|
|
79
79
|
mediaWidth: media.media_details.sizes[ fallbackSize ].width,
|
|
80
80
|
mediaHeight: media.media_details.sizes[ fallbackSize ].height,
|