Skip to content

Commit ad4d278

Browse files
committed
Add migrate function to migrate to use image elements
1 parent 36fc812 commit ad4d278

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

plugin/assets/src/block-editor/blocks/card/deprecated.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ const deprecated = [
3131
{
3232
attributes: { ...omit( attributes, [ 'imageElement' ] ) },
3333
save,
34+
migrate( attr ) {
35+
if ( 'undefined' === typeof attr.imageElement ) {
36+
attr = {
37+
...attr,
38+
...{
39+
imageElement: true,
40+
},
41+
};
42+
}
43+
44+
return attr;
45+
},
3446
isEligible( attr ) {
3547
return 'undefined' === typeof attr.imageElement;
3648
},

plugin/assets/src/block-editor/blocks/cards-collection/deprecated.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ const deprecated = [
3131
{
3232
attributes: { ...omit( attributes, [ 'imageElement' ] ) },
3333
save,
34+
migrate( attr ) {
35+
if ( 'undefined' === typeof attr.imageElement ) {
36+
attr = {
37+
...attr,
38+
...{
39+
imageElement: true,
40+
},
41+
};
42+
}
43+
44+
return attr;
45+
},
3446
isEligible( attr ) {
3547
return 'undefined' === typeof attr.imageElement;
3648
},

0 commit comments

Comments
 (0)