RedactorStyles-Craft icon indicating copy to clipboard operation
RedactorStyles-Craft copied to clipboard

Redactor fails to initialize if Styles JSON Object field is empty

Open alexroper opened this issue 9 years ago • 1 comments

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

alexroper avatar Apr 10 '15 21:04 alexroper

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.

bransinanderson avatar Aug 12 '15 16:08 bransinanderson