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 }) {
3131 if ( styleCache . has ( stylesheet ) ) {
3232 return styleCache . get ( stylesheet ) ;
3333 }
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 ;
3440 const transformedStyle = Object . entries ( stylesheet ) . reduce ( ( newStylesheet , [ className , style ] ) => {
3541 newStylesheet [ className ] = Object . entries ( style ) . reduce ( ( newStyle , [ key , value ] ) => {
3642 if ( key === 'overflowX' || key === "overflow" ) {
You can’t perform that action at this time.
0 commit comments