Skip to content

Commit 6f24971

Browse files
committed
Support shorthand values with span
1 parent d055214 commit 6f24971

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

modules/plugins/grid.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ const propertyConverters = {
2222
if (isSimplePositionValue(value)) {
2323
style.msGridColumn = value
2424
} else {
25-
const [start, end] = value.split('/').map(position => +position)
26-
propertyConverters.gridColumnStart(start, style)
27-
propertyConverters.gridColumnEnd(end, style)
25+
const [start, end] = value.split('/')
26+
propertyConverters.gridColumnStart(+start, style)
27+
28+
const [maybeSpan, maybeNumber] = end.split(/ ?span /)
29+
if (maybeSpan === '') {
30+
propertyConverters.gridColumnEnd(+start + +maybeNumber, style)
31+
} else {
32+
propertyConverters.gridColumnEnd(+end, style)
33+
}
2834
}
2935
},
3036

@@ -45,9 +51,15 @@ const propertyConverters = {
4551
if (isSimplePositionValue(value)) {
4652
style.msGridRow = value
4753
} else {
48-
const [start, end] = value.split('/').map(position => +position)
49-
propertyConverters.gridRowStart(start, style)
50-
propertyConverters.gridRowEnd(end, style)
54+
const [start, end] = value.split('/')
55+
propertyConverters.gridRowStart(+start, style)
56+
57+
const [maybeSpan, maybeNumber] = end.split(/ ?span /)
58+
if (maybeSpan === '') {
59+
propertyConverters.gridRowEnd(+start + +maybeNumber, style)
60+
} else {
61+
propertyConverters.gridRowEnd(+end, style)
62+
}
5163
}
5264
},
5365

0 commit comments

Comments
 (0)