Andrew Davey Andrew Davey - 1 year ago 108
Javascript Question

Add class or ID to FCKeditor's editable iframe body

I'm using FCKeditor to edit the contents of a div. This content div has an ID set so my CSS can target the p, li, img, etc tags contained. I want the FCKeditor's contents to look the same as my div's contents. I have @import'd my stylesheet in the fck_editorarea.css, but of course the FCKeditor body does not have the ID set, so the styles are not applied.

I have been trying to write a plugin for FCK to set the ID of the body tag in the inner iframe but can't get it working. Can anyone suggest a solution or better approach?

Answer Source

There is no need for a plugin. Find these lines in FCKedotor's confing file, fckconfig,js

// This will be applied to the body element of the editor
FCKConfig.BodyId = '' ;
FCKConfig.BodyClass = '' ;

and change empty body id to whatever you need.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download