mattmilburn/strapi-plugin-preview-button

Not compatible with richtext

Closed this issue ยท 7 comments

  • Version: 2.1.1
  • Description bug:
    • When the contentType have CKedtior richtext. The draft and live view button are not display.
    • I debugged and found out that the error was due to this line of code encodeURIComponent(decodeURIComponent(val)) in the parse_url function.
    • Note: Using default richtext strapi is also got this error

image

  • Please help me to take a look this issue. Thank you!

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

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

@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.

@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 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 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

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! ๐Ÿ‘๐Ÿป