Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Max Gano on Jun 13, 2009 10:37
open dhtmlx forum
dhtmlxEditor stylesheet for content being edited

Hi,

I have initialized a dhtmlxEditor by attaching it to a layout cell as follows:

var myEditor = workZoneLayout.cells("b").attachEditor();
myEditor.setIconsPath("codebase/dhtmlx/imgs/");
myEditor.init();

I am using dhtmlxEditor to manage and format text blocks of content to be displayed in a website. I would like the display of content being edited within dhtmlxEditor to match how will appear when displayed within the website. How do I set the dhtmlxEditor to use the same styles (or even stylesheet) that controls the appearance of the content once it is displayed?

Thanks,
Max
Answer posted by Alex (support) on Jun 15, 2009 07:48

Hello, 

you can try to use the following approach to apply external stylesheet to editor document:

...

editor.init();

window.setTimeout(function(){
  var linkEl = document.createElement("link"); 
  linkEl.rel="stylesheet"; 
  linkEl.type="text/css"; 
  linkEl.href=".../some.css"; 
  var head = editor.edDoc.getElementsByTagName('head')[0];
  head.appendChild(linkEl);
  
 },1)