mattmilburn / strapi-plugin-preview-button

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.
MIT License
100 stars 35 forks source link

Preview Button not visible when install Plugin using npm i strapi-plugin-preview-button@latest #119

Open Ram-Metapercept opened 10 months ago

Ram-Metapercept commented 10 months ago

I am installing Plugin with latest version of strapi but not visible eventhough I run command npm run build and added code in my config/plugin.js file by just following https://market.strapi.io/plugins/strapi-plugin-preview-button documention but not getting my problem solved. if anyone has solution please help me

Thank you

mattmilburn commented 10 months ago

Hi @Ram-Metapercept Could you provide more your details from your package.json and config/plugins.js files? Have you also tried restarting or rebuiding your app?

dwhiteGUK commented 10 months ago

I've got this issue, it's any new entries in a collection don't have the preview button. Old entries in a collection are all good:

image

This is my config file:

 module.exports = ({ env }) => {
  return {
    "preview-button": {
      config: {
        contentTypes: [          
          {
            uid: "api::page.page",
            draft: {
              url: `${env("FRONTEND_URL")}/api/preview`,
              query: {
                slug: "{slug}",
                secret: env("FRONTEND_PREVIEW_SECRET"),
              },
            },
            published: {
              url: `${env("FRONTEND_URL")}/api/preview`,
              query: {
                slug: "{slug}",
                secret: env("FRONTEND_PREVIEW_SECRET"),
              },
            },
          },
        ],
      },
    },
  };
};

All running locally, I've rebuilt, restarted the CMS and changed node versions.

L-Weisz commented 9 months ago

Hello, did you find a way to make it work ? I have the same issue

mattmilburn commented 9 months ago

Hi @Ram-Metapercept @dwhiteGUK @L-Weisz Please make sure to provide your package.json details in addition to your config/plugins.js as it can be very helpful in diagnosing this kind of issue.

As of right now, the current stable version of Strapi is v4.14.5 so please make sure you are using that one. There are also alpha releases for v4.15.x and you should avoid that until the alpha label is removed.

barath-kumar-tw commented 7 months ago

Hi @mattmilburn, I configured as per the documentation but I don't see the preview button.

Here is the config:

export default ({ env }) => ({
  'preview-button': {
    config: {
      contentTypes: [
        {
          uid: "api::home-page.home-page",
          draft: {
            url: "http://localhost:3000/homepage",
            query: {
              mode: "preview",
            },
            openTarget: '_blank',
            alwaysVisible: true,
          },
        },

      ],
    },
  },
});

package.json

{
  "name": "strapi-cms",
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "dev": "strapi develop",
    "start": "NODE_ENV=production strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "@ckeditor/strapi-plugin-ckeditor": "^0.0.10",
    "@strapi/plugin-cloud": "4.17.1",
    "@strapi/plugin-i18n": "4.17.1",
    "@strapi/plugin-users-permissions": "4.17.1",
    "@strapi/provider-upload-aws-s3": "^4.17.1",
    "@strapi/strapi": "4.17.1",
    "better-sqlite3": "8.6.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "5.3.4",
    "strapi-plugin-preview-button": "^2.2.1",
    "styled-components": "5.3.3"
  },
  "author": {
    "name": "Admin"
  },
  "strapi": {
    "uuid": "39c6dbea-1674-4254-8754-cfa3a0904ca7"
  },
  "engines": {
    "node": ">=18.0.0 <=20.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}
L-Weisz commented 7 months ago

Hello I solved my problem I had named the fileplugin.ts instead of plugins.ts, the s was missing, check the name of your file @barath-kumar-tw

barath-kumar-tw commented 7 months ago

@L-Weisz The file name was already plugins.ts. I have an upload plugin and added preview-button as another plugin.

@mattmilburn

Screenshot 2024-01-19 at 10 17 55 AM