UNPKG

@wordpress/block-library

Version:
43 lines (42 loc) 1.12 kB
// packages/block-library/src/cover/edit/cover-placeholder.js import { BlockIcon, MediaPlaceholder } from "@wordpress/block-editor"; import { __ } from "@wordpress/i18n"; import { cover as icon } from "@wordpress/icons"; import { createBlobURL } from "@wordpress/blob"; import { ALLOWED_MEDIA_TYPES } from "../shared.mjs"; import { jsx } from "react/jsx-runtime"; function CoverPlaceholder({ disableMediaButtons = false, children, onSelectMedia, onError, style, toggleUseFeaturedImage }) { const onFilesPreUpload = (files) => { if (files.length === 1) { onSelectMedia({ url: createBlobURL(files[0]) }); } }; return /* @__PURE__ */ jsx( MediaPlaceholder, { icon: /* @__PURE__ */ jsx(BlockIcon, { icon }), labels: { title: __("Cover") }, onSelect: onSelectMedia, allowedTypes: ALLOWED_MEDIA_TYPES, disableMediaButtons, onToggleFeaturedImage: toggleUseFeaturedImage, onFilesPreUpload, onError, style, children } ); } export { CoverPlaceholder as default }; //# sourceMappingURL=cover-placeholder.mjs.map