danestves / strapi-plugin-preview-content

A plugin for Strapi Headless CMS that provides content preview to integrate with any frontend
MIT License
64 stars 27 forks source link

Clone doesn't work #9

Open smadaan8 opened 3 years ago

smadaan8 commented 3 years ago

Hi and first of all thanks for such an amazing plugin. It helped reduce my task a lot for previewing content. I want to enquire if the cloning of content entry also works with this plugin? In the image I see the clone button and after installing the plugin also I was able to display the clone button but it doesn't seem to be functioning. Is there something I am missing or is cloning not supported in this plugin?

danestves commented 3 years ago

Hey @smadaan8 let me test it to see what is happening with the clone and i'll post an answer

smadaan8 commented 3 years ago

Hey @danestves Thanks for the quick response. Awaiting for your reply regarding clone.

danestves commented 3 years ago

Hi @smadaan8 i test it with a newer version even the latest version and it works as expected, you copy the files and rebuild the interface with npm run build?

smadaan8 commented 3 years ago

Hi @danestves Thanks for checking. I copied the files and rebuild the interface and the clone button seems to be working. I have a quick question about clone function. Does the clone function let you make a clone record or is it something close to versioning? As in if I create a clone and publish it does it unpublish the original content?

danestves commented 3 years ago
  1. Is a clone record
  2. No, doesn't unpublish the original content 🙌
smadaan8 commented 3 years ago

@danestves Thanks, I understood. I have one quick question. We are trying to put in logic to have a different URL for each collection type and we were able to do it by making some changes to the following file. strapi-plugin-preview-content/src/admin/main/preview-context/index.js /

I was able to verify the results in my local development environment but when I try to release the changes to my production environment(running on Heroku) it says that I cannot change the files in admin folder. Do you know if there is some workaround?

danestves commented 3 years ago

Can you show me the error with more details? To see what is happening and also see if your workaround is good to put it in the plugin 🙌

smadaan8 commented 3 years ago

Hey @danestves Sorry for the delay in response. What we did is specify the URL for each collection type in the index.js file below. if (${apiID}== "article" ) { data.url =https://XXX.com/article?id=${row.id}; } else if (${apiID}== "product") { data.url =https://XXX.com/product?id=${row.id}; } Since we specified URLs directly I don't think it is possible to put it in the plugin.

However the problem I am facing is as below. We put the above changes in below index.js and reflected them in the extension folder in Strapi and were able to check the preview working from the list view. strapi-plugin-preview-content/strapi-files/v3.4.x/extensions/content-manager/admin/src/components/CustomTable/Row/index.js /

However, for preview button on the detail page we figured out that the URL needs to be specified in the below file. strapi-plugin-preview-content/src/admin/main/preview-context/index.js / The issue we are facing is that we can't exactly figure out in which folder in Strapi do we need to put the above file after updating it. Do we need to update the admin folder?

danestves commented 3 years ago

Hi, this is a problem with Strapi because there is a lot of files to be injected, i'm going to put this as a bug because we need to wait a way to do it

Ruixian1006 commented 3 years ago

Hi @danestves, thanks for the effort to create the plugin. It's really great. I also have some custom logic would like to add to the preview button on the detail page. I have tried to customize the logic under extensions/preview-content/admin/main/preview-context/index.js but this does not work. May I know is there any solution for this now ?

Ruixian1006 commented 3 years ago

Hi, @smadaan8 may I know is there any alternative solution to resolve your issue?