@wordpress/block-library 9.12.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/build/block-keyboard-shortcuts/index.js +7 -7
- package/build/block-keyboard-shortcuts/index.js.map +1 -1
- package/build/cover/edit/index.js +1 -1
- 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/shared.js +6 -7
- package/build/cover/shared.js.map +1 -1
- package/build/details/index.js +19 -0
- package/build/details/index.js.map +1 -1
- package/build/file/edit.js +7 -3
- 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/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/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/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 +1 -11
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/utils.js +6 -8
- 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/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/tracks-editor.js +135 -121
- 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/cover/edit/index.js +1 -1
- 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/shared.js +6 -7
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/details/index.js +20 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/file/edit.js +7 -3
- 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/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/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/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 +1 -11
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/utils.js +6 -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/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/tracks-editor.js +136 -122
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/editor-rtl.css +12 -8
- package/build-style/editor.css +12 -8
- 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 +8 -4
- package/build-style/style.css +8 -4
- package/build-style/video/editor-rtl.css +8 -0
- package/build-style/video/editor.css +8 -0
- package/package.json +33 -33
- package/src/block-keyboard-shortcuts/index.js +25 -11
- package/src/cover/edit/index.js +1 -1
- package/src/cover/index.js +8 -8
- package/src/cover/shared.js +10 -10
- package/src/cover/test/edit.js +2 -2
- package/src/details/index.js +23 -1
- package/src/file/edit.js +8 -2
- package/src/freeform/modal.js +1 -1
- 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/navigation/index.php +4 -150
- 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/query/edit/inspector-controls/enhanced-pagination-control.js +3 -5
- package/src/query/edit/inspector-controls/index.js +0 -10
- package/src/query/editor.scss +0 -4
- package/src/query/index.php +1 -1
- package/src/query/utils.js +14 -15
- package/src/rss/index.php +11 -8
- 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/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/editor.scss +9 -0
- package/src/video/tracks-editor.js +157 -139
- 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
|
@@ -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
|
<>
|
|
@@ -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/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
|
+
}
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from '@wordpress/block-editor';
|
|
25
25
|
import { upload, media } from '@wordpress/icons';
|
|
26
26
|
import { useSelect } from '@wordpress/data';
|
|
27
|
-
import { useState } from '@wordpress/element';
|
|
27
|
+
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
28
28
|
import { getFilename } from '@wordpress/url';
|
|
29
29
|
|
|
30
30
|
const ALLOWED_TYPES = [ 'text/vtt' ];
|
|
@@ -40,39 +40,29 @@ const KIND_OPTIONS = [
|
|
|
40
40
|
];
|
|
41
41
|
|
|
42
42
|
function TrackList( { tracks, onEditPress } ) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
const content = tracks.map( ( track, index ) => {
|
|
44
|
+
return (
|
|
45
|
+
<HStack
|
|
46
|
+
key={ index }
|
|
47
|
+
className="block-library-video-tracks-editor__track-list-track"
|
|
48
|
+
>
|
|
49
|
+
<span>{ track.label }</span>
|
|
50
|
+
<Button
|
|
51
|
+
__next40pxDefaultSize
|
|
52
|
+
variant="tertiary"
|
|
53
|
+
onClick={ () => onEditPress( index ) }
|
|
54
|
+
aria-label={ sprintf(
|
|
55
|
+
/* translators: %s: Label of the video text track e.g: "French subtitles". */
|
|
56
|
+
_x( 'Edit %s', 'text tracks' ),
|
|
57
|
+
track.label
|
|
58
|
+
) }
|
|
58
59
|
>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/* translators: %s: Label of the video text track e.g: "French subtitles" */
|
|
66
|
-
_x( 'Edit %s', 'text tracks' ),
|
|
67
|
-
track.label
|
|
68
|
-
) }
|
|
69
|
-
>
|
|
70
|
-
{ __( 'Edit' ) }
|
|
71
|
-
</Button>
|
|
72
|
-
</HStack>
|
|
73
|
-
);
|
|
74
|
-
} );
|
|
75
|
-
}
|
|
60
|
+
{ __( 'Edit' ) }
|
|
61
|
+
</Button>
|
|
62
|
+
</HStack>
|
|
63
|
+
);
|
|
64
|
+
} );
|
|
65
|
+
|
|
76
66
|
return (
|
|
77
67
|
<MenuGroup
|
|
78
68
|
label={ __( 'Text tracks' ) }
|
|
@@ -87,105 +77,100 @@ function SingleTrackEditor( { track, onChange, onClose, onRemove } ) {
|
|
|
87
77
|
const { src = '', label = '', srcLang = '', kind = DEFAULT_KIND } = track;
|
|
88
78
|
const fileName = src.startsWith( 'blob:' ) ? '' : getFilename( src ) || '';
|
|
89
79
|
return (
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
80
|
+
<VStack
|
|
81
|
+
className="block-library-video-tracks-editor__single-track-editor"
|
|
82
|
+
spacing="4"
|
|
83
|
+
>
|
|
84
|
+
<span className="block-library-video-tracks-editor__single-track-editor-edit-track-label">
|
|
85
|
+
{ __( 'Edit track' ) }
|
|
86
|
+
</span>
|
|
87
|
+
<span>
|
|
88
|
+
{ __( 'File' ) }: <b>{ fileName }</b>
|
|
89
|
+
</span>
|
|
90
|
+
<Grid columns={ 2 } gap={ 4 }>
|
|
91
|
+
<TextControl
|
|
92
|
+
__next40pxDefaultSize
|
|
93
|
+
__nextHasNoMarginBottom
|
|
94
|
+
onChange={ ( newLabel ) =>
|
|
95
|
+
onChange( {
|
|
96
|
+
...track,
|
|
97
|
+
label: newLabel,
|
|
98
|
+
} )
|
|
99
|
+
}
|
|
100
|
+
label={ __( 'Label' ) }
|
|
101
|
+
value={ label }
|
|
102
|
+
help={ __( 'Title of track' ) }
|
|
103
|
+
/>
|
|
104
|
+
<TextControl
|
|
105
|
+
__next40pxDefaultSize
|
|
106
|
+
__nextHasNoMarginBottom
|
|
107
|
+
onChange={ ( newSrcLang ) =>
|
|
108
|
+
onChange( {
|
|
109
|
+
...track,
|
|
110
|
+
srcLang: newSrcLang,
|
|
111
|
+
} )
|
|
112
|
+
}
|
|
113
|
+
label={ __( 'Source language' ) }
|
|
114
|
+
value={ srcLang }
|
|
115
|
+
help={ __( 'Language tag (en, fr, etc.)' ) }
|
|
116
|
+
/>
|
|
117
|
+
</Grid>
|
|
118
|
+
<VStack spacing="8">
|
|
119
|
+
<SelectControl
|
|
120
|
+
__next40pxDefaultSize
|
|
121
|
+
__nextHasNoMarginBottom
|
|
122
|
+
className="block-library-video-tracks-editor__single-track-editor-kind-select"
|
|
123
|
+
options={ KIND_OPTIONS }
|
|
124
|
+
value={ kind }
|
|
125
|
+
label={ __( 'Kind' ) }
|
|
126
|
+
onChange={ ( newKind ) => {
|
|
127
|
+
onChange( {
|
|
128
|
+
...track,
|
|
129
|
+
kind: newKind,
|
|
130
|
+
} );
|
|
131
|
+
} }
|
|
132
|
+
/>
|
|
133
|
+
<HStack className="block-library-video-tracks-editor__single-track-editor-buttons-container">
|
|
134
|
+
<Button
|
|
119
135
|
__next40pxDefaultSize
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
label={ __( 'Source language' ) }
|
|
128
|
-
value={ srcLang }
|
|
129
|
-
help={ __( 'Language tag (en, fr, etc.)' ) }
|
|
130
|
-
/>
|
|
131
|
-
</Grid>
|
|
132
|
-
<VStack spacing="8">
|
|
133
|
-
<SelectControl
|
|
136
|
+
isDestructive
|
|
137
|
+
variant="link"
|
|
138
|
+
onClick={ onRemove }
|
|
139
|
+
>
|
|
140
|
+
{ __( 'Remove track' ) }
|
|
141
|
+
</Button>
|
|
142
|
+
<Button
|
|
134
143
|
__next40pxDefaultSize
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
variant="primary"
|
|
145
|
+
onClick={ () => {
|
|
146
|
+
const changes = {};
|
|
147
|
+
let hasChanges = false;
|
|
148
|
+
if ( label === '' ) {
|
|
149
|
+
changes.label = __( 'English' );
|
|
150
|
+
hasChanges = true;
|
|
151
|
+
}
|
|
152
|
+
if ( srcLang === '' ) {
|
|
153
|
+
changes.srcLang = 'en';
|
|
154
|
+
hasChanges = true;
|
|
155
|
+
}
|
|
156
|
+
if ( track.kind === undefined ) {
|
|
157
|
+
changes.kind = DEFAULT_KIND;
|
|
158
|
+
hasChanges = true;
|
|
159
|
+
}
|
|
160
|
+
if ( hasChanges ) {
|
|
161
|
+
onChange( {
|
|
162
|
+
...track,
|
|
163
|
+
...changes,
|
|
164
|
+
} );
|
|
165
|
+
}
|
|
166
|
+
onClose();
|
|
145
167
|
} }
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
variant="secondary"
|
|
151
|
-
onClick={ () => {
|
|
152
|
-
const changes = {};
|
|
153
|
-
let hasChanges = false;
|
|
154
|
-
if ( label === '' ) {
|
|
155
|
-
changes.label = __( 'English' );
|
|
156
|
-
hasChanges = true;
|
|
157
|
-
}
|
|
158
|
-
if ( srcLang === '' ) {
|
|
159
|
-
changes.srcLang = 'en';
|
|
160
|
-
hasChanges = true;
|
|
161
|
-
}
|
|
162
|
-
if ( track.kind === undefined ) {
|
|
163
|
-
changes.kind = DEFAULT_KIND;
|
|
164
|
-
hasChanges = true;
|
|
165
|
-
}
|
|
166
|
-
if ( hasChanges ) {
|
|
167
|
-
onChange( {
|
|
168
|
-
...track,
|
|
169
|
-
...changes,
|
|
170
|
-
} );
|
|
171
|
-
}
|
|
172
|
-
onClose();
|
|
173
|
-
} }
|
|
174
|
-
>
|
|
175
|
-
{ __( 'Close' ) }
|
|
176
|
-
</Button>
|
|
177
|
-
<Button
|
|
178
|
-
__next40pxDefaultSize
|
|
179
|
-
isDestructive
|
|
180
|
-
variant="link"
|
|
181
|
-
onClick={ onRemove }
|
|
182
|
-
>
|
|
183
|
-
{ __( 'Remove track' ) }
|
|
184
|
-
</Button>
|
|
185
|
-
</HStack>
|
|
186
|
-
</VStack>
|
|
168
|
+
>
|
|
169
|
+
{ __( 'Apply' ) }
|
|
170
|
+
</Button>
|
|
171
|
+
</HStack>
|
|
187
172
|
</VStack>
|
|
188
|
-
</
|
|
173
|
+
</VStack>
|
|
189
174
|
);
|
|
190
175
|
}
|
|
191
176
|
|
|
@@ -194,6 +179,11 @@ export default function TracksEditor( { tracks = [], onChange } ) {
|
|
|
194
179
|
return select( blockEditorStore ).getSettings().mediaUpload;
|
|
195
180
|
}, [] );
|
|
196
181
|
const [ trackBeingEdited, setTrackBeingEdited ] = useState( null );
|
|
182
|
+
const dropdownPopoverRef = useRef();
|
|
183
|
+
|
|
184
|
+
useEffect( () => {
|
|
185
|
+
dropdownPopoverRef.current?.focus();
|
|
186
|
+
}, [ trackBeingEdited ] );
|
|
197
187
|
|
|
198
188
|
if ( ! mediaUpload ) {
|
|
199
189
|
return null;
|
|
@@ -201,17 +191,32 @@ export default function TracksEditor( { tracks = [], onChange } ) {
|
|
|
201
191
|
return (
|
|
202
192
|
<Dropdown
|
|
203
193
|
contentClassName="block-library-video-tracks-editor"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
194
|
+
focusOnMount
|
|
195
|
+
popoverProps={ {
|
|
196
|
+
ref: dropdownPopoverRef,
|
|
197
|
+
} }
|
|
198
|
+
renderToggle={ ( { isOpen, onToggle } ) => {
|
|
199
|
+
const handleOnToggle = () => {
|
|
200
|
+
if ( ! isOpen ) {
|
|
201
|
+
// When the Popover opens make sure the initial view is
|
|
202
|
+
// always the track list rather than the edit track UI.
|
|
203
|
+
setTrackBeingEdited( null );
|
|
204
|
+
}
|
|
205
|
+
onToggle();
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<ToolbarGroup>
|
|
210
|
+
<ToolbarButton
|
|
211
|
+
aria-expanded={ isOpen }
|
|
212
|
+
aria-haspopup="true"
|
|
213
|
+
onClick={ handleOnToggle }
|
|
214
|
+
>
|
|
215
|
+
{ __( 'Text tracks' ) }
|
|
216
|
+
</ToolbarButton>
|
|
217
|
+
</ToolbarGroup>
|
|
218
|
+
);
|
|
219
|
+
} }
|
|
215
220
|
renderContent={ () => {
|
|
216
221
|
if ( trackBeingEdited !== null ) {
|
|
217
222
|
return (
|
|
@@ -235,8 +240,21 @@ export default function TracksEditor( { tracks = [], onChange } ) {
|
|
|
235
240
|
/>
|
|
236
241
|
);
|
|
237
242
|
}
|
|
243
|
+
|
|
238
244
|
return (
|
|
239
245
|
<>
|
|
246
|
+
{ tracks.length === 0 && (
|
|
247
|
+
<div className="block-library-video-tracks-editor__tracks-informative-message">
|
|
248
|
+
<h2 className="block-library-video-tracks-editor__tracks-informative-message-title">
|
|
249
|
+
{ __( 'Text tracks' ) }
|
|
250
|
+
</h2>
|
|
251
|
+
<p className="block-library-video-tracks-editor__tracks-informative-message-description">
|
|
252
|
+
{ __(
|
|
253
|
+
'Tracks can be subtitles, captions, chapters, or descriptions. They help make your content more accessible to a wider range of users.'
|
|
254
|
+
) }
|
|
255
|
+
</p>
|
|
256
|
+
</div>
|
|
257
|
+
) }
|
|
240
258
|
<NavigableMenu>
|
|
241
259
|
<TrackList
|
|
242
260
|
tracks={ tracks }
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _element = require("@wordpress/element");
|
|
8
|
-
var _url = require("@wordpress/url");
|
|
9
|
-
var _coreData = require("@wordpress/core-data");
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const CreateNewPostLink = ({
|
|
17
|
-
postType
|
|
18
|
-
}) => {
|
|
19
|
-
const newPostUrl = (0, _url.addQueryArgs)('post-new.php', {
|
|
20
|
-
post_type: postType
|
|
21
|
-
});
|
|
22
|
-
const addNewItemLabel = (0, _data.useSelect)(select => {
|
|
23
|
-
const {
|
|
24
|
-
getPostType
|
|
25
|
-
} = select(_coreData.store);
|
|
26
|
-
return getPostType(postType)?.labels?.add_new_item;
|
|
27
|
-
}, [postType]);
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
29
|
-
className: "wp-block-query__create-new-link",
|
|
30
|
-
children: (0, _element.createInterpolateElement)('<a>' + addNewItemLabel + '</a>',
|
|
31
|
-
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
32
|
-
{
|
|
33
|
-
a: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
34
|
-
href: newPostUrl
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
var _default = exports.default = CreateNewPostLink;
|
|
40
|
-
//# sourceMappingURL=create-new-post-link.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_url","_coreData","_data","_jsxRuntime","CreateNewPostLink","postType","newPostUrl","addQueryArgs","post_type","addNewItemLabel","useSelect","select","getPostType","coreStore","labels","add_new_item","jsx","className","children","createInterpolateElement","a","href","_default","exports","default"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/create-new-post-link.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createInterpolateElement } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nconst CreateNewPostLink = ( { postType } ) => {\n\tconst newPostUrl = addQueryArgs( 'post-new.php', {\n\t\tpost_type: postType,\n\t} );\n\n\tconst addNewItemLabel = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn getPostType( postType )?.labels?.add_new_item;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn (\n\t\t<div className=\"wp-block-query__create-new-link\">\n\t\t\t{ createInterpolateElement(\n\t\t\t\t'<a>' + addNewItemLabel + '</a>',\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t{ a: <a href={ newPostUrl } /> }\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport default CreateNewPostLink;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAA4C,IAAAI,WAAA,GAAAJ,OAAA;AAN5C;AACA;AACA;;AAMA,MAAMK,iBAAiB,GAAGA,CAAE;EAAEC;AAAS,CAAC,KAAM;EAC7C,MAAMC,UAAU,GAAG,IAAAC,iBAAY,EAAE,cAAc,EAAE;IAChDC,SAAS,EAAEH;EACZ,CAAE,CAAC;EAEH,MAAMI,eAAe,GAAG,IAAAC,eAAS,EAC9BC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IAC3C,OAAOD,WAAW,CAAEP,QAAS,CAAC,EAAES,MAAM,EAAEC,YAAY;EACrD,CAAC,EACD,CAAEV,QAAQ,CACX,CAAC;EACD,oBACC,IAAAF,WAAA,CAAAa,GAAA;IAAKC,SAAS,EAAC,iCAAiC;IAAAC,QAAA,EAC7C,IAAAC,iCAAwB,EACzB,KAAK,GAAGV,eAAe,GAAG,MAAM;IAChC;IACA;MAAEW,CAAC,eAAE,IAAAjB,WAAA,CAAAa,GAAA;QAAGK,IAAI,EAAGf;MAAY,CAAE;IAAE,CAChC;EAAC,CACG,CAAC;AAER,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEapB,iBAAiB","ignoreList":[]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
5
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { useSelect } from '@wordpress/data';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const CreateNewPostLink = ({
|
|
10
|
-
postType
|
|
11
|
-
}) => {
|
|
12
|
-
const newPostUrl = addQueryArgs('post-new.php', {
|
|
13
|
-
post_type: postType
|
|
14
|
-
});
|
|
15
|
-
const addNewItemLabel = useSelect(select => {
|
|
16
|
-
const {
|
|
17
|
-
getPostType
|
|
18
|
-
} = select(coreStore);
|
|
19
|
-
return getPostType(postType)?.labels?.add_new_item;
|
|
20
|
-
}, [postType]);
|
|
21
|
-
return /*#__PURE__*/_jsx("div", {
|
|
22
|
-
className: "wp-block-query__create-new-link",
|
|
23
|
-
children: createInterpolateElement('<a>' + addNewItemLabel + '</a>',
|
|
24
|
-
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
25
|
-
{
|
|
26
|
-
a: /*#__PURE__*/_jsx("a", {
|
|
27
|
-
href: newPostUrl
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
export default CreateNewPostLink;
|
|
33
|
-
//# sourceMappingURL=create-new-post-link.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createInterpolateElement","addQueryArgs","store","coreStore","useSelect","jsx","_jsx","CreateNewPostLink","postType","newPostUrl","post_type","addNewItemLabel","select","getPostType","labels","add_new_item","className","children","a","href"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/create-new-post-link.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createInterpolateElement } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nconst CreateNewPostLink = ( { postType } ) => {\n\tconst newPostUrl = addQueryArgs( 'post-new.php', {\n\t\tpost_type: postType,\n\t} );\n\n\tconst addNewItemLabel = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn getPostType( postType )?.labels?.add_new_item;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn (\n\t\t<div className=\"wp-block-query__create-new-link\">\n\t\t\t{ createInterpolateElement(\n\t\t\t\t'<a>' + addNewItemLabel + '</a>',\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t{ a: <a href={ newPostUrl } /> }\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport default CreateNewPostLink;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC;AAAS,CAAC,KAAM;EAC7C,MAAMC,UAAU,GAAGR,YAAY,CAAE,cAAc,EAAE;IAChDS,SAAS,EAAEF;EACZ,CAAE,CAAC;EAEH,MAAMG,eAAe,GAAGP,SAAS,CAC9BQ,MAAM,IAAM;IACb,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAET,SAAU,CAAC;IAC3C,OAAOU,WAAW,CAAEL,QAAS,CAAC,EAAEM,MAAM,EAAEC,YAAY;EACrD,CAAC,EACD,CAAEP,QAAQ,CACX,CAAC;EACD,oBACCF,IAAA;IAAKU,SAAS,EAAC,iCAAiC;IAAAC,QAAA,EAC7CjB,wBAAwB,CACzB,KAAK,GAAGW,eAAe,GAAG,MAAM;IAChC;IACA;MAAEO,CAAC,eAAEZ,IAAA;QAAGa,IAAI,EAAGV;MAAY,CAAE;IAAE,CAChC;EAAC,CACG,CAAC;AAER,CAAC;AAED,eAAeF,iBAAiB","ignoreList":[]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
5
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { useSelect } from '@wordpress/data';
|
|
8
|
-
|
|
9
|
-
const CreateNewPostLink = ( { postType } ) => {
|
|
10
|
-
const newPostUrl = addQueryArgs( 'post-new.php', {
|
|
11
|
-
post_type: postType,
|
|
12
|
-
} );
|
|
13
|
-
|
|
14
|
-
const addNewItemLabel = useSelect(
|
|
15
|
-
( select ) => {
|
|
16
|
-
const { getPostType } = select( coreStore );
|
|
17
|
-
return getPostType( postType )?.labels?.add_new_item;
|
|
18
|
-
},
|
|
19
|
-
[ postType ]
|
|
20
|
-
);
|
|
21
|
-
return (
|
|
22
|
-
<div className="wp-block-query__create-new-link">
|
|
23
|
-
{ createInterpolateElement(
|
|
24
|
-
'<a>' + addNewItemLabel + '</a>',
|
|
25
|
-
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
26
|
-
{ a: <a href={ newPostUrl } /> }
|
|
27
|
-
) }
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default CreateNewPostLink;
|