Skip to content

allowedTypes as '_media' in contentType definition has no effect #195

@evest

Description

@evest

I'm using the following contentType definition:

import { contentType } from '@optimizely/cms-sdk';

export const FactCardBlock = contentType({
  key: 'FactCardBlock',
  baseType: '_component',
  displayName: 'Fact Card',
  compositionBehaviors: ['elementEnabled', 'sectionEnabled'] ,
  properties: {
    title: { type: 'string', displayName: 'Title' },
    mediaRef: { type: 'contentReference', displayName: 'Media', 
        allowedTypes: ['_media'] },
    description: { type: 'richText', displayName: 'Description' },
  },
});

See the use of allowedTypes in this: mediaRef: { type: 'contentReference', displayName: 'Media', allowedTypes: ['_media'] },

The resulting type:

Image

Note the "Allowed Content Types" with lowercase "media".

Using this type:

Image

Note "Select Content" on button. It is not recognizing that this is a media type.

Go back and select the "Media" in "Allowed Content Types":

Image

The result:

Image

The button says "Select Media", which is correct.

There seems to be a bug somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions