mitydigital / statamic-tinymce-cloud

A Statamic fieldtype for TinyMCE using Tiny Cloud for Statamic 3.3+ and Statamic 4.0
https://docs.mity.com.au/tinymce-cloud
MIT License
2 stars 1 forks source link

Configuration defaults must be a valid json string #2

Closed Ahmed3rab closed 3 years ago

Ahmed3rab commented 3 years ago

Although I use the same config object in a codepen, it always triggers a validation error Here's the object Imgur

martyf commented 3 years ago

Convert your single quotes to double quotes, and it should validate. Parse your JSON through a validator, such as https://jsonlint.com/, to check for any errors.

Technically TinyMCE is expecting a JavaScript object, not strictly JSON, where single quotes are valid, however we can't validate that within the default configuration with Statamic - but we can validate JSON. So either using double quotes (which is valid JSON), or I'd need to disable validation - and I feel that keeping it as JSON validation has value given how complicated configuration settings can become.

Ahmed3rab commented 3 years ago

Sorry for the late reply. Everything went great after converting the single quotes to double! Thanks

martyf commented 3 years ago

I've just released v1.0.1 which has an updated readme note about validating the configuration as JSON.

Outside of Statamic, you can use a typical JavaScript object - but I felt validation had potential to be useful. But at the same time, you have raised a valid point, so am happy to also remove the in-Statamic validation if it makes on-boarding easier too.