Preview button not visible at all
L-Weisz opened this issue · 4 comments
Hello,
I am trying to add the preview button, but I don't see it content manager edit page :
I rebuilt with yarn build
and yarn develop
several times, event tried with npm
![image](https://private-user-images.githubusercontent.com/117728108/285821045-e90f0502-2d79-4ab7-995a-a436296e3fe5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3ODU0MjMsIm5iZiI6MTcyMzc4NTEyMywicGF0aCI6Ii8xMTc3MjgxMDgvMjg1ODIxMDQ1LWU5MGYwNTAyLTJkNzktNGFiNy05OTVhLWE0MzYyOTZlM2ZlNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxNlQwNTEyMDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lMzM2ZDg3OGRhMDQ1MjE4ZjljYmNjMGRlOGMyZjA1MTlkZTA4NWJjYjgyMDNmOWQ4YzY0YjMyYjk4Yjg3NjBhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.VHhbXzYCYOn17IIq_Dd5-AHyoDyxNsqzRqjkeAD4Axg)
My dependencies in package.json
"dependencies": {
"@commitlint/cli": "^18.4.2",
"@commitlint/config-conventional": "^18.4.2",
"@strapi/plugin-i18n": "4.15.4",
"@strapi/plugin-users-permissions": "4.15.4",
"@strapi/strapi": "4.15.0",
"better-sqlite3": "^9.1.1",
"strapi-plugin-preview-button": "2.2.1"
},
my config/plugin.ts
'use strict';
module.exports = {
'preview-button': {
config: {
contentTypes: [
{
uid: 'api::dressing.dressing',
draft: {
url: 'http://localhost:3000/api/preview',
query: {
category: 'dressing',
locale: '{locale}',
slug: '{slug}',
secret: process.env.STRAPI_PREVIEW_SECRET
},
openTarget: '_blank',
},
published: {
url: 'http://localhost:3000/dressing/{slug}',
},
},
{
uid: 'api::cream.cream',
draft: {
url: 'http://localhost:3000/api/preview',
query: {
category: 'cream',
slug: '{slug}',
secret: process.env.STRAPI_PREVIEW_SECRET
},
openTarget: '_blank',
},
published: {
url: 'http://localhost:3000/cream/{slug}',
},
},
{
uid: 'api::compress.compress',
draft: {
url: 'http://localhost:3000/api/preview',
query: {
category: 'compression',
slug: '{slug}',
secret: process.env.STRAPI_PREVIEW_SECRET
},
openTarget: '_blank',
},
published: {
url: 'http://localhost:3000/compression/{slug}',
},
},
{
uid: 'api::cleanser.cleanser',
draft: {
url: 'http://localhost:3000/api/preview',
query: {
category: 'cleanser',
slug: '{slug}',
secret: process.env.STRAPI_PREVIEW_SECRET
},
openTarget: '_blank',
},
published: {
url: 'http://localhost:3000/cleanser/{slug}',
},
},
],
},
},
};
the url of my preview should be for example
http://localhost:3000/api/preview?secret=secret&category=dressing&slug=slug
Hi @L-Weisz The only thing I noticed out of place in your config was "@strapi/strapi": "4.15.x",
in your package.json. You should try changing your Strapi dependencies to 4.14.5
for now until a stable version of v4.15.x is released. The v4.15.x branch is currently an alpha release.
Hello @mattmilburn I tried to roll back to 4.14.5
, I reinstalled the plugin with yarn add strapi-plugin-preview-button@latest
and solved all dependency warnings but it still doesnt work.
My package is now :
{
"name": "healico-strapi",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi",
"prepare": "husky install"
},
"devDependencies": {
"husky": "^8.0.3"
},
"dependencies": {
"@babel/core": "^7.0.0-0",
"@babel/runtime": "^7.11.0",
"@codemirror/autocomplete": "^6.0.0",
"@codemirror/language": "^6.0.0",
"@codemirror/lint": "^6.0.0",
"@codemirror/search": "^6.0.0",
"@codemirror/state": "^6.0.0",
"@codemirror/theme-one-dark": "^6.0.0",
"@codemirror/view": "^6.0.0",
"@commitlint/cli": "^18.4.2",
"@commitlint/config-conventional": "^18.4.2",
"@lezer/common": "^1.0.0",
"@strapi/design-system": "1.13.0",
"@strapi/helper-plugin": "^4.13.1",
"@strapi/icons": "1.13.0",
"@strapi/plugin-i18n": "4.14.5",
"@strapi/plugin-users-permissions": "4.14.5",
"@strapi/strapi": "4.14.5",
"@strapi/utils": "^4.13.1",
"better-sqlite3": "^9.1.1",
"codemirror": "^6.0.0",
"lodash": "4.17.21",
"prop-types": "15.8.1",
"qs": "6.11.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-intl": "6.4.1",
"react-is": "^16.8.0",
"react-router-dom": "^5.2.0",
"strapi-plugin-populate-deep": "^3.0.1",
"strapi-plugin-preview-button": "^2.2.1",
"styled-components": "5.3.3",
"typescript": "^4"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "4a3dd523-a60c-4e3e-a3d4-42f39d1bac80"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"license": "MIT",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"body-max-line-length": [
0,
"always",
"Infinity"
],
"scope-case": [
0,
"always",
"lower-case"
]
}
}
}
Hello @mattmilburn do you have an example of package.json
and plugin.ts
in typescript that does work so I can adjust my configuration ? This is the only plugin I want to use so I can modify the version if necessary
Hello @mattmilburn I solved my issue, turned out I should have created plugins.ts
instead of plugin.ts