Skip to content

Can't override core mapWidgetTypes #3

@abea

Description

@abea

Question or comment

Please include as much detail as possible so we can help more quickly.

  • The way it is written, self.options.mapWidgetTypes takes any user-entered configuration, spreads it, then adds core widget config. This prevents users from overriding the core widget mapping. For image widgets it could be especially useful to be able to identify a different widget type and data structure

Details

Current mapping:

    self.options.mapWidgetTypes = {
      ...self.options.mapWidgetTypes,
      'apostrophe-rich-text': '@apostrophecms/rich-text',
      'apostrophe-images': async (widget) => ({
        ...widget,
        type: '@apostrophecms/image',
        imageFields: widget.relationships,
        imageIds: (widget.pieceIds || []).slice(0, 1)
      }),
      'apostrophe-video': '@apostrophecms/video',
      'apostrophe-html': '@apostrophecms/html'
    };

self.options.mapWidgetTypes = {
...self.options.mapWidgetTypes,
'apostrophe-rich-text': '@apostrophecms/rich-text',
'apostrophe-images': async (widget) => ({
...widget,
type: '@apostrophecms/image',
imageFields: widget.relationships,
imageIds: (widget.pieceIds || []).slice(0, 1)
}),
'apostrophe-video': '@apostrophecms/video',
'apostrophe-html': '@apostrophecms/html'
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions