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
99 stars 35 forks source link

Not compatible with richtext #117

Closed trungnouden1108 closed 10 months ago

trungnouden1108 commented 10 months ago

image

mattmilburn commented 10 months ago

Hi @trungnouden1108 Can you share more details of your package.json and also share the console error?

trungnouden1108 commented 10 months ago

Hi @trungnouden1108 Can you share more details of your package.json and also share the console error?

Hi @mattmilburn , please see the video for the detail error.webm

mattmilburn commented 10 months ago

@trungnouden1108 I'm still unable to reproduce this. What does the config for preview button found in config/plugins.js look like? It seems whatever URL is being passed to decodeURIComponent is an invalid URL format.

mattmilburn commented 10 months ago

@trungnouden1108 You may also want to try installing the latest version 2.2.0 of this plugin which just released yesterday. Not sure if it relates to your problem but try using Strapi v4.14.x with v2.2.0 of this plugin and let me know how it goes for you 👍🏻

trungnouden1108 commented 10 months ago

@trungnouden1108 I'm still unable to reproduce this. What does the config for preview button found in config/plugins.js look like? It seems whatever URL is being passed to decodeURIComponent is an invalid URL format.

image

I have debugged and see that your code will decode and then encode the value of the entire field. And when any field has this '%' character, the code will error

You can create content-type contains rich-text field, and paste the content below - 200 grams of broccoli can provide up to 75% of the body's vitamin A needs. Glutathione transferase in improved cotton has detoxifying and fat-reducing effects

trungnouden1108 commented 10 months ago

@trungnouden1108 I'm still unable to reproduce this. What does the config for preview button found in config/plugins.js look like? It seems whatever URL is being passed to decodeURIComponent is an invalid URL format.

Here is my config/plugins.js image

mattmilburn commented 10 months ago

Hi again @trungnouden1108 Thank you for that perfect example text with the % character 🙌🏻

The plugin is now upgraded to version 2.2.1 which should resolve your issue. Let me know how it goes for you! 👍🏻