Skip to content

Commit 0391659

Browse files
added substitutions
1 parent 00db456 commit 0391659

File tree

9 files changed

+132
-1
lines changed

9 files changed

+132
-1
lines changed

src/block/card/substitute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const substitute = {
55
transform: ( oldAttributes, innerBlocks ) => {
66
return [
77
'stackable/columns',
8-
{ uniqueId: 'test' },
8+
{},
99
[
1010
[
1111
'stackable/column',

src/block/carousel/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import schema from './schema'
1515
import metadata from './block.json'
1616
import example from './example'
1717
import deprecated from './deprecated'
18+
import substitute from './substitute'
1819

1920
export const settings = {
2021
...metadata,
@@ -34,4 +35,5 @@ export const settings = {
3435
deprecated,
3536
edit,
3637
save,
38+
substitute,
3739
}

src/block/carousel/substitute.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const substitute = {
2+
from: 'stackable/carousel',
3+
variants: [],
4+
to: [ 'stackable/columns' ],
5+
transform: ( oldAttributes, innerBlocks ) => {
6+
return [
7+
'stackable/columns',
8+
{},
9+
innerBlocks,
10+
]
11+
},
12+
}
13+
14+
export default substitute

src/block/countdown/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import save from './save'
1515
import schema from './schema'
1616
import metadata from './block.json'
1717
import deprecated from './deprecated'
18+
import substitute from './substitute'
1819

1920
export const settings = {
2021
...metadata,
@@ -29,5 +30,6 @@ export const settings = {
2930
align: [ 'center', 'wide', 'full' ],
3031
spacing: true,
3132
},
33+
substitute,
3234
}
3335

src/block/countdown/substitute.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
export const substitute = {
2+
from: 'stackable/countdown',
3+
variations: [],
4+
to: 'stackable/columns',
5+
transform: () => {
6+
return [
7+
'stackable/columns',
8+
{},
9+
[
10+
[
11+
'stackable/column',
12+
{ align: 'center' },
13+
[
14+
[ 'core/text', {
15+
fontSize: 'x-large',
16+
content: '3',
17+
align: 'center',
18+
style: { spacing: { margin: { top: '0', bottom: '0' } } },
19+
} ],
20+
[ 'core/text', {
21+
content: 'Days',
22+
align: 'center',
23+
style: { spacing: { margin: { top: '0', bottom: '0' } } },
24+
} ],
25+
],
26+
],
27+
[
28+
'stackable/column',
29+
{ align: 'center' },
30+
[
31+
[ 'core/text', {
32+
fontSize: 'x-large',
33+
content: '16',
34+
align: 'center',
35+
style: { spacing: { margin: { top: '0', bottom: '0' } } },
36+
} ],
37+
[ 'core/text', {
38+
content: 'Hours',
39+
align: 'center',
40+
style: { spacing: { margin: { top: '0', bottom: '0' } } },
41+
} ],
42+
],
43+
],
44+
],
45+
]
46+
},
47+
}
48+
49+
export default substitute

src/block/expand/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import schema from './schema'
1616
import metadata from './block.json'
1717
import example from './example'
1818
import deprecated from './deprecated'
19+
import substitute from './substitute'
1920

2021
/**
2122
* WordPress dependencies
@@ -37,4 +38,5 @@ export const settings = {
3738
deprecated,
3839
edit,
3940
save,
41+
substitute,
4042
}

src/block/expand/substitute.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const substitute = {
2+
from: 'stackable/expand',
3+
to: 'stackable/text',
4+
transform: ( oldAttributes, innerBlocks ) => {
5+
return {
6+
text: innerBlocks[ 2 ][ 1 ].text,
7+
}
8+
},
9+
}
10+
11+
export default substitute

src/block/posts/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import metadata from './block.json'
1313
import example from './example'
1414
import { BlogPostsIcon } from '~stackable/icons'
1515
import deprecated from './deprecated'
16+
import substitute from './substitute'
1617

1718
export const settings = {
1819
...metadata,
@@ -30,4 +31,5 @@ export const settings = {
3031
variations,
3132
edit,
3233
save,
34+
substitute,
3335
}

src/block/posts/substitute.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
export const substitute = {
2+
from: 'stackable/posts',
3+
variants: [],
4+
to: [ 'core/query' ],
5+
transform: oldAttributes => {
6+
return [
7+
'core/query',
8+
{
9+
queryId: 0,
10+
query: {
11+
perPage: 10,
12+
pages: 0,
13+
offset: 0,
14+
postType: 'post',
15+
order: 'desc',
16+
orderBy: 'date',
17+
author: '',
18+
search: '',
19+
exclude: [],
20+
sticky: '',
21+
inherit: false,
22+
taxQuery: null,
23+
parents: [],
24+
format: [],
25+
},
26+
layout: { type: 'default' },
27+
},
28+
[
29+
[
30+
'core/post-template',
31+
{
32+
layout: {
33+
type: 'grid',
34+
columnCount: oldAttributes.columns,
35+
},
36+
},
37+
[
38+
[ 'post-featured-image', { aspectRatio: '1' } ],
39+
[ 'post-title', {} ],
40+
[ 'post-date', {} ],
41+
[ 'post-excerpt', { moreText: 'Continue Reading' } ],
42+
],
43+
],
44+
],
45+
]
46+
},
47+
}
48+
49+
export default substitute

0 commit comments

Comments
 (0)