@wordpress/block-library 9.11.0 → 9.12.1-next.082ed6819.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/block-keyboard-shortcuts/index.js +7 -7
- package/build/block-keyboard-shortcuts/index.js.map +1 -1
- package/build/button/index.js +1 -1
- package/build/button/index.js.map +1 -1
- package/build/cover/deprecated.js +140 -4
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +1 -1
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +1 -2
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +23 -23
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/index.js +10 -10
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +13 -13
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +6 -7
- package/build/cover/shared.js.map +1 -1
- package/build/details/index.js +20 -0
- package/build/details/index.js.map +1 -1
- package/build/file/edit.js +8 -4
- package/build/file/edit.js.map +1 -1
- package/build/freeform/modal.js +1 -1
- package/build/freeform/modal.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/heading/index.js +1 -7
- package/build/heading/index.js.map +1 -1
- package/build/home-link/edit.js +20 -36
- package/build/home-link/edit.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +144 -78
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/latest-posts/edit.js +0 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/navigation/edit/index.js +2 -23
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +6 -8
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/page-list/index.js +14 -0
- package/build/page-list/index.js.map +1 -1
- package/build/paragraph/edit.js +26 -25
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-content/index.js +13 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-template/edit.js +11 -0
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +1 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +3 -13
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +0 -3
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/edit/query-content.js +10 -12
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +1 -1
- package/build/query/utils.js +38 -9
- package/build/query/utils.js.map +1 -1
- package/build/social-link/edit.js +22 -9
- package/build/social-link/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +2 -7
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +1 -4
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +0 -3
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/get-template-part-icon.js +23 -0
- package/build/template-part/edit/utils/get-template-part-icon.js.map +1 -0
- package/build/template-part/edit/utils/hooks.js +1 -6
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/variations.js +6 -12
- package/build/template-part/variations.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +135 -123
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/block-keyboard-shortcuts/index.js +7 -7
- package/build-module/block-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/button/index.js +1 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/cover/deprecated.js +140 -4
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +1 -1
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +1 -2
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +23 -23
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/index.js +10 -10
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +13 -13
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +6 -7
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/details/index.js +21 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/file/edit.js +8 -4
- package/build-module/file/edit.js.map +1 -1
- package/build-module/freeform/modal.js +1 -1
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/heading/index.js +1 -7
- package/build-module/heading/index.js.map +1 -1
- package/build-module/home-link/edit.js +23 -39
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/image/edit.js +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +149 -83
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/latest-posts/edit.js +0 -1
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/navigation/edit/index.js +2 -23
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +6 -8
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/page-list/index.js +14 -0
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/paragraph/edit.js +26 -25
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-content/index.js +13 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-template/edit.js +11 -0
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +1 -3
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +3 -13
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +0 -3
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/edit/query-content.js +10 -12
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +1 -1
- package/build-module/query/utils.js +35 -8
- package/build-module/query/utils.js.map +1 -1
- package/build-module/social-link/edit.js +24 -11
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +3 -8
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +1 -4
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +0 -3
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/get-template-part-icon.js +15 -0
- package/build-module/template-part/edit/utils/get-template-part-icon.js.map +1 -0
- package/build-module/template-part/edit/utils/hooks.js +1 -6
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/variations.js +5 -11
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +136 -124
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/cover/editor-rtl.css +3 -5
- package/build-style/cover/editor.css +3 -5
- package/build-style/cover/style-rtl.css +19 -15
- package/build-style/cover/style.css +19 -15
- package/build-style/editor-rtl.css +19 -30
- package/build-style/editor.css +19 -30
- package/build-style/group/editor-rtl.css +0 -10
- package/build-style/group/editor.css +0 -10
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/image/style-rtl.css +0 -2
- package/build-style/image/style.css +0 -2
- package/build-style/latest-posts/editor-rtl.css +0 -7
- package/build-style/latest-posts/editor.css +0 -7
- package/build-style/media-text/style-rtl.css +1 -1
- package/build-style/media-text/style.css +1 -1
- package/build-style/navigation/style-rtl.css +1 -1
- package/build-style/navigation/style.css +1 -1
- package/build-style/page-list/style-rtl.css +4 -0
- package/build-style/page-list/style.css +4 -0
- package/build-style/query/editor-rtl.css +0 -4
- package/build-style/query/editor.css +0 -4
- package/build-style/search/style-rtl.css +3 -3
- package/build-style/search/style.css +3 -3
- package/build-style/social-link/editor-rtl.css +4 -4
- package/build-style/social-link/editor.css +4 -4
- package/build-style/style-rtl.css +28 -22
- package/build-style/style.css +28 -22
- package/build-style/video/editor-rtl.css +8 -0
- package/build-style/video/editor.css +8 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/package.json +39 -39
- package/src/block-keyboard-shortcuts/index.js +25 -11
- package/src/button/index.js +1 -1
- package/src/comments/block.json +3 -9
- package/src/cover/deprecated.js +182 -4
- package/src/cover/edit/block-controls.js +1 -1
- package/src/cover/edit/cover-placeholder.js +0 -3
- package/src/cover/edit/index.js +42 -27
- package/src/cover/editor.scss +4 -5
- package/src/cover/index.js +8 -8
- package/src/cover/save.js +27 -20
- package/src/cover/shared.js +10 -10
- package/src/cover/style.scss +40 -16
- package/src/cover/test/__snapshots__/edit.native.js.snap +9 -9
- package/src/cover/test/__snapshots__/transforms.native.js.snap +4 -4
- package/src/cover/test/edit.js +2 -2
- package/src/cover/test/edit.native.js +4 -4
- package/src/cover/test/transforms.native.js +4 -4
- package/src/details/block.json +1 -0
- package/src/details/index.js +23 -1
- package/src/file/edit.js +9 -3
- package/src/freeform/modal.js +1 -1
- package/src/gallery/edit.js +1 -1
- package/src/group/editor.scss +0 -12
- package/src/heading/block.json +1 -7
- package/src/home-link/edit.js +27 -45
- package/src/home-link/index.php +0 -3
- package/src/image/block.json +1 -1
- package/src/image/edit.js +1 -1
- package/src/image/editor.scss +4 -0
- package/src/image/image.js +200 -109
- package/src/image/style.scss +0 -1
- package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/latest-posts/edit.js +0 -1
- package/src/latest-posts/editor.scss +0 -11
- package/src/media-text/style.scss +1 -1
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/navigation/edit/index.js +3 -30
- package/src/navigation/index.php +5 -151
- package/src/navigation/style.scss +1 -1
- package/src/navigation/use-template-part-area-label.js +10 -10
- package/src/page-list/block.json +14 -0
- package/src/page-list/style.scss +4 -0
- package/src/paragraph/edit.js +20 -17
- package/src/pattern/index.php +0 -7
- package/src/post-content/block.json +14 -1
- package/src/post-template/block.json +2 -1
- package/src/post-template/edit.js +19 -0
- package/src/query/block.json +1 -1
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -5
- package/src/query/edit/inspector-controls/index.js +2 -12
- package/src/query/edit/pattern-selection-modal.js +0 -3
- package/src/query/edit/query-content.js +9 -17
- package/src/query/editor.scss +0 -4
- package/src/query/index.php +1 -1
- package/src/query/test/utils.js +59 -1
- package/src/query/utils.js +43 -15
- package/src/rss/index.php +11 -8
- package/src/search/index.php +2 -2
- package/src/search/style.scss +3 -5
- package/src/social-link/edit.js +47 -19
- package/src/social-link/editor.scss +6 -7
- package/src/template-part/edit/advanced-controls.js +13 -13
- package/src/template-part/edit/index.js +1 -4
- package/src/template-part/edit/selection-modal.js +0 -3
- package/src/template-part/edit/utils/get-template-part-icon.js +20 -0
- package/src/template-part/edit/utils/hooks.js +2 -7
- package/src/template-part/variations.js +4 -16
- package/src/video/edit.js +1 -1
- package/src/video/editor.scss +9 -0
- package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/video/tracks-editor.js +157 -141
- package/tsconfig.tsbuildinfo +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +0 -40
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +0 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +0 -33
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +0 -1
- package/src/query/edit/inspector-controls/create-new-post-link.js +0 -32
- /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
package/src/query/test/utils.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { terms } from './fixtures';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
getEntitiesInfo,
|
|
7
|
+
getValueFromObjectPath,
|
|
8
|
+
getQueryContextFromTemplate,
|
|
9
|
+
} from '../utils';
|
|
6
10
|
|
|
7
11
|
describe( 'Query block utils', () => {
|
|
8
12
|
describe( 'getEntitiesInfo', () => {
|
|
@@ -61,4 +65,58 @@ describe( 'Query block utils', () => {
|
|
|
61
65
|
expect( result ).toBe( 'test' );
|
|
62
66
|
} );
|
|
63
67
|
} );
|
|
68
|
+
|
|
69
|
+
describe( 'getQueryContextFromTemplate', () => {
|
|
70
|
+
it( 'should return the correct query context based on template slug', () => {
|
|
71
|
+
expect( getQueryContextFromTemplate() ).toStrictEqual( {
|
|
72
|
+
isSingular: true,
|
|
73
|
+
} );
|
|
74
|
+
expect( getQueryContextFromTemplate( '404' ) ).toStrictEqual( {
|
|
75
|
+
isSingular: true,
|
|
76
|
+
templateType: '404',
|
|
77
|
+
} );
|
|
78
|
+
expect( getQueryContextFromTemplate( 'blank' ) ).toStrictEqual( {
|
|
79
|
+
isSingular: true,
|
|
80
|
+
templateType: 'blank',
|
|
81
|
+
} );
|
|
82
|
+
expect( getQueryContextFromTemplate( 'single' ) ).toStrictEqual( {
|
|
83
|
+
isSingular: true,
|
|
84
|
+
templateType: 'single',
|
|
85
|
+
} );
|
|
86
|
+
expect(
|
|
87
|
+
getQueryContextFromTemplate( 'single-film' )
|
|
88
|
+
).toStrictEqual( {
|
|
89
|
+
isSingular: true,
|
|
90
|
+
templateType: 'single',
|
|
91
|
+
} );
|
|
92
|
+
expect( getQueryContextFromTemplate( 'page' ) ).toStrictEqual( {
|
|
93
|
+
isSingular: true,
|
|
94
|
+
templateType: 'page',
|
|
95
|
+
} );
|
|
96
|
+
expect( getQueryContextFromTemplate( 'wp' ) ).toStrictEqual( {
|
|
97
|
+
isSingular: true,
|
|
98
|
+
templateType: 'custom',
|
|
99
|
+
} );
|
|
100
|
+
expect( getQueryContextFromTemplate( 'category' ) ).toStrictEqual( {
|
|
101
|
+
isSingular: false,
|
|
102
|
+
templateType: 'category',
|
|
103
|
+
} );
|
|
104
|
+
expect(
|
|
105
|
+
getQueryContextFromTemplate( 'category-dog' )
|
|
106
|
+
).toStrictEqual( {
|
|
107
|
+
isSingular: false,
|
|
108
|
+
templateType: 'category',
|
|
109
|
+
} );
|
|
110
|
+
expect( getQueryContextFromTemplate( 'archive' ) ).toStrictEqual( {
|
|
111
|
+
isSingular: false,
|
|
112
|
+
templateType: 'archive',
|
|
113
|
+
} );
|
|
114
|
+
expect(
|
|
115
|
+
getQueryContextFromTemplate( 'archive-film' )
|
|
116
|
+
).toStrictEqual( {
|
|
117
|
+
isSingular: false,
|
|
118
|
+
templateType: 'archive',
|
|
119
|
+
} );
|
|
120
|
+
} );
|
|
121
|
+
} );
|
|
64
122
|
} );
|
package/src/query/utils.js
CHANGED
|
@@ -272,32 +272,31 @@ export const getTransformedBlocksFromPattern = (
|
|
|
272
272
|
* @return {string} The block name to be used in the patterns suggestions.
|
|
273
273
|
*/
|
|
274
274
|
export function useBlockNameForPatterns( clientId, attributes ) {
|
|
275
|
-
|
|
276
|
-
( select ) =>
|
|
277
|
-
select( blocksStore ).getActiveBlockVariation(
|
|
278
|
-
'core/query',
|
|
279
|
-
attributes
|
|
280
|
-
)?.name,
|
|
281
|
-
[ attributes ]
|
|
282
|
-
);
|
|
283
|
-
const blockName = `core/query/${ activeVariationName }`;
|
|
284
|
-
const hasActiveVariationPatterns = useSelect(
|
|
275
|
+
return useSelect(
|
|
285
276
|
( select ) => {
|
|
277
|
+
const activeVariationName = select(
|
|
278
|
+
blocksStore
|
|
279
|
+
).getActiveBlockVariation( 'core/query', attributes )?.name;
|
|
280
|
+
|
|
286
281
|
if ( ! activeVariationName ) {
|
|
287
|
-
return
|
|
282
|
+
return 'core/query';
|
|
288
283
|
}
|
|
284
|
+
|
|
289
285
|
const { getBlockRootClientId, getPatternsByBlockTypes } =
|
|
290
286
|
select( blockEditorStore );
|
|
287
|
+
|
|
291
288
|
const rootClientId = getBlockRootClientId( clientId );
|
|
292
289
|
const activePatterns = getPatternsByBlockTypes(
|
|
293
|
-
|
|
290
|
+
`core/query/${ activeVariationName }`,
|
|
294
291
|
rootClientId
|
|
295
292
|
);
|
|
296
|
-
|
|
293
|
+
|
|
294
|
+
return activePatterns.length > 0
|
|
295
|
+
? `core/query/${ activeVariationName }`
|
|
296
|
+
: 'core/query';
|
|
297
297
|
},
|
|
298
|
-
[ clientId,
|
|
298
|
+
[ clientId, attributes ]
|
|
299
299
|
);
|
|
300
|
-
return hasActiveVariationPatterns ? blockName : 'core/query';
|
|
301
300
|
}
|
|
302
301
|
|
|
303
302
|
/**
|
|
@@ -435,3 +434,32 @@ export const useUnsupportedBlocks = ( clientId ) => {
|
|
|
435
434
|
[ clientId ]
|
|
436
435
|
);
|
|
437
436
|
};
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Helper function that returns the query context from the editor based on the
|
|
440
|
+
* available template slug.
|
|
441
|
+
*
|
|
442
|
+
* @param {string} templateSlug Current template slug based on context.
|
|
443
|
+
* @return {Object} An object with isSingular and templateType properties.
|
|
444
|
+
*/
|
|
445
|
+
export function getQueryContextFromTemplate( templateSlug ) {
|
|
446
|
+
// In the Post Editor, the template slug is not available.
|
|
447
|
+
if ( ! templateSlug ) {
|
|
448
|
+
return { isSingular: true };
|
|
449
|
+
}
|
|
450
|
+
let isSingular = false;
|
|
451
|
+
let templateType = templateSlug === 'wp' ? 'custom' : templateSlug;
|
|
452
|
+
const singularTemplates = [ '404', 'blank', 'single', 'page', 'custom' ];
|
|
453
|
+
const templateTypeFromSlug = templateSlug.includes( '-' )
|
|
454
|
+
? templateSlug.split( '-', 1 )[ 0 ]
|
|
455
|
+
: templateSlug;
|
|
456
|
+
const queryFromTemplateSlug = templateSlug.includes( '-' )
|
|
457
|
+
? templateSlug.split( '-' ).slice( 1 ).join( '-' )
|
|
458
|
+
: '';
|
|
459
|
+
if ( queryFromTemplateSlug ) {
|
|
460
|
+
templateType = templateTypeFromSlug;
|
|
461
|
+
}
|
|
462
|
+
isSingular = singularTemplates.includes( templateType );
|
|
463
|
+
|
|
464
|
+
return { isSingular, templateType };
|
|
465
|
+
}
|
package/src/rss/index.php
CHANGED
|
@@ -61,17 +61,20 @@ function render_block_core_rss( $attributes ) {
|
|
|
61
61
|
$author = $item->get_author();
|
|
62
62
|
if ( is_object( $author ) ) {
|
|
63
63
|
$author = $author->get_name();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
if ( ! empty( $author ) ) {
|
|
65
|
+
$author = '<span class="wp-block-rss__item-author">' . sprintf(
|
|
66
|
+
/* translators: byline. %s: author. */
|
|
67
|
+
__( 'by %s' ),
|
|
68
|
+
esc_html( strip_tags( $author ) )
|
|
69
|
+
) . '</span>';
|
|
70
|
+
}
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
$excerpt
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
$excerpt = '';
|
|
75
|
+
$description = $item->get_description();
|
|
76
|
+
if ( $attributes['displayExcerpt'] && ! empty( $description ) ) {
|
|
77
|
+
$excerpt = html_entity_decode( $description, ENT_QUOTES, get_option( 'blog_charset' ) );
|
|
75
78
|
$excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' […]' ) );
|
|
76
79
|
|
|
77
80
|
// Change existing [...] to […].
|
package/src/search/index.php
CHANGED
|
@@ -31,8 +31,8 @@ function render_block_core_search( $attributes ) {
|
|
|
31
31
|
|
|
32
32
|
$input_id = wp_unique_id( 'wp-block-search__input-' );
|
|
33
33
|
$classnames = classnames_for_block_core_search( $attributes );
|
|
34
|
-
$show_label =
|
|
35
|
-
$use_icon_button =
|
|
34
|
+
$show_label = ! empty( $attributes['showLabel'] );
|
|
35
|
+
$use_icon_button = ! empty( $attributes['buttonUseIcon'] );
|
|
36
36
|
$show_button = ( ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition'] ) ? false : true;
|
|
37
37
|
$button_position = $show_button ? $attributes['buttonPosition'] : null;
|
|
38
38
|
$query_params = ( ! empty( $attributes['query'] ) ) ? $attributes['query'] : array();
|
package/src/search/style.scss
CHANGED
|
@@ -58,11 +58,9 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
|
|
|
58
58
|
// Prevent unintended text wrapping.
|
|
59
59
|
flex-shrink: 0;
|
|
60
60
|
max-width: 100%;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.wp-block-search__button[aria-expanded="true"] {
|
|
65
|
-
max-width: calc(100% - 100px);
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: center;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
.wp-block-search__inside-wrapper {
|
package/src/social-link/edit.js
CHANGED
|
@@ -6,7 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { DELETE, BACKSPACE } from '@wordpress/keycodes';
|
|
9
|
+
import { DELETE, BACKSPACE, ENTER } from '@wordpress/keycodes';
|
|
10
10
|
import { useDispatch } from '@wordpress/data';
|
|
11
11
|
|
|
12
12
|
import {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
useBlockProps,
|
|
17
17
|
store as blockEditorStore,
|
|
18
18
|
} from '@wordpress/block-editor';
|
|
19
|
-
import { useState } from '@wordpress/element';
|
|
19
|
+
import { useState, useRef } from '@wordpress/element';
|
|
20
20
|
import {
|
|
21
21
|
Button,
|
|
22
22
|
PanelBody,
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
TextControl,
|
|
25
25
|
__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
|
|
26
26
|
} from '@wordpress/components';
|
|
27
|
+
import { useMergeRefs } from '@wordpress/compose';
|
|
27
28
|
import { __ } from '@wordpress/i18n';
|
|
28
29
|
import { keyboardReturn } from '@wordpress/icons';
|
|
29
30
|
|
|
@@ -112,12 +113,19 @@ const SocialLinkEdit = ( {
|
|
|
112
113
|
iconBackgroundColorValue,
|
|
113
114
|
} = context;
|
|
114
115
|
const [ showURLPopover, setPopover ] = useState( false );
|
|
115
|
-
const
|
|
116
|
-
'wp-social-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
const wrapperClasses = clsx(
|
|
117
|
+
'wp-social-link',
|
|
118
|
+
// Manually adding this class for backwards compatibility of CSS when moving the
|
|
119
|
+
// blockProps from the li to the button: https://github.com/WordPress/gutenberg/pull/64883
|
|
120
|
+
'wp-block-social-link',
|
|
121
|
+
'wp-social-link-' + service,
|
|
122
|
+
{
|
|
123
|
+
'wp-social-link__is-incomplete': ! url,
|
|
124
|
+
[ `has-${ iconColor }-color` ]: iconColor,
|
|
125
|
+
[ `has-${ iconBackgroundColor }-background-color` ]:
|
|
126
|
+
iconBackgroundColor,
|
|
127
|
+
}
|
|
128
|
+
);
|
|
121
129
|
|
|
122
130
|
// Use internal state instead of a ref to make sure that the component
|
|
123
131
|
// re-renders when the popover's anchor updates.
|
|
@@ -131,11 +139,16 @@ const SocialLinkEdit = ( {
|
|
|
131
139
|
// spaces. The PHP render callback fallbacks to the social name as well.
|
|
132
140
|
const socialLinkText = label.trim() === '' ? socialLinkName : label;
|
|
133
141
|
|
|
142
|
+
const ref = useRef();
|
|
134
143
|
const blockProps = useBlockProps( {
|
|
135
|
-
className:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
144
|
+
className: 'wp-block-social-link-anchor',
|
|
145
|
+
ref: useMergeRefs( [ setPopoverAnchor, ref ] ),
|
|
146
|
+
onClick: () => setPopover( true ),
|
|
147
|
+
onKeyDown: ( event ) => {
|
|
148
|
+
if ( event.keyCode === ENTER ) {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
setPopover( true );
|
|
151
|
+
}
|
|
139
152
|
},
|
|
140
153
|
} );
|
|
141
154
|
|
|
@@ -169,13 +182,27 @@ const SocialLinkEdit = ( {
|
|
|
169
182
|
onChange={ ( value ) => setAttributes( { rel: value } ) }
|
|
170
183
|
/>
|
|
171
184
|
</InspectorControls>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
{ /*
|
|
186
|
+
* Because the `<ul>` element has a role=document, the `<li>` is
|
|
187
|
+
* not semantically correct, so adding role=presentation is cleaner.
|
|
188
|
+
* https://github.com/WordPress/gutenberg/pull/64883#issuecomment-2472874551
|
|
189
|
+
*/ }
|
|
190
|
+
<li
|
|
191
|
+
role="presentation"
|
|
192
|
+
className={ wrapperClasses }
|
|
193
|
+
style={ {
|
|
194
|
+
color: iconColorValue,
|
|
195
|
+
backgroundColor: iconBackgroundColorValue,
|
|
196
|
+
} }
|
|
197
|
+
>
|
|
198
|
+
{ /*
|
|
199
|
+
* Disable reason: The `button` ARIA role is redundant but
|
|
200
|
+
* blockProps has a role of `document` automatically applied
|
|
201
|
+
* which breaks the semantics of this button since it removes
|
|
202
|
+
* the information about the popover.
|
|
203
|
+
*/
|
|
204
|
+
/* eslint-disable jsx-a11y/no-redundant-roles */ }
|
|
205
|
+
<button aria-haspopup="dialog" { ...blockProps } role="button">
|
|
179
206
|
<IconComponent />
|
|
180
207
|
<span
|
|
181
208
|
className={ clsx( 'wp-block-social-link-label', {
|
|
@@ -185,6 +212,7 @@ const SocialLinkEdit = ( {
|
|
|
185
212
|
{ socialLinkText }
|
|
186
213
|
</span>
|
|
187
214
|
</button>
|
|
215
|
+
{ /* eslint-enable jsx-a11y/no-redundant-roles */ }
|
|
188
216
|
{ isSelected && showURLPopover && (
|
|
189
217
|
<SocialLinkURLPopover
|
|
190
218
|
url={ url }
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
font-size: inherit;
|
|
15
15
|
color: currentColor;
|
|
16
16
|
height: auto;
|
|
17
|
+
font-weight: inherit;
|
|
18
|
+
font-family: inherit;
|
|
17
19
|
|
|
18
20
|
// This rule ensures social link buttons display correctly in template parts.
|
|
19
21
|
opacity: 1;
|
|
@@ -21,13 +23,10 @@
|
|
|
21
23
|
// This rule is duplicated from the style.scss and needs to be the same as there.
|
|
22
24
|
padding: 0.25em;
|
|
23
25
|
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
30
|
-
outline: 3px solid transparent;
|
|
26
|
+
// Override the shared `.wp-block-social-link` class used on both the li and button
|
|
27
|
+
// due to backwards compatibility from moving the blockProps from the li to the button.
|
|
28
|
+
&:hover {
|
|
29
|
+
transform: none;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useEntityProp } from '@wordpress/core-data';
|
|
4
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
5
5
|
import { SelectControl, TextControl } from '@wordpress/components';
|
|
6
6
|
import { sprintf, __ } from '@wordpress/i18n';
|
|
7
7
|
import { useSelect } from '@wordpress/data';
|
|
@@ -54,19 +54,19 @@ export function TemplatePartAdvancedControls( {
|
|
|
54
54
|
templatePartId
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
).__experimentalGetDefaultTemplatePartAreas();
|
|
64
|
-
}, [] );
|
|
57
|
+
const defaultTemplatePartAreas = useSelect(
|
|
58
|
+
( select ) =>
|
|
59
|
+
select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
|
|
60
|
+
?.default_template_part_areas || [],
|
|
61
|
+
[]
|
|
62
|
+
);
|
|
65
63
|
|
|
66
|
-
const areaOptions =
|
|
67
|
-
label,
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
const areaOptions = defaultTemplatePartAreas.map(
|
|
65
|
+
( { label, area: _area } ) => ( {
|
|
66
|
+
label,
|
|
67
|
+
value: _area,
|
|
68
|
+
} )
|
|
69
|
+
);
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
72
|
<>
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
MenuItem,
|
|
22
22
|
ToolbarButton,
|
|
23
23
|
} from '@wordpress/components';
|
|
24
|
-
import { useAsyncList } from '@wordpress/compose';
|
|
25
24
|
import { __, sprintf } from '@wordpress/i18n';
|
|
26
25
|
import { store as coreStore } from '@wordpress/core-data';
|
|
27
26
|
import { useState } from '@wordpress/element';
|
|
@@ -85,7 +84,6 @@ function TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {
|
|
|
85
84
|
isEntityAvailable &&
|
|
86
85
|
!! blockPatterns.length &&
|
|
87
86
|
( area === 'header' || area === 'footer' );
|
|
88
|
-
const shownTemplates = useAsyncList( blockPatterns );
|
|
89
87
|
|
|
90
88
|
if ( ! canReplace ) {
|
|
91
89
|
return null;
|
|
@@ -96,9 +94,8 @@ function TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {
|
|
|
96
94
|
<BlockPatternsList
|
|
97
95
|
label={ __( 'Templates' ) }
|
|
98
96
|
blockPatterns={ blockPatterns }
|
|
99
|
-
shownPatterns={ shownTemplates }
|
|
100
97
|
onClickPattern={ onSelect }
|
|
101
|
-
|
|
98
|
+
showTitlesAsTooltip
|
|
102
99
|
/>
|
|
103
100
|
</PanelBody>
|
|
104
101
|
);
|
|
@@ -5,7 +5,6 @@ import { useMemo, useState } from '@wordpress/element';
|
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { store as noticesStore } from '@wordpress/notices';
|
|
7
7
|
import { useDispatch } from '@wordpress/data';
|
|
8
|
-
import { useAsyncList } from '@wordpress/compose';
|
|
9
8
|
import { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
|
|
10
9
|
import {
|
|
11
10
|
SearchControl,
|
|
@@ -43,7 +42,6 @@ export default function TemplatePartSelectionModal( {
|
|
|
43
42
|
|
|
44
43
|
return searchPatterns( partsAsPatterns, searchValue );
|
|
45
44
|
}, [ templateParts, searchValue ] );
|
|
46
|
-
const shownTemplateParts = useAsyncList( filteredTemplateParts );
|
|
47
45
|
const blockPatterns = useAlternativeBlockPatterns( area, clientId );
|
|
48
46
|
const filteredBlockPatterns = useMemo( () => {
|
|
49
47
|
return searchPatterns( blockPatterns, searchValue );
|
|
@@ -89,7 +87,6 @@ export default function TemplatePartSelectionModal( {
|
|
|
89
87
|
<h2>{ __( 'Existing template parts' ) }</h2>
|
|
90
88
|
<BlockPatternsList
|
|
91
89
|
blockPatterns={ filteredTemplateParts }
|
|
92
|
-
shownPatterns={ shownTemplateParts }
|
|
93
90
|
onClickPattern={ ( pattern ) => {
|
|
94
91
|
onTemplatePartSelect( pattern.templatePart );
|
|
95
92
|
} }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
header as headerIcon,
|
|
6
|
+
footer as footerIcon,
|
|
7
|
+
sidebar as sidebarIcon,
|
|
8
|
+
symbolFilled as symbolFilledIcon,
|
|
9
|
+
} from '@wordpress/icons';
|
|
10
|
+
|
|
11
|
+
export const getTemplatePartIcon = ( iconName ) => {
|
|
12
|
+
if ( 'header' === iconName ) {
|
|
13
|
+
return headerIcon;
|
|
14
|
+
} else if ( 'footer' === iconName ) {
|
|
15
|
+
return footerIcon;
|
|
16
|
+
} else if ( 'sidebar' === iconName ) {
|
|
17
|
+
return sidebarIcon;
|
|
18
|
+
}
|
|
19
|
+
return symbolFilledIcon;
|
|
20
|
+
};
|
|
@@ -136,14 +136,9 @@ export function useCreateTemplatePartFromBlocks( area, setAttributes ) {
|
|
|
136
136
|
export function useTemplatePartArea( area ) {
|
|
137
137
|
return useSelect(
|
|
138
138
|
( select ) => {
|
|
139
|
-
// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
|
|
140
|
-
// Blocks can be loaded into a *non-post* block editor.
|
|
141
|
-
/* eslint-disable @wordpress/data-no-store-string-literals */
|
|
142
139
|
const definedAreas =
|
|
143
|
-
select(
|
|
144
|
-
|
|
145
|
-
).__experimentalGetDefaultTemplatePartAreas();
|
|
146
|
-
/* eslint-enable @wordpress/data-no-store-string-literals */
|
|
140
|
+
select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
|
|
141
|
+
?.default_template_part_areas || [];
|
|
147
142
|
|
|
148
143
|
const selectedArea = definedAreas.find(
|
|
149
144
|
( definedArea ) => definedArea.area === area
|
|
@@ -3,23 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
5
5
|
import { select } from '@wordpress/data';
|
|
6
|
-
import {
|
|
7
|
-
header as headerIcon,
|
|
8
|
-
footer as footerIcon,
|
|
9
|
-
sidebar as sidebarIcon,
|
|
10
|
-
symbolFilled as symbolFilledIcon,
|
|
11
|
-
} from '@wordpress/icons';
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return footerIcon;
|
|
18
|
-
} else if ( 'sidebar' === iconName ) {
|
|
19
|
-
return sidebarIcon;
|
|
20
|
-
}
|
|
21
|
-
return symbolFilledIcon;
|
|
22
|
-
}
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { getTemplatePartIcon } from './edit/utils/get-template-part-icon';
|
|
23
11
|
|
|
24
12
|
export function enhanceTemplatePartVariations( settings, name ) {
|
|
25
13
|
if ( name !== 'core/template-part' ) {
|
package/src/video/edit.js
CHANGED
|
@@ -141,7 +141,7 @@ function VideoEdit( {
|
|
|
141
141
|
icon={ icon }
|
|
142
142
|
label={ __( 'Video' ) }
|
|
143
143
|
instructions={ __(
|
|
144
|
-
'
|
|
144
|
+
'Drag and drop a video, upload, or choose from your library.'
|
|
145
145
|
) }
|
|
146
146
|
>
|
|
147
147
|
{ content }
|
package/src/video/editor.scss
CHANGED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
max-width: 240px;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
.block-library-video-tracks-editor__tracks-informative-message-title,
|
|
40
41
|
.block-library-video-tracks-editor__single-track-editor-edit-track-label {
|
|
41
42
|
margin-top: $grid-unit-05;
|
|
42
43
|
color: $gray-700;
|
|
@@ -56,3 +57,11 @@
|
|
|
56
57
|
padding: 0;
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
.block-library-video-tracks-editor__tracks-informative-message {
|
|
62
|
+
padding: $grid-unit-10;
|
|
63
|
+
|
|
64
|
+
&-description {
|
|
65
|
+
margin-bottom: 0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -12,7 +12,7 @@ exports[`Video block transforms to Columns block 1`] = `
|
|
|
12
12
|
|
|
13
13
|
exports[`Video block transforms to Cover block 1`] = `
|
|
14
14
|
"<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","dimRatio":50,"backgroundType":"video"} -->
|
|
15
|
-
<div class="wp-block-cover"><
|
|
15
|
+
<div class="wp-block-cover"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" data-object-fit="cover"></video><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","fontSize":"large"} -->
|
|
16
16
|
<p class="has-text-align-center has-large-font-size">Cloudup video</p>
|
|
17
17
|
<!-- /wp:paragraph --></div></div>
|
|
18
18
|
<!-- /wp:cover -->"
|