@wordpress/block-library 7.14.8 → 7.14.10
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/embed/deprecated.js +43 -4
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/file/deprecated.js +108 -4
- package/build/file/deprecated.js.map +1 -1
- package/build/gallery/deprecated.js +147 -22
- package/build/gallery/deprecated.js.map +1 -1
- package/build/table/deprecated.js +282 -27
- package/build/table/deprecated.js.map +1 -1
- package/build/video/deprecated.js +159 -0
- package/build/video/deprecated.js.map +1 -0
- package/build/video/index.js +3 -0
- package/build/video/index.js.map +1 -1
- package/build-module/embed/deprecated.js +44 -5
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/deprecated.js +108 -4
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/gallery/deprecated.js +145 -23
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/table/deprecated.js +282 -27
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/video/deprecated.js +147 -0
- package/build-module/video/deprecated.js.map +1 -0
- package/build-module/video/index.js +2 -0
- package/build-module/video/index.js.map +1 -1
- package/build-style/button/style-rtl.css +1 -0
- package/build-style/button/style.css +1 -0
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/package.json +4 -4
- package/src/button/style.scss +2 -0
- package/src/embed/deprecated.js +53 -26
- package/src/embed/variations.js +1 -1
- package/src/file/deprecated.js +130 -2
- package/src/gallery/deprecated.js +127 -2
- package/src/post-featured-image/index.php +1 -1
- package/src/table/deprecated.js +587 -348
- package/src/video/deprecated.js +57 -0
- 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;
|
|
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"]}
|
|
@@ -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 {
|
package/build-style/style.css
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "7.14.10",
|
|
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.
|
|
38
|
+
"@wordpress/block-editor": "^10.0.9",
|
|
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.
|
|
55
|
+
"@wordpress/reusable-blocks": "^3.15.9",
|
|
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": "
|
|
76
|
+
"gitHead": "ca07aa8354a1131dbabcc36dfcaf70e0c0891f54"
|
|
77
77
|
}
|
package/src/button/style.scss
CHANGED
|
@@ -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
|
}
|
package/src/embed/deprecated.js
CHANGED
|
@@ -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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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;
|
package/src/embed/variations.js
CHANGED
|
@@ -309,7 +309,7 @@ const variations = [
|
|
|
309
309
|
icon: embedTumblrIcon,
|
|
310
310
|
keywords: [ __( 'social' ) ],
|
|
311
311
|
description: __( 'Embed a Tumblr post.' ),
|
|
312
|
-
patterns: [ /^https?:\/\/(
|
|
312
|
+
patterns: [ /^https?:\/\/(.+)\.tumblr\.com\/.+/i ],
|
|
313
313
|
attributes: { providerNameSlug: 'tumblr', responsive: true },
|
|
314
314
|
},
|
|
315
315
|
{
|
package/src/file/deprecated.js
CHANGED
|
@@ -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
|
|
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 {
|
|
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 ];
|
|
@@ -64,7 +64,7 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
|
|
|
64
64
|
if ( ! empty( $attributes['scale'] ) ) {
|
|
65
65
|
$image_styles .= "object-fit:{$attributes['scale']};";
|
|
66
66
|
}
|
|
67
|
-
$featured_image = str_replace( '
|
|
67
|
+
$featured_image = str_replace( '<img ', '<img style="' . esc_attr( safecss_filter_attr( $image_styles ) ) . '" ', $featured_image );
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return "<figure {$wrapper_attributes}>{$featured_image}</figure>";
|