TinyMCE control - background color

0
0

Quick question; is it possible to change the background color of a TinyMCE control in WiseJ – I’ve tried all sorts of Javascript (using Eval()) to do it, but none has worked?

  • Neil Hoskins
    This is the last thing I tried (htmlBody is the TinyMCE control) : Color cBack = Application.Theme.GetColor(“errorBackground”); StringBuilder jsText = new StringBuilder(); jsText.AppendLine($”function changeTinyMCEBackgroundColor(editorId, color) {{“); jsText.AppendLine($” var editor = tinymce.get(editorId);”); jsText.AppendLine($” if (editor) {{“); jsText.AppendLine($” editor.contentDocument.body.style.backgroundColor = color;”); jsText.AppendLine($” }}”); jsText.AppendLine($”}}”); jsText.AppendLine($”changeTinyMCEBackgroundColor(‘htmlBody’, ‘#{cBack.R:X2}{cBack.G:X2}{cBack.B:X2}’)”); htmlBody.Eval(jsText.ToString());
  • You must to post comments
0
0

Hi Neil,

You can call  this.tinyMCE1.Eval(“this.editor.getBody().style.backgroundColor = \”#FFFF66\”;”);

But make sure to attach it to the Appear event of the TinyMCE wrapper:

private void tinyMCE1_Appear(object sender, System.EventArgs e)
{
this.tinyMCE1.Eval(“this.editor.getBody().style.backgroundColor = \”#FFFF66\”;”);
}

Best,
Alaa

//

//

Attachment
  • Neil Hoskins
    Perfect, thank you Alaa!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.