Skip to content

Commit

Permalink
feat: editor fonts reflect typography selections
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonrabb committed May 26, 2020
1 parent 8b2f052 commit b90f985
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/newsletter-editor/typography/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { compose } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
import { withDispatch, withSelect } from '@wordpress/data';
import { Fragment } from '@wordpress/element';
import { Fragment, useEffect } from '@wordpress/element';
import { SelectControl } from '@wordpress/components';

const fontOptions = [
Expand Down Expand Up @@ -75,6 +75,12 @@ export default compose( [
};
} ),
] )( ( { editPost, fontBody, fontHeader } ) => {
useEffect(() => {
document.documentElement.style.setProperty( '--body-font', fontBody );
}, [ fontBody ]);
useEffect(() => {
document.documentElement.style.setProperty( '--header-font', fontHeader );
}, [ fontHeader ]);
return (
<Fragment>
<SelectControl
Expand Down

0 comments on commit b90f985

Please sign in to comment.