@wordpress/block-library 7.14.8 → 7.14.9

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.
Files changed (47) hide show
  1. package/build/embed/deprecated.js +43 -4
  2. package/build/embed/deprecated.js.map +1 -1
  3. package/build/embed/variations.js +1 -1
  4. package/build/embed/variations.js.map +1 -1
  5. package/build/file/deprecated.js +108 -4
  6. package/build/file/deprecated.js.map +1 -1
  7. package/build/gallery/deprecated.js +147 -22
  8. package/build/gallery/deprecated.js.map +1 -1
  9. package/build/page-list/edit.js +29 -10
  10. package/build/page-list/edit.js.map +1 -1
  11. package/build/table/deprecated.js +282 -27
  12. package/build/table/deprecated.js.map +1 -1
  13. package/build/video/deprecated.js +159 -0
  14. package/build/video/deprecated.js.map +1 -0
  15. package/build/video/index.js +3 -0
  16. package/build/video/index.js.map +1 -1
  17. package/build-module/embed/deprecated.js +44 -5
  18. package/build-module/embed/deprecated.js.map +1 -1
  19. package/build-module/embed/variations.js +1 -1
  20. package/build-module/embed/variations.js.map +1 -1
  21. package/build-module/file/deprecated.js +108 -4
  22. package/build-module/file/deprecated.js.map +1 -1
  23. package/build-module/gallery/deprecated.js +145 -23
  24. package/build-module/gallery/deprecated.js.map +1 -1
  25. package/build-module/page-list/edit.js +29 -10
  26. package/build-module/page-list/edit.js.map +1 -1
  27. package/build-module/table/deprecated.js +282 -27
  28. package/build-module/table/deprecated.js.map +1 -1
  29. package/build-module/video/deprecated.js +147 -0
  30. package/build-module/video/deprecated.js.map +1 -0
  31. package/build-module/video/index.js +2 -0
  32. package/build-module/video/index.js.map +1 -1
  33. package/build-style/button/style-rtl.css +1 -0
  34. package/build-style/button/style.css +1 -0
  35. package/build-style/style-rtl.css +1 -0
  36. package/build-style/style.css +1 -0
  37. package/package.json +4 -4
  38. package/src/button/style.scss +2 -0
  39. package/src/embed/deprecated.js +53 -26
  40. package/src/embed/variations.js +1 -1
  41. package/src/file/deprecated.js +130 -2
  42. package/src/gallery/deprecated.js +127 -2
  43. package/src/page-list/edit.js +36 -22
  44. package/src/post-featured-image/index.php +11 -18
  45. package/src/table/deprecated.js +587 -348
  46. package/src/video/deprecated.js +57 -0
  47. package/src/video/index.js +2 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/video/deprecated.js"],"names":["RichText","useBlockProps","Tracks","attributes","blockAttributes","metadata","v1","save","autoplay","caption","controls","loop","muted","poster","preload","src","playsInline","tracks","undefined","isEmpty","deprecated"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,aAAnB,QAAwC,yBAAxC;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,MAAM;AAAEC,EAAAA,UAAU,EAAEC;AAAd,IAAkCC,QAAxC,C,CAEA;AACA;;AACA,MAAMC,EAAE,GAAG;AACVH,EAAAA,UAAU,EAAEC,eADF;;AAEVG,EAAAA,IAAI,OAAmB;AAAA,QAAjB;AAAEJ,MAAAA;AAAF,KAAiB;AACtB,UAAM;AACLK,MAAAA,QADK;AAELC,MAAAA,OAFK;AAGLC,MAAAA,QAHK;AAILC,MAAAA,IAJK;AAKLC,MAAAA,KALK;AAMLC,MAAAA,MANK;AAOLC,MAAAA,OAPK;AAQLC,MAAAA,GARK;AASLC,MAAAA,WATK;AAULC,MAAAA;AAVK,QAWFd,UAXJ;AAYA,WACC,wBAAaF,aAAa,CAACM,IAAd,EAAb,EACGQ,GAAG,IACJ;AACC,MAAA,QAAQ,EAAGP,QADZ;AAEC,MAAA,QAAQ,EAAGE,QAFZ;AAGC,MAAA,IAAI,EAAGC,IAHR;AAIC,MAAA,KAAK,EAAGC,KAJT;AAKC,MAAA,MAAM,EAAGC,MALV;AAMC,MAAA,OAAO,EAAGC,OAAO,KAAK,UAAZ,GAAyBA,OAAzB,GAAmCI,SAN9C;AAOC,MAAA,GAAG,EAAGH,GAPP;AAQC,MAAA,WAAW,EAAGC;AARf,OAUC,cAAC,MAAD;AAAQ,MAAA,MAAM,EAAGC;AAAjB,MAVD,CAFF,EAeG,CAAEjB,QAAQ,CAACmB,OAAT,CAAkBV,OAAlB,CAAF,IACD,cAAC,QAAD,CAAU,OAAV;AAAkB,MAAA,OAAO,EAAC,YAA1B;AAAuC,MAAA,KAAK,EAAGA;AAA/C,MAhBF,CADD;AAqBA;;AApCS,CAAX;AAuCA,MAAMW,UAAU,GAAG,CAAEd,EAAF,CAAnB;AAEA,eAAec,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport Tracks from './tracks';\n\nconst { attributes: blockAttributes } = metadata;\n\n// In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname\n// to the video figcaption element.\nconst v1 = {\n\tattributes: blockAttributes,\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tautoplay,\n\t\t\tcaption,\n\t\t\tcontrols,\n\t\t\tloop,\n\t\t\tmuted,\n\t\t\tposter,\n\t\t\tpreload,\n\t\t\tsrc,\n\t\t\tplaysInline,\n\t\t\ttracks,\n\t\t} = attributes;\n\t\treturn (\n\t\t\t<figure { ...useBlockProps.save() }>\n\t\t\t\t{ src && (\n\t\t\t\t\t<video\n\t\t\t\t\t\tautoPlay={ autoplay }\n\t\t\t\t\t\tcontrols={ controls }\n\t\t\t\t\t\tloop={ loop }\n\t\t\t\t\t\tmuted={ muted }\n\t\t\t\t\t\tposter={ poster }\n\t\t\t\t\t\tpreload={ preload !== 'metadata' ? preload : undefined }\n\t\t\t\t\t\tsrc={ src }\n\t\t\t\t\t\tplaysInline={ playsInline }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Tracks tracks={ tracks } />\n\t\t\t\t\t</video>\n\t\t\t\t) }\n\t\t\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t\t\t<RichText.Content tagName=\"figcaption\" value={ caption } />\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t);\n\t},\n};\n\nconst deprecated = [ v1 ];\n\nexport default deprecated;\n"]}
@@ -8,6 +8,7 @@ import { video as icon } from '@wordpress/icons';
8
8
  */
9
9
 
10
10
  import initBlock from '../utils/init-block';
11
+ import deprecated from './deprecated';
11
12
  import edit from './edit';
12
13
  const metadata = {
13
14
  $schema: "https://schemas.wp.org/trunk/block.json",
@@ -116,6 +117,7 @@ export const settings = {
116
117
  }
117
118
  },
118
119
  transforms,
120
+ deprecated,
119
121
  edit,
120
122
  save
121
123
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/video/index.js"],"names":["__","video","icon","initBlock","edit","save","transforms","name","metadata","settings","example","attributes","src","caption","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,IAAlB,QAA8B,kBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,OAAOC,IAAP,MAAiB,QAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBP,EAAAA,IADuB;AAEvBQ,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,GAAG,EAAE,+GADM;AAEX;AACAC,MAAAA,OAAO,EAAEb,EAAE,CAAE,2CAAF;AAHA;AADJ,GAFc;AASvBM,EAAAA,UATuB;AAUvBF,EAAAA,IAVuB;AAWvBC,EAAAA;AAXuB,CAAjB;AAcP,OAAO,MAAMS,IAAI,GAAG,MAAMX,SAAS,CAAE;AAAEI,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { video as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',\n\t\t\t// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.\n\t\t\tcaption: __( 'Wood thrush singing in Central Park, NYC.' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/video/index.js"],"names":["__","video","icon","initBlock","deprecated","edit","save","transforms","name","metadata","settings","example","attributes","src","caption","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,IAAlB,QAA8B,kBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,IAAP,MAAiB,QAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBR,EAAAA,IADuB;AAEvBS,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,GAAG,EAAE,+GADM;AAEX;AACAC,MAAAA,OAAO,EAAEd,EAAE,CAAE,2CAAF;AAHA;AADJ,GAFc;AASvBO,EAAAA,UATuB;AAUvBH,EAAAA,UAVuB;AAWvBC,EAAAA,IAXuB;AAYvBC,EAAAA;AAZuB,CAAjB;AAeP,OAAO,MAAMS,IAAI,GAAG,MAAMZ,SAAS,CAAE;AAAEK,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { video as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',\n\t\t\t// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.\n\t\t\tcaption: __( 'Wood thrush singing in Central Park, NYC.' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
@@ -156,4 +156,5 @@
156
156
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
157
157
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
158
158
  background-color: transparent;
159
+ background-image: none;
159
160
  }
@@ -157,4 +157,5 @@
157
157
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
158
158
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
159
159
  background-color: transparent;
160
+ background-image: none;
160
161
  }
@@ -180,6 +180,7 @@
180
180
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
181
181
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
182
182
  background-color: transparent;
183
+ background-image: none;
183
184
  }
184
185
 
185
186
  .wp-block-buttons {
@@ -181,6 +181,7 @@
181
181
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
182
182
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
183
183
  background-color: transparent;
184
+ background-image: none;
184
185
  }
185
186
 
186
187
  .wp-block-buttons {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "7.14.8",
3
+ "version": "7.14.9",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -35,7 +35,7 @@
35
35
  "@wordpress/api-fetch": "^6.14.1",
36
36
  "@wordpress/autop": "^3.17.1",
37
37
  "@wordpress/blob": "^3.17.1",
38
- "@wordpress/block-editor": "^10.0.7",
38
+ "@wordpress/block-editor": "^10.0.8",
39
39
  "@wordpress/blocks": "^11.16.4",
40
40
  "@wordpress/components": "^21.0.6",
41
41
  "@wordpress/compose": "^5.15.2",
@@ -52,7 +52,7 @@
52
52
  "@wordpress/keycodes": "^3.17.1",
53
53
  "@wordpress/notices": "^3.17.3",
54
54
  "@wordpress/primitives": "^3.15.1",
55
- "@wordpress/reusable-blocks": "^3.15.7",
55
+ "@wordpress/reusable-blocks": "^3.15.8",
56
56
  "@wordpress/rich-text": "^5.15.3",
57
57
  "@wordpress/server-side-render": "^3.15.6",
58
58
  "@wordpress/url": "^3.18.1",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "84269cffad0bab2b10e6b6da8e275716fcc8c57b"
76
+ "gitHead": "21ef2792a2c3889830aee525f0136657a570c265"
77
77
  }
@@ -113,4 +113,6 @@ $blocks-block__margin: 0.5em;
113
113
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
114
114
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
115
115
  background-color: transparent;
116
+ // background-image is required to overwrite a gradient background
117
+ background-image: none;
116
118
  }
@@ -11,36 +11,63 @@ import metadata from './block.json';
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
14
- import { RichText } from '@wordpress/block-editor';
14
+ import { RichText, useBlockProps } from '@wordpress/block-editor';
15
15
 
16
16
  const { attributes: blockAttributes } = metadata;
17
17
 
18
- const deprecated = [
19
- {
20
- attributes: blockAttributes,
21
- save( { attributes: { url, caption, type, providerNameSlug } } ) {
22
- if ( ! url ) {
23
- return null;
24
- }
25
-
26
- const embedClassName = classnames( 'wp-block-embed', {
27
- [ `is-type-${ type }` ]: type,
28
- [ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
29
- } );
30
-
31
- return (
32
- <figure className={ embedClassName }>
18
+ // In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
19
+ // to the embed figcaption element.
20
+ const v2 = {
21
+ attributes: blockAttributes,
22
+ save( { attributes } ) {
23
+ const { url, caption, type, providerNameSlug } = attributes;
24
+
25
+ if ( ! url ) {
26
+ return null;
27
+ }
28
+
29
+ const className = classnames( 'wp-block-embed', {
30
+ [ `is-type-${ type }` ]: type,
31
+ [ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
32
+ [ `wp-block-embed-${ providerNameSlug }` ]: providerNameSlug,
33
+ } );
34
+
35
+ return (
36
+ <figure { ...useBlockProps.save( { className } ) }>
37
+ <div className="wp-block-embed__wrapper">
33
38
  { `\n${ url }\n` /* URL needs to be on its own line. */ }
34
- { ! RichText.isEmpty( caption ) && (
35
- <RichText.Content
36
- tagName="figcaption"
37
- value={ caption }
38
- />
39
- ) }
40
- </figure>
41
- );
42
- },
39
+ </div>
40
+ { ! RichText.isEmpty( caption ) && (
41
+ <RichText.Content tagName="figcaption" value={ caption } />
42
+ ) }
43
+ </figure>
44
+ );
45
+ },
46
+ };
47
+
48
+ const v1 = {
49
+ attributes: blockAttributes,
50
+ save( { attributes: { url, caption, type, providerNameSlug } } ) {
51
+ if ( ! url ) {
52
+ return null;
53
+ }
54
+
55
+ const embedClassName = classnames( 'wp-block-embed', {
56
+ [ `is-type-${ type }` ]: type,
57
+ [ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
58
+ } );
59
+
60
+ return (
61
+ <figure className={ embedClassName }>
62
+ { `\n${ url }\n` /* URL needs to be on its own line. */ }
63
+ { ! RichText.isEmpty( caption ) && (
64
+ <RichText.Content tagName="figcaption" value={ caption } />
65
+ ) }
66
+ </figure>
67
+ );
43
68
  },
44
- ];
69
+ };
70
+
71
+ const deprecated = [ v2, v1 ];
45
72
 
46
73
  export default deprecated;
@@ -309,7 +309,7 @@ const variations = [
309
309
  icon: embedTumblrIcon,
310
310
  keywords: [ __( 'social' ) ],
311
311
  description: __( 'Embed a Tumblr post.' ),
312
- patterns: [ /^https?:\/\/(www\.)?tumblr\.com\/.+/i ],
312
+ patterns: [ /^https?:\/\/(.+)\.tumblr\.com\/.+/i ],
313
313
  attributes: { providerNameSlug: 'tumblr', responsive: true },
314
314
  },
315
315
  {
@@ -14,7 +14,7 @@ import {
14
14
  import { __, sprintf } from '@wordpress/i18n';
15
15
 
16
16
  // Version of the file block without PR#43050 removing the translated aria-label.
17
- const v2 = {
17
+ const v3 = {
18
18
  attributes: {
19
19
  id: {
20
20
  type: 'number',
@@ -143,6 +143,134 @@ const v2 = {
143
143
  },
144
144
  };
145
145
 
146
+ // In #41239 the button was made an element button which added a `wp-element-button` classname
147
+ // to the download link element.
148
+ const v2 = {
149
+ attributes: {
150
+ id: {
151
+ type: 'number',
152
+ },
153
+ href: {
154
+ type: 'string',
155
+ },
156
+ fileId: {
157
+ type: 'string',
158
+ source: 'attribute',
159
+ selector: 'a:not([download])',
160
+ attribute: 'id',
161
+ },
162
+ fileName: {
163
+ type: 'string',
164
+ source: 'html',
165
+ selector: 'a:not([download])',
166
+ },
167
+ textLinkHref: {
168
+ type: 'string',
169
+ source: 'attribute',
170
+ selector: 'a:not([download])',
171
+ attribute: 'href',
172
+ },
173
+ textLinkTarget: {
174
+ type: 'string',
175
+ source: 'attribute',
176
+ selector: 'a:not([download])',
177
+ attribute: 'target',
178
+ },
179
+ showDownloadButton: {
180
+ type: 'boolean',
181
+ default: true,
182
+ },
183
+ downloadButtonText: {
184
+ type: 'string',
185
+ source: 'html',
186
+ selector: 'a[download]',
187
+ },
188
+ displayPreview: {
189
+ type: 'boolean',
190
+ },
191
+ previewHeight: {
192
+ type: 'number',
193
+ default: 600,
194
+ },
195
+ },
196
+ supports: {
197
+ anchor: true,
198
+ align: true,
199
+ },
200
+ save( { attributes } ) {
201
+ const {
202
+ href,
203
+ fileId,
204
+ fileName,
205
+ textLinkHref,
206
+ textLinkTarget,
207
+ showDownloadButton,
208
+ downloadButtonText,
209
+ displayPreview,
210
+ previewHeight,
211
+ } = attributes;
212
+
213
+ const pdfEmbedLabel = RichText.isEmpty( fileName )
214
+ ? __( 'PDF embed' )
215
+ : sprintf(
216
+ /* translators: %s: filename. */
217
+ __( 'Embed of %s.' ),
218
+ fileName
219
+ );
220
+
221
+ const hasFilename = ! RichText.isEmpty( fileName );
222
+
223
+ // Only output an `aria-describedby` when the element it's referring to is
224
+ // actually rendered.
225
+ const describedById = hasFilename ? fileId : undefined;
226
+
227
+ return (
228
+ href && (
229
+ <div { ...useBlockProps.save() }>
230
+ { displayPreview && (
231
+ <>
232
+ <object
233
+ className="wp-block-file__embed"
234
+ data={ href }
235
+ type="application/pdf"
236
+ style={ {
237
+ width: '100%',
238
+ height: `${ previewHeight }px`,
239
+ } }
240
+ aria-label={ pdfEmbedLabel }
241
+ />
242
+ </>
243
+ ) }
244
+ { hasFilename && (
245
+ <a
246
+ id={ describedById }
247
+ href={ textLinkHref }
248
+ target={ textLinkTarget }
249
+ rel={
250
+ textLinkTarget
251
+ ? 'noreferrer noopener'
252
+ : undefined
253
+ }
254
+ >
255
+ <RichText.Content value={ fileName } />
256
+ </a>
257
+ ) }
258
+ { showDownloadButton && (
259
+ <a
260
+ href={ href }
261
+ className="wp-block-file__button"
262
+ download={ true }
263
+ aria-describedby={ describedById }
264
+ >
265
+ <RichText.Content value={ downloadButtonText } />
266
+ </a>
267
+ ) }
268
+ </div>
269
+ )
270
+ );
271
+ },
272
+ };
273
+
146
274
  // Version of the file block without PR#28062 accessibility fix.
147
275
  const v1 = {
148
276
  attributes: {
@@ -255,6 +383,6 @@ const v1 = {
255
383
  },
256
384
  };
257
385
 
258
- const deprecated = [ v2, v1 ];
386
+ const deprecated = [ v3, v2, v1 ];
259
387
 
260
388
  export default deprecated;
@@ -7,7 +7,11 @@ import { map, some } from 'lodash';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { RichText, useBlockProps } from '@wordpress/block-editor';
10
+ import {
11
+ RichText,
12
+ useBlockProps,
13
+ useInnerBlocksProps,
14
+ } from '@wordpress/block-editor';
11
15
 
12
16
  import { createBlock } from '@wordpress/blocks';
13
17
 
@@ -127,6 +131,127 @@ export function getImageBlock( image, sizeSlug, linkTo ) {
127
131
  } );
128
132
  }
129
133
 
134
+ // In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
135
+ // to the gallery figcaption element.
136
+ const v7 = {
137
+ attributes: {
138
+ images: {
139
+ type: 'array',
140
+ default: [],
141
+ source: 'query',
142
+ selector: '.blocks-gallery-item',
143
+ query: {
144
+ url: {
145
+ type: 'string',
146
+ source: 'attribute',
147
+ selector: 'img',
148
+ attribute: 'src',
149
+ },
150
+ fullUrl: {
151
+ type: 'string',
152
+ source: 'attribute',
153
+ selector: 'img',
154
+ attribute: 'data-full-url',
155
+ },
156
+ link: {
157
+ type: 'string',
158
+ source: 'attribute',
159
+ selector: 'img',
160
+ attribute: 'data-link',
161
+ },
162
+ alt: {
163
+ type: 'string',
164
+ source: 'attribute',
165
+ selector: 'img',
166
+ attribute: 'alt',
167
+ default: '',
168
+ },
169
+ id: {
170
+ type: 'string',
171
+ source: 'attribute',
172
+ selector: 'img',
173
+ attribute: 'data-id',
174
+ },
175
+ caption: {
176
+ type: 'string',
177
+ source: 'html',
178
+ selector: '.blocks-gallery-item__caption',
179
+ },
180
+ },
181
+ },
182
+ ids: {
183
+ type: 'array',
184
+ items: {
185
+ type: 'number',
186
+ },
187
+ default: [],
188
+ },
189
+ shortCodeTransforms: {
190
+ type: 'array',
191
+ default: [],
192
+ items: {
193
+ type: 'object',
194
+ },
195
+ },
196
+ columns: {
197
+ type: 'number',
198
+ minimum: 1,
199
+ maximum: 8,
200
+ },
201
+ caption: {
202
+ type: 'string',
203
+ source: 'html',
204
+ selector: '.blocks-gallery-caption',
205
+ },
206
+ imageCrop: {
207
+ type: 'boolean',
208
+ default: true,
209
+ },
210
+ fixedHeight: {
211
+ type: 'boolean',
212
+ default: true,
213
+ },
214
+ linkTarget: {
215
+ type: 'string',
216
+ },
217
+ linkTo: {
218
+ type: 'string',
219
+ },
220
+ sizeSlug: {
221
+ type: 'string',
222
+ default: 'large',
223
+ },
224
+ allowResize: {
225
+ type: 'boolean',
226
+ default: false,
227
+ },
228
+ },
229
+ save( { attributes } ) {
230
+ const { caption, columns, imageCrop } = attributes;
231
+
232
+ const className = classnames( 'has-nested-images', {
233
+ [ `columns-${ columns }` ]: columns !== undefined,
234
+ [ `columns-default` ]: columns === undefined,
235
+ 'is-cropped': imageCrop,
236
+ } );
237
+ const blockProps = useBlockProps.save( { className } );
238
+ const innerBlocksProps = useInnerBlocksProps.save( blockProps );
239
+
240
+ return (
241
+ <figure { ...innerBlocksProps }>
242
+ { innerBlocksProps.children }
243
+ { ! RichText.isEmpty( caption ) && (
244
+ <RichText.Content
245
+ tagName="figcaption"
246
+ className="blocks-gallery-caption"
247
+ value={ caption }
248
+ />
249
+ ) }
250
+ </figure>
251
+ );
252
+ },
253
+ };
254
+
130
255
  const v6 = {
131
256
  attributes: {
132
257
  images: {
@@ -984,4 +1109,4 @@ const v1 = {
984
1109
  },
985
1110
  };
986
1111
 
987
- export default [ v6, v5, v4, v3, v2, v1 ];
1112
+ export default [ v7, v6, v5, v4, v3, v2, v1 ];
@@ -52,50 +52,64 @@ export default function PageListEdit( { context, clientId } ) {
52
52
  style: { ...context.style?.color },
53
53
  } );
54
54
 
55
- return (
56
- <>
57
- { allowConvertToLinks && (
58
- <BlockControls group="other">
59
- <ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>
60
- { __( 'Edit' ) }
61
- </ToolbarButton>
62
- </BlockControls>
63
- ) }
64
- { allowConvertToLinks && isOpen && (
65
- <ConvertToLinksModal
66
- onClose={ closeModal }
67
- clientId={ clientId }
68
- />
69
- ) }
70
- { ! hasResolvedPages && (
55
+ const getBlockContent = () => {
56
+ if ( ! hasResolvedPages ) {
57
+ return (
71
58
  <div { ...blockProps }>
72
59
  <Spinner />
73
60
  </div>
74
- ) }
61
+ );
62
+ }
75
63
 
76
- { hasResolvedPages && totalPages === null && (
64
+ if ( totalPages === null ) {
65
+ return (
77
66
  <div { ...blockProps }>
78
67
  <Notice status={ 'warning' } isDismissible={ false }>
79
68
  { __( 'Page List: Cannot retrieve Pages.' ) }
80
69
  </Notice>
81
70
  </div>
82
- ) }
71
+ );
72
+ }
83
73
 
84
- { totalPages === 0 && (
74
+ if ( totalPages === 0 ) {
75
+ return (
85
76
  <div { ...blockProps }>
86
77
  <Notice status={ 'info' } isDismissible={ false }>
87
78
  { __( 'Page List: Cannot retrieve Pages.' ) }
88
79
  </Notice>
89
80
  </div>
90
- ) }
91
- { totalPages > 0 && (
81
+ );
82
+ }
83
+
84
+ if ( totalPages > 0 ) {
85
+ return (
92
86
  <ul { ...blockProps }>
93
87
  <PageItems
94
88
  context={ context }
95
89
  pagesByParentId={ pagesByParentId }
96
90
  />
97
91
  </ul>
92
+ );
93
+ }
94
+ };
95
+
96
+ return (
97
+ <>
98
+ { allowConvertToLinks && (
99
+ <BlockControls group="other">
100
+ <ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>
101
+ { __( 'Edit' ) }
102
+ </ToolbarButton>
103
+ </BlockControls>
98
104
  ) }
105
+ { allowConvertToLinks && isOpen && (
106
+ <ConvertToLinksModal
107
+ onClose={ closeModal }
108
+ clientId={ clientId }
109
+ />
110
+ ) }
111
+
112
+ { getBlockContent() }
99
113
  </>
100
114
  );
101
115
  }
@@ -29,11 +29,18 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
29
29
  $attr['alt'] = $post_title;
30
30
  }
31
31
 
32
+ if ( ! empty( $attributes['height'] ) ) {
33
+ $extra_styles = "height:{$attributes['height']};";
34
+ if ( ! empty( $attributes['scale'] ) ) {
35
+ $extra_styles .= "object-fit:{$attributes['scale']};";
36
+ }
37
+ $attr['style'] = empty( $attr['style'] ) ? $extra_styles : $attr['style'] . $extra_styles;
38
+ }
39
+
32
40
  $featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr );
33
41
  if ( ! $featured_image ) {
34
42
  return '';
35
43
  }
36
- $wrapper_attributes = get_block_wrapper_attributes();
37
44
  if ( $is_link ) {
38
45
  $link_target = $attributes['linkTarget'];
39
46
  $rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
@@ -49,23 +56,9 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
49
56
  $featured_image = $featured_image . $overlay_markup;
50
57
  }
51
58
 
52
- $has_width = ! empty( $attributes['width'] );
53
- $has_height = ! empty( $attributes['height'] );
54
- if ( ! $has_height && ! $has_width ) {
55
- return "<figure {$wrapper_attributes}>{$featured_image}</figure>";
56
- }
57
-
58
- if ( $has_width ) {
59
- $wrapper_attributes = get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) );
60
- }
61
-
62
- if ( $has_height ) {
63
- $image_styles = "height:{$attributes['height']};";
64
- if ( ! empty( $attributes['scale'] ) ) {
65
- $image_styles .= "object-fit:{$attributes['scale']};";
66
- }
67
- $featured_image = str_replace( 'src=', 'style="' . esc_attr( $image_styles ) . '" src=', $featured_image );
68
- }
59
+ $wrapper_attributes = empty( $attributes['width'] )
60
+ ? get_block_wrapper_attributes()
61
+ : get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) );
69
62
 
70
63
  return "<figure {$wrapper_attributes}>{$featured_image}</figure>";
71
64
  }