File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,12 @@ function generateNewStylesheet({ stylesheet, highlighter }) {
31
31
if ( styleCache . has ( stylesheet ) ) {
32
32
return styleCache . get ( stylesheet ) ;
33
33
}
34
+ // I don't know why, but sometimes 'stylesheet' comes as an Array
35
+ // like this [{ stylesheet }, { opacity: 0.85 }], instead of an Object,
36
+ // so this throws an error referenced at issue #17
37
+ // So, this is a workaround, if the stylesheet is an Array,
38
+ // returns the first element, wich is the actual style object.
39
+ stylesheet = Array . isArray ( stylesheet ) ? stylesheet [ 0 ] : stylesheet ;
34
40
const transformedStyle = Object . entries ( stylesheet ) . reduce ( ( newStylesheet , [ className , style ] ) => {
35
41
newStylesheet [ className ] = Object . entries ( style ) . reduce ( ( newStyle , [ key , value ] ) => {
36
42
if ( key === 'overflowX' || key === "overflow" ) {
You can’t perform that action at this time.
0 commit comments