RedactorStyles-Craft
RedactorStyles-Craft copied to clipboard
Redactor fails to initialize if Styles JSON Object field is empty
I'm getting an error where Redactor fields will fail to initialize if the "Styles JSON Object" field is left blank in the plugin settings. Any Redactor fields are inaccessible then.
The console shows this error in Chrome:
Uncaught ReferenceError: RedactorStyles is not defined
A quick fix is to put an empty JSON object in the plugins settings field
"Styles JSON Object"
{}
Redactor Styles 0.3 Craft Client 2.4.2682
This would happen when using the Simple layout on a Rich text field. Simple.json
{ buttons: ['bold', 'italic'], plugins: ['styles'], toolbarFixed: true, stylesJson: RedactorStyles.stylesJson }
Looks like the problem occurs here: https://github.com/aelvan/RedactorStyles-Craft/blob/master/RedactorStylesPlugin.php#L40
$stylesJson is empty, therefore the RedactorStyles JSON object is not defined.