Javascript code in Raw Content or Text breaks Cornerstone Visual Editor

Hi, when I add java for an ad I’m placing on my page, the visual editor breaks and I need to use the component view (not sure the real name - the one that shows you the components on the page and allows you to select and edit, but not WYSISYG) to do anything. The actual page works fine and includes the code, but I have to comment out the code to use the visual editor - it’s kind of annoying. Is there a decent solution for this?

Hi there,

Please try adding the Javascript code in the Content element of the Footer builder.

Let us know how it goes.

Wouldn’t that place it on any page with the footer? I only want the ads to appear on specific pages. maybe I’m missing something, but I’m assuming your’re talking about adding it to the footer content section in the site footer.

Hey @ickybuck,

Sorry for the confusion. You can add Javascript in the Raw Content element. However, not all Javascript functions are the same. Some code works and some might break the builder. There’s really no definite solution to this. For instance, the third party plugins bundled in Pro are not displayed live in the builder. That is because, they contain script that conflicts with the builder which is also powered by Javascript.

With that said, the simplest solution would be to comment out the code when your editing and paste it back when your done. You can also try out putting your code in a Global Block. An advanced but custom solution would be to put your code in a custom developed shortcode that has a condition to stop the rendering of the code when in the builder. That would be outside the scope of our support and we don’t have documentation on this though so you might want to consult with a third party developer.


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