mattmilburn/strapi-plugin-preview-button

It does not work on last Strapi version 4.13.7

jpcmf opened this issue · 1 comments

jpcmf commented

I recently updated the plugin, and it's not working anymore. I followed the instructions, but the preview button disappeared. What am I missing?

package.json

  "dependencies": {
    "@google-cloud/secret-manager": "^4.2.2",
    "@strapi-community/strapi-provider-upload-google-cloud-storage": "^4.6.1",
    "@strapi/plugin-i18n": "4.13.7",
    "@strapi/plugin-seo": "^1.7.7",
    "@strapi/plugin-users-permissions": "4.13.7",
    "@strapi/provider-upload-local": "^4.13.7",
    "@strapi/strapi": "4.13.7",
    "dotenv": "^16.0.3",
    "mysql": "^2.18.1",
    "strapi-plugin-populate-deep": "^2.0.0",
    "strapi-plugin-preview-button": "^2.0.0"
  },

plugins.js

"use strict";

module.exports = ({ env }) => ({
  // Configuration for preview button in articles section
  "preview-button": {
    config: {
      contentTypes: [
        {
          uid: "api::article.article",
          draft: {
            url: env(
              "STRAPI_PREVIEW_DRAFT_URL",
              process.env.STRAPI_PREVIEW_DRAFT_URL
            ),
            query: {
              type: "article",
              slug: "{slug}",
              secret: env(
                "STRAPI_PREVIEW_SECRET",
                process.env.STRAPI_PREVIEW_SECRET
              ),
            },
          },
          published: {
            url:
              env(
                "STRAPI_PREVIEW_PUBLISHED_URL",
                process.env.STRAPI_PREVIEW_PUBLISHED_URL
              ) + "/blog/{slug}",
          },
        },
      ],
    },
  },
});

schema.json

{
  "kind": "collectionType",
  "collectionName": "articles",
  "info": {
    "singularName": "article",
    "pluralName": "articles",
    "displayName": "Articles",
    "description": ""
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {
    "preview-button": {
      "listViewColumn": true
    }
  },
  "attributes": {
    ...
  }
}
jpcmf commented

I was missing an important step.

You need to execute the command npm run build after updating the library.

I highly recommend merging this pull request as soon as possible.