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