From 3e588f697e2577ea3d2b0539478b74ca4e8b00ca Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 12 Nov 2019 20:34:35 +0000 Subject: [PATCH] Update packages/edit-post/src/components/sidebar/settings-sidebar/index.js Co-Authored-By: Enrique Piqueras --- .../src/components/simulate-media-query/index.js | 10 +++++----- .../src/components/sidebar/settings-sidebar/index.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/block-editor/src/components/simulate-media-query/index.js b/packages/block-editor/src/components/simulate-media-query/index.js index 2dad040e78f2a..4c6b68b01200b 100644 --- a/packages/block-editor/src/components/simulate-media-query/index.js +++ b/packages/block-editor/src/components/simulate-media-query/index.js @@ -59,14 +59,14 @@ function replaceMediaQueryWithWidthEvaluation( ruleText, widthValue ) { } ); } -export default function SimulateMediaQuery( { partialPaths, value } ) { +export default function SimulateMediaQuery( { partialPaths, width } ) { useEffect( () => { const styleSheets = getStyleSheetsThatMatchPaths( partialPaths ); const originalStyles = []; styleSheets.forEach( ( styleSheet, styleSheetIndex ) => { - for ( let ruleIndex = 0; ruleIndex < styleSheet.rules.length; ++ruleIndex ) { - const rule = styleSheet.rules[ ruleIndex ]; + for ( let ruleIndex = 0; ruleIndex < styleSheet.cssRules.length; ++ruleIndex ) { + const rule = styleSheet.cssRules[ ruleIndex ]; if ( ! isReplaceableMediaRule( rule ) ) { continue; } @@ -77,7 +77,7 @@ export default function SimulateMediaQuery( { partialPaths, value } ) { originalStyles[ styleSheetIndex ][ ruleIndex ] = ruleText; replaceRule( styleSheet, - replaceMediaQueryWithWidthEvaluation( ruleText, value ), + replaceMediaQueryWithWidthEvaluation( ruleText, width ), ruleIndex ); } @@ -96,7 +96,7 @@ export default function SimulateMediaQuery( { partialPaths, value } ) { } ); }; }, - [ partialPaths, value ] + [ partialPaths, width ] ); return null; } diff --git a/packages/edit-post/src/components/sidebar/settings-sidebar/index.js b/packages/edit-post/src/components/sidebar/settings-sidebar/index.js index 5046fe6404bba..2b9c6bae84d92 100644 --- a/packages/edit-post/src/components/sidebar/settings-sidebar/index.js +++ b/packages/edit-post/src/components/sidebar/settings-sidebar/index.js @@ -41,7 +41,7 @@ function TestSimulateMediaQuery() { onChange={ ( newValue ) => setIsSimulationEnabled( newValue ) } /> ); - if ( ! isSimulationEnable ) { + if ( ! isSimulationEnabled ) { return toggleUI; } return ( @@ -56,7 +56,7 @@ function TestSimulateMediaQuery() { onChange={ ( newValue ) => ( setSimulationWidth( newValue ) ) } /> <__experimentalSimulateMediaQuery - value={ simulationWidth } + width={ simulationWidth } partialPaths={ PARTIAL_PATHS } />