Skip to content

Commit 31f856c

Browse files
committed
fix: remaining substitute definitions for blocks with no designs in the design library
1 parent 1df86a7 commit 31f856c

File tree

13 files changed

+83
-28
lines changed

13 files changed

+83
-28
lines changed

src/block/button-group/substitute.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { BLOCK_STATE } from '~stackable/util'
33
export const substitute = {
44
from: 'stackable/button-group',
55
variants: [ 'stackable/button-group|icon-button', 'stackable/button-group|button' ],
6-
to: [ 'core/buttons', 'core/social-links' ],
76
transform: ( oldAttributes, innerBlocks, disabledBlocks ) => {
87
if ( 'stackable/button-group|icon-button' in disabledBlocks && disabledBlocks[ 'stackable/button-group|icon-button' ] === BLOCK_STATE.DISABLED && // eslint-disable-line camelcase
98
innerBlocks.length &&

src/block/button/substitute.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { BLOCK_STATE } from '~stackable/util'
33
export const substitute = {
44
from: 'stackable/button',
55
variants: [ 'stackable/button-group|button' ],
6-
to: 'core/paragraph',
76
transform: ( oldAttributes, innerBlocks, disabledBlocks ) => {
87
if ( 'stackable/button-group|button' in disabledBlocks && disabledBlocks[ 'stackable/button-group|button' ] === BLOCK_STATE.DISABLED ) { // eslint-disable-line camelcase
98
return [ 'core/button', {

src/block/carousel/substitute.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
export const substitute = {
22
from: 'stackable/carousel',
3-
variants: [],
4-
to: [ 'stackable/columns' ],
53
transform: ( oldAttributes, innerBlocks ) => {
64
return [
75
'stackable/columns',
8-
{},
6+
{ ...oldAttributes },
97
innerBlocks,
108
]
119
},

src/block/countdown/substitute.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
export const substitute = {
22
from: 'stackable/countdown',
3-
variations: [],
4-
to: 'stackable/columns',
5-
transform: () => {
3+
transform: oldAttributes => {
64
return [
75
'stackable/columns',
8-
{},
6+
{ ...oldAttributes },
97
[
108
[
119
'stackable/column',
1210
{ align: 'center' },
1311
[
14-
[ 'core/text', {
12+
[ 'core/paragraph', {
1513
fontSize: 'x-large',
1614
content: '3',
1715
align: 'center',
1816
style: { spacing: { margin: { top: '0', bottom: '0' } } },
1917
} ],
20-
[ 'core/text', {
18+
[ 'core/paragraph', {
2119
content: 'Days',
2220
align: 'center',
2321
style: { spacing: { margin: { top: '0', bottom: '0' } } },
@@ -28,13 +26,13 @@ export const substitute = {
2826
'stackable/column',
2927
{ align: 'center' },
3028
[
31-
[ 'core/text', {
29+
[ 'core/paragraph', {
3230
fontSize: 'x-large',
3331
content: '16',
3432
align: 'center',
3533
style: { spacing: { margin: { top: '0', bottom: '0' } } },
3634
} ],
37-
[ 'core/text', {
35+
[ 'core/paragraph', {
3836
content: 'Hours',
3937
align: 'center',
4038
style: { spacing: { margin: { top: '0', bottom: '0' } } },

src/block/design-library/edit.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const createBlockWithAttributes = ( blockName, attributes, innerBlocks, design )
3636
const disabledBlocks = settings.stackable_block_states || {} // eslint-disable-line camelcase
3737
let hasSubstituted = false
3838

39+
blockName = 'stackable/progress-circle'
40+
attributes = { uniqueID: '1234567' }
41+
innerBlocks = []
42+
3943
// Recursively substitute core blocks to disabled Stackable blocks
4044
const traverseBlocksAndSubstitute = blocks => {
4145
return blocks.map( block => {

src/block/expand/substitute.js

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

src/block/horizontal-scroller/substitute.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
export const substitute = {
22
from: 'stackable/horizontal-scroller',
3-
variants: [],
4-
to: [ 'stackable/columns' ],
53
transform: ( oldAttributes, innerBlocks ) => {
64
return [
75
'stackable/columns',
8-
{},
6+
{ ...oldAttributes },
97
innerBlocks,
108
]
119
},

src/block/map/substitute.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const substitute = {
2+
from: 'stackable/map',
3+
transform: () => {
4+
return [
5+
'stackable/image',
6+
]
7+
},
8+
}
9+
10+
export default substitute
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export const substitute = {
2+
from: 'stackable/notification',
3+
transform: ( oldAttributes, innerBlocks ) => {
4+
return [
5+
'stackable/columns',
6+
{
7+
...oldAttributes,
8+
},
9+
[
10+
[
11+
'stackable/column',
12+
{
13+
hasContainer: true,
14+
containerBackgroundColor: oldAttributes.containerBackgroundColor,
15+
},
16+
innerBlocks,
17+
],
18+
],
19+
]
20+
},
21+
}
22+
23+
export default substitute

src/block/posts/substitute.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export const substitute = {
22
from: 'stackable/posts',
3-
variants: [],
4-
to: [ 'core/query' ],
53
transform: oldAttributes => {
64
return [
75
'core/query',
@@ -35,10 +33,10 @@ export const substitute = {
3533
},
3634
},
3735
[
38-
[ 'post-featured-image', { aspectRatio: '1' } ],
39-
[ 'post-title', {} ],
40-
[ 'post-date', {} ],
41-
[ 'post-excerpt', { moreText: 'Continue Reading' } ],
36+
[ 'core/post-featured-image', { aspectRatio: '1' } ],
37+
[ 'core/post-title', {} ],
38+
[ 'core/post-date', {} ],
39+
[ 'core/post-excerpt', { moreText: 'Continue Reading' } ],
4240
],
4341
],
4442
],

0 commit comments

Comments
 (0)