@wordpress/block-library 8.12.7 → 8.12.8
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/footnotes/edit.js +20 -1
- package/build/footnotes/edit.js.map +1 -1
- package/build/footnotes/format.js +2 -7
- package/build/footnotes/format.js.map +1 -1
- package/build/footnotes/index.js +0 -1
- package/build/footnotes/index.js.map +1 -1
- package/build/image/deprecated.js +453 -175
- package/build/image/deprecated.js.map +1 -1
- package/build/image/save.js +3 -1
- package/build/image/save.js.map +1 -1
- package/build/list/edit.js +4 -4
- package/build/list/edit.js.map +1 -1
- package/build/navigation-link/edit.js +10 -5
- package/build/navigation-link/edit.js.map +1 -1
- package/build/quote/transforms.js +8 -0
- package/build/quote/transforms.js.map +1 -1
- package/build-module/footnotes/edit.js +18 -2
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/footnotes/format.js +2 -7
- package/build-module/footnotes/format.js.map +1 -1
- package/build-module/footnotes/index.js +0 -1
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/image/deprecated.js +454 -176
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/save.js +3 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/list/edit.js +4 -4
- package/build-module/list/edit.js.map +1 -1
- package/build-module/navigation-link/edit.js +10 -5
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/quote/transforms.js +8 -0
- package/build-module/quote/transforms.js.map +1 -1
- package/build-style/footnotes/style-rtl.css +4 -3
- package/build-style/footnotes/style.css +4 -3
- package/build-style/style-rtl.css +4 -3
- package/build-style/style.css +4 -3
- package/package.json +8 -8
- package/src/comment-template/index.php +5 -2
- package/src/footnotes/block.json +0 -1
- package/src/footnotes/edit.js +21 -2
- package/src/footnotes/format.js +2 -6
- package/src/footnotes/style.scss +6 -3
- package/src/image/deprecated.js +597 -320
- package/src/image/save.js +2 -0
- package/src/list/edit.js +6 -4
- package/src/navigation-link/edit.js +59 -45
- package/src/post-template/index.php +4 -2
- package/src/quote/test/__snapshots__/transforms.native.js.snap +10 -0
- package/src/quote/test/transforms.native.js +5 -1
- package/src/quote/transforms.js +13 -0
|
@@ -8,100 +8,226 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
id: {
|
|
59
|
-
type: 'number'
|
|
60
|
-
},
|
|
61
|
-
width: {
|
|
62
|
-
type: 'number'
|
|
63
|
-
},
|
|
64
|
-
height: {
|
|
65
|
-
type: 'number'
|
|
66
|
-
},
|
|
67
|
-
sizeSlug: {
|
|
68
|
-
type: 'string'
|
|
69
|
-
},
|
|
70
|
-
linkDestination: {
|
|
71
|
-
type: 'string'
|
|
11
|
+
import { RichText, useBlockProps, __experimentalGetElementClassName as getBorderClassesAndStyles } from '@wordpress/block-editor';
|
|
12
|
+
/**
|
|
13
|
+
* Deprecation for adding the `wp-image-${id}` class to the image block for
|
|
14
|
+
* responsive images.
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.com/WordPress/gutenberg/pull/4898
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const v1 = {
|
|
20
|
+
attributes: {
|
|
21
|
+
url: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
source: 'attribute',
|
|
24
|
+
selector: 'img',
|
|
25
|
+
attribute: 'src'
|
|
26
|
+
},
|
|
27
|
+
alt: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
source: 'attribute',
|
|
30
|
+
selector: 'img',
|
|
31
|
+
attribute: 'alt',
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
caption: {
|
|
35
|
+
type: 'array',
|
|
36
|
+
source: 'children',
|
|
37
|
+
selector: 'figcaption'
|
|
38
|
+
},
|
|
39
|
+
href: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
source: 'attribute',
|
|
42
|
+
selector: 'a',
|
|
43
|
+
attribute: 'href'
|
|
44
|
+
},
|
|
45
|
+
id: {
|
|
46
|
+
type: 'number'
|
|
47
|
+
},
|
|
48
|
+
align: {
|
|
49
|
+
type: 'string'
|
|
50
|
+
},
|
|
51
|
+
width: {
|
|
52
|
+
type: 'number'
|
|
53
|
+
},
|
|
54
|
+
height: {
|
|
55
|
+
type: 'number'
|
|
56
|
+
}
|
|
72
57
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
58
|
+
|
|
59
|
+
save({
|
|
60
|
+
attributes
|
|
61
|
+
}) {
|
|
62
|
+
const {
|
|
63
|
+
url,
|
|
64
|
+
alt,
|
|
65
|
+
caption,
|
|
66
|
+
align,
|
|
67
|
+
href,
|
|
68
|
+
width,
|
|
69
|
+
height
|
|
70
|
+
} = attributes;
|
|
71
|
+
const extraImageProps = width || height ? {
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
} : {};
|
|
75
|
+
const image = createElement("img", {
|
|
76
|
+
src: url,
|
|
77
|
+
alt: alt,
|
|
78
|
+
...extraImageProps
|
|
79
|
+
});
|
|
80
|
+
let figureStyle = {};
|
|
81
|
+
|
|
82
|
+
if (width) {
|
|
83
|
+
figureStyle = {
|
|
84
|
+
width
|
|
85
|
+
};
|
|
86
|
+
} else if (align === 'left' || align === 'right') {
|
|
87
|
+
figureStyle = {
|
|
88
|
+
maxWidth: '50%'
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return createElement("figure", {
|
|
93
|
+
className: align ? `align${align}` : null,
|
|
94
|
+
style: figureStyle
|
|
95
|
+
}, href ? createElement("a", {
|
|
96
|
+
href: href
|
|
97
|
+
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
98
|
+
tagName: "figcaption",
|
|
99
|
+
value: caption
|
|
100
|
+
}));
|
|
78
101
|
}
|
|
102
|
+
|
|
79
103
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Deprecation for adding the `is-resized` class to the image block to fix
|
|
106
|
+
* captions on resized images.
|
|
107
|
+
*
|
|
108
|
+
* @see https://github.com/WordPress/gutenberg/pull/6496
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
const v2 = {
|
|
112
|
+
attributes: {
|
|
113
|
+
url: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
source: 'attribute',
|
|
116
|
+
selector: 'img',
|
|
117
|
+
attribute: 'src'
|
|
118
|
+
},
|
|
119
|
+
alt: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
source: 'attribute',
|
|
122
|
+
selector: 'img',
|
|
123
|
+
attribute: 'alt',
|
|
124
|
+
default: ''
|
|
125
|
+
},
|
|
126
|
+
caption: {
|
|
127
|
+
type: 'array',
|
|
128
|
+
source: 'children',
|
|
129
|
+
selector: 'figcaption'
|
|
130
|
+
},
|
|
131
|
+
href: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
source: 'attribute',
|
|
134
|
+
selector: 'a',
|
|
135
|
+
attribute: 'href'
|
|
136
|
+
},
|
|
137
|
+
id: {
|
|
138
|
+
type: 'number'
|
|
139
|
+
},
|
|
140
|
+
align: {
|
|
141
|
+
type: 'string'
|
|
142
|
+
},
|
|
143
|
+
width: {
|
|
144
|
+
type: 'number'
|
|
145
|
+
},
|
|
146
|
+
height: {
|
|
147
|
+
type: 'number'
|
|
91
148
|
}
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
save({
|
|
152
|
+
attributes
|
|
153
|
+
}) {
|
|
154
|
+
const {
|
|
155
|
+
url,
|
|
156
|
+
alt,
|
|
157
|
+
caption,
|
|
158
|
+
align,
|
|
159
|
+
href,
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
id
|
|
163
|
+
} = attributes;
|
|
164
|
+
const image = createElement("img", {
|
|
165
|
+
src: url,
|
|
166
|
+
alt: alt,
|
|
167
|
+
className: id ? `wp-image-${id}` : null,
|
|
168
|
+
width: width,
|
|
169
|
+
height: height
|
|
170
|
+
});
|
|
171
|
+
return createElement("figure", {
|
|
172
|
+
className: align ? `align${align}` : null
|
|
173
|
+
}, href ? createElement("a", {
|
|
174
|
+
href: href
|
|
175
|
+
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
176
|
+
tagName: "figcaption",
|
|
177
|
+
value: caption
|
|
178
|
+
}));
|
|
92
179
|
}
|
|
180
|
+
|
|
93
181
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Deprecation for image floats including a wrapping div.
|
|
184
|
+
*
|
|
185
|
+
* @see https://github.com/WordPress/gutenberg/pull/7721
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
const v3 = {
|
|
189
|
+
attributes: {
|
|
190
|
+
url: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
source: 'attribute',
|
|
193
|
+
selector: 'img',
|
|
194
|
+
attribute: 'src'
|
|
195
|
+
},
|
|
196
|
+
alt: {
|
|
197
|
+
type: 'string',
|
|
198
|
+
source: 'attribute',
|
|
199
|
+
selector: 'img',
|
|
200
|
+
attribute: 'alt',
|
|
201
|
+
default: ''
|
|
202
|
+
},
|
|
203
|
+
caption: {
|
|
204
|
+
type: 'array',
|
|
205
|
+
source: 'children',
|
|
206
|
+
selector: 'figcaption'
|
|
207
|
+
},
|
|
208
|
+
href: {
|
|
209
|
+
type: 'string',
|
|
210
|
+
source: 'attribute',
|
|
211
|
+
selector: 'figure > a',
|
|
212
|
+
attribute: 'href'
|
|
213
|
+
},
|
|
214
|
+
id: {
|
|
215
|
+
type: 'number'
|
|
216
|
+
},
|
|
217
|
+
align: {
|
|
218
|
+
type: 'string'
|
|
219
|
+
},
|
|
220
|
+
width: {
|
|
221
|
+
type: 'number'
|
|
222
|
+
},
|
|
223
|
+
height: {
|
|
224
|
+
type: 'number'
|
|
225
|
+
},
|
|
226
|
+
linkDestination: {
|
|
227
|
+
type: 'string',
|
|
228
|
+
default: 'none'
|
|
229
|
+
}
|
|
230
|
+
},
|
|
105
231
|
|
|
106
232
|
save({
|
|
107
233
|
attributes
|
|
@@ -112,19 +238,12 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
112
238
|
caption,
|
|
113
239
|
align,
|
|
114
240
|
href,
|
|
115
|
-
rel,
|
|
116
|
-
linkClass,
|
|
117
241
|
width,
|
|
118
242
|
height,
|
|
119
|
-
id
|
|
120
|
-
linkTarget,
|
|
121
|
-
sizeSlug,
|
|
122
|
-
title
|
|
243
|
+
id
|
|
123
244
|
} = attributes;
|
|
124
|
-
const newRel = !rel ? undefined : rel;
|
|
125
245
|
const classes = classnames({
|
|
126
246
|
[`align${align}`]: align,
|
|
127
|
-
[`size-${sizeSlug}`]: sizeSlug,
|
|
128
247
|
'is-resized': width || height
|
|
129
248
|
});
|
|
130
249
|
const image = createElement("img", {
|
|
@@ -132,37 +251,97 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
132
251
|
alt: alt,
|
|
133
252
|
className: id ? `wp-image-${id}` : null,
|
|
134
253
|
width: width,
|
|
135
|
-
height: height
|
|
136
|
-
title: title
|
|
254
|
+
height: height
|
|
137
255
|
});
|
|
138
|
-
|
|
139
|
-
className:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
rel: newRel
|
|
256
|
+
return createElement("figure", {
|
|
257
|
+
className: classes
|
|
258
|
+
}, href ? createElement("a", {
|
|
259
|
+
href: href
|
|
143
260
|
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
144
261
|
tagName: "figcaption",
|
|
145
262
|
value: caption
|
|
146
263
|
}));
|
|
147
|
-
return createElement("figure", { ...useBlockProps.save({
|
|
148
|
-
className: classes
|
|
149
|
-
})
|
|
150
|
-
}, figure);
|
|
151
264
|
}
|
|
152
265
|
|
|
153
|
-
}
|
|
154
|
-
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Deprecation for removing the outer div wrapper around aligned images.
|
|
269
|
+
*
|
|
270
|
+
* @see https://github.com/WordPress/gutenberg/pull/38657
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
const v4 = {
|
|
274
|
+
attributes: {
|
|
275
|
+
align: {
|
|
276
|
+
type: 'string'
|
|
277
|
+
},
|
|
278
|
+
url: {
|
|
279
|
+
type: 'string',
|
|
280
|
+
source: 'attribute',
|
|
281
|
+
selector: 'img',
|
|
282
|
+
attribute: 'src'
|
|
283
|
+
},
|
|
284
|
+
alt: {
|
|
285
|
+
type: 'string',
|
|
286
|
+
source: 'attribute',
|
|
287
|
+
selector: 'img',
|
|
288
|
+
attribute: 'alt',
|
|
289
|
+
default: ''
|
|
290
|
+
},
|
|
291
|
+
caption: {
|
|
292
|
+
type: 'string',
|
|
293
|
+
source: 'html',
|
|
294
|
+
selector: 'figcaption'
|
|
295
|
+
},
|
|
155
296
|
title: {
|
|
156
297
|
type: 'string',
|
|
157
298
|
source: 'attribute',
|
|
158
299
|
selector: 'img',
|
|
159
300
|
attribute: 'title'
|
|
160
301
|
},
|
|
302
|
+
href: {
|
|
303
|
+
type: 'string',
|
|
304
|
+
source: 'attribute',
|
|
305
|
+
selector: 'figure > a',
|
|
306
|
+
attribute: 'href'
|
|
307
|
+
},
|
|
308
|
+
rel: {
|
|
309
|
+
type: 'string',
|
|
310
|
+
source: 'attribute',
|
|
311
|
+
selector: 'figure > a',
|
|
312
|
+
attribute: 'rel'
|
|
313
|
+
},
|
|
314
|
+
linkClass: {
|
|
315
|
+
type: 'string',
|
|
316
|
+
source: 'attribute',
|
|
317
|
+
selector: 'figure > a',
|
|
318
|
+
attribute: 'class'
|
|
319
|
+
},
|
|
320
|
+
id: {
|
|
321
|
+
type: 'number'
|
|
322
|
+
},
|
|
323
|
+
width: {
|
|
324
|
+
type: 'number'
|
|
325
|
+
},
|
|
326
|
+
height: {
|
|
327
|
+
type: 'number'
|
|
328
|
+
},
|
|
161
329
|
sizeSlug: {
|
|
162
330
|
type: 'string'
|
|
331
|
+
},
|
|
332
|
+
linkDestination: {
|
|
333
|
+
type: 'string'
|
|
334
|
+
},
|
|
335
|
+
linkTarget: {
|
|
336
|
+
type: 'string',
|
|
337
|
+
source: 'attribute',
|
|
338
|
+
selector: 'figure > a',
|
|
339
|
+
attribute: 'target'
|
|
163
340
|
}
|
|
164
341
|
},
|
|
165
|
-
supports:
|
|
342
|
+
supports: {
|
|
343
|
+
anchor: true
|
|
344
|
+
},
|
|
166
345
|
|
|
167
346
|
save({
|
|
168
347
|
attributes
|
|
@@ -219,8 +398,106 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
219
398
|
}, figure);
|
|
220
399
|
}
|
|
221
400
|
|
|
222
|
-
}
|
|
223
|
-
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Deprecation for moving existing border radius styles onto the inner img
|
|
404
|
+
* element where new border block support styles must be applied.
|
|
405
|
+
* It will also add a new `.has-custom-border` class for existing blocks
|
|
406
|
+
* with border radii set. This class is required to improve caption position
|
|
407
|
+
* and styling when an image within a gallery has a custom border or
|
|
408
|
+
* rounded corners.
|
|
409
|
+
*
|
|
410
|
+
* @see https://github.com/WordPress/gutenberg/pull/31366
|
|
411
|
+
*/
|
|
412
|
+
|
|
413
|
+
const v5 = {
|
|
414
|
+
attributes: {
|
|
415
|
+
align: {
|
|
416
|
+
type: 'string'
|
|
417
|
+
},
|
|
418
|
+
url: {
|
|
419
|
+
type: 'string',
|
|
420
|
+
source: 'attribute',
|
|
421
|
+
selector: 'img',
|
|
422
|
+
attribute: 'src'
|
|
423
|
+
},
|
|
424
|
+
alt: {
|
|
425
|
+
type: 'string',
|
|
426
|
+
source: 'attribute',
|
|
427
|
+
selector: 'img',
|
|
428
|
+
attribute: 'alt',
|
|
429
|
+
default: ''
|
|
430
|
+
},
|
|
431
|
+
caption: {
|
|
432
|
+
type: 'string',
|
|
433
|
+
source: 'html',
|
|
434
|
+
selector: 'figcaption'
|
|
435
|
+
},
|
|
436
|
+
title: {
|
|
437
|
+
type: 'string',
|
|
438
|
+
source: 'attribute',
|
|
439
|
+
selector: 'img',
|
|
440
|
+
attribute: 'title'
|
|
441
|
+
},
|
|
442
|
+
href: {
|
|
443
|
+
type: 'string',
|
|
444
|
+
source: 'attribute',
|
|
445
|
+
selector: 'figure > a',
|
|
446
|
+
attribute: 'href'
|
|
447
|
+
},
|
|
448
|
+
rel: {
|
|
449
|
+
type: 'string',
|
|
450
|
+
source: 'attribute',
|
|
451
|
+
selector: 'figure > a',
|
|
452
|
+
attribute: 'rel'
|
|
453
|
+
},
|
|
454
|
+
linkClass: {
|
|
455
|
+
type: 'string',
|
|
456
|
+
source: 'attribute',
|
|
457
|
+
selector: 'figure > a',
|
|
458
|
+
attribute: 'class'
|
|
459
|
+
},
|
|
460
|
+
id: {
|
|
461
|
+
type: 'number'
|
|
462
|
+
},
|
|
463
|
+
width: {
|
|
464
|
+
type: 'number'
|
|
465
|
+
},
|
|
466
|
+
height: {
|
|
467
|
+
type: 'number'
|
|
468
|
+
},
|
|
469
|
+
sizeSlug: {
|
|
470
|
+
type: 'string'
|
|
471
|
+
},
|
|
472
|
+
linkDestination: {
|
|
473
|
+
type: 'string'
|
|
474
|
+
},
|
|
475
|
+
linkTarget: {
|
|
476
|
+
type: 'string',
|
|
477
|
+
source: 'attribute',
|
|
478
|
+
selector: 'figure > a',
|
|
479
|
+
attribute: 'target'
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
supports: {
|
|
483
|
+
anchor: true,
|
|
484
|
+
color: {
|
|
485
|
+
__experimentalDuotone: 'img',
|
|
486
|
+
text: false,
|
|
487
|
+
background: false
|
|
488
|
+
},
|
|
489
|
+
__experimentalBorder: {
|
|
490
|
+
radius: true,
|
|
491
|
+
__experimentalDefaultControls: {
|
|
492
|
+
radius: true
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
__experimentalStyle: {
|
|
496
|
+
spacing: {
|
|
497
|
+
margin: '0 0 1em 0'
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
},
|
|
224
501
|
|
|
225
502
|
save({
|
|
226
503
|
attributes
|
|
@@ -231,12 +508,19 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
231
508
|
caption,
|
|
232
509
|
align,
|
|
233
510
|
href,
|
|
511
|
+
rel,
|
|
512
|
+
linkClass,
|
|
234
513
|
width,
|
|
235
514
|
height,
|
|
236
|
-
id
|
|
515
|
+
id,
|
|
516
|
+
linkTarget,
|
|
517
|
+
sizeSlug,
|
|
518
|
+
title
|
|
237
519
|
} = attributes;
|
|
520
|
+
const newRel = !rel ? undefined : rel;
|
|
238
521
|
const classes = classnames({
|
|
239
522
|
[`align${align}`]: align,
|
|
523
|
+
[`size-${sizeSlug}`]: sizeSlug,
|
|
240
524
|
'is-resized': width || height
|
|
241
525
|
});
|
|
242
526
|
const image = createElement("img", {
|
|
@@ -244,21 +528,33 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
244
528
|
alt: alt,
|
|
245
529
|
className: id ? `wp-image-${id}` : null,
|
|
246
530
|
width: width,
|
|
247
|
-
height: height
|
|
531
|
+
height: height,
|
|
532
|
+
title: title
|
|
248
533
|
});
|
|
249
|
-
|
|
250
|
-
className:
|
|
251
|
-
|
|
252
|
-
|
|
534
|
+
const figure = createElement(Fragment, null, href ? createElement("a", {
|
|
535
|
+
className: linkClass,
|
|
536
|
+
href: href,
|
|
537
|
+
target: linkTarget,
|
|
538
|
+
rel: newRel
|
|
253
539
|
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
254
540
|
tagName: "figcaption",
|
|
255
541
|
value: caption
|
|
256
542
|
}));
|
|
543
|
+
return createElement("figure", { ...useBlockProps.save({
|
|
544
|
+
className: classes
|
|
545
|
+
})
|
|
546
|
+
}, figure);
|
|
257
547
|
}
|
|
258
548
|
|
|
259
|
-
}
|
|
260
|
-
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* Deprecation for adding width and height as style rules on the inner img.
|
|
552
|
+
* It also updates the widht and height attributes to be strings instead of numbers.
|
|
553
|
+
*
|
|
554
|
+
* @see https://github.com/WordPress/gutenberg/pull/31366
|
|
555
|
+
*/
|
|
261
556
|
|
|
557
|
+
const v6 = {
|
|
262
558
|
save({
|
|
263
559
|
attributes
|
|
264
560
|
}) {
|
|
@@ -268,74 +564,56 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
268
564
|
caption,
|
|
269
565
|
align,
|
|
270
566
|
href,
|
|
567
|
+
rel,
|
|
568
|
+
linkClass,
|
|
271
569
|
width,
|
|
272
570
|
height,
|
|
273
|
-
|
|
571
|
+
aspectRatio,
|
|
572
|
+
scale,
|
|
573
|
+
id,
|
|
574
|
+
linkTarget,
|
|
575
|
+
sizeSlug,
|
|
576
|
+
title
|
|
274
577
|
} = attributes;
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
578
|
+
const newRel = !rel ? undefined : rel;
|
|
579
|
+
const borderProps = getBorderClassesAndStyles(attributes);
|
|
580
|
+
const classes = classnames({
|
|
581
|
+
[`align${align}`]: align,
|
|
582
|
+
[`size-${sizeSlug}`]: sizeSlug,
|
|
583
|
+
'is-resized': width || height,
|
|
584
|
+
'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0
|
|
585
|
+
});
|
|
586
|
+
const imageClasses = classnames(borderProps.className, {
|
|
587
|
+
[`wp-image-${id}`]: !!id
|
|
281
588
|
});
|
|
282
|
-
return createElement("figure", {
|
|
283
|
-
className: align ? `align${align}` : null
|
|
284
|
-
}, href ? createElement("a", {
|
|
285
|
-
href: href
|
|
286
|
-
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
287
|
-
tagName: "figcaption",
|
|
288
|
-
value: caption
|
|
289
|
-
}));
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
}, {
|
|
293
|
-
attributes: blockAttributes,
|
|
294
|
-
|
|
295
|
-
save({
|
|
296
|
-
attributes
|
|
297
|
-
}) {
|
|
298
|
-
const {
|
|
299
|
-
url,
|
|
300
|
-
alt,
|
|
301
|
-
caption,
|
|
302
|
-
align,
|
|
303
|
-
href,
|
|
304
|
-
width,
|
|
305
|
-
height
|
|
306
|
-
} = attributes;
|
|
307
|
-
const extraImageProps = width || height ? {
|
|
308
|
-
width,
|
|
309
|
-
height
|
|
310
|
-
} : {};
|
|
311
589
|
const image = createElement("img", {
|
|
312
590
|
src: url,
|
|
313
591
|
alt: alt,
|
|
314
|
-
|
|
592
|
+
className: imageClasses || undefined,
|
|
593
|
+
style: { ...borderProps.style,
|
|
594
|
+
aspectRatio,
|
|
595
|
+
objectFit: scale
|
|
596
|
+
},
|
|
597
|
+
width: width,
|
|
598
|
+
height: height,
|
|
599
|
+
title: title
|
|
315
600
|
});
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
};
|
|
322
|
-
} else if (align === 'left' || align === 'right') {
|
|
323
|
-
figureStyle = {
|
|
324
|
-
maxWidth: '50%'
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return createElement("figure", {
|
|
329
|
-
className: align ? `align${align}` : null,
|
|
330
|
-
style: figureStyle
|
|
331
|
-
}, href ? createElement("a", {
|
|
332
|
-
href: href
|
|
601
|
+
const figure = createElement(Fragment, null, href ? createElement("a", {
|
|
602
|
+
className: linkClass,
|
|
603
|
+
href: href,
|
|
604
|
+
target: linkTarget,
|
|
605
|
+
rel: newRel
|
|
333
606
|
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
607
|
+
className: getBorderClassesAndStyles('caption'),
|
|
334
608
|
tagName: "figcaption",
|
|
335
609
|
value: caption
|
|
336
610
|
}));
|
|
611
|
+
return createElement("figure", { ...useBlockProps.save({
|
|
612
|
+
className: classes
|
|
613
|
+
})
|
|
614
|
+
}, figure);
|
|
337
615
|
}
|
|
338
616
|
|
|
339
|
-
}
|
|
340
|
-
export default
|
|
617
|
+
};
|
|
618
|
+
export default [v6, v5, v4, v3, v2, v1];
|
|
341
619
|
//# sourceMappingURL=deprecated.js.map
|