mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-21 08:52:46 +08:00
* add: media upload button * add: support for custom icon * fix: code alignment, phpcs * fix: code alignment and linting * add: mixpanel events * fix: styling of custom svg * fix: missing variable * fix: missing variable * fix: load gutenberg block without css * fix: icon spacing in preview * fix: indentation * fix: indents
26 lines
662 B
JavaScript
26 lines
662 B
JavaScript
import CircularProgress from '@elementor/ui/CircularProgress';
|
|
import { useSelect } from '@wordpress/data';
|
|
|
|
const MediaUploadCheck = (props) => {
|
|
const { fallback = null, children } = props;
|
|
|
|
const { checkingPermissions, hasUploadPermissions } = useSelect((select) => {
|
|
const core = select('core');
|
|
return {
|
|
hasUploadPermissions: core.canUser('read', 'media'),
|
|
checkingPermissions: !core.hasFinishedResolution('canUser', [
|
|
'read',
|
|
'media',
|
|
]),
|
|
};
|
|
});
|
|
|
|
return (
|
|
<>
|
|
{checkingPermissions && <CircularProgress />}
|
|
{!checkingPermissions && hasUploadPermissions ? children : fallback}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default MediaUploadCheck;
|