@wordpress/block-library 9.27.0 → 9.28.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/categories/edit.js +15 -3
- package/build/categories/edit.js.map +1 -1
- package/build/cover/edit/index.js +1 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +5 -3
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/file/edit.js +5 -2
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/transforms.js +6 -6
- package/build/file/transforms.js.map +1 -1
- package/build/file/utils/index.js +5 -0
- package/build/file/utils/index.js.map +1 -1
- package/build/gallery/use-get-media.js +3 -3
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-get-media.native.js +3 -3
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/image/edit.native.js +2 -2
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.js +0 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list-item/edit.js +3 -0
- package/build/list-item/edit.js.map +1 -1
- package/build/media-text/edit.js +2 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/more/edit.js +13 -28
- package/build/more/edit.js.map +1 -1
- package/build/paragraph/edit.js +2 -2
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-comments-count/index.js +3 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-link/index.js +3 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-date/deprecated.js +104 -1
- package/build/post-date/deprecated.js.map +1 -1
- package/build/post-date/edit.js +32 -32
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +4 -4
- package/build/post-date/index.js.map +1 -1
- package/build/post-date/variations.js +32 -3
- package/build/post-date/variations.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/site-logo/edit.js +2 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-link/icons/tiktok.js +2 -2
- package/build/social-link/icons/tiktok.js.map +1 -1
- package/build/social-link/variations.js +51 -49
- package/build/social-link/variations.js.map +1 -1
- package/build/utils/poster-image.js +141 -0
- package/build/utils/poster-image.js.map +1 -0
- package/build/video/edit.js +6 -2
- package/build/video/edit.js.map +1 -1
- package/build-module/categories/edit.js +15 -3
- package/build-module/categories/edit.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/edit/inspector-controls.js +5 -3
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/file/edit.js +5 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/transforms.js +6 -6
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/file/utils/index.js +5 -0
- package/build-module/file/utils/index.js.map +1 -1
- package/build-module/gallery/use-get-media.js +3 -3
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +3 -3
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/image/edit.native.js +2 -2
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.js +0 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list-item/edit.js +3 -0
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/media-text/edit.js +2 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/more/edit.js +15 -29
- package/build-module/more/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +2 -2
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +3 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +3 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-date/deprecated.js +104 -1
- package/build-module/post-date/deprecated.js.map +1 -1
- package/build-module/post-date/edit.js +35 -35
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +4 -4
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-date/variations.js +32 -3
- package/build-module/post-date/variations.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -2
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +2 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-link/icons/tiktok.js +2 -2
- package/build-module/social-link/icons/tiktok.js.map +1 -1
- package/build-module/social-link/variations.js +52 -50
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/utils/poster-image.js +133 -0
- package/build-module/utils/poster-image.js.map +1 -0
- package/build-module/video/edit.js +6 -2
- package/build-module/video/edit.js.map +1 -1
- package/build-style/editor-rtl.css +77 -23
- package/build-style/editor.css +77 -23
- package/build-style/gallery/style-rtl.css +1 -2
- package/build-style/gallery/style.css +1 -2
- package/build-style/image/style-rtl.css +1 -2
- package/build-style/image/style.css +1 -2
- package/build-style/more/editor-rtl.css +3 -11
- package/build-style/more/editor.css +3 -11
- package/build-style/navigation/editor-rtl.css +6 -6
- package/build-style/navigation/editor.css +6 -6
- package/build-style/page-list/editor-rtl.css +0 -4
- package/build-style/page-list/editor.css +0 -4
- package/build-style/post-featured-image/editor-rtl.css +1 -2
- package/build-style/post-featured-image/editor.css +1 -2
- package/build-style/style-rtl.css +3 -4
- package/build-style/style.css +3 -4
- package/build-style/video/style-rtl.css +1 -0
- package/build-style/video/style.css +1 -0
- package/package.json +35 -35
- package/src/block/index.php +33 -20
- package/src/categories/edit.js +13 -1
- package/src/cover/edit/index.js +8 -3
- package/src/cover/edit/inspector-controls.js +12 -3
- package/src/editor.scss +1 -0
- package/src/file/edit.js +10 -2
- package/src/file/edit.native.js +5 -1
- package/src/file/transforms.js +6 -6
- package/src/file/utils/index.js +5 -0
- package/src/form-input/index.php +4 -2
- package/src/gallery/use-get-media.js +9 -5
- package/src/gallery/use-get-media.native.js +10 -6
- package/src/image/edit.native.js +4 -2
- package/src/image/image.js +6 -1
- package/src/image/index.php +1 -1
- package/src/image/test/edit.native.js +16 -10
- package/src/latest-posts/edit.js +0 -2
- package/src/list-item/edit.js +3 -0
- package/src/loginout/index.php +4 -2
- package/src/media-text/edit.js +16 -6
- package/src/more/edit.js +27 -33
- package/src/more/editor.scss +3 -12
- package/src/page-list/editor.scss +0 -6
- package/src/paragraph/edit.js +2 -2
- package/src/post-comments-count/block.json +3 -0
- package/src/post-comments-link/block.json +3 -0
- package/src/post-date/block.json +4 -4
- package/src/post-date/deprecated.js +104 -1
- package/src/post-date/edit.js +74 -86
- package/src/post-date/index.php +51 -28
- package/src/post-date/variations.js +37 -3
- package/src/post-featured-image/edit.js +2 -2
- package/src/site-logo/edit.js +11 -4
- package/src/social-link/README.md +21 -0
- package/src/social-link/icons/tiktok.js +2 -2
- package/src/social-link/index.php +49 -49
- package/src/social-link/variations.js +51 -49
- package/src/utils/poster-image.js +176 -0
- package/src/utils/poster-image.scss +82 -0
- package/src/video/edit.js +7 -2
- package/src/video/index.php +91 -0
- package/src/video/style.native.scss +1 -0
- package/src/video/style.scss +1 -0
- package/build/cover/edit/poster-image.js +0 -81
- package/build/cover/edit/poster-image.js.map +0 -1
- package/build/video/poster-image.js +0 -81
- package/build/video/poster-image.js.map +0 -1
- package/build-module/cover/edit/poster-image.js +0 -74
- package/build-module/cover/edit/poster-image.js.map +0 -1
- package/build-module/video/poster-image.js +0 -74
- package/build-module/video/poster-image.js.map +0 -1
- package/src/cover/edit/poster-image.js +0 -91
- package/src/video/poster-image.js +0 -91
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { _x } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -62,292 +62,294 @@ const variations = [
|
|
|
62
62
|
isDefault: true,
|
|
63
63
|
name: 'wordpress',
|
|
64
64
|
attributes: { service: 'wordpress' },
|
|
65
|
-
title:
|
|
65
|
+
title: _x( 'WordPress', 'social link block variation name' ),
|
|
66
66
|
icon: WordPressIcon,
|
|
67
67
|
},
|
|
68
68
|
|
|
69
69
|
{
|
|
70
70
|
name: 'fivehundredpx',
|
|
71
71
|
attributes: { service: 'fivehundredpx' },
|
|
72
|
-
title:
|
|
72
|
+
title: _x( '500px', 'social link block variation name' ),
|
|
73
73
|
icon: FivehundredpxIcon,
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
name: 'amazon',
|
|
77
77
|
attributes: { service: 'amazon' },
|
|
78
|
-
title:
|
|
78
|
+
title: _x( 'Amazon', 'social link block variation name' ),
|
|
79
79
|
icon: AmazonIcon,
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
name: 'bandcamp',
|
|
83
83
|
attributes: { service: 'bandcamp' },
|
|
84
|
-
title:
|
|
84
|
+
title: _x( 'Bandcamp', 'social link block variation name' ),
|
|
85
85
|
icon: BandcampIcon,
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
name: 'behance',
|
|
89
89
|
attributes: { service: 'behance' },
|
|
90
|
-
title:
|
|
90
|
+
title: _x( 'Behance', 'social link block variation name' ),
|
|
91
91
|
icon: BehanceIcon,
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
name: 'bluesky',
|
|
95
95
|
attributes: { service: 'bluesky' },
|
|
96
|
-
title:
|
|
96
|
+
title: _x( 'Bluesky', 'social link block variation name' ),
|
|
97
97
|
icon: BlueskyIcon,
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
name: 'chain',
|
|
101
101
|
attributes: { service: 'chain' },
|
|
102
|
-
title:
|
|
102
|
+
title: _x( 'Link', 'social link block variation name' ),
|
|
103
103
|
icon: ChainIcon,
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
name: 'codepen',
|
|
107
107
|
attributes: { service: 'codepen' },
|
|
108
|
-
title:
|
|
108
|
+
title: _x( 'CodePen', 'social link block variation name' ),
|
|
109
109
|
icon: CodepenIcon,
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
name: 'deviantart',
|
|
113
113
|
attributes: { service: 'deviantart' },
|
|
114
|
-
title:
|
|
114
|
+
title: _x( 'DeviantArt', 'social link block variation name' ),
|
|
115
115
|
icon: DeviantArtIcon,
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
name: 'discord',
|
|
119
119
|
attributes: { service: 'discord' },
|
|
120
|
-
title:
|
|
120
|
+
title: _x( 'Discord', 'social link block variation name' ),
|
|
121
121
|
icon: DiscordIcon,
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
name: 'dribbble',
|
|
125
125
|
attributes: { service: 'dribbble' },
|
|
126
|
-
title:
|
|
126
|
+
title: _x( 'Dribbble', 'social link block variation name' ),
|
|
127
127
|
icon: DribbbleIcon,
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
name: 'dropbox',
|
|
131
131
|
attributes: { service: 'dropbox' },
|
|
132
|
-
title:
|
|
132
|
+
title: _x( 'Dropbox', 'social link block variation name' ),
|
|
133
133
|
icon: DropboxIcon,
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
name: 'etsy',
|
|
137
137
|
attributes: { service: 'etsy' },
|
|
138
|
-
title:
|
|
138
|
+
title: _x( 'Etsy', 'social link block variation name' ),
|
|
139
139
|
icon: EtsyIcon,
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
name: 'facebook',
|
|
143
143
|
attributes: { service: 'facebook' },
|
|
144
|
-
title:
|
|
144
|
+
title: _x( 'Facebook', 'social link block variation name' ),
|
|
145
145
|
icon: FacebookIcon,
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
name: 'feed',
|
|
149
149
|
attributes: { service: 'feed' },
|
|
150
|
-
title:
|
|
150
|
+
title: _x( 'RSS Feed', 'social link block variation name' ),
|
|
151
151
|
icon: FeedIcon,
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
name: 'flickr',
|
|
155
155
|
attributes: { service: 'flickr' },
|
|
156
|
-
title:
|
|
156
|
+
title: _x( 'Flickr', 'social link block variation name' ),
|
|
157
157
|
icon: FlickrIcon,
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
name: 'foursquare',
|
|
161
161
|
attributes: { service: 'foursquare' },
|
|
162
|
-
title:
|
|
162
|
+
title: _x( 'Foursquare', 'social link block variation name' ),
|
|
163
163
|
icon: FoursquareIcon,
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
name: 'goodreads',
|
|
167
167
|
attributes: { service: 'goodreads' },
|
|
168
|
-
title:
|
|
168
|
+
title: _x( 'Goodreads', 'social link block variation name' ),
|
|
169
169
|
icon: GoodreadsIcon,
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
name: 'google',
|
|
173
173
|
attributes: { service: 'google' },
|
|
174
|
-
title:
|
|
174
|
+
title: _x( 'Google', 'social link block variation name' ),
|
|
175
175
|
icon: GoogleIcon,
|
|
176
176
|
},
|
|
177
177
|
{
|
|
178
178
|
name: 'github',
|
|
179
179
|
attributes: { service: 'github' },
|
|
180
|
-
title:
|
|
180
|
+
title: _x( 'GitHub', 'social link block variation name' ),
|
|
181
181
|
icon: GitHubIcon,
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
name: 'gravatar',
|
|
185
185
|
attributes: { service: 'gravatar' },
|
|
186
|
-
title:
|
|
186
|
+
title: _x( 'Gravatar', 'social link block variation name' ),
|
|
187
187
|
icon: GravatarIcon,
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
name: 'instagram',
|
|
191
191
|
attributes: { service: 'instagram' },
|
|
192
|
-
title:
|
|
192
|
+
title: _x( 'Instagram', 'social link block variation name' ),
|
|
193
193
|
icon: InstagramIcon,
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
196
|
name: 'lastfm',
|
|
197
197
|
attributes: { service: 'lastfm' },
|
|
198
|
-
title:
|
|
198
|
+
title: _x( 'Last.fm', 'social link block variation name' ),
|
|
199
199
|
icon: LastfmIcon,
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
name: 'linkedin',
|
|
203
203
|
attributes: { service: 'linkedin' },
|
|
204
|
-
title:
|
|
204
|
+
title: _x( 'LinkedIn', 'social link block variation name' ),
|
|
205
205
|
icon: LinkedInIcon,
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
208
|
name: 'mail',
|
|
209
209
|
attributes: { service: 'mail' },
|
|
210
|
-
title:
|
|
210
|
+
title: _x( 'Mail', 'social link block variation name' ),
|
|
211
211
|
keywords: [ 'email', 'e-mail' ],
|
|
212
212
|
icon: MailIcon,
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
215
|
name: 'mastodon',
|
|
216
216
|
attributes: { service: 'mastodon' },
|
|
217
|
-
title:
|
|
217
|
+
title: _x( 'Mastodon', 'social link block variation name' ),
|
|
218
218
|
icon: MastodonIcon,
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
name: 'meetup',
|
|
222
222
|
attributes: { service: 'meetup' },
|
|
223
|
-
title:
|
|
223
|
+
title: _x( 'Meetup', 'social link block variation name' ),
|
|
224
224
|
icon: MeetupIcon,
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
name: 'medium',
|
|
228
228
|
attributes: { service: 'medium' },
|
|
229
|
-
title:
|
|
229
|
+
title: _x( 'Medium', 'social link block variation name' ),
|
|
230
230
|
icon: MediumIcon,
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
name: 'patreon',
|
|
234
234
|
attributes: { service: 'patreon' },
|
|
235
|
-
title:
|
|
235
|
+
title: _x( 'Patreon', 'social link block variation name' ),
|
|
236
236
|
icon: PatreonIcon,
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
name: 'pinterest',
|
|
240
240
|
attributes: { service: 'pinterest' },
|
|
241
|
-
title:
|
|
241
|
+
title: _x( 'Pinterest', 'social link block variation name' ),
|
|
242
242
|
icon: PinterestIcon,
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
name: 'pocket',
|
|
246
246
|
attributes: { service: 'pocket' },
|
|
247
|
-
title:
|
|
247
|
+
title: _x( 'Pocket', 'social link block variation name' ),
|
|
248
248
|
icon: PocketIcon,
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
251
|
name: 'reddit',
|
|
252
252
|
attributes: { service: 'reddit' },
|
|
253
|
-
title:
|
|
253
|
+
title: _x( 'Reddit', 'social link block variation name' ),
|
|
254
254
|
icon: RedditIcon,
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
257
|
name: 'skype',
|
|
258
258
|
attributes: { service: 'skype' },
|
|
259
|
-
title:
|
|
259
|
+
title: _x( 'Skype', 'social link block variation name' ),
|
|
260
260
|
icon: SkypeIcon,
|
|
261
|
+
// Deprecated: Skype service is no longer available.
|
|
262
|
+
scope: [],
|
|
261
263
|
},
|
|
262
264
|
{
|
|
263
265
|
name: 'snapchat',
|
|
264
266
|
attributes: { service: 'snapchat' },
|
|
265
|
-
title:
|
|
267
|
+
title: _x( 'Snapchat', 'social link block variation name' ),
|
|
266
268
|
icon: SnapchatIcon,
|
|
267
269
|
},
|
|
268
270
|
{
|
|
269
271
|
name: 'soundcloud',
|
|
270
272
|
attributes: { service: 'soundcloud' },
|
|
271
|
-
title:
|
|
273
|
+
title: _x( 'SoundCloud', 'social link block variation name' ),
|
|
272
274
|
icon: SoundCloudIcon,
|
|
273
275
|
},
|
|
274
276
|
{
|
|
275
277
|
name: 'spotify',
|
|
276
278
|
attributes: { service: 'spotify' },
|
|
277
|
-
title:
|
|
279
|
+
title: _x( 'Spotify', 'social link block variation name' ),
|
|
278
280
|
icon: SpotifyIcon,
|
|
279
281
|
},
|
|
280
282
|
{
|
|
281
283
|
name: 'telegram',
|
|
282
284
|
attributes: { service: 'telegram' },
|
|
283
|
-
title:
|
|
285
|
+
title: _x( 'Telegram', 'social link block variation name' ),
|
|
284
286
|
icon: TelegramIcon,
|
|
285
287
|
},
|
|
286
288
|
{
|
|
287
289
|
name: 'threads',
|
|
288
290
|
attributes: { service: 'threads' },
|
|
289
|
-
title:
|
|
291
|
+
title: _x( 'Threads', 'social link block variation name' ),
|
|
290
292
|
icon: ThreadsIcon,
|
|
291
293
|
},
|
|
292
294
|
{
|
|
293
295
|
name: 'tiktok',
|
|
294
296
|
attributes: { service: 'tiktok' },
|
|
295
|
-
title:
|
|
297
|
+
title: _x( 'TikTok', 'social link block variation name' ),
|
|
296
298
|
icon: TiktokIcon,
|
|
297
299
|
},
|
|
298
300
|
{
|
|
299
301
|
name: 'tumblr',
|
|
300
302
|
attributes: { service: 'tumblr' },
|
|
301
|
-
title:
|
|
303
|
+
title: _x( 'Tumblr', 'social link block variation name' ),
|
|
302
304
|
icon: TumblrIcon,
|
|
303
305
|
},
|
|
304
306
|
{
|
|
305
307
|
name: 'twitch',
|
|
306
308
|
attributes: { service: 'twitch' },
|
|
307
|
-
title:
|
|
309
|
+
title: _x( 'Twitch', 'social link block variation name' ),
|
|
308
310
|
icon: TwitchIcon,
|
|
309
311
|
},
|
|
310
312
|
{
|
|
311
313
|
name: 'twitter',
|
|
312
314
|
attributes: { service: 'twitter' },
|
|
313
|
-
title:
|
|
315
|
+
title: _x( 'Twitter', 'social link block variation name' ),
|
|
314
316
|
icon: TwitterIcon,
|
|
315
317
|
},
|
|
316
318
|
{
|
|
317
319
|
name: 'vimeo',
|
|
318
320
|
attributes: { service: 'vimeo' },
|
|
319
|
-
title:
|
|
321
|
+
title: _x( 'Vimeo', 'social link block variation name' ),
|
|
320
322
|
icon: VimeoIcon,
|
|
321
323
|
},
|
|
322
324
|
{
|
|
323
325
|
name: 'vk',
|
|
324
326
|
attributes: { service: 'vk' },
|
|
325
|
-
title:
|
|
327
|
+
title: _x( 'VK', 'social link block variation name' ),
|
|
326
328
|
icon: VkIcon,
|
|
327
329
|
},
|
|
328
330
|
{
|
|
329
331
|
name: 'whatsapp',
|
|
330
332
|
attributes: { service: 'whatsapp' },
|
|
331
|
-
title:
|
|
333
|
+
title: _x( 'WhatsApp', 'social link block variation name' ),
|
|
332
334
|
icon: WhatsAppIcon,
|
|
333
335
|
},
|
|
334
336
|
{
|
|
335
337
|
name: 'x',
|
|
336
338
|
attributes: { service: 'x' },
|
|
337
339
|
keywords: [ 'twitter' ],
|
|
338
|
-
title:
|
|
340
|
+
title: _x( 'X', 'social link block variation name' ),
|
|
339
341
|
icon: XIcon,
|
|
340
342
|
},
|
|
341
343
|
{
|
|
342
344
|
name: 'yelp',
|
|
343
345
|
attributes: { service: 'yelp' },
|
|
344
|
-
title:
|
|
346
|
+
title: _x( 'Yelp', 'social link block variation name' ),
|
|
345
347
|
icon: YelpIcon,
|
|
346
348
|
},
|
|
347
349
|
{
|
|
348
350
|
name: 'youtube',
|
|
349
351
|
attributes: { service: 'youtube' },
|
|
350
|
-
title:
|
|
352
|
+
title: _x( 'YouTube', 'social link block variation name' ),
|
|
351
353
|
icon: YouTubeIcon,
|
|
352
354
|
},
|
|
353
355
|
];
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
MediaUpload,
|
|
11
|
+
MediaUploadCheck,
|
|
12
|
+
store as blockEditorStore,
|
|
13
|
+
} from '@wordpress/block-editor';
|
|
14
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
15
|
+
import {
|
|
16
|
+
Button,
|
|
17
|
+
BaseControl,
|
|
18
|
+
DropZone,
|
|
19
|
+
Spinner,
|
|
20
|
+
__experimentalHStack as HStack,
|
|
21
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
22
|
+
} from '@wordpress/components';
|
|
23
|
+
import { isBlobURL } from '@wordpress/blob';
|
|
24
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
25
|
+
import { useRef, useState } from '@wordpress/element';
|
|
26
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
27
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
28
|
+
|
|
29
|
+
const POSTER_IMAGE_ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
30
|
+
|
|
31
|
+
function PosterImage( { poster, onChange } ) {
|
|
32
|
+
const posterButtonRef = useRef();
|
|
33
|
+
const [ isLoading, setIsLoading ] = useState( false );
|
|
34
|
+
const descriptionId = useInstanceId(
|
|
35
|
+
PosterImage,
|
|
36
|
+
'block-library-poster-image-description'
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const { getSettings } = useSelect( blockEditorStore );
|
|
40
|
+
const { createErrorNotice } = useDispatch( noticesStore );
|
|
41
|
+
|
|
42
|
+
const onDropFiles = ( filesList ) => {
|
|
43
|
+
getSettings().mediaUpload( {
|
|
44
|
+
allowedTypes: POSTER_IMAGE_ALLOWED_MEDIA_TYPES,
|
|
45
|
+
filesList,
|
|
46
|
+
onFileChange: ( [ image ] ) => {
|
|
47
|
+
if ( isBlobURL( image?.url ) ) {
|
|
48
|
+
setIsLoading( true );
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if ( image ) {
|
|
53
|
+
onChange( image );
|
|
54
|
+
}
|
|
55
|
+
setIsLoading( false );
|
|
56
|
+
},
|
|
57
|
+
onError: ( message ) => {
|
|
58
|
+
createErrorNotice( message, {
|
|
59
|
+
id: 'poster-image-upload-notice',
|
|
60
|
+
type: 'snackbar',
|
|
61
|
+
} );
|
|
62
|
+
setIsLoading( false );
|
|
63
|
+
},
|
|
64
|
+
multiple: false,
|
|
65
|
+
} );
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const getPosterButtonContent = () => {
|
|
69
|
+
if ( ! poster && isLoading ) {
|
|
70
|
+
return <Spinner />;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return ! poster ? __( 'Set poster image' ) : __( 'Replace' );
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<MediaUploadCheck>
|
|
78
|
+
<ToolsPanelItem
|
|
79
|
+
label={ __( 'Poster image' ) }
|
|
80
|
+
isShownByDefault
|
|
81
|
+
hasValue={ () => !! poster }
|
|
82
|
+
onDeselect={ () => onChange( undefined ) }
|
|
83
|
+
>
|
|
84
|
+
<BaseControl.VisualLabel>
|
|
85
|
+
{ __( 'Poster image' ) }
|
|
86
|
+
</BaseControl.VisualLabel>
|
|
87
|
+
<MediaUpload
|
|
88
|
+
title={ __( 'Select poster image' ) }
|
|
89
|
+
onSelect={ onChange }
|
|
90
|
+
allowedTypes={ POSTER_IMAGE_ALLOWED_MEDIA_TYPES }
|
|
91
|
+
render={ ( { open } ) => (
|
|
92
|
+
<div className="block-library-poster-image__container">
|
|
93
|
+
{ poster && (
|
|
94
|
+
<Button
|
|
95
|
+
__next40pxDefaultSize
|
|
96
|
+
onClick={ open }
|
|
97
|
+
aria-haspopup="dialog"
|
|
98
|
+
aria-label={ __(
|
|
99
|
+
'Edit or replace the poster image.'
|
|
100
|
+
) }
|
|
101
|
+
className="block-library-poster-image__preview"
|
|
102
|
+
disabled={ isLoading }
|
|
103
|
+
accessibleWhenDisabled
|
|
104
|
+
>
|
|
105
|
+
<img
|
|
106
|
+
src={ poster }
|
|
107
|
+
alt={ __( 'Poster image preview' ) }
|
|
108
|
+
className="block-library-poster-image__preview-image"
|
|
109
|
+
/>
|
|
110
|
+
{ isLoading && <Spinner /> }
|
|
111
|
+
</Button>
|
|
112
|
+
) }
|
|
113
|
+
<HStack
|
|
114
|
+
className={ clsx(
|
|
115
|
+
'block-library-poster-image__actions',
|
|
116
|
+
{
|
|
117
|
+
'block-library-poster-image__actions-select':
|
|
118
|
+
! poster,
|
|
119
|
+
}
|
|
120
|
+
) }
|
|
121
|
+
>
|
|
122
|
+
<Button
|
|
123
|
+
__next40pxDefaultSize
|
|
124
|
+
onClick={ open }
|
|
125
|
+
ref={ posterButtonRef }
|
|
126
|
+
className="block-library-poster-image__action"
|
|
127
|
+
aria-describedby={ descriptionId }
|
|
128
|
+
aria-haspopup="dialog"
|
|
129
|
+
variant={
|
|
130
|
+
! poster ? 'secondary' : undefined
|
|
131
|
+
}
|
|
132
|
+
disabled={ isLoading }
|
|
133
|
+
accessibleWhenDisabled
|
|
134
|
+
>
|
|
135
|
+
{ getPosterButtonContent() }
|
|
136
|
+
</Button>
|
|
137
|
+
<p id={ descriptionId } hidden>
|
|
138
|
+
{ poster
|
|
139
|
+
? sprintf(
|
|
140
|
+
/* translators: %s: poster image URL. */
|
|
141
|
+
__(
|
|
142
|
+
'The current poster image url is %s.'
|
|
143
|
+
),
|
|
144
|
+
poster
|
|
145
|
+
)
|
|
146
|
+
: __(
|
|
147
|
+
'There is no poster image currently selected.'
|
|
148
|
+
) }
|
|
149
|
+
</p>
|
|
150
|
+
{ !! poster && (
|
|
151
|
+
<Button
|
|
152
|
+
__next40pxDefaultSize
|
|
153
|
+
onClick={ () => {
|
|
154
|
+
onChange( undefined );
|
|
155
|
+
|
|
156
|
+
// Move focus back to the Media Upload button.
|
|
157
|
+
posterButtonRef.current.focus();
|
|
158
|
+
} }
|
|
159
|
+
className="block-library-poster-image__action"
|
|
160
|
+
disabled={ isLoading }
|
|
161
|
+
accessibleWhenDisabled
|
|
162
|
+
>
|
|
163
|
+
{ __( 'Remove' ) }
|
|
164
|
+
</Button>
|
|
165
|
+
) }
|
|
166
|
+
</HStack>
|
|
167
|
+
<DropZone onFilesDrop={ onDropFiles } />
|
|
168
|
+
</div>
|
|
169
|
+
) }
|
|
170
|
+
/>
|
|
171
|
+
</ToolsPanelItem>
|
|
172
|
+
</MediaUploadCheck>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default PosterImage;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
.block-library-poster-image__container {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
&:hover,
|
|
5
|
+
&:focus,
|
|
6
|
+
&:focus-within {
|
|
7
|
+
.block-library-poster-image__actions {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.block-library-poster-image__actions.block-library-poster-image__actions-select {
|
|
13
|
+
opacity: 1;
|
|
14
|
+
margin-top: $grid-unit-20;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.components-drop-zone__content {
|
|
18
|
+
border-radius: $radius-small;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Align text and icons horizontally to avoid clipping when the poster image is not set.
|
|
22
|
+
.components-drop-zone .components-drop-zone__content-inner {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: $grid-unit-10;
|
|
26
|
+
|
|
27
|
+
.components-drop-zone__content-icon {
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.components-spinner {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 50%;
|
|
35
|
+
left: 50%;
|
|
36
|
+
margin-top: -9px;
|
|
37
|
+
margin-left: -9px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.block-library-poster-image__preview {
|
|
42
|
+
width: 100%;
|
|
43
|
+
padding: 0;
|
|
44
|
+
overflow: hidden; // Ensure the focus style properly encapsulates the image.
|
|
45
|
+
outline-offset: -#{$border-width};
|
|
46
|
+
min-height: $grid-unit-50;
|
|
47
|
+
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
height: auto !important;
|
|
51
|
+
outline: $border-width solid rgba($black, 0.1);
|
|
52
|
+
|
|
53
|
+
.block-library-poster-image__preview-image {
|
|
54
|
+
object-fit: cover;
|
|
55
|
+
width: 100%;
|
|
56
|
+
object-position: 50% 50%;
|
|
57
|
+
aspect-ratio: 2/1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.block-library-poster-image__actions {
|
|
62
|
+
&:not(.block-library-poster-image__actions-select) {
|
|
63
|
+
bottom: 0;
|
|
64
|
+
opacity: 0; // Use opacity instead of visibility so that the buttons remain in the tab order.
|
|
65
|
+
padding: $grid-unit-10;
|
|
66
|
+
position: absolute;
|
|
67
|
+
|
|
68
|
+
@media not ( prefers-reduced-motion ) {
|
|
69
|
+
transition: opacity 50ms ease-out;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.block-library-poster-image__action {
|
|
73
|
+
backdrop-filter: blur(16px) saturate(180%);
|
|
74
|
+
background: rgba(255, 255, 255, 0.75);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.block-library-poster-image__action {
|
|
79
|
+
flex-grow: 1;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
}
|
|
82
|
+
}
|
package/src/video/edit.js
CHANGED
|
@@ -30,7 +30,6 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
30
30
|
/**
|
|
31
31
|
* Internal dependencies
|
|
32
32
|
*/
|
|
33
|
-
import PosterImage from './poster-image';
|
|
34
33
|
import { createUpgradedEmbedBlock } from '../embed/util';
|
|
35
34
|
import {
|
|
36
35
|
useUploadMediaFromBlobURL,
|
|
@@ -40,6 +39,7 @@ import VideoCommonSettings from './edit-common-settings';
|
|
|
40
39
|
import TracksEditor from './tracks-editor';
|
|
41
40
|
import Tracks from './tracks';
|
|
42
41
|
import { Caption } from '../utils/caption';
|
|
42
|
+
import PosterImage from '../utils/poster-image';
|
|
43
43
|
|
|
44
44
|
const ALLOWED_MEDIA_TYPES = [ 'video' ];
|
|
45
45
|
|
|
@@ -70,6 +70,7 @@ function VideoEdit( {
|
|
|
70
70
|
}
|
|
71
71
|
}, [ poster ] );
|
|
72
72
|
|
|
73
|
+
// TODO: Whether the video was obtained from the media library or was provided by URL, obtain the `videoWidth` and `videoHeight` of the video once its metadata has loaded and persist in the block attributes.
|
|
73
74
|
function onSelectVideo( media ) {
|
|
74
75
|
if ( ! media || ! media.url ) {
|
|
75
76
|
// In this case there was an error
|
|
@@ -219,7 +220,11 @@ function VideoEdit( {
|
|
|
219
220
|
/>
|
|
220
221
|
<PosterImage
|
|
221
222
|
poster={ poster }
|
|
222
|
-
|
|
223
|
+
onChange={ ( posterImage ) =>
|
|
224
|
+
setAttributes( {
|
|
225
|
+
poster: posterImage?.url,
|
|
226
|
+
} )
|
|
227
|
+
}
|
|
223
228
|
/>
|
|
224
229
|
</ToolsPanel>
|
|
225
230
|
</InspectorControls>
|