-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow disabling custom font sizes using theme.json config (#25038)
- Loading branch information
1 parent
3f557de
commit 459ab7f
Showing
9 changed files
with
48 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,9 @@ | |
}, | ||
"gradient": { | ||
"custom": true | ||
}, | ||
"fontSize": { | ||
"custom": true | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 23 additions & 11 deletions
34
packages/block-editor/src/components/font-sizes/font-size-picker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { FontSizePicker } from '@wordpress/components'; | ||
import { withSelect } from '@wordpress/data'; | ||
import { FontSizePicker as BaseFontSizePicker } from '@wordpress/components'; | ||
import { useSelect } from '@wordpress/data'; | ||
|
||
export default withSelect( ( select ) => { | ||
const { disableCustomFontSizes, fontSizes } = select( | ||
'core/block-editor' | ||
).getSettings(); | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import useEditorFeature from '../use-editor-feature'; | ||
|
||
function FontSizePicker( props ) { | ||
const fontSizes = useSelect( | ||
( select ) => select( 'core/block-editor' ).getSettings().fontSizes, | ||
[] | ||
); | ||
const disableCustomFontSizes = ! useEditorFeature( 'fontSize.custom' ); | ||
|
||
return ( | ||
<BaseFontSizePicker | ||
{ ...props } | ||
fontSizes={ fontSizes } | ||
disableCustomFontSizes={ disableCustomFontSizes } | ||
/> | ||
); | ||
} | ||
|
||
return { | ||
disableCustomFontSizes, | ||
fontSizes, | ||
}; | ||
} )( FontSizePicker ); | ||
export default FontSizePicker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters