npm.io
0.2.0 • Published 2 years ago

@strapi/plugin-content-source-map

Licence
SEE LICENSE IN LICENSE.md
Version
0.2.0
Deps
3
Size
7 kB
Vulns
0
Weekly
0

Content Source Map

This plugin adds content source map support to a Strapi project. It is compatible with Vercel's visual editing feature.

You can learn more about Vercel's visual editing here.

This plugin requires a Strapi Enterprise Edition License. Contact our sales team if you don't already have one.

Installation

Add the plugin to your project

npm install @strapi/plugin-content-source-map

Configure the plugin in your project

./config/plugins.js

module.exports = () => ({
  'content-source-map': {
    enabled: true,
    config: {
      contentTypes: ['api::article.article', 'api::restaurant.restaurant'],
      origin: 'strapi.io',
      baseHref: 'https://my.strapi-admin.com',
    },
  },
});

Configuration

Name Description Default
contentTypes Array of content type uid to enable content source map for []
origin Origin defined in the source map and used to display the edit button strapi.io
baseHref Base url of your Strapi admin panel Generated based on the server.url config

Usage

This plugin adds content source map support to the following APIs

  • GET /api/:contentType : list a content type entries
  • GET /api/:contentType/:id Retrieve a content type entry by id

To get the data with source map you will have to add the following query parameter to your API calls:

  • encodeSourceMaps=true

This will have performance impacts so you should use this only in draft mode or when doing previews.