@wordpress/block-library 10.0.1-next.v.202606191442.0 → 10.0.1
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 -1
- package/build/audio/edit.cjs +8 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/breadcrumbs/edit.cjs +0 -1
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/button/edit.cjs +0 -1
- package/build/button/edit.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +0 -1
- package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
- package/build/details/edit.cjs +0 -1
- package/build/details/edit.cjs.map +2 -2
- package/build/form/edit.cjs +0 -2
- package/build/form/edit.cjs.map +2 -2
- package/build/form-input/edit.cjs +0 -2
- package/build/form-input/edit.cjs.map +2 -2
- package/build/freeform/edit.cjs +5 -14
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/migration-notice.cjs.map +2 -2
- package/build/home-link/edit.cjs +0 -1
- package/build/home-link/edit.cjs.map +2 -2
- package/build/html/modal.cjs +6 -3
- package/build/html/modal.cjs.map +2 -2
- package/build/icon/edit.cjs +2 -4
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/image.cjs +0 -2
- package/build/image/image.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +5 -25
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +0 -1
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +9 -9
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
- package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/link-ui/page-creator.cjs +0 -1
- package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
- package/build/navigation-link/shared/controls.cjs +0 -2
- package/build/navigation-link/shared/controls.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +0 -3
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-comment/edit.cjs +0 -1
- package/build/post-comment/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +0 -1
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +0 -1
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-title/edit.cjs +0 -1
- package/build/post-title/edit.cjs.map +2 -2
- package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
- package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
- package/build/query/edit/inspector-controls/index.cjs +0 -1
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/rss/edit.cjs +0 -1
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/block.json +4 -0
- package/build/search/edit.cjs +242 -204
- package/build/search/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +2 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/social-link/edit.cjs +0 -3
- package/build/social-link/edit.cjs.map +2 -2
- package/build/tab-list/block.json +2 -2
- package/build/tab-list/edit.cjs +14 -8
- package/build/tab-list/edit.cjs.map +2 -2
- package/build/tab-list/init.cjs +28 -0
- package/build/tab-list/init.cjs.map +7 -0
- package/build/tab-panel/edit.cjs +0 -9
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/tab-panel/save.cjs +2 -1
- package/build/tab-panel/save.cjs.map +2 -2
- package/build/tab-panels/block.json +0 -1
- package/build/tab-panels/init.cjs +28 -0
- package/build/tab-panels/init.cjs.map +7 -0
- package/build/table/edit.cjs +0 -2
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/view.cjs +20 -94
- package/build/tabs/view.cjs.map +2 -2
- package/build/template-part/edit/advanced-controls.cjs +0 -1
- package/build/template-part/edit/advanced-controls.cjs.map +2 -2
- package/build/template-part/edit/title-modal.cjs +1 -2
- package/build/template-part/edit/title-modal.cjs.map +2 -2
- package/build/video/edit.cjs +3 -2
- package/build/video/edit.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -2
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/audio/edit.mjs +8 -2
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +0 -1
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/button/edit.mjs +0 -1
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/details/edit.mjs +0 -1
- package/build-module/details/edit.mjs.map +2 -2
- package/build-module/form/edit.mjs +0 -2
- package/build-module/form/edit.mjs.map +2 -2
- package/build-module/form-input/edit.mjs +0 -2
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/freeform/edit.mjs +5 -14
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/migration-notice.mjs.map +2 -2
- package/build-module/home-link/edit.mjs +0 -1
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +6 -3
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/edit.mjs +2 -4
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +0 -2
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +0 -1
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +9 -9
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
- package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +0 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +0 -3
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-comment/edit.mjs +0 -1
- package/build-module/post-comment/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +0 -1
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +0 -1
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +0 -1
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
- package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +0 -1
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/rss/edit.mjs +0 -1
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/block.json +4 -0
- package/build-module/search/edit.mjs +242 -204
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +2 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/social-link/edit.mjs +0 -3
- package/build-module/social-link/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +2 -2
- package/build-module/tab-list/edit.mjs +15 -9
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/init.mjs +7 -0
- package/build-module/tab-list/init.mjs.map +7 -0
- package/build-module/tab-panel/edit.mjs +1 -10
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/tab-panel/save.mjs +2 -1
- package/build-module/tab-panel/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +0 -1
- package/build-module/tab-panels/init.mjs +7 -0
- package/build-module/tab-panels/init.mjs.map +7 -0
- package/build-module/table/edit.mjs +0 -2
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/view.mjs +20 -94
- package/build-module/tabs/view.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +0 -1
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/title-modal.mjs +1 -2
- package/build-module/template-part/edit/title-modal.mjs.map +2 -2
- package/build-module/video/edit.mjs +3 -3
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -2
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/editor-rtl.css +0 -15
- package/build-style/editor.css +0 -15
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/build-style/tab-list/style-rtl.css +1 -1
- package/build-style/tab-list/style.css +1 -1
- package/package.json +40 -40
- package/src/audio/edit.js +5 -9
- package/src/breadcrumbs/edit.js +0 -1
- package/src/button/edit.js +0 -1
- package/src/cover/edit/embed-video-url-input.js +0 -1
- package/src/cover/test/edit.js +51 -2
- package/src/details/edit.js +0 -1
- package/src/editor.scss +0 -1
- package/src/form/edit.js +0 -2
- package/src/form-input/edit.js +0 -2
- package/src/freeform/edit.js +6 -29
- package/src/freeform/migration-notice.js +2 -4
- package/src/home-link/edit.js +0 -1
- package/src/html/modal.js +3 -0
- package/src/icon/edit.js +0 -2
- package/src/image/image.js +0 -2
- package/src/image/test/use-open-image-media-editor-modal.js +20 -26
- package/src/image/use-open-image-media-editor-modal.js +24 -42
- package/src/list/ordered-list-settings.js +0 -1
- package/src/navigation/edit/index.js +9 -13
- package/src/navigation/edit/navigation-menu-name-control.js +0 -1
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/link-ui/page-creator.js +0 -1
- package/src/navigation-link/shared/controls.js +0 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
- package/src/playlist-track/edit.js +0 -3
- package/src/post-comment/edit.js +0 -1
- package/src/post-featured-image/edit.js +0 -1
- package/src/post-terms/edit.js +0 -1
- package/src/post-title/edit.js +0 -1
- package/src/query/edit/enhanced-pagination-modal.js +11 -1
- package/src/query/edit/inspector-controls/index.js +0 -1
- package/src/rss/edit.js +0 -1
- package/src/search/README.md +1 -0
- package/src/search/block.json +4 -0
- package/src/search/edit.js +106 -55
- package/src/search/index.php +25 -1
- package/src/site-logo/edit.js +3 -1
- package/src/social-link/edit.js +0 -3
- package/src/tab-list/README.md +1 -1
- package/src/tab-list/block.json +2 -2
- package/src/tab-list/edit.js +14 -8
- package/src/tab-list/index.php +4 -6
- package/src/tab-list/init.js +6 -0
- package/src/tab-list/style.scss +1 -2
- package/src/tab-panel/edit.js +1 -14
- package/src/tab-panel/index.php +2 -25
- package/src/tab-panel/save.js +1 -0
- package/src/tab-panels/block.json +0 -1
- package/src/tab-panels/init.js +6 -0
- package/src/table/edit.js +0 -2
- package/src/tabs/index.php +12 -19
- package/src/tabs/view.js +20 -100
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/title-modal.js +0 -1
- package/src/utils/test/style-state.js +26 -26
- package/src/video/edit.js +9 -16
- package/src/video/tracks-editor.js +0 -2
- package/build/freeform/convert-to-blocks-button.cjs +0 -40
- package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
- package/build/list-item/utils.cjs +0 -57
- package/build/list-item/utils.cjs.map +0 -7
- package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
- package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
- package/build-module/list-item/utils.mjs +0 -32
- package/build-module/list-item/utils.mjs.map +0 -7
- package/build-style/tab-list/editor-rtl.css +0 -14
- package/build-style/tab-list/editor.css +0 -14
- package/src/freeform/convert-to-blocks-button.js +0 -18
- package/src/list-item/utils.js +0 -34
- package/src/tab-list/editor.scss +0 -17
|
@@ -45,8 +45,7 @@ jest.mock( '../../lock-unlock', () => ( {
|
|
|
45
45
|
|
|
46
46
|
function createRegistry( {
|
|
47
47
|
getEditedEntityRecord = () => false,
|
|
48
|
-
|
|
49
|
-
resolveGetEntityRecord = getEntityRecord,
|
|
48
|
+
resolveGetEntityRecord = () => undefined,
|
|
50
49
|
} = {} ) {
|
|
51
50
|
const actions = {
|
|
52
51
|
invalidateResolution: jest.fn(),
|
|
@@ -54,7 +53,6 @@ function createRegistry( {
|
|
|
54
53
|
return {
|
|
55
54
|
select: jest.fn( () => ( {
|
|
56
55
|
getEditedEntityRecord,
|
|
57
|
-
getEntityRecord,
|
|
58
56
|
} ) ),
|
|
59
57
|
dispatch: jest.fn( () => actions ),
|
|
60
58
|
resolveSelect: jest.fn( () => ( {
|
|
@@ -169,11 +167,8 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
169
167
|
caption: 'Original caption',
|
|
170
168
|
},
|
|
171
169
|
registryOptions: {
|
|
172
|
-
|
|
173
|
-
resolveGetEntityRecord: (
|
|
174
|
-
query?.context === 'edit'
|
|
175
|
-
? updatedAttachment
|
|
176
|
-
: originalAttachment,
|
|
170
|
+
getEditedEntityRecord: () => originalAttachment,
|
|
171
|
+
resolveGetEntityRecord: () => updatedAttachment,
|
|
177
172
|
},
|
|
178
173
|
} );
|
|
179
174
|
|
|
@@ -181,13 +176,15 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
181
176
|
alt: 'Updated alt',
|
|
182
177
|
caption: 'Updated caption',
|
|
183
178
|
} );
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
// A single, query-less resolution is invalidated: the hook reads,
|
|
180
|
+
// resolves, and invalidates the attachment through the entity's default
|
|
181
|
+
// (edit) context rather than an explicitly-keyed query.
|
|
182
|
+
expect( registry.actions.invalidateResolution ).toHaveBeenCalledTimes(
|
|
183
|
+
1
|
|
187
184
|
);
|
|
188
185
|
expect( registry.actions.invalidateResolution ).toHaveBeenCalledWith(
|
|
189
186
|
'getEntityRecord',
|
|
190
|
-
[ 'postType', 'attachment', 1
|
|
187
|
+
[ 'postType', 'attachment', 1 ]
|
|
191
188
|
);
|
|
192
189
|
} );
|
|
193
190
|
|
|
@@ -220,8 +217,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
220
217
|
1,
|
|
221
218
|
'postType',
|
|
222
219
|
'attachment',
|
|
223
|
-
1
|
|
224
|
-
{ context: 'edit' }
|
|
220
|
+
1
|
|
225
221
|
);
|
|
226
222
|
expect( openMediaEditorModal ).toHaveBeenCalledWith( {
|
|
227
223
|
id: 1,
|
|
@@ -263,8 +259,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
263
259
|
1,
|
|
264
260
|
'postType',
|
|
265
261
|
'attachment',
|
|
266
|
-
1
|
|
267
|
-
{ context: 'edit' }
|
|
262
|
+
1
|
|
268
263
|
);
|
|
269
264
|
expect( openMediaEditorModal ).toHaveBeenCalledWith( {
|
|
270
265
|
id: 1,
|
|
@@ -299,7 +294,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
299
294
|
caption: undefined,
|
|
300
295
|
},
|
|
301
296
|
registryOptions: {
|
|
302
|
-
|
|
297
|
+
getEditedEntityRecord: () => ( {
|
|
303
298
|
id: 1,
|
|
304
299
|
alt_text: '',
|
|
305
300
|
caption: {
|
|
@@ -314,8 +309,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
314
309
|
1,
|
|
315
310
|
'postType',
|
|
316
311
|
'attachment',
|
|
317
|
-
1
|
|
318
|
-
{ context: 'edit' }
|
|
312
|
+
1
|
|
319
313
|
);
|
|
320
314
|
expect( setAttributes ).toHaveBeenCalledWith( {
|
|
321
315
|
caption: 'Updated attachment caption',
|
|
@@ -341,7 +335,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
341
335
|
caption: '',
|
|
342
336
|
},
|
|
343
337
|
registryOptions: {
|
|
344
|
-
|
|
338
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
345
339
|
attachmentId === 1 ? originalAttachment : undefined,
|
|
346
340
|
resolveGetEntityRecord: ( kind, name, attachmentId ) =>
|
|
347
341
|
attachmentId === 2 ? updatedAttachment : undefined,
|
|
@@ -371,7 +365,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
371
365
|
};
|
|
372
366
|
const deferredAttachment = createDeferred();
|
|
373
367
|
const registry = createRegistry( {
|
|
374
|
-
|
|
368
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
375
369
|
attachmentId === 1 ? originalAttachment : undefined,
|
|
376
370
|
resolveGetEntityRecord: ( kind, name, attachmentId ) =>
|
|
377
371
|
attachmentId === 2 ? deferredAttachment.promise : undefined,
|
|
@@ -437,7 +431,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
437
431
|
caption: '',
|
|
438
432
|
},
|
|
439
433
|
registryOptions: {
|
|
440
|
-
|
|
434
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
441
435
|
attachmentId === 1
|
|
442
436
|
? originalAttachment
|
|
443
437
|
: {
|
|
@@ -469,7 +463,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
469
463
|
caption: undefined,
|
|
470
464
|
},
|
|
471
465
|
registryOptions: {
|
|
472
|
-
|
|
466
|
+
getEditedEntityRecord: () => ( {
|
|
473
467
|
id: 1,
|
|
474
468
|
alt_text: '',
|
|
475
469
|
caption: { raw: 'Existing caption' },
|
|
@@ -526,7 +520,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
526
520
|
caption: undefined,
|
|
527
521
|
},
|
|
528
522
|
registryOptions: {
|
|
529
|
-
|
|
523
|
+
getEditedEntityRecord: () => ( {
|
|
530
524
|
id: 1,
|
|
531
525
|
alt_text: 'Original alt',
|
|
532
526
|
caption: { raw: 'Existing caption' },
|
|
@@ -556,7 +550,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
556
550
|
caption: { toString: () => '' },
|
|
557
551
|
},
|
|
558
552
|
registryOptions: {
|
|
559
|
-
|
|
553
|
+
getEditedEntityRecord: () => ( {
|
|
560
554
|
id: 1,
|
|
561
555
|
alt_text: 'Original alt',
|
|
562
556
|
caption: { raw: 'Existing caption' },
|
|
@@ -603,7 +597,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
603
597
|
};
|
|
604
598
|
const deferredAttachment = createDeferred();
|
|
605
599
|
const registry = createRegistry( {
|
|
606
|
-
|
|
600
|
+
getEditedEntityRecord: () => ( {
|
|
607
601
|
id: 1,
|
|
608
602
|
alt_text: '',
|
|
609
603
|
caption: { raw: '' },
|
|
@@ -104,9 +104,6 @@ export function getSyncedImageBlockAttributes(
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const { openMediaEditorModalKey } = unlock( blockEditorPrivateApis );
|
|
107
|
-
// Caption sync needs `caption.raw`; view/default attachment records can contain
|
|
108
|
-
// only rendered caption data or be tied to an in-flight stale resolution.
|
|
109
|
-
const ATTACHMENT_EDIT_QUERY = { context: 'edit' };
|
|
110
107
|
|
|
111
108
|
function getAttachmentFallbackForEmptyBlockMetadata( { alt, caption } ) {
|
|
112
109
|
const attachment = {};
|
|
@@ -177,25 +174,23 @@ export function useOpenImageMediaEditorModal( {
|
|
|
177
174
|
};
|
|
178
175
|
}, [ alt, caption, id, url ] );
|
|
179
176
|
|
|
177
|
+
// Reads the cached attachment record. The `attachment` postType entity
|
|
178
|
+
// fetches with `context: 'edit'` by default, so `getEditedEntityRecord`
|
|
179
|
+
// returns the edit-context record — carrying `caption` as `{ raw }` and a
|
|
180
|
+
// usable `alt_text` — without us specifying a context. It is resolver-
|
|
181
|
+
// backed, so on a cold cache this also kicks off the fetch and returns a
|
|
182
|
+
// falsy value synchronously; that resolution shares its cache key with the
|
|
183
|
+
// `resolveAttachmentRecord` call below (both keyed on the no-query
|
|
184
|
+
// `getEntityRecord`), so the two dedupe into a single request.
|
|
180
185
|
const getCachedAttachmentRecord = useCallback(
|
|
181
|
-
( attachmentId ) =>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
getEditedEntityRecord(
|
|
186
|
+
( attachmentId ) =>
|
|
187
|
+
registry
|
|
188
|
+
.select( coreStore )
|
|
189
|
+
.getEditedEntityRecord(
|
|
186
190
|
'postType',
|
|
187
191
|
'attachment',
|
|
188
192
|
attachmentId
|
|
189
|
-
)
|
|
190
|
-
getEntityRecord(
|
|
191
|
-
'postType',
|
|
192
|
-
'attachment',
|
|
193
|
-
attachmentId,
|
|
194
|
-
ATTACHMENT_EDIT_QUERY
|
|
195
|
-
) ||
|
|
196
|
-
getEntityRecord( 'postType', 'attachment', attachmentId )
|
|
197
|
-
);
|
|
198
|
-
},
|
|
193
|
+
),
|
|
199
194
|
[ registry ]
|
|
200
195
|
);
|
|
201
196
|
|
|
@@ -204,18 +199,10 @@ export function useOpenImageMediaEditorModal( {
|
|
|
204
199
|
const resolveSelect = registry.resolveSelect( coreStore );
|
|
205
200
|
|
|
206
201
|
try {
|
|
207
|
-
return (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
attachmentId,
|
|
212
|
-
ATTACHMENT_EDIT_QUERY
|
|
213
|
-
) ) ||
|
|
214
|
-
( await resolveSelect.getEntityRecord(
|
|
215
|
-
'postType',
|
|
216
|
-
'attachment',
|
|
217
|
-
attachmentId
|
|
218
|
-
) )
|
|
202
|
+
return await resolveSelect.getEntityRecord(
|
|
203
|
+
'postType',
|
|
204
|
+
'attachment',
|
|
205
|
+
attachmentId
|
|
219
206
|
);
|
|
220
207
|
} catch {
|
|
221
208
|
return undefined;
|
|
@@ -226,8 +213,9 @@ export function useOpenImageMediaEditorModal( {
|
|
|
226
213
|
|
|
227
214
|
const resolveFreshAttachmentRecord = useCallback(
|
|
228
215
|
async ( attachmentId ) => {
|
|
229
|
-
//
|
|
230
|
-
// server state that reflects the media editor's
|
|
216
|
+
// Invalidate the cached resolution so resolveAttachmentRecord
|
|
217
|
+
// re-fetches the server state that reflects the media editor's
|
|
218
|
+
// saved changes.
|
|
231
219
|
const { invalidateResolution } = registry.dispatch( coreStore );
|
|
232
220
|
|
|
233
221
|
invalidateResolution( 'getEntityRecord', [
|
|
@@ -235,12 +223,6 @@ export function useOpenImageMediaEditorModal( {
|
|
|
235
223
|
'attachment',
|
|
236
224
|
attachmentId,
|
|
237
225
|
] );
|
|
238
|
-
invalidateResolution( 'getEntityRecord', [
|
|
239
|
-
'postType',
|
|
240
|
-
'attachment',
|
|
241
|
-
attachmentId,
|
|
242
|
-
ATTACHMENT_EDIT_QUERY,
|
|
243
|
-
] );
|
|
244
226
|
return resolveAttachmentRecord( attachmentId );
|
|
245
227
|
},
|
|
246
228
|
[ registry, resolveAttachmentRecord ]
|
|
@@ -321,10 +303,10 @@ export function useOpenImageMediaEditorModal( {
|
|
|
321
303
|
}
|
|
322
304
|
|
|
323
305
|
// Snapshot the attachment's current metadata before the user makes
|
|
324
|
-
// any changes so handleMediaUpdate can compare against it later.
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
// the block's own attributes
|
|
306
|
+
// any changes so handleMediaUpdate can compare against it later. Use
|
|
307
|
+
// the cached record when it's already present; only resolve when
|
|
308
|
+
// nothing is cached yet, then fall back to a minimal object derived
|
|
309
|
+
// from the block's own attributes.
|
|
328
310
|
const cachedAttachmentRecord = getCachedAttachmentRecord( id );
|
|
329
311
|
const fallbackAttachmentRecord =
|
|
330
312
|
getAttachmentFallbackForEmptyBlockMetadata(
|
|
@@ -362,27 +362,29 @@ function Navigation( {
|
|
|
362
362
|
innerBlocks,
|
|
363
363
|
} = useInnerBlocks( clientId );
|
|
364
364
|
|
|
365
|
+
const {
|
|
366
|
+
replaceInnerBlocks,
|
|
367
|
+
selectBlock,
|
|
368
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
369
|
+
} = useDispatch( blockEditorStore );
|
|
370
|
+
|
|
365
371
|
// Reset submenuVisibility to default if orientation changes to horizontal
|
|
366
372
|
// while "always" is selected, but only when the Navigation block or one
|
|
367
373
|
// of its inner blocks is being edited. Rendering related template parts
|
|
368
374
|
// should not mark them dirty.
|
|
369
375
|
useEffect( () => {
|
|
370
|
-
if (
|
|
371
|
-
(
|
|
372
|
-
orientation === 'horizontal' &&
|
|
373
|
-
submenuVisibility === 'always'
|
|
374
|
-
) {
|
|
376
|
+
if ( orientation === 'horizontal' && submenuVisibility === 'always' ) {
|
|
377
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
375
378
|
setAttributes( {
|
|
376
379
|
submenuVisibility: 'hover',
|
|
377
380
|
showSubmenuIcon: true,
|
|
378
381
|
} );
|
|
379
382
|
}
|
|
380
383
|
}, [
|
|
381
|
-
isSelected,
|
|
382
|
-
isInnerBlockSelected,
|
|
383
384
|
orientation,
|
|
384
385
|
submenuVisibility,
|
|
385
386
|
setAttributes,
|
|
387
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
386
388
|
] );
|
|
387
389
|
|
|
388
390
|
// Use a ref to store whether we've confirmed a page-list has submenus.
|
|
@@ -442,12 +444,6 @@ function Navigation( {
|
|
|
442
444
|
templatePart.area === NAVIGATION_OVERLAY_TEMPLATE_PART_AREA
|
|
443
445
|
) ?? false;
|
|
444
446
|
|
|
445
|
-
const {
|
|
446
|
-
replaceInnerBlocks,
|
|
447
|
-
selectBlock,
|
|
448
|
-
__unstableMarkNextChangeAsNotPersistent,
|
|
449
|
-
} = useDispatch( blockEditorStore );
|
|
450
|
-
|
|
451
447
|
const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] =
|
|
452
448
|
useState( false );
|
|
453
449
|
|
|
@@ -74,7 +74,7 @@ _Defined via the [`usesContext` and `providesContext`](https://developer.wordpre
|
|
|
74
74
|
_Defined via the [`selectors`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-selectors/) property in block.json._
|
|
75
75
|
|
|
76
76
|
- **states**:
|
|
77
|
-
-
|
|
77
|
+
- -current: `.wp-block-navigation .current-menu-item`
|
|
78
78
|
|
|
79
79
|
## Block Markup
|
|
80
80
|
|
|
@@ -178,7 +178,6 @@ export function Controls( {
|
|
|
178
178
|
isShownByDefault
|
|
179
179
|
>
|
|
180
180
|
<TextControl
|
|
181
|
-
__next40pxDefaultSize
|
|
182
181
|
label={ __( 'Text' ) }
|
|
183
182
|
value={ label ? stripHTML( label ) : '' }
|
|
184
183
|
onChange={ ( labelValue ) => {
|
|
@@ -292,7 +291,6 @@ export function Controls( {
|
|
|
292
291
|
isShownByDefault={ ! isContentOnly }
|
|
293
292
|
>
|
|
294
293
|
<TextControl
|
|
295
|
-
__next40pxDefaultSize
|
|
296
294
|
label={ __( 'Rel attribute' ) }
|
|
297
295
|
value={ rel || '' }
|
|
298
296
|
onChange={ ( relValue ) => {
|
|
@@ -9,6 +9,7 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
9
9
|
"attributes": {},
|
|
10
10
|
"description": "A link to a custom URL.",
|
|
11
11
|
"icon": <SVG
|
|
12
|
+
fill="currentColor"
|
|
12
13
|
viewBox="0 0 24 24"
|
|
13
14
|
xmlns="http://www.w3.org/2000/svg"
|
|
14
15
|
>
|
|
@@ -26,6 +27,7 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
26
27
|
},
|
|
27
28
|
"description": "A link to a post.",
|
|
28
29
|
"icon": <SVG
|
|
30
|
+
fill="currentColor"
|
|
29
31
|
viewBox="0 0 24 24"
|
|
30
32
|
xmlns="http://www.w3.org/2000/svg"
|
|
31
33
|
>
|
|
@@ -43,6 +45,7 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
43
45
|
},
|
|
44
46
|
"description": "A link to a page.",
|
|
45
47
|
"icon": <SVG
|
|
48
|
+
fill="currentColor"
|
|
46
49
|
viewBox="0 0 24 24"
|
|
47
50
|
xmlns="http://www.w3.org/2000/svg"
|
|
48
51
|
>
|
|
@@ -63,6 +66,7 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
63
66
|
},
|
|
64
67
|
"description": "A link to a category.",
|
|
65
68
|
"icon": <SVG
|
|
69
|
+
fill="currentColor"
|
|
66
70
|
viewBox="0 0 24 24"
|
|
67
71
|
xmlns="http://www.w3.org/2000/svg"
|
|
68
72
|
>
|
|
@@ -82,6 +86,7 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
82
86
|
},
|
|
83
87
|
"description": "A link to a tag.",
|
|
84
88
|
"icon": <SVG
|
|
89
|
+
fill="currentColor"
|
|
85
90
|
viewBox="0 0 24 24"
|
|
86
91
|
xmlns="http://www.w3.org/2000/svg"
|
|
87
92
|
>
|
|
@@ -161,7 +161,6 @@ const PlaylistTrackEdit = ( { attributes, setAttributes, context } ) => {
|
|
|
161
161
|
<InspectorControls>
|
|
162
162
|
<PanelBody title={ __( 'Settings' ) }>
|
|
163
163
|
<TextControl
|
|
164
|
-
__next40pxDefaultSize
|
|
165
164
|
label={ __( 'Artist' ) }
|
|
166
165
|
value={ artist ? stripHTML( artist ) : '' }
|
|
167
166
|
onChange={ ( artistValue ) => {
|
|
@@ -169,7 +168,6 @@ const PlaylistTrackEdit = ( { attributes, setAttributes, context } ) => {
|
|
|
169
168
|
} }
|
|
170
169
|
/>
|
|
171
170
|
<TextControl
|
|
172
|
-
__next40pxDefaultSize
|
|
173
171
|
label={ __( 'Album' ) }
|
|
174
172
|
value={ album ? stripHTML( album ) : '' }
|
|
175
173
|
onChange={ ( albumValue ) => {
|
|
@@ -177,7 +175,6 @@ const PlaylistTrackEdit = ( { attributes, setAttributes, context } ) => {
|
|
|
177
175
|
} }
|
|
178
176
|
/>
|
|
179
177
|
<TextControl
|
|
180
|
-
__next40pxDefaultSize
|
|
181
178
|
label={ __( 'Title' ) }
|
|
182
179
|
value={ title ? stripHTML( title ) : '' }
|
|
183
180
|
onChange={ ( titleValue ) => {
|
package/src/post-comment/edit.js
CHANGED
package/src/post-terms/edit.js
CHANGED
package/src/post-title/edit.js
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import { useState, useEffect } from '@wordpress/element';
|
|
11
|
+
import { useDispatch } from '@wordpress/data';
|
|
12
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Internal dependencies
|
|
@@ -24,13 +26,21 @@ export default function EnhancedPaginationModal( {
|
|
|
24
26
|
} ) {
|
|
25
27
|
const [ isOpen, setOpen ] = useState( false );
|
|
26
28
|
const hasUnsupportedBlocks = useUnsupportedBlocks( clientId );
|
|
29
|
+
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
30
|
+
useDispatch( blockEditorStore );
|
|
27
31
|
|
|
28
32
|
useEffect( () => {
|
|
29
33
|
if ( enhancedPagination && hasUnsupportedBlocks ) {
|
|
34
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
30
35
|
setAttributes( { enhancedPagination: false } );
|
|
31
36
|
setOpen( true );
|
|
32
37
|
}
|
|
33
|
-
}, [
|
|
38
|
+
}, [
|
|
39
|
+
enhancedPagination,
|
|
40
|
+
hasUnsupportedBlocks,
|
|
41
|
+
setAttributes,
|
|
42
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
43
|
+
] );
|
|
34
44
|
|
|
35
45
|
const closeModal = () => {
|
|
36
46
|
setOpen( false );
|
package/src/rss/edit.js
CHANGED
|
@@ -289,7 +289,6 @@ export default function RSSEdit( { attributes, setAttributes, name } ) {
|
|
|
289
289
|
</InspectorControls>
|
|
290
290
|
<InspectorControls group="advanced">
|
|
291
291
|
<TextControl
|
|
292
|
-
__next40pxDefaultSize
|
|
293
292
|
label={ __( 'Link relation' ) }
|
|
294
293
|
help={ createInterpolateElement(
|
|
295
294
|
__(
|
package/src/search/README.md
CHANGED
|
@@ -24,6 +24,7 @@ _Defined via the [`attributes`](https://developer.wordpress.org/block-editor/ref
|
|
|
24
24
|
| `buttonPosition` | `string` | `"button-outside"` | — |
|
|
25
25
|
| `buttonUseIcon` | `boolean` | `false` | — |
|
|
26
26
|
| `query` | `object` | `{}` | — |
|
|
27
|
+
| `tagName` | `string` | `""` | — |
|
|
27
28
|
|
|
28
29
|
## Supports
|
|
29
30
|
|