Download wp-calypso/client/data/block-editor/with-block-editor-settings.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 812 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/block-editor/with-block-editor-settings.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/block-editor/with-block-editor-settings.js
-
curl -L -o with-block-editor-settings.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/block-editor/with-block-editor-settings.js
812 Bytes
| import { createHigherOrderComponent } from '@wordpress/compose'; | |
| import { useSelector } from 'react-redux'; | |
| import { isUserLoggedIn } from 'calypso/state/current-user/selectors'; | |
| import { getSelectedSiteId } from 'calypso/state/ui/selectors'; | |
| import { useBlockEditorSettingsQuery } from './use-block-editor-settings-query'; | |
| const withBlockEditorSettings = createHigherOrderComponent( | |
| ( Wrapped ) => ( props ) => { | |
| const siteId = useSelector( getSelectedSiteId ); | |
| const userLoggedIn = useSelector( isUserLoggedIn ); | |
| const { data, isLoading } = useBlockEditorSettingsQuery( siteId, userLoggedIn ); | |
| return ( | |
| <Wrapped | |
| { ...props } | |
| blockEditorSettings={ data } | |
| areBlockEditorSettingsLoading={ isLoading } | |
| /> | |
| ); | |
| }, | |
| 'withBlockEditorSettings' | |
| ); | |
| export default withBlockEditorSettings; | |