Preview failing in Redactor 3.1.0-pl

I have an issue with the previews in Redactor 3.1.0-pl and it shows an error message:

Could not update preview, error thrown: [ReferenceError] $R is not defined
This may indicate an error in a plugin or Redactor itself. Saving your configuration and refreshing may resolve it as well. If the problem persists, please contact support with an export of your configuration and information about your browser.

It is occurring in all sets.


This may have happened during the upgrade from v3.0. I don’t remember this problem before upgrading and I don’t think I have looked in the Redactor settings since.

Possibly related to this topic which also showed up…

Can you check if the use_editor system setting is enabled? If it’s not, enable that.

If it is, can you check in the browser developer console if there are any errors related to loading files or such?

use_editor is enabled.

There are some browser errors that seem related.

Those errors show it fails because the redactor files aren’t loaded, but not why, unfortunately.

If you can provide a manager login to support@modmore.com I’d be happy to take a look and see if I can figure out the root cause for you.

I tried looking for those files physically in the back end, and couldn’t find them. So I tried clicking the reinstall button in the MODx installer and it fixed the problem. I don’t know why it might have lost those files. I assume maybe it happened during the last upgrade of Redactor.