@wordpress/block-library 8.17.1 → 8.18.1-next.5a1d1283.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/column/edit.native.js +5 -5
- package/build/column/edit.native.js.map +1 -1
- package/build/cover/edit/index.js +3 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/shared.js +26 -21
- package/build/cover/shared.js.map +1 -1
- package/build/embed/embed-link-settings.native.js +0 -1
- package/build/embed/embed-link-settings.native.js.map +1 -1
- package/build/footnotes/edit.js +2 -3
- package/build/footnotes/edit.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/post-terms/use-post-terms.js +3 -2
- package/build/post-terms/use-post-terms.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +28 -3
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +2 -1
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +9 -2
- package/build/query/index.js.map +1 -1
- package/build/query/view.js +75 -0
- package/build/query/view.js.map +1 -0
- package/build/query-pagination-next/index.js +1 -1
- package/build/query-pagination-numbers/edit.js +50 -5
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-pagination-numbers/index.js +7 -1
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/query-pagination-previous/index.js +1 -1
- package/build/search/edit.js +3 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/utils.js +2 -4
- package/build/search/utils.js.map +1 -1
- package/build/social-link/edit.native.js +1 -3
- package/build/social-link/edit.native.js.map +1 -1
- package/build-module/column/edit.native.js +5 -5
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/cover/edit/index.js +3 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/shared.js +26 -21
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/embed-link-settings.native.js +0 -1
- package/build-module/embed/embed-link-settings.native.js.map +1 -1
- package/build-module/footnotes/edit.js +2 -3
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/post-terms/use-post-terms.js +3 -2
- package/build-module/post-terms/use-post-terms.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +29 -4
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +2 -1
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +9 -2
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/view.js +72 -0
- package/build-module/query/view.js.map +1 -0
- package/build-module/query-pagination-next/index.js +1 -1
- package/build-module/query-pagination-numbers/edit.js +51 -6
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +7 -1
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +1 -1
- package/build-module/search/edit.js +4 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/utils.js +0 -1
- package/build-module/search/utils.js.map +1 -1
- package/build-module/social-link/edit.native.js +1 -3
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-style/query/style-rtl.css +140 -0
- package/build-style/query/style.css +140 -0
- package/build-style/site-logo/style-rtl.css +1 -0
- package/build-style/site-logo/style.css +1 -0
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/package.json +32 -32
- package/src/audio/test/__snapshots__/edit.native.js.snap +106 -78
- package/src/column/edit.native.js +4 -4
- package/src/columns/test/__snapshots__/edit.native.js.snap +14 -0
- package/src/columns/test/edit.native.js +47 -17
- package/src/cover/edit/index.js +3 -1
- package/src/cover/shared.js +25 -20
- package/src/cover/test/edit.native.js +1 -5
- package/src/embed/embed-link-settings.native.js +0 -1
- package/src/embed/test/index.native.js +9 -9
- package/src/file/test/__snapshots__/edit.native.js.snap +218 -162
- package/src/footnotes/edit.js +3 -1
- package/src/group/block.json +1 -0
- package/src/image/index.php +5 -0
- package/src/post-content/edit.js +2 -2
- package/src/post-content/index.php +0 -6
- package/src/post-featured-image/index.php +0 -6
- package/src/post-navigation-link/index.php +10 -1
- package/src/post-template/block.json +2 -1
- package/src/post-template/index.php +19 -4
- package/src/post-terms/use-post-terms.js +4 -2
- package/src/query/block.json +9 -2
- package/src/query/edit/inspector-controls/index.js +46 -3
- package/src/query/edit/query-content.js +1 -0
- package/src/query/index.php +94 -1
- package/src/query/style.scss +63 -0
- package/src/query/view.js +82 -0
- package/src/query-no-results/index.php +1 -5
- package/src/query-pagination-next/block.json +7 -1
- package/src/query-pagination-next/index.php +20 -3
- package/src/query-pagination-numbers/block.json +7 -1
- package/src/query-pagination-numbers/edit.js +64 -16
- package/src/query-pagination-numbers/index.php +27 -4
- package/src/query-pagination-previous/block.json +7 -1
- package/src/query-pagination-previous/index.php +19 -2
- package/src/search/edit.js +8 -2
- package/src/search/test/__snapshots__/edit.native.js.snap +363 -265
- package/src/search/utils.js +0 -1
- package/src/site-logo/style.scss +1 -0
- package/src/social-link/edit.native.js +1 -1
- package/src/social-link/editor.native.scss +0 -4
- package/src/social-links/test/edit.native.js +30 -0
- package/src/social-link/test/index.native.js +0 -132
|
@@ -4,14 +4,16 @@
|
|
|
4
4
|
import {
|
|
5
5
|
act,
|
|
6
6
|
addBlock,
|
|
7
|
+
dismissModal,
|
|
7
8
|
fireEvent,
|
|
9
|
+
getBlock,
|
|
8
10
|
getEditorHtml,
|
|
9
11
|
initializeEditor,
|
|
12
|
+
openBlockActionsMenu,
|
|
10
13
|
openBlockSettings,
|
|
11
|
-
|
|
12
|
-
getBlock,
|
|
13
|
-
dismissModal,
|
|
14
|
+
screen,
|
|
14
15
|
waitForModalVisible,
|
|
16
|
+
within,
|
|
15
17
|
} from 'test/helpers';
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -43,7 +45,7 @@ afterAll( () => {
|
|
|
43
45
|
|
|
44
46
|
describe( 'Columns block', () => {
|
|
45
47
|
it( 'inserts block', async () => {
|
|
46
|
-
|
|
48
|
+
await initializeEditor();
|
|
47
49
|
|
|
48
50
|
// Add block
|
|
49
51
|
await addBlock( screen, 'Columns' );
|
|
@@ -55,7 +57,7 @@ describe( 'Columns block', () => {
|
|
|
55
57
|
} );
|
|
56
58
|
|
|
57
59
|
it( 'adds a column block using the appender', async () => {
|
|
58
|
-
|
|
60
|
+
await initializeEditor( {
|
|
59
61
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
60
62
|
} );
|
|
61
63
|
|
|
@@ -73,7 +75,7 @@ describe( 'Columns block', () => {
|
|
|
73
75
|
|
|
74
76
|
describe( 'when using the number of columns setting', () => {
|
|
75
77
|
it( 'adds a column block when incrementing the value', async () => {
|
|
76
|
-
|
|
78
|
+
await initializeEditor( {
|
|
77
79
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
78
80
|
} );
|
|
79
81
|
const { getByLabelText } = screen;
|
|
@@ -95,7 +97,7 @@ describe( 'Columns block', () => {
|
|
|
95
97
|
} );
|
|
96
98
|
|
|
97
99
|
it( 'adds at least 15 Column blocks without limitation', async () => {
|
|
98
|
-
|
|
100
|
+
await initializeEditor( {
|
|
99
101
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
100
102
|
} );
|
|
101
103
|
const { getByLabelText } = screen;
|
|
@@ -120,7 +122,7 @@ describe( 'Columns block', () => {
|
|
|
120
122
|
} );
|
|
121
123
|
|
|
122
124
|
it( 'removes a column block when decrementing the value', async () => {
|
|
123
|
-
|
|
125
|
+
await initializeEditor( {
|
|
124
126
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
125
127
|
} );
|
|
126
128
|
const { getByLabelText } = screen;
|
|
@@ -142,7 +144,7 @@ describe( 'Columns block', () => {
|
|
|
142
144
|
} );
|
|
143
145
|
|
|
144
146
|
it( 'reaches the minimum limit of number of column blocks', async () => {
|
|
145
|
-
|
|
147
|
+
await initializeEditor();
|
|
146
148
|
|
|
147
149
|
// Add block
|
|
148
150
|
await addBlock( screen, 'Columns' );
|
|
@@ -185,7 +187,7 @@ describe( 'Columns block', () => {
|
|
|
185
187
|
} );
|
|
186
188
|
|
|
187
189
|
it( 'removes column with the remove button', async () => {
|
|
188
|
-
|
|
190
|
+
await initializeEditor( {
|
|
189
191
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
190
192
|
} );
|
|
191
193
|
const { getByLabelText } = screen;
|
|
@@ -210,7 +212,7 @@ describe( 'Columns block', () => {
|
|
|
210
212
|
} );
|
|
211
213
|
|
|
212
214
|
it( 'removes the only one left Column with the remove button', async () => {
|
|
213
|
-
|
|
215
|
+
await initializeEditor( {
|
|
214
216
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
215
217
|
} );
|
|
216
218
|
const { getByLabelText } = screen;
|
|
@@ -247,7 +249,7 @@ describe( 'Columns block', () => {
|
|
|
247
249
|
} );
|
|
248
250
|
|
|
249
251
|
it( 'changes vertical alignment on Columns', async () => {
|
|
250
|
-
|
|
252
|
+
await initializeEditor( {
|
|
251
253
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
252
254
|
} );
|
|
253
255
|
const { getByLabelText } = screen;
|
|
@@ -270,7 +272,7 @@ describe( 'Columns block', () => {
|
|
|
270
272
|
} );
|
|
271
273
|
|
|
272
274
|
it( 'changes the vertical alignment on individual Column', async () => {
|
|
273
|
-
|
|
275
|
+
await initializeEditor( {
|
|
274
276
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
275
277
|
} );
|
|
276
278
|
|
|
@@ -308,7 +310,7 @@ describe( 'Columns block', () => {
|
|
|
308
310
|
} );
|
|
309
311
|
|
|
310
312
|
it( 'sets current vertical alignment on new Columns', async () => {
|
|
311
|
-
|
|
313
|
+
await initializeEditor( {
|
|
312
314
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
313
315
|
} );
|
|
314
316
|
const { getByLabelText } = screen;
|
|
@@ -337,7 +339,7 @@ describe( 'Columns block', () => {
|
|
|
337
339
|
|
|
338
340
|
describe( 'when using columns percentage mechanism', () => {
|
|
339
341
|
it( "updates the slider's input value", async () => {
|
|
340
|
-
|
|
342
|
+
await initializeEditor();
|
|
341
343
|
|
|
342
344
|
// Add block
|
|
343
345
|
await addBlock( screen, 'Columns' );
|
|
@@ -377,7 +379,7 @@ describe( 'Columns block', () => {
|
|
|
377
379
|
} );
|
|
378
380
|
|
|
379
381
|
it( 'sets custom values correctly', async () => {
|
|
380
|
-
|
|
382
|
+
await initializeEditor( {
|
|
381
383
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
382
384
|
} );
|
|
383
385
|
const { getByLabelText, getByTestId } = screen;
|
|
@@ -443,7 +445,7 @@ describe( 'Columns block', () => {
|
|
|
443
445
|
test.each( testData )(
|
|
444
446
|
'sets the predefined percentages for %s',
|
|
445
447
|
async ( layout ) => {
|
|
446
|
-
|
|
448
|
+
await initializeEditor();
|
|
447
449
|
|
|
448
450
|
// Add block
|
|
449
451
|
await addBlock( screen, 'Columns' );
|
|
@@ -463,4 +465,32 @@ describe( 'Columns block', () => {
|
|
|
463
465
|
}
|
|
464
466
|
);
|
|
465
467
|
} );
|
|
468
|
+
|
|
469
|
+
it( 'transforms a nested Columns block into a Group block', async () => {
|
|
470
|
+
await initializeEditor( {
|
|
471
|
+
initialHtml: `<!-- wp:group {"layout":{"type":"constrained"}} -->
|
|
472
|
+
<div class="wp-block-group"><!-- wp:columns -->
|
|
473
|
+
<div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
|
|
474
|
+
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:paragraph -->
|
|
475
|
+
<p></p>
|
|
476
|
+
<!-- /wp:paragraph --></div>
|
|
477
|
+
<!-- /wp:column --></div>
|
|
478
|
+
<!-- /wp:columns --></div>
|
|
479
|
+
<!-- /wp:group -->`,
|
|
480
|
+
} );
|
|
481
|
+
|
|
482
|
+
// Get Columns block
|
|
483
|
+
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
484
|
+
fireEvent.press( columnsBlock );
|
|
485
|
+
|
|
486
|
+
// Open block actions menu
|
|
487
|
+
await openBlockActionsMenu( screen );
|
|
488
|
+
|
|
489
|
+
// Tap on the Transform block button
|
|
490
|
+
fireEvent.press( screen.getByLabelText( /Transform block…/ ) );
|
|
491
|
+
|
|
492
|
+
// Tap on the Group transform button
|
|
493
|
+
fireEvent.press( screen.getByLabelText( 'Group' ) );
|
|
494
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
495
|
+
} );
|
|
466
496
|
} );
|
package/src/cover/edit/index.js
CHANGED
|
@@ -151,8 +151,10 @@ function CoverEdit( {
|
|
|
151
151
|
const setMedia = attributesFromMedia( setAttributes, dimRatio );
|
|
152
152
|
|
|
153
153
|
const onSelectMedia = async ( newMedia ) => {
|
|
154
|
+
// Only pass the url to getCoverIsDark if the media is an image as video is not handled.
|
|
155
|
+
const newUrl = newMedia?.type === 'image' ? newMedia.url : undefined;
|
|
154
156
|
const isDarkSetting = await getCoverIsDark(
|
|
155
|
-
|
|
157
|
+
newUrl,
|
|
156
158
|
dimRatio,
|
|
157
159
|
overlayColor.color
|
|
158
160
|
);
|
package/src/cover/shared.js
CHANGED
|
@@ -167,26 +167,31 @@ export async function getCoverIsDark( url, dimRatio = 50, overlayColor ) {
|
|
|
167
167
|
.toRgb();
|
|
168
168
|
|
|
169
169
|
if ( url ) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
170
|
+
try {
|
|
171
|
+
const imgCrossOrigin = applyFilters(
|
|
172
|
+
'media.crossOrigin',
|
|
173
|
+
undefined,
|
|
174
|
+
url
|
|
175
|
+
);
|
|
176
|
+
const {
|
|
177
|
+
value: [ r, g, b, a ],
|
|
178
|
+
} = await retrieveFastAverageColor().getColorAsync( url, {
|
|
179
|
+
// Previously the default color was white, but that changed
|
|
180
|
+
// in v6.0.0 so it has to be manually set now.
|
|
181
|
+
defaultColor: [ 255, 255, 255, 255 ],
|
|
182
|
+
// Errors that come up don't reject the promise, so error
|
|
183
|
+
// logging has to be silenced with this option.
|
|
184
|
+
silent: process.env.NODE_ENV === 'production',
|
|
185
|
+
crossOrigin: imgCrossOrigin,
|
|
186
|
+
} );
|
|
187
|
+
// FAC uses 0-255 for alpha, but colord expects 0-1.
|
|
188
|
+
const media = { r, g, b, a: a / 255 };
|
|
189
|
+
const composite = compositeSourceOver( overlay, media );
|
|
190
|
+
return colord( composite ).isDark();
|
|
191
|
+
} catch ( error ) {
|
|
192
|
+
// If there's an error, just assume the image is dark.
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
// Assume a white background because it isn't easy to get the actual
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Image
|
|
4
|
+
import { Image } from 'react-native';
|
|
5
5
|
import {
|
|
6
6
|
getEditorHtml,
|
|
7
7
|
initializeEditor,
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
getBlock,
|
|
13
13
|
openBlockSettings,
|
|
14
14
|
} from 'test/helpers';
|
|
15
|
-
import HsvColorPicker from 'react-native-hsv-color-picker';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* WordPress dependencies
|
|
@@ -541,9 +540,6 @@ describe( 'color settings', () => {
|
|
|
541
540
|
} );
|
|
542
541
|
|
|
543
542
|
it( 'displays the hex color value in the custom color picker', async () => {
|
|
544
|
-
HsvColorPicker.mockImplementation( ( props ) => {
|
|
545
|
-
return <Pressable { ...props } testID="hsv-color-picker" />;
|
|
546
|
-
} );
|
|
547
543
|
const screen = await initializeEditor( {
|
|
548
544
|
initialHtml: COVER_BLOCK_PLACEHOLDER_HTML,
|
|
549
545
|
} );
|
|
@@ -241,7 +241,7 @@ describe( 'Embed block', () => {
|
|
|
241
241
|
|
|
242
242
|
// Wait for edit URL modal to be visible.
|
|
243
243
|
const embedEditURLModal = editor.getByTestId(
|
|
244
|
-
'
|
|
244
|
+
'link-settings-navigation'
|
|
245
245
|
);
|
|
246
246
|
await waitForModalVisible( embedEditURLModal );
|
|
247
247
|
|
|
@@ -259,7 +259,7 @@ describe( 'Embed block', () => {
|
|
|
259
259
|
|
|
260
260
|
// Wait for edit URL modal to be visible.
|
|
261
261
|
const embedEditURLModal = editor.getByTestId(
|
|
262
|
-
'
|
|
262
|
+
'link-settings-navigation'
|
|
263
263
|
);
|
|
264
264
|
await waitForModalVisible( embedEditURLModal );
|
|
265
265
|
|
|
@@ -299,7 +299,7 @@ describe( 'Embed block', () => {
|
|
|
299
299
|
|
|
300
300
|
// Wait for edit URL modal to be visible.
|
|
301
301
|
const embedEditURLModal = editor.getByTestId(
|
|
302
|
-
'
|
|
302
|
+
'link-settings-navigation'
|
|
303
303
|
);
|
|
304
304
|
await waitForModalVisible( embedEditURLModal );
|
|
305
305
|
|
|
@@ -338,7 +338,7 @@ describe( 'Embed block', () => {
|
|
|
338
338
|
|
|
339
339
|
// Wait for edit URL modal to be visible.
|
|
340
340
|
const embedEditURLModal = editor.getByTestId(
|
|
341
|
-
'
|
|
341
|
+
'link-settings-navigation'
|
|
342
342
|
);
|
|
343
343
|
await waitForModalVisible( embedEditURLModal );
|
|
344
344
|
|
|
@@ -359,7 +359,7 @@ describe( 'Embed block', () => {
|
|
|
359
359
|
|
|
360
360
|
// Wait for edit URL modal to be visible.
|
|
361
361
|
const embedEditURLModal = editor.getByTestId(
|
|
362
|
-
'
|
|
362
|
+
'link-settings-navigation'
|
|
363
363
|
);
|
|
364
364
|
await waitForModalVisible( embedEditURLModal );
|
|
365
365
|
|
|
@@ -400,7 +400,7 @@ describe( 'Embed block', () => {
|
|
|
400
400
|
|
|
401
401
|
// Wait for edit URL modal to be visible.
|
|
402
402
|
const embedEditURLModal = editor.getByTestId(
|
|
403
|
-
'
|
|
403
|
+
'link-settings-navigation'
|
|
404
404
|
);
|
|
405
405
|
await waitForModalVisible( embedEditURLModal );
|
|
406
406
|
|
|
@@ -584,7 +584,7 @@ describe( 'Embed block', () => {
|
|
|
584
584
|
|
|
585
585
|
// Wait for edit URL modal to be visible.
|
|
586
586
|
const embedEditURLModal = editor.getByTestId(
|
|
587
|
-
'
|
|
587
|
+
'link-settings-navigation'
|
|
588
588
|
);
|
|
589
589
|
await waitForModalVisible( embedEditURLModal );
|
|
590
590
|
|
|
@@ -623,7 +623,7 @@ describe( 'Embed block', () => {
|
|
|
623
623
|
|
|
624
624
|
// Wait for edit URL modal to be visible.
|
|
625
625
|
const embedEditURLModal = editor.getByTestId(
|
|
626
|
-
'
|
|
626
|
+
'link-settings-navigation'
|
|
627
627
|
);
|
|
628
628
|
await waitForModalVisible( embedEditURLModal );
|
|
629
629
|
|
|
@@ -804,7 +804,7 @@ describe( 'Embed block', () => {
|
|
|
804
804
|
|
|
805
805
|
// Dismiss the edit URL modal.
|
|
806
806
|
const embedEditURLModal = editor.getByTestId(
|
|
807
|
-
'
|
|
807
|
+
'link-settings-navigation'
|
|
808
808
|
);
|
|
809
809
|
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
810
810
|
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|