locked
Change background color in tinyMCE textBox is not possible RRS feed

  • Question

  • User1692696040 posted

    Hi,

    I have a tinyMCE.init textbox.

    When using this code below it is not possible to have a black backcolor on the textBox because of the class MCEClass. In somehow the class is preventing it from changing backcolor to the textBox.

    Could this be possible to achieve in any way ?

    Thanks...

    <script src='<%= ResolveUrl("~/jscripts/tiny_mce/tiny_mce.js")%>' type="text/javascript"></script>   
    <script language="javascript" type="text/javascript">
    
        tinyMCE.init({
            theme: "advanced",
            mode: "textareas",
            plugins: "emotions",
            readonly: 1,
            theme_advanced_buttons1: "",
            theme_advanced_disable: "numlist,bullist,redo,undo,unlink,link,outdent,indent,cut,copy,paste,cleanup,help,code,hr,removeformat,formatselect,fontselect,fontsizeselect,styleselect,sub,sup,charmap,visualaid,anchor,newdocument,separator,strikethrough",
            theme_advanced_buttons2: "",
            theme_advanced_buttons3: "",
    
            editor_selector: "MCEClass",
            
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left"
    
        });
    </script>
    
    
    
    <asp:TextBox ID="TextBox7" runat="server" Font-Names="Arial" Font-Size="12pt" BackColor="Black"
                 Height="100%" TextMode="MultiLine" Width="100%" class="MCEClass"></asp:TextBox>


     

     

    Monday, August 16, 2010 8:32 PM

Answers

  • User1692696040 posted

    I found a solution using oninit:

    So this example works out:

        tinyMCE.init({
            theme: "advanced",
            mode: "textareas",
            plugins: "emotions",
            force_br_newlines: "true",
            theme_advanced_buttons1_add: "emotions,bullist,numlist,undo,redo,link,unlink,code,image,|,forecolor,backcolor,image",
            theme_advanced_disable: "numlist,bullist,redo,undo,outdent,indent,cut,copy,paste,cleanup,help,hr,removeformat,formatselect,fontselect,fontsizeselect,styleselect,sub,sup,charmap,visualaid,anchor,newdocument,separator,strikethrough",
            theme_advanced_buttons2: "",
            theme_advanced_buttons3: "",
    
            editor_selector : "MCEClass",
    
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
    
            oninit: "myCustomOnInit"
    
    
        });
    
    
    
        function myCustomOnInit() {
            tinyMCE.getInstanceById('MCEClass').getWin().document.body.style.backgroundColor = '#00FF00';
        }


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 17, 2010 12:10 PM