UNPKG

@websolutespa/payload-plugin-bowl

Version:

Bowl PayloadCms plugin of the BOM Repository

40 lines (39 loc) 1.51 kB
import { hasRole, isRole } from '../core'; import { roles } from '../types'; const PAYLOAD_IMAGE_MAX_WIDTH = process.env.PAYLOAD_IMAGE_MAX_WIDTH ? parseInt(process.env.PAYLOAD_IMAGE_MAX_WIDTH) : 3840; const PAYLOAD_IMAGE_MAX_HEIGHT = process.env.PAYLOAD_IMAGE_MAX_HEIGHT ? parseInt(process.env.PAYLOAD_IMAGE_MAX_HEIGHT) : 3840; export const Media = (options)=>({ type: 'withCollection', slug: options.slug.media, admin: { group: options.group.content, // !!! todo defaultColumns hidden: (args)=>!hasRole(args.user, roles.Admin, roles.Contributor, roles.Editor) }, access: { create: isRole(roles.Admin, roles.Contributor, roles.Editor), read: ()=>true, update: isRole(roles.Admin, roles.Contributor, roles.Editor), delete: isRole(roles.Admin, roles.Contributor, roles.Editor) }, upload: { focalPoint: true, resizeOptions: { withoutEnlargement: true, width: PAYLOAD_IMAGE_MAX_WIDTH, height: PAYLOAD_IMAGE_MAX_HEIGHT } }, fields: [ // inherited fields: id, createdAt, updatedAt // !!! todo convert to localized text { name: 'alt', label: 'Alt Text', type: 'text', required: true, localized: true } ] }); //# sourceMappingURL=Media.js.map