Skip to content

Commit 75f7fc4

Browse files
committed
fix: refactor, fix some substitutions
1 parent 73e20c7 commit 75f7fc4

File tree

15 files changed

+73
-63
lines changed

15 files changed

+73
-63
lines changed

src/block/accordion/substitute.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export const substitute = {
22
from: 'stackable/accordion',
3-
variations: [ 'stackable/accordion' ],
4-
to: 'core/details',
53
transform: ( oldAttributes, innerBlocks ) => {
64
// Get the heading
75
const heading = innerBlocks[ 0 ][ 2 ][ 0 ][ 2 ][ 0 ][ 1 ].text
@@ -13,7 +11,7 @@ export const substitute = {
1311
open: false,
1412
summary: heading,
1513
},
16-
[ insideBlocks ],
14+
insideBlocks,
1715
]
1816
},
1917
}

src/block/blockquote/substitute.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
export const substitute = {
22
from: 'stackable/blockquote',
3-
to: 'core/pullquote',
43
transform: ( oldAttributes, innerBlocks ) => {
5-
return {
6-
value: innerBlocks[ 1 ][ 1 ].text,
7-
align: oldAttributes.contentAlign,
8-
}
4+
return [
5+
'core/pullquote',
6+
{
7+
value: innerBlocks[ 1 ][ 1 ].text,
8+
align: oldAttributes.contentAlign,
9+
},
10+
]
911
},
1012
}
1113

src/block/call-to-action/substitute.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export const substitute = {
22
from: 'stackable/call-to-action',
3-
variants: [ 'stackable/call-to-action' ],
4-
to: [ 'stackable/columns' ],
53
transform: ( oldAttributes, innerBlocks ) => {
64
return [
75
'stackable/columns',

src/block/card/substitute.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export const substitute = {
22
from: 'stackable/card',
3-
variants: [],
4-
to: [ 'stackable/columns' ],
53
transform: ( oldAttributes, innerBlocks ) => {
64
return [
75
'stackable/columns',

src/block/count-up/substitute.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
export const substitute = {
22
from: 'stackable/count-up',
3-
to: 'core/paragraph',
43
transform: oldAttributes => {
5-
return {
6-
fontSize: 'x-large',
7-
content: oldAttributes.text,
8-
align: oldAttributes.contentAlign,
9-
style: { spacing: { margin: { top: '0', bottom: '0' } } },
10-
}
4+
return [
5+
'core/paragraph',
6+
{
7+
fontSize: 'x-large',
8+
content: oldAttributes.text,
9+
align: oldAttributes.contentAlign,
10+
style: { spacing: { margin: { top: '0', bottom: '0' } } },
11+
},
12+
]
1113
},
1214
}
1315

src/block/divider/substitute.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
export const substitute = {
22
from: 'stackable/divider',
33
to: 'core/separator',
4+
transform: () => {
5+
return [
6+
'core/separator',
7+
]
8+
},
49
}
510

611
export default substitute

src/block/heading/substitute.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
export const substitute = {
22
from: 'stackable/heading',
3-
to: 'core/heading',
43
transform: oldAttributes => {
5-
return {
6-
content: oldAttributes.text,
7-
level: oldAttributes.textTag ? Number( oldAttributes.textTag.replace( 'h', '' ) ) : 2,
8-
textAlign: oldAttributes.contentAlign,
9-
}
4+
return [
5+
'core/heading',
6+
{
7+
content: oldAttributes.text,
8+
level: oldAttributes.textTag ? Number( oldAttributes.textTag.replace( 'h', '' ) ) : 2,
9+
textAlign: oldAttributes.contentAlign,
10+
},
11+
]
1012
},
1113
}
1214

src/block/icon-label/substitute.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ export const substitute = {
22
from: 'stackable/icon-label',
33
to: 'stackable/text',
44
transform: ( oldAttributes, innerBlocks ) => {
5-
return {
6-
text: innerBlocks[ 1 ][ 1 ].text,
7-
}
5+
return [
6+
'stackable/text',
7+
{
8+
text: innerBlocks[ 1 ][ 1 ].text,
9+
},
10+
]
811
},
912
}
1013

src/block/image/substitute.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
export const substitute = {
22
from: 'stackable/image',
3-
to: 'core/image',
43
transform: oldAttributes => {
5-
if ( oldAttributes ) {
6-
return {
7-
height: oldAttributes.imageHeight,
8-
url: oldAttributes.imageUrl,
9-
}
10-
}
4+
return [
5+
'core/image',
6+
{
7+
height: oldAttributes?.imageHeight,
8+
url: oldAttributes?.imageUrl,
9+
},
10+
]
1111
},
1212
}
1313

src/block/number-box/substitute.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
export const substitute = {
22
from: 'stackable/number-box',
3-
to: 'core/paragraph',
43
transform: oldAttributes => {
5-
return {
6-
fontSize: 'xx-large',
7-
content: oldAttributes.text,
8-
align: oldAttributes.contentAlign,
9-
style: { spacing: { margin: { top: '0', bottom: '0' } } },
10-
}
4+
return [
5+
'core/paragraph',
6+
{
7+
fontSize: 'xx-large',
8+
content: oldAttributes.text,
9+
align: oldAttributes.contentAlign,
10+
style: { spacing: { margin: { top: '0', bottom: '0' } } },
11+
},
12+
]
1113
},
1214
}
1315

0 commit comments

Comments
 (0)