Skip to content

Commit

Permalink
disable font library UI
Browse files Browse the repository at this point in the history
Co-authored-by: Jeff Ong <[email protected]>
  • Loading branch information
matiasbenedetto and jffng committed Jan 12, 2024
1 parent 0e48342 commit b4a2699
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
import { __ } from '@wordpress/i18n';
import { __experimentalVStack as VStack } from '@wordpress/components';
import { store as editorStore } from '@wordpress/editor';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -12,6 +14,12 @@ import FontFamilies from './font-families';
import ScreenHeader from './header';

function ScreenTypography() {
const fontLibraryEnabled = useSelect(
( select ) =>
select( editorStore ).getEditorSettings().fontLibraryEnabled,
[]
);

return (
<>
<ScreenHeader
Expand All @@ -22,9 +30,7 @@ function ScreenTypography() {
/>
<div className="edit-site-global-styles-screen-typography">
<VStack spacing={ 6 }>
{ ! window.__experimentalDisableFontLibrary && (
<FontFamilies />
) }
{ fontLibraryEnabled && <FontFamilies /> }
<TypographyElements />
</VStack>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/store/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SETTINGS_DEFAULTS } from '@wordpress/block-editor';
* @property {boolean} richEditingEnabled Whether rich editing is enabled or not
* @property {boolean} codeEditingEnabled Whether code editing is enabled or not
* @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.
* @property {boolean} fontLibraryEnabled Whether the font library is enabled or not.
* true = the user has opted to show the Custom Fields panel at the bottom of the editor.
* false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
* undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.
Expand All @@ -27,5 +28,6 @@ export const EDITOR_SETTINGS_DEFAULTS = {
richEditingEnabled: true,
codeEditingEnabled: true,
enableCustomFields: undefined,
fontLibraryEnabled: true,
defaultRenderingMode: 'post-only',
};

0 comments on commit b4a2699

Please sign in to comment.