JS error: N2R is not defined with Pro 2.1.x update

Hello,

After the X Pro 2.1.x updates, the backend page editor now gets uncaught reference errors that breaks the layout and some functionality. The console is throwing this error from the cs.js file:

This error is now persistent even after reverting back to the stable X Pro version of 2.0.4. Clearing caches does not help, which is odd since this did not start until after the update, but is now persistent regardless of version being used.

Any help on a fix would be appreciated, thanks!

After some more investigation this error is being caused by the Smart Slider 3 plugin. All of the pages where the X Pro editor is broken is using a shortcode generated by that plugin, so something in that execution is messing with the X Pro editor.

This is similar to this issue: https://theme.co/apex/forum/t/pro-page-editor-not-working-when-using-plugin-generated-shortcode-within-tabbed-element-global-block/36493/12

However, it is not realistic to disable the plugin whenever someone needs to edit those pages, or to use a different plugin in its place. It is also not realistic to have switch to the Skeleton editor for some pages and not others. If this issue can occur with the shortcode of this plugin, surely it can occur with the shortcodes of other plugins (as seen in the referenced issue).

So, is there a way to simply disable the execution of shortcodes in the editor area? That way all the X Pro elements will still render properly, while shortcode just display the shortcode itself?

Hi @5foldmarketing,

Thanks for reaching out.

It’s not the shortcode, but the resources outputted by that shortcode. And it’s unable to capture the script generated by that shortcode. There is no possible solution for that since the builder has no capability to predict the output of a shortcode.

Any shortcode that outputs scripts should be integrated first, it’s the same integration between other plugins like Revolution Slider, Essential Grid, and much more. In your case, your shortcode should be integrated first.

Another possible cause is your shortcode doesn’t use proper way of enqueueing scripts and cornerstone fails to capture them. So even if you integrated it and it fails to properly enqueue it then it’s going to fail. I recommend contacting the plugin author for possible fixes and integration.

Thanks!

Thanks for your reply. I was able to get around this issue by putting their shortcode in brackets like so: [[smart-slider-shortcode]].

Thanks again.

Hi there,

I see, glad it’s okay now and thanks for sharing.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.