Skip to content

Commit

Permalink
fix: editor crash when in code mode (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
adekbadek authored Nov 12, 2020
1 parent 8334fa5 commit 143fe4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/newsletter-editor/styling/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export const ApplyStyling = withSelect( customStylesSelector )(
document.documentElement.style.setProperty( '--header-font', fontHeader );
}, [ fontHeader ]);
useEffect(() => {
document.querySelector( '.edit-post-visual-editor' ).style.backgroundColor = backgroundColor;
const editorElement = document.querySelector( '.edit-post-visual-editor' );
if ( editorElement ) {
editorElement.style.backgroundColor = backgroundColor;
}
}, [ backgroundColor ]);

return null;
Expand Down

0 comments on commit 143fe4c

Please sign in to comment.